diff --git a/webui/dist/assets/charts-DbiuC1q1.js b/webui/dist/assets/charts-simvewUa.js similarity index 99% rename from webui/dist/assets/charts-DbiuC1q1.js rename to webui/dist/assets/charts-simvewUa.js index 1548c853..389f665b 100644 --- a/webui/dist/assets/charts-DbiuC1q1.js +++ b/webui/dist/assets/charts-simvewUa.js @@ -1,4 +1,4 @@ -import{r as h,w as cb,b as Nl,a as sb,i as fb}from"./router-Bz250laD.js";import{c as H}from"./utils-BXc2jIuz.js";import{g as Qt,a as db}from"./react-vendor-BmxF9s7Q.js";var vb=["dangerouslySetInnerHTML","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"];function $l(e){if(typeof e!="string")return!1;var t=vb;return t.includes(e)}var hb=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],pb=new Set(hb);function cp(e){return typeof e!="string"?!1:pb.has(e)}function sp(e){return typeof e=="string"&&e.startsWith("data-")}function Ze(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(cp(r)||sp(r))&&(t[r]=e[r]);return t}function hr(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Ze(t)}return typeof e=="object"&&!Array.isArray(e)?Ze(e):null}function $e(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(cp(r)||sp(r)||$l(r))&&(t[r]=e[r]);return t}function mb(e){return e==null?null:h.isValidElement(e)?$e(e.props):typeof e=="object"&&!Array.isArray(e)?$e(e):null}var yb=["children","width","height","viewBox","className","style","title","desc"];function Tu(){return Tu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,width:n,height:i,viewBox:a,className:o,style:u,title:l,desc:s}=e,c=gb(e,yb),f=a||{width:n,height:i,x:0,y:0},d=H("recharts-surface",o);return h.createElement("svg",Tu({},$e(c),{className:d,width:n,height:i,style:u,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,l),h.createElement("desc",null,s),r)}),wb=["children","className"];function Du(){return Du=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,className:n}=e,i=xb(e,wb),a=H("recharts-layer",n);return h.createElement("g",Du({className:a},$e(i),{ref:t}),r)}),fp=h.createContext(null),Ob=()=>h.useContext(fp);function J(e){return function(){return e}}const dp=Math.cos,wi=Math.sin,ht=Math.sqrt,xi=Math.PI,fa=2*xi,Nu=Math.PI,$u=2*Nu,ar=1e-6,Ab=$u-ar;function vp(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return vp;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iar)if(!(Math.abs(f*l-s*c)>ar)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let v=n-o,p=i-u,y=l*l+s*s,m=v*v+p*p,g=Math.sqrt(y),x=Math.sqrt(d),w=a*Math.tan((Nu-Math.acos((y+d-m)/(2*g*x)))/2),P=w/x,b=w/g;Math.abs(P-1)>ar&&this._append`L${t+P*c},${r+P*f}`,this._append`A${a},${a},0,0,${+(f*v>c*p)},${this._x1=t+b*l},${this._y1=r+b*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),l=n*Math.sin(i),s=t+u,c=r+l,f=1^o,d=o?i-a:a-i;this._x1===null?this._append`M${s},${c}`:(Math.abs(this._x1-s)>ar||Math.abs(this._y1-c)>ar)&&this._append`L${s},${c}`,n&&(d<0&&(d=d%$u+$u),d>Ab?this._append`A${n},${n},0,1,${f},${t-u},${r-l}A${n},${n},0,1,${f},${this._x1=s},${this._y1=c}`:d>ar&&this._append`A${n},${n},0,${+(d>=Nu)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Ll(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Eb(t)}function zl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hp(e){this._context=e}hp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function da(e){return new hp(e)}function pp(e){return e[0]}function mp(e){return e[1]}function yp(e,t){var r=J(!0),n=null,i=da,a=null,o=Ll(u);e=typeof e=="function"?e:e===void 0?pp:J(e),t=typeof t=="function"?t:t===void 0?mp:J(t);function u(l){var s,c=(l=zl(l)).length,f,d=!1,v;for(n==null&&(a=i(v=o())),s=0;s<=c;++s)!(s=v;--p)u.point(w[p],P[p]);u.lineEnd(),u.areaEnd()}g&&(w[d]=+e(m,d,f),P[d]=+t(m,d,f),u.point(n?+n(m,d,f):w[d],r?+r(m,d,f):P[d]))}if(x)return u=null,x+""||null}function c(){return yp().defined(i).curve(o).context(a)}return s.x=function(f){return arguments.length?(e=typeof f=="function"?f:J(+f),n=null,s):e},s.x0=function(f){return arguments.length?(e=typeof f=="function"?f:J(+f),s):e},s.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:J(+f),s):n},s.y=function(f){return arguments.length?(t=typeof f=="function"?f:J(+f),r=null,s):t},s.y0=function(f){return arguments.length?(t=typeof f=="function"?f:J(+f),s):t},s.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:J(+f),s):r},s.lineX0=s.lineY0=function(){return c().x(e).y(t)},s.lineY1=function(){return c().x(e).y(r)},s.lineX1=function(){return c().x(n).y(t)},s.defined=function(f){return arguments.length?(i=typeof f=="function"?f:J(!!f),s):i},s.curve=function(f){return arguments.length?(o=f,a!=null&&(u=o(a)),s):o},s.context=function(f){return arguments.length?(f==null?a=u=null:u=o(a=f),s):a},s}class gp{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function _b(e){return new gp(e,!0)}function kb(e){return new gp(e,!1)}const Bl={draw(e,t){const r=ht(t/xi);e.moveTo(r,0),e.arc(0,0,r,0,fa)}},jb={draw(e,t){const r=ht(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},bp=ht(1/3),Cb=bp*2,Ib={draw(e,t){const r=ht(t/Cb),n=r*bp;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},Mb={draw(e,t){const r=ht(t),n=-r/2;e.rect(n,n,r,r)}},Tb=.8908130915292852,wp=wi(xi/10)/wi(7*xi/10),Db=wi(fa/10)*wp,Nb=-dp(fa/10)*wp,$b={draw(e,t){const r=ht(t*Tb),n=Db*r,i=Nb*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=fa*a/5,u=dp(o),l=wi(o);e.lineTo(l*r,-u*r),e.lineTo(u*n-l*i,l*n+u*i)}e.closePath()}},ro=ht(3),Rb={draw(e,t){const r=-ht(t/(ro*3));e.moveTo(0,r*2),e.lineTo(-ro*r,-r),e.lineTo(ro*r,-r),e.closePath()}},et=-.5,tt=ht(3)/2,Ru=1/ht(12),Lb=(Ru/2+1)*3,zb={draw(e,t){const r=ht(t/Lb),n=r/2,i=r*Ru,a=n,o=r*Ru+r,u=-a,l=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,l),e.lineTo(et*n-tt*i,tt*n+et*i),e.lineTo(et*a-tt*o,tt*a+et*o),e.lineTo(et*u-tt*l,tt*u+et*l),e.lineTo(et*n+tt*i,et*i-tt*n),e.lineTo(et*a+tt*o,et*o-tt*a),e.lineTo(et*u+tt*l,et*l-tt*u),e.closePath()}};function Bb(e,t){let r=null,n=Ll(i);e=typeof e=="function"?e:J(e||Bl),t=typeof t=="function"?t:J(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:J(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:J(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function Pi(){}function Oi(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function xp(e){this._context=e}xp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Oi(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Fb(e){return new xp(e)}function Pp(e){this._context=e}Pp.prototype={areaStart:Pi,areaEnd:Pi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Kb(e){return new Pp(e)}function Op(e){this._context=e}Op.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function qb(e){return new Op(e)}function Ap(e){this._context=e}Ap.prototype={areaStart:Pi,areaEnd:Pi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Wb(e){return new Ap(e)}function Fs(e){return e<0?-1:1}function Ks(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(Fs(a)+Fs(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function qs(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function no(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Ai(e){this._context=e}Ai.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:no(this,this._t0,qs(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,no(this,qs(this,r=Ks(this,e,t)),r);break;default:no(this,this._t0,r=Ks(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Sp(e){this._context=new Ep(e)}(Sp.prototype=Object.create(Ai.prototype)).point=function(e,t){Ai.prototype.point.call(this,t,e)};function Ep(e){this._context=e}Ep.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function Ub(e){return new Ai(e)}function Hb(e){return new Sp(e)}function _p(e){this._context=e}_p.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Ws(e),i=Ws(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Gb(e){return new va(e,.5)}function Vb(e){return new va(e,0)}function Xb(e){return new va(e,1)}function Ir(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function Zb(e,t){return e[t]}function Qb(e){const t=[];return t.key=e,t}function Jb(){var e=J([]),t=Lu,r=Ir,n=Zb;function i(a){var o=Array.from(e.apply(this,arguments),Qb),u,l=o.length,s=-1,c;for(const f of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;ne===0?0:e>0?1:-1,dt=e=>typeof e=="number"&&e!=+e,Ct=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,N=e=>(typeof e=="number"||e instanceof Number)&&!dt(e),bt=e=>N(e)||typeof e=="string",uw=0,cn=e=>{var t=++uw;return"".concat(e||"").concat(t)},Ie=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!N(t)&&typeof t!="string")return n;var a;if(Ct(t)){if(r==null)return n;var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return dt(a)&&(a=n),i&&r!=null&&a>r&&(a=r),a},jp=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;nn&&(typeof t=="function"?t(n):pr(n,t))===r)}var ae=e=>e===null||typeof e>"u",An=e=>ae(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function lw(e){return e!=null}function Sn(){}var cw=["type","size","sizeType"];function zu(){return zu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(An(e));return Ip[t]||Bl},yw=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*pw;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},gw=(e,t)=>{Ip["symbol".concat(An(e))]=t},Wl=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=vw(e,cw),a=Js(Js({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var u=()=>{var d=mw(o),v=Bb().type(d).size(yw(r,n,o)),p=v();if(p!==null)return p},{className:l,cx:s,cy:c}=a,f=$e(a);return N(s)&&N(c)&&N(r)?h.createElement("path",zu({},f,{className:H("recharts-symbols",l),transform:"translate(".concat(s,", ").concat(c,")"),d:u()})):null};Wl.registerSymbol=gw;var Mp=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ul=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{$l(i)&&(n[i]=(a=>r[i](r,a)))}),n},bw=(e,t,r)=>n=>(e(t,r,n),null),En=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];$l(i)&&typeof a=="function"&&(n||(n={}),n[i]=bw(a,t,r))}),n};function ef(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ww(e){for(var t=1;t(o[u]===void 0&&n[u]!==void 0&&(o[u]=n[u]),o),r);return a}function Si(){return Si=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,width:n,height:i,viewBox:a,className:o,style:u,title:l,desc:s}=e,c=gb(e,yb),f=a||{width:n,height:i,x:0,y:0},d=H("recharts-surface",o);return h.createElement("svg",Tu({},$e(c),{className:d,width:n,height:i,style:u,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,l),h.createElement("desc",null,s),r)}),wb=["children","className"];function Du(){return Du=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,className:n}=e,i=xb(e,wb),a=H("recharts-layer",n);return h.createElement("g",Du({className:a},$e(i),{ref:t}),r)}),fp=h.createContext(null),Ob=()=>h.useContext(fp);function J(e){return function(){return e}}const dp=Math.cos,wi=Math.sin,ht=Math.sqrt,xi=Math.PI,fa=2*xi,Nu=Math.PI,$u=2*Nu,ar=1e-6,Ab=$u-ar;function vp(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return vp;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iar)if(!(Math.abs(f*l-s*c)>ar)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let v=n-o,p=i-u,y=l*l+s*s,m=v*v+p*p,g=Math.sqrt(y),x=Math.sqrt(d),w=a*Math.tan((Nu-Math.acos((y+d-m)/(2*g*x)))/2),P=w/x,b=w/g;Math.abs(P-1)>ar&&this._append`L${t+P*c},${r+P*f}`,this._append`A${a},${a},0,0,${+(f*v>c*p)},${this._x1=t+b*l},${this._y1=r+b*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),l=n*Math.sin(i),s=t+u,c=r+l,f=1^o,d=o?i-a:a-i;this._x1===null?this._append`M${s},${c}`:(Math.abs(this._x1-s)>ar||Math.abs(this._y1-c)>ar)&&this._append`L${s},${c}`,n&&(d<0&&(d=d%$u+$u),d>Ab?this._append`A${n},${n},0,1,${f},${t-u},${r-l}A${n},${n},0,1,${f},${this._x1=s},${this._y1=c}`:d>ar&&this._append`A${n},${n},0,${+(d>=Nu)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Ll(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Eb(t)}function zl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hp(e){this._context=e}hp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function da(e){return new hp(e)}function pp(e){return e[0]}function mp(e){return e[1]}function yp(e,t){var r=J(!0),n=null,i=da,a=null,o=Ll(u);e=typeof e=="function"?e:e===void 0?pp:J(e),t=typeof t=="function"?t:t===void 0?mp:J(t);function u(l){var s,c=(l=zl(l)).length,f,d=!1,v;for(n==null&&(a=i(v=o())),s=0;s<=c;++s)!(s=v;--p)u.point(w[p],P[p]);u.lineEnd(),u.areaEnd()}g&&(w[d]=+e(m,d,f),P[d]=+t(m,d,f),u.point(n?+n(m,d,f):w[d],r?+r(m,d,f):P[d]))}if(x)return u=null,x+""||null}function c(){return yp().defined(i).curve(o).context(a)}return s.x=function(f){return arguments.length?(e=typeof f=="function"?f:J(+f),n=null,s):e},s.x0=function(f){return arguments.length?(e=typeof f=="function"?f:J(+f),s):e},s.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:J(+f),s):n},s.y=function(f){return arguments.length?(t=typeof f=="function"?f:J(+f),r=null,s):t},s.y0=function(f){return arguments.length?(t=typeof f=="function"?f:J(+f),s):t},s.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:J(+f),s):r},s.lineX0=s.lineY0=function(){return c().x(e).y(t)},s.lineY1=function(){return c().x(e).y(r)},s.lineX1=function(){return c().x(n).y(t)},s.defined=function(f){return arguments.length?(i=typeof f=="function"?f:J(!!f),s):i},s.curve=function(f){return arguments.length?(o=f,a!=null&&(u=o(a)),s):o},s.context=function(f){return arguments.length?(f==null?a=u=null:u=o(a=f),s):a},s}class gp{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function _b(e){return new gp(e,!0)}function kb(e){return new gp(e,!1)}const Bl={draw(e,t){const r=ht(t/xi);e.moveTo(r,0),e.arc(0,0,r,0,fa)}},jb={draw(e,t){const r=ht(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},bp=ht(1/3),Cb=bp*2,Ib={draw(e,t){const r=ht(t/Cb),n=r*bp;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},Mb={draw(e,t){const r=ht(t),n=-r/2;e.rect(n,n,r,r)}},Tb=.8908130915292852,wp=wi(xi/10)/wi(7*xi/10),Db=wi(fa/10)*wp,Nb=-dp(fa/10)*wp,$b={draw(e,t){const r=ht(t*Tb),n=Db*r,i=Nb*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=fa*a/5,u=dp(o),l=wi(o);e.lineTo(l*r,-u*r),e.lineTo(u*n-l*i,l*n+u*i)}e.closePath()}},ro=ht(3),Rb={draw(e,t){const r=-ht(t/(ro*3));e.moveTo(0,r*2),e.lineTo(-ro*r,-r),e.lineTo(ro*r,-r),e.closePath()}},et=-.5,tt=ht(3)/2,Ru=1/ht(12),Lb=(Ru/2+1)*3,zb={draw(e,t){const r=ht(t/Lb),n=r/2,i=r*Ru,a=n,o=r*Ru+r,u=-a,l=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,l),e.lineTo(et*n-tt*i,tt*n+et*i),e.lineTo(et*a-tt*o,tt*a+et*o),e.lineTo(et*u-tt*l,tt*u+et*l),e.lineTo(et*n+tt*i,et*i-tt*n),e.lineTo(et*a+tt*o,et*o-tt*a),e.lineTo(et*u+tt*l,et*l-tt*u),e.closePath()}};function Bb(e,t){let r=null,n=Ll(i);e=typeof e=="function"?e:J(e||Bl),t=typeof t=="function"?t:J(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:J(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:J(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function Pi(){}function Oi(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function xp(e){this._context=e}xp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Oi(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Fb(e){return new xp(e)}function Pp(e){this._context=e}Pp.prototype={areaStart:Pi,areaEnd:Pi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Kb(e){return new Pp(e)}function Op(e){this._context=e}Op.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function qb(e){return new Op(e)}function Ap(e){this._context=e}Ap.prototype={areaStart:Pi,areaEnd:Pi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Wb(e){return new Ap(e)}function Fs(e){return e<0?-1:1}function Ks(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(Fs(a)+Fs(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function qs(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function no(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Ai(e){this._context=e}Ai.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:no(this,this._t0,qs(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,no(this,qs(this,r=Ks(this,e,t)),r);break;default:no(this,this._t0,r=Ks(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Sp(e){this._context=new Ep(e)}(Sp.prototype=Object.create(Ai.prototype)).point=function(e,t){Ai.prototype.point.call(this,t,e)};function Ep(e){this._context=e}Ep.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function Ub(e){return new Ai(e)}function Hb(e){return new Sp(e)}function _p(e){this._context=e}_p.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Ws(e),i=Ws(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Gb(e){return new va(e,.5)}function Vb(e){return new va(e,0)}function Xb(e){return new va(e,1)}function Ir(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function Zb(e,t){return e[t]}function Qb(e){const t=[];return t.key=e,t}function Jb(){var e=J([]),t=Lu,r=Ir,n=Zb;function i(a){var o=Array.from(e.apply(this,arguments),Qb),u,l=o.length,s=-1,c;for(const f of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;ne===0?0:e>0?1:-1,dt=e=>typeof e=="number"&&e!=+e,Ct=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,N=e=>(typeof e=="number"||e instanceof Number)&&!dt(e),bt=e=>N(e)||typeof e=="string",uw=0,cn=e=>{var t=++uw;return"".concat(e||"").concat(t)},Ie=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!N(t)&&typeof t!="string")return n;var a;if(Ct(t)){if(r==null)return n;var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return dt(a)&&(a=n),i&&r!=null&&a>r&&(a=r),a},jp=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;nn&&(typeof t=="function"?t(n):pr(n,t))===r)}var ae=e=>e===null||typeof e>"u",An=e=>ae(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function lw(e){return e!=null}function Sn(){}var cw=["type","size","sizeType"];function zu(){return zu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(An(e));return Ip[t]||Bl},yw=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*pw;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},gw=(e,t)=>{Ip["symbol".concat(An(e))]=t},Wl=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=vw(e,cw),a=Js(Js({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var u=()=>{var d=mw(o),v=Bb().type(d).size(yw(r,n,o)),p=v();if(p!==null)return p},{className:l,cx:s,cy:c}=a,f=$e(a);return N(s)&&N(c)&&N(r)?h.createElement("path",zu({},f,{className:H("recharts-symbols",l),transform:"translate(".concat(s,", ").concat(c,")"),d:u()})):null};Wl.registerSymbol=gw;var Mp=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ul=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{$l(i)&&(n[i]=(a=>r[i](r,a)))}),n},bw=(e,t,r)=>n=>(e(t,r,n),null),En=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];$l(i)&&typeof a=="function"&&(n||(n={}),n[i]=bw(a,t,r))}),n};function ef(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ww(e){for(var t=1;t(o[u]===void 0&&n[u]!==void 0&&(o[u]=n[u]),o),r);return a}function Si(){return Si=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var d=c.formatter||i,v=H({"recharts-legend-item":!0,["legend-item-".concat(f)]:!0,inactive:c.inactive});if(c.type==="none")return null;var p=c.inactive?a:c.color,y=d?d(c.value,c,f):c.value;return h.createElement("li",Si({className:v,style:l,key:"legend-item-".concat(f)},En(e,c,f)),h.createElement(Rl,{width:r,height:r,viewBox:u,style:s,"aria-label":"".concat(y," legend icon")},h.createElement(jw,{data:c,iconType:o,inactiveColor:a})),h.createElement("span",{className:"recharts-legend-item-text",style:{color:p}},y))})}var Iw=e=>{var t=pe(e,kw),{payload:r,layout:n,align:i}=t;if(!r||!r.length)return null;var a={padding:0,margin:0,textAlign:n==="horizontal"?i:"left"};return h.createElement("ul",{className:"recharts-default-legend",style:a},h.createElement(Cw,Si({},t,{payload:r})))},fo={},vo={},rf;function Mw(){return rf||(rf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){const i=new Map;for(let a=0;a=0}e.isLength=t})(yo)),yo}var of;function Hl(){return of||(of=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Tw();function r(n){return n!=null&&typeof n!="function"&&t.isLength(n.length)}e.isArrayLike=r})(mo)),mo}var go={},uf;function Dw(){return uf||(uf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="object"&&r!==null}e.isObjectLike=t})(go)),go}var lf;function Nw(){return lf||(lf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Hl(),r=Dw();function n(i){return r.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=n})(po)),po}var bo={},wo={},cf;function $w(){return cf||(cf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ql();function r(n){return function(i){return t.get(i,n)}}e.property=r})(wo)),wo}var xo={},Po={},Oo={},Ao={},sf;function Dp(){return sf||(sf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&(typeof r=="object"||typeof r=="function")}e.isObject=t})(Ao)),Ao}var So={},ff;function Np(){return ff||(ff=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null||typeof r!="object"&&typeof r!="function"}e.isPrimitive=t})(So)),So}var Eo={},df;function $p(){return df||(df=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return r===n||Number.isNaN(r)&&Number.isNaN(n)}e.eq=t})(Eo)),Eo}var vf;function Rw(){return vf||(vf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Dp(),r=Np(),n=$p();function i(c,f,d){return typeof d!="function"?i(c,f,()=>{}):a(c,f,function v(p,y,m,g,x,w){const P=d(p,y,m,g,x,w);return P!==void 0?!!P:a(p,y,v,w)},new Map)}function a(c,f,d,v){if(f===c)return!0;switch(typeof f){case"object":return o(c,f,d,v);case"function":return Object.keys(f).length>0?a(c,{...f},d,v):n.eq(c,f);default:return t.isObject(c)?typeof f=="string"?f==="":!0:n.eq(c,f)}}function o(c,f,d,v){if(f==null)return!0;if(Array.isArray(f))return l(c,f,d,v);if(f instanceof Map)return u(c,f,d,v);if(f instanceof Set)return s(c,f,d,v);const p=Object.keys(f);if(c==null)return p.length===0;if(p.length===0)return!0;if(v?.has(f))return v.get(f)===c;v?.set(f,c);try{for(let y=0;y{})}e.isMatch=r})(Po)),Po}var _o={},ko={},jo={},pf;function Lw(){return pf||(pf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Object.getOwnPropertySymbols(r).filter(n=>Object.prototype.propertyIsEnumerable.call(r,n))}e.getSymbols=t})(jo)),jo}var Co={},mf;function Lp(){return mf||(mf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}e.getTag=t})(Co)),Co}var Io={},yf;function zp(){return yf||(yf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",r="[object String]",n="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",u="[object Date]",l="[object Map]",s="[object Set]",c="[object Array]",f="[object Function]",d="[object ArrayBuffer]",v="[object Object]",p="[object Error]",y="[object DataView]",m="[object Uint8Array]",g="[object Uint8ClampedArray]",x="[object Uint16Array]",w="[object Uint32Array]",P="[object BigUint64Array]",b="[object Int8Array]",O="[object Int16Array]",S="[object Int32Array]",_="[object BigInt64Array]",I="[object Float32Array]",M="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=d,e.arrayTag=c,e.bigInt64ArrayTag=_,e.bigUint64ArrayTag=P,e.booleanTag=i,e.dataViewTag=y,e.dateTag=u,e.errorTag=p,e.float32ArrayTag=I,e.float64ArrayTag=M,e.functionTag=f,e.int16ArrayTag=O,e.int32ArrayTag=S,e.int8ArrayTag=b,e.mapTag=l,e.numberTag=n,e.objectTag=v,e.regexpTag=t,e.setTag=s,e.stringTag=r,e.symbolTag=o,e.uint16ArrayTag=x,e.uint32ArrayTag=w,e.uint8ArrayTag=m,e.uint8ClampedArrayTag=g})(Io)),Io}var Mo={},gf;function zw(){return gf||(gf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}e.isTypedArray=t})(Mo)),Mo}var bf;function Bp(){return bf||(bf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Lw(),r=Lp(),n=zp(),i=Np(),a=zw();function o(c,f){return u(c,void 0,c,new Map,f)}function u(c,f,d,v=new Map,p=void 0){const y=p?.(c,f,d,v);if(y!==void 0)return y;if(i.isPrimitive(c))return c;if(v.has(c))return v.get(c);if(Array.isArray(c)){const m=new Array(c.length);v.set(c,m);for(let g=0;gt.isMatch(a,i)}e.matches=n})(xo)),xo}var To={},Do={},No={},Pf;function Kw(){return Pf||(Pf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Bp(),r=zp();function n(i,a){return t.cloneDeepWith(i,(o,u,l,s)=>{const c=a?.(o,u,l,s);if(c!==void 0)return c;if(typeof i=="object")switch(Object.prototype.toString.call(i)){case r.numberTag:case r.stringTag:case r.booleanTag:{const f=new i.constructor(i?.valueOf());return t.copyProperties(f,i),f}case r.argumentsTag:{const f={};return t.copyProperties(f,i),f.length=i.length,f[Symbol.iterator]=i[Symbol.iterator],f}default:return}})}e.cloneDeepWith=n})(No)),No}var Of;function qw(){return Of||(Of=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kw();function r(n){return t.cloneDeepWith(n)}e.cloneDeep=r})(Do)),Do}var $o={},Ro={},Af;function Fp(){return Af||(Af=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function r(n,i=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&ne,ee=()=>{var e=h.useContext(Yl);return e?e.store.dispatch:Zw},pi=()=>{},Qw=()=>pi,Jw=(e,t)=>e===t;function T(e){var t=h.useContext(Yl);return cb.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Qw,t?t.store.getState:pi,t?t.store.getState:pi,t?e:pi,Jw)}function ex(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function tx(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function rx(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Mf=e=>Array.isArray(e)?e:[e];function nx(e){const t=Array.isArray(e[0])?e[0]:e;return rx(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ix(e,t){const r=[],{length:n}=e;for(let i=0;i{r=Qn(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function lx(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,o=0,u,l={},s=i.pop();typeof s=="object"&&(l=s,s=i.pop()),ex(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const c={...r,...l},{memoize:f,memoizeOptions:d=[],argsMemoize:v=qp,argsMemoizeOptions:p=[]}=c,y=Mf(d),m=Mf(p),g=nx(i),x=f(function(){return a++,s.apply(null,arguments)},...y),w=v(function(){o++;const b=ix(g,arguments);return u=x.apply(null,b),u},...m);return Object.assign(w,{resultFunc:s,memoizedResultFunc:x,dependencies:g,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>u,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:v})};return Object.assign(n,{withTypes:()=>n}),n}var A=lx(qp),cx=Object.assign((e,t=A)=>{tx(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((o,u,l)=>(o[r[l]]=u,o),{}))},{withTypes:()=>cx}),Bo={},Fo={},Ko={},Df;function sx(){return Df||(Df=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"?1:n===null?2:n===void 0?3:n!==n?4:0}const r=(n,i,a)=>{if(n!==i){const o=t(n),u=t(i);if(o===u&&o===0){if(ni)return a==="desc"?-1:1}return a==="desc"?u-o:o-u}return 0};e.compareValues=r})(Ko)),Ko}var qo={},Wo={},Nf;function Wp(){return Nf||(Nf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"||r instanceof Symbol}e.isSymbol=t})(Wo)),Wo}var $f;function fx(){return $f||($f=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wp(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(n.test(a)||!r.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(qo)),qo}var Rf;function dx(){return Rf||(Rf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=sx(),r=fx(),n=Kl();function i(a,o,u,l){if(a==null)return[];u=l?void 0:u,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(u)||(u=u==null?[]:[u]),u=u.map(v=>String(v));const s=(v,p)=>{let y=v;for(let m=0;mp==null||v==null?p:typeof v=="object"&&"key"in v?Object.hasOwn(p,v.key)?p[v.key]:s(p,v.path):typeof v=="function"?v(p):Array.isArray(v)?s(p,v):typeof p=="object"?p[v]:p,f=o.map(v=>(Array.isArray(v)&&v.length===1&&(v=v[0]),v==null||typeof v=="function"||Array.isArray(v)||r.isKey(v)?v:{key:v,path:n.toPath(v)}));return a.map(v=>({original:v,criteria:f.map(p=>c(p,v))})).slice().sort((v,p)=>{for(let y=0;yv.original)}e.orderBy=i})(Fo)),Fo}var Uo={},Lf;function vx(){return Lf||(Lf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n=1){const i=[],a=Math.floor(n),o=(u,l)=>{for(let s=0;s1&&n.isIterateeCall(a,o[0],o[1])?o=[]:u>2&&n.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,r.flatten(o),["asc"])}e.sortBy=i})(Bo)),Bo}var Yo,Ff;function px(){return Ff||(Ff=1,Yo=hx().sortBy),Yo}var mx=px();const ha=Qt(mx);var Hp=e=>e.legend.settings,yx=e=>e.legend.size,gx=e=>e.legend.payload,bx=A([gx,Hp],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?ha(n,r):n});function wx(){return T(bx)}var Jn=1;function Yp(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>Jn||Math.abs(o.left-t.left)>Jn||Math.abs(o.top-t.top)>Jn||Math.abs(o.width-t.width)>Jn)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function _e(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xx=typeof Symbol=="function"&&Symbol.observable||"@@observable",Kf=xx,Go=()=>Math.random().toString(36).substring(7).split("").join("."),Px={INIT:`@@redux/INIT${Go()}`,REPLACE:`@@redux/REPLACE${Go()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Go()}`},Ei=Px;function Gl(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Gp(e,t,r){if(typeof e!="function")throw new Error(_e(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(_e(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(_e(1));return r(Gp)(e,t)}let n=e,i=t,a=new Map,o=a,u=0,l=!1;function s(){o===a&&(o=new Map,a.forEach((m,g)=>{o.set(g,m)}))}function c(){if(l)throw new Error(_e(3));return i}function f(m){if(typeof m!="function")throw new Error(_e(4));if(l)throw new Error(_e(5));let g=!0;s();const x=u++;return o.set(x,m),function(){if(g){if(l)throw new Error(_e(6));g=!1,s(),o.delete(x),a=null}}}function d(m){if(!Gl(m))throw new Error(_e(7));if(typeof m.type>"u")throw new Error(_e(8));if(typeof m.type!="string")throw new Error(_e(17));if(l)throw new Error(_e(9));try{l=!0,i=n(i,m)}finally{l=!1}return(a=o).forEach(x=>{x()}),m}function v(m){if(typeof m!="function")throw new Error(_e(10));n=m,d({type:Ei.REPLACE})}function p(){const m=f;return{subscribe(g){if(typeof g!="object"||g===null)throw new Error(_e(11));function x(){const P=g;P.next&&P.next(c())}return x(),{unsubscribe:m(x)}},[Kf](){return this}}}return d({type:Ei.INIT}),{dispatch:d,subscribe:f,getState:c,replaceReducer:v,[Kf]:p}}function Ox(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Ei.INIT})>"u")throw new Error(_e(12));if(typeof r(void 0,{type:Ei.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(_e(13))})}function Vp(e){const t=Object.keys(e),r={};for(let a=0;a"u")throw u&&u.type,new Error(_e(14));s[f]=p,l=l||p!==v}return l=l||n.length!==Object.keys(o).length,l?s:o}}function _i(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Ax(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(_e(15))};const o={getState:i.getState,dispatch:(l,...s)=>a(l,...s)},u=e.map(l=>l(o));return a=_i(...u)(i.dispatch),{...i,dispatch:a}}}function Xp(e){return Gl(e)&&"type"in e&&typeof e.type=="string"}var Zp=Symbol.for("immer-nothing"),qf=Symbol.for("immer-draftable"),Re=Symbol.for("immer-state");function lt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ve=Object,Mr=Ve.getPrototypeOf,ki="constructor",pa="prototype",Bu="configurable",ji="enumerable",mi="writable",sn="value",It=e=>!!e&&!!e[Re];function vt(e){return e?Qp(e)||ma(e)||!!e[qf]||!!e[ki]?.[qf]||ya(e)||ga(e):!1}var Sx=Ve[pa][ki].toString(),Wf=new WeakMap;function Qp(e){if(!e||!Vl(e))return!1;const t=Mr(e);if(t===null||t===Ve[pa])return!0;const r=Ve.hasOwnProperty.call(t,ki)&&t[ki];if(r===Object)return!0;if(!Er(r))return!1;let n=Wf.get(r);return n===void 0&&(n=Function.toString.call(r),Wf.set(r,n)),n===Sx}function _n(e,t,r=!0){kn(e)===0?(r?Reflect.ownKeys(e):Ve.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function kn(e){const t=e[Re];return t?t.type_:ma(e)?1:ya(e)?2:ga(e)?3:0}var Uf=(e,t,r=kn(e))=>r===2?e.has(t):Ve[pa].hasOwnProperty.call(e,t),Fu=(e,t,r=kn(e))=>r===2?e.get(t):e[t],Ci=(e,t,r,n=kn(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Ex(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ma=Array.isArray,ya=e=>e instanceof Map,ga=e=>e instanceof Set,Vl=e=>typeof e=="object",Er=e=>typeof e=="function",Vo=e=>typeof e=="boolean",Ot=e=>e.copy_||e.base_,Xl=e=>e.modified_?e.copy_:e.base_;function Ku(e,t){if(ya(e))return new Map(e);if(ga(e))return new Set(e);if(ma(e))return Array[pa].slice.call(e);const r=Qp(e);if(t===!0||t==="class_only"&&!r){const n=Ve.getOwnPropertyDescriptors(e);delete n[Re];let i=Reflect.ownKeys(n);for(let a=0;a1&&Ve.defineProperties(e,{set:ei,add:ei,clear:ei,delete:ei}),Ve.freeze(e),t&&_n(e,(r,n)=>{Zl(n,!0)},!1)),e}function _x(){lt(2)}var ei={[sn]:_x};function ba(e){return e===null||!Vl(e)?!0:Ve.isFrozen(e)}var Ii="MapSet",qu="Patches",Jp={};function Tr(e){const t=Jp[e];return t||lt(0,e),t}var kx=e=>!!Jp[e],fn,em=()=>fn,jx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:kx(Ii)?Tr(Ii):void 0});function Hf(e,t){t&&(e.patchPlugin_=Tr(qu),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Wu(e){Uu(e),e.drafts_.forEach(Cx),e.drafts_=null}function Uu(e){e===fn&&(fn=e.parent_)}var Yf=e=>fn=jx(fn,e);function Cx(e){const t=e[Re];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gf(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[Re].modified_&&(Wu(t),lt(4)),vt(e)&&(e=Vf(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[Re].base_,e,t)}else e=Vf(t,r);return Ix(t,e,!0),Wu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Zp?e:void 0}function Vf(e,t){if(ba(t))return t;const r=t[Re];if(!r)return Ql(t,e.handledSet_,e);if(!wa(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);nm(r,e)}return r.copy_}function Ix(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zl(t,r)}function tm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var wa=(e,t)=>e.scope_===t,Mx=[];function rm(e,t,r,n){const i=Ot(e),a=e.type_;if(n!==void 0&&Fu(i,n,a)===t){Ci(i,n,r,a);return}if(!e.draftLocations_){const u=e.draftLocations_=new Map;_n(i,(l,s)=>{if(It(s)){const c=u.get(s)||[];c.push(l),u.set(s,c)}})}const o=e.draftLocations_.get(t)??Mx;for(const u of o)Ci(i,u,r,a)}function Tx(e,t,r){e.callbacks_.push(function(i){const a=t;if(!a||!wa(a,i))return;i.mapSetPlugin_?.fixSetContents(a);const o=Xl(a);rm(e,a.draft_??a,o,r),nm(a,i)})}function nm(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const i=n.getPath(e);i&&n.generatePatches_(e,i,t)}tm(e)}}function Dx(e,t,r){const{scope_:n}=e;if(It(r)){const i=r[Re];wa(i,n)&&i.callbacks_.push(function(){yi(e);const o=Xl(i);rm(e,r,o,t)})}else vt(r)&&e.callbacks_.push(function(){const a=Ot(e);Fu(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ql(Fu(e.copy_,t,e.type_),n.handledSet_,n)})}function Ql(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||It(e)||t.has(e)||!vt(e)||ba(e)||(t.add(e),_n(e,(n,i)=>{if(It(i)){const a=i[Re];if(wa(a,r)){const o=Xl(a);Ci(e,n,o,e.type_),tm(a)}}else vt(i)&&Ql(i,t,r)})),e}function Nx(e,t){const r=ma(e),n={type_:r?1:0,scope_:t?t.scope_:em(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,a=Jl;r&&(i=[n],a=dn);const{revoke:o,proxy:u}=Proxy.revocable(i,a);return n.draft_=u,n.revoke_=o,[u,n]}var Jl={get(e,t){if(t===Re)return e;const r=Ot(e);if(!Uf(r,t,e.type_))return $x(e,r,t);const n=r[t];if(e.finalized_||!vt(n))return n;if(n===Xo(e.base_,t)){yi(e);const i=e.type_===1?+t:t,a=Yu(e.scope_,n,e,i);return e.copy_[i]=a}return n},has(e,t){return t in Ot(e)},ownKeys(e){return Reflect.ownKeys(Ot(e))},set(e,t,r){const n=im(Ot(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Xo(Ot(e),t),a=i?.[Re];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Ex(r,i)&&(r!==void 0||Uf(e.base_,t,e.type_)))return!0;yi(e),Hu(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Dx(e,t,r)),!0},deleteProperty(e,t){return yi(e),Xo(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Hu(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Ot(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[mi]:!0,[Bu]:e.type_!==1||t!=="length",[ji]:n[ji],[sn]:r[t]}},defineProperty(){lt(11)},getPrototypeOf(e){return Mr(e.base_)},setPrototypeOf(){lt(12)}},dn={};_n(Jl,(e,t)=>{dn[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}});dn.deleteProperty=function(e,t){return dn.set.call(this,e,t,void 0)};dn.set=function(e,t,r){return Jl.set.call(this,e[0],t,r,e[0])};function Xo(e,t){const r=e[Re];return(r?Ot(r):e)[t]}function $x(e,t,r){const n=im(t,r);return n?sn in n?n[sn]:n.get?.call(e.draft_):void 0}function im(e,t){if(!(t in e))return;let r=Mr(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Mr(r)}}function Hu(e){e.modified_||(e.modified_=!0,e.parent_&&Hu(e.parent_))}function yi(e){e.copy_||(e.assigned_=new Map,e.copy_=Ku(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Rx=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,i)=>{if(Er(r)&&!Er(n)){const o=n;n=r;const u=this;return function(s=o,...c){return u.produce(s,f=>n.call(this,f,...c))}}Er(n)||lt(6),i!==void 0&&!Er(i)&<(7);let a;if(vt(r)){const o=Yf(this),u=Yu(o,r,void 0);let l=!0;try{a=n(u),l=!1}finally{l?Wu(o):Uu(o)}return Hf(o,i),Gf(a,o)}else if(!r||!Vl(r)){if(a=n(r),a===void 0&&(a=r),a===Zp&&(a=void 0),this.autoFreeze_&&Zl(a,!0),i){const o=[],u=[];Tr(qu).generateReplacementPatches_(r,a,{patches_:o,inversePatches_:u}),i(o,u)}return a}else lt(1,r)},this.produceWithPatches=(r,n)=>{if(Er(r))return(u,...l)=>this.produceWithPatches(u,s=>r(s,...l));let i,a;return[this.produce(r,n,(u,l)=>{i=u,a=l}),i,a]},Vo(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Vo(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Vo(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){vt(t)||lt(8),It(t)&&(t=ft(t));const r=Yf(this),n=Yu(r,t,void 0);return n[Re].isManual_=!0,Uu(r),n}finishDraft(t,r){const n=t&&t[Re];(!n||!n.isManual_)&<(9);const{scope_:i}=n;return Hf(i,r),Gf(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const a=r[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(r=r.slice(n+1));const i=Tr(qu).applyPatches_;return It(t)?i(t,r):this.produce(t,a=>i(a,r))}};function Yu(e,t,r,n){const[i,a]=ya(t)?Tr(Ii).proxyMap_(t,r):ga(t)?Tr(Ii).proxySet_(t,r):Nx(t,r);return(r?.scope_??em()).drafts_.push(i),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?Tx(r,a,n):a.callbacks_.push(function(l){l.mapSetPlugin_?.fixSetContents(a);const{patchPlugin_:s}=l;a.modified_&&s&&s.generatePatches_(a,[],l)}),i}function ft(e){return It(e)||lt(10,e),am(e)}function am(e){if(!vt(e)||ba(e))return e;const t=e[Re];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ku(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ku(e,!0);return _n(r,(i,a)=>{Ci(r,i,am(a))},n),t&&(t.finalized_=!1),r}var Lx=new Rx,om=Lx.produce;function um(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var zx=um(),Bx=um,Fx=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?_i:_i.apply(null,arguments)};function at(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(Xe(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Xp(n)&&n.type===e,r}var lm=class on extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,on.prototype)}static get[Symbol.species](){return on}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new on(...t[0].concat(this)):new on(...t.concat(this))}};function Xf(e){return vt(e)?om(e,()=>{}):e}function ti(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Kx(e){return typeof e=="boolean"}var qx=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new lm;return r&&(Kx(r)?o.push(zx):o.push(Bx(r.extraArgument))),o},cm="RTK_autoBatch",re=()=>e=>({payload:e,meta:{[cm]:!0}}),Zf=e=>t=>{setTimeout(t,e)},sm=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const u=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Zf(10):e.type==="callback"?e.queueNotification:Zf(e.timeout),s=()=>{o=!1,a&&(a=!1,u.forEach(c=>c()))};return Object.assign({},n,{subscribe(c){const f=()=>i&&c(),d=n.subscribe(f);return u.add(c),()=>{d(),u.delete(c)}},dispatch(c){try{return i=!c?.meta?.[cm],a=!i,a&&(o||(o=!0,l(s))),n.dispatch(c)}finally{i=!0}}})},Wx=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new lm(e);return n&&i.push(sm(typeof n=="object"?n:void 0)),i};function Ux(e){const t=qx(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let u;if(typeof r=="function")u=r;else if(Gl(r))u=Vp(r);else throw new Error(Xe(1));let l;typeof n=="function"?l=n(t):l=t();let s=_i;i&&(s=Fx({trace:!1,...typeof i=="object"&&i}));const c=Ax(...l),f=Wx(c);let d=typeof o=="function"?o(f):f();const v=s(...d);return Gp(u,a,v)}function fm(e){const t={},r=[];let n;const i={addCase(a,o){const u=typeof a=="string"?a:a.type;if(!u)throw new Error(Xe(28));if(u in t)throw new Error(Xe(29));return t[u]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function Hx(e){return typeof e=="function"}function Yx(e,t){let[r,n,i]=fm(t),a;if(Hx(e))a=()=>Xf(e());else{const u=Xf(e);a=()=>u}function o(u=a(),l){let s=[r[l.type],...n.filter(({matcher:c})=>c(l)).map(({reducer:c})=>c)];return s.filter(c=>!!c).length===0&&(s=[i]),s.reduce((c,f)=>{if(f)if(It(c)){const v=f(c,l);return v===void 0?c:v}else{if(vt(c))return om(c,d=>f(d,l));{const d=f(c,l);if(d===void 0){if(c===null)return c;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return c},u)}return o.getInitialState=a,o}var Gx="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Vx=(e=21)=>{let t="",r=e;for(;r--;)t+=Gx[Math.random()*64|0];return t},Xx=Symbol.for("rtk-slice-createasyncthunk");function Zx(e,t){return`${e}/${t}`}function Qx({creators:e}={}){const t=e?.asyncThunk?.[Xx];return function(n){const{name:i,reducerPath:a=i}=n;if(!i)throw new Error(Xe(11));const o=(typeof n.reducers=="function"?n.reducers(eP()):n.reducers)||{},u=Object.keys(o),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(w,P){const b=typeof w=="string"?w:w.type;if(!b)throw new Error(Xe(12));if(b in l.sliceCaseReducersByType)throw new Error(Xe(13));return l.sliceCaseReducersByType[b]=P,s},addMatcher(w,P){return l.sliceMatchers.push({matcher:w,reducer:P}),s},exposeAction(w,P){return l.actionCreators[w]=P,s},exposeCaseReducer(w,P){return l.sliceCaseReducersByName[w]=P,s}};u.forEach(w=>{const P=o[w],b={reducerName:w,type:Zx(i,w),createNotation:typeof n.reducers=="function"};rP(P)?iP(b,P,s,t):tP(b,P,s)});function c(){const[w={},P=[],b=void 0]=typeof n.extraReducers=="function"?fm(n.extraReducers):[n.extraReducers],O={...w,...l.sliceCaseReducersByType};return Yx(n.initialState,S=>{for(let _ in O)S.addCase(_,O[_]);for(let _ of l.sliceMatchers)S.addMatcher(_.matcher,_.reducer);for(let _ of P)S.addMatcher(_.matcher,_.reducer);b&&S.addDefaultCase(b)})}const f=w=>w,d=new Map,v=new WeakMap;let p;function y(w,P){return p||(p=c()),p(w,P)}function m(){return p||(p=c()),p.getInitialState()}function g(w,P=!1){function b(S){let _=S[w];return typeof _>"u"&&P&&(_=ti(v,b,m)),_}function O(S=f){const _=ti(d,P,()=>new WeakMap);return ti(_,S,()=>{const I={};for(const[M,E]of Object.entries(n.selectors??{}))I[M]=Jx(E,S,()=>ti(v,S,m),P);return I})}return{reducerPath:w,getSelectors:O,get selectors(){return O(b)},selectSlice:b}}const x={name:i,reducer:y,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:m,...g(a),injectInto(w,{reducerPath:P,...b}={}){const O=P??a;return w.inject({reducerPath:O,reducer:y},b),{...x,...g(O,!0)}}};return x}}function Jx(e,t,r,n){function i(a,...o){let u=t(a);return typeof u>"u"&&n&&(u=r()),e(u,...o)}return i.unwrapped=e,i}var qe=Qx();function eP(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function tP({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!nP(n))throw new Error(Xe(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?at(e,o):at(e))}function rP(e){return e._reducerDefinitionType==="asyncThunk"}function nP(e){return e._reducerDefinitionType==="reducerWithPrepare"}function iP({type:e,reducerName:t},r,n,i){if(!i)throw new Error(Xe(18));const{payloadCreator:a,fulfilled:o,pending:u,rejected:l,settled:s,options:c}=r,f=i(e,a,c);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),u&&n.addCase(f.pending,u),l&&n.addCase(f.rejected,l),s&&n.addMatcher(f.settled,s),n.exposeCaseReducer(t,{fulfilled:o||ri,pending:u||ri,rejected:l||ri,settled:s||ri})}function ri(){}var aP="task",dm="listener",vm="completed",ec="cancelled",oP=`task-${ec}`,uP=`task-${vm}`,Gu=`${dm}-${ec}`,lP=`${dm}-${vm}`,xa=class{constructor(e){this.code=e,this.message=`${aP} ${ec} (reason: ${e})`}name="TaskAbortError";message},tc=(e,t)=>{if(typeof e!="function")throw new TypeError(Xe(32))},Mi=()=>{},hm=(e,t=Mi)=>(e.catch(t),e),pm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),fr=e=>{if(e.aborted)throw new xa(e.reason)};function mm(e,t){let r=Mi;return new Promise((n,i)=>{const a=()=>i(new xa(e.reason));if(e.aborted){a();return}r=pm(e,a),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Mi})}var cP=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof xa?"cancelled":"rejected",error:r}}finally{t?.()}},Ti=e=>t=>hm(mm(e,t).then(r=>(fr(e),r))),ym=e=>{const t=Ti(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:jr}=Object,Qf={},Pa="listenerMiddleware",sP=(e,t)=>{const r=n=>pm(e,()=>n.abort(e.reason));return(n,i)=>{tc(n);const a=new AbortController;r(a);const o=cP(async()=>{fr(e),fr(a.signal);const u=await n({pause:Ti(a.signal),delay:ym(a.signal),signal:a.signal});return fr(a.signal),u},()=>a.abort(uP));return i?.autoJoin&&t.push(o.catch(Mi)),{result:Ti(e)(o),cancel(){a.abort(oP)}}}},fP=(e,t)=>{const r=async(n,i)=>{fr(t);let a=()=>{};const u=[new Promise((l,s)=>{let c=e({predicate:n,effect:(f,d)=>{d.unsubscribe(),l([f,d.getState(),d.getOriginalState()])}});a=()=>{c(),s()}})];i!=null&&u.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await mm(t,Promise.race(u));return fr(t),l}finally{a()}};return(n,i)=>hm(r(n,i))},gm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=at(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(Xe(21));return tc(a),{predicate:i,type:t,effect:a}},bm=jr(e=>{const{type:t,predicate:r,effect:n}=gm(e);return{id:Vx(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Xe(22))}}},{withTypes:()=>bm}),Jf=(e,t)=>{const{type:r,effect:n,predicate:i}=gm(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===i)&&a.effect===n)},Vu=e=>{e.pending.forEach(t=>{t.abort(Gu)})},dP=(e,t)=>()=>{for(const r of t.keys())Vu(r);e.clear()},ed=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},wm=jr(at(`${Pa}/add`),{withTypes:()=>wm}),vP=at(`${Pa}/removeAll`),xm=jr(at(`${Pa}/remove`),{withTypes:()=>xm}),hP=(...e)=>{console.error(`${Pa}/error`,...e)},jn=(e={})=>{const t=new Map,r=new Map,n=v=>{const p=r.get(v)??0;r.set(v,p+1)},i=v=>{const p=r.get(v)??1;p===1?r.delete(v):r.set(v,p-1)},{extra:a,onError:o=hP}=e;tc(o);const u=v=>(v.unsubscribe=()=>t.delete(v.id),t.set(v.id,v),p=>{v.unsubscribe(),p?.cancelActive&&Vu(v)}),l=v=>{const p=Jf(t,v)??bm(v);return u(p)};jr(l,{withTypes:()=>l});const s=v=>{const p=Jf(t,v);return p&&(p.unsubscribe(),v.cancelActive&&Vu(p)),!!p};jr(s,{withTypes:()=>s});const c=async(v,p,y,m)=>{const g=new AbortController,x=fP(l,g.signal),w=[];try{v.pending.add(g),n(v),await Promise.resolve(v.effect(p,jr({},y,{getOriginalState:m,condition:(P,b)=>x(P,b).then(Boolean),take:x,delay:ym(g.signal),pause:Ti(g.signal),extra:a,signal:g.signal,fork:sP(g.signal,w),unsubscribe:v.unsubscribe,subscribe:()=>{t.set(v.id,v)},cancelActiveListeners:()=>{v.pending.forEach((P,b,O)=>{P!==g&&(P.abort(Gu),O.delete(P))})},cancel:()=>{g.abort(Gu),v.pending.delete(g)},throwIfCancelled:()=>{fr(g.signal)}})))}catch(P){P instanceof xa||ed(o,P,{raisedBy:"effect"})}finally{await Promise.all(w),g.abort(lP),i(v),v.pending.delete(g)}},f=dP(t,r);return{middleware:v=>p=>y=>{if(!Xp(y))return p(y);if(wm.match(y))return l(y.payload);if(vP.match(y)){f();return}if(xm.match(y))return s(y.payload);let m=v.getState();const g=()=>{if(m===Qf)throw new Error(Xe(23));return m};let x;try{if(x=p(y),t.size>0){const w=v.getState(),P=Array.from(t.values());for(const b of P){let O=!1;try{O=b.predicate(y,w,m)}catch(S){O=!1,ed(o,S,{raisedBy:"predicate"})}O&&c(b,y,v,g)}}}finally{m=Qf}return x},startListening:l,stopListening:s,clearListeners:f}};function Xe(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var pP={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Pm=qe({name:"chartLayout",initialState:pP,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,a;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:mP,setLayout:yP,setChartSize:gP,setScale:bP}=Pm.actions,wP=Pm.reducer;function Om(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function td(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _r(e){for(var t=1;t{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:o,layout:u}=t;if((u==="vertical"||u==="horizontal"&&o==="middle")&&a!=="center"&&N(e[a]))return _r(_r({},e),{},{[a]:e[a]+(n||0)});if((u==="horizontal"||u==="vertical"&&a==="center")&&o!=="middle"&&N(e[o]))return _r(_r({},e),{},{[o]:e[o]+(i||0)})}return e},Jt=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",Am=(e,t,r,n)=>{if(n)return e.map(u=>u.coordinate);var i,a,o=e.map(u=>(u.coordinate===t&&(i=!0),u.coordinate===r&&(a=!0),u.coordinate));return i||o.push(t),a||o.push(r),o},Sm=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:a,scale:o,realScaleType:u,isCategorical:l,categoricalDomain:s,tickCount:c,ticks:f,niceTicks:d,axisType:v}=e;if(!o)return null;var p=u==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,y=i==="category"&&o.bandwidth?o.bandwidth()/p:0;if(y=v==="angleAxis"&&a&&a.length>=2?Ae(a[0]-a[1])*2*y:y,f||d){var m=(f||d||[]).map((g,x)=>{var w=n?n.indexOf(g):g;return{coordinate:o(w)+y,value:g,offset:y,index:x}});return m.filter(g=>!dt(g.coordinate))}return l&&s?s.map((g,x)=>({coordinate:o(g)+y,value:g,index:x,offset:y})):o.ticks&&c!=null?o.ticks(c).map((g,x)=>({coordinate:o(g)+y,value:g,offset:y,index:x})):o.domain().map((g,x)=>({coordinate:o(g)+y,value:n?n[g]:g,index:x,offset:y}))},rd=1e-4,SP=e=>{var t=e.domain();if(!(!t||t.length<=2)){var r=t.length,n=e.range(),i=Math.min(n[0],n[1])-rd,a=Math.max(n[0],n[1])+rd,o=e(t[0]),u=e(t[r-1]);(oa||ua)&&e.domain([t[0],t[r-1]])}},EP=(e,t)=>{if(!t||t.length!==2||!N(t[0])||!N(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!N(e[0])||e[0]n)&&(i[1]=n),i[0]>n&&(i[0]=n),i[1]{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[o][r][0]=i,e[o][r][1]=i+u,i=e[o][r][1]):(e[o][r][0]=a,e[o][r][1]=a+u,a=e[o][r][1])}},kP=e=>{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[a][r][0]=i,e[a][r][1]=i+o,i=e[a][r][1]):(e[a][r][0]=0,e[a][r][1]=0)}},jP={sign:_P,expand:ew,none:Ir,silhouette:tw,wiggle:rw,positive:kP},CP=(e,t,r)=>{var n=jP[r],i=Jb().keys(t).value((a,o)=>Number(X(a,o,0))).order(Lu).offset(n);return i(e)};function IP(e){return e==null?void 0:String(e)}function nd(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!ae(i[t.dataKey])){var u=Cp(r,"value",i[t.dataKey]);if(u)return u.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var l=X(i,ae(o)?t.dataKey:o);return ae(l)?null:t.scale(l)}var id=e=>{var{axis:t,ticks:r,offset:n,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var u=X(a,t.dataKey,t.scale.domain()[o]);return ae(u)?null:t.scale(u)-i/2+n},MP=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return n<=0&&i>=0?0:i<0?i:n}return r[0]},TP=e=>{var t=e.flat(2).filter(N);return[Math.min(...t),Math.max(...t)]},DP=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],NP=(e,t,r)=>{if(e!=null)return DP(Object.keys(e).reduce((n,i)=>{var a=e[i],{stackedData:o}=a,u=o.reduce((l,s)=>{var c=Om(s,t,r),f=TP(c);return[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(u[0],n[0]),Math.max(u[1],n[1])]},[1/0,-1/0]))},ad=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,od=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Dr=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=ha(t,c=>c.coordinate),a=1/0,o=1,u=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},RP=(e,t)=>t==="centric"?e.angle:e.radius,Rt=e=>e.layout.width,Lt=e=>e.layout.height,LP=e=>e.layout.scale,Em=e=>e.layout.margin,Oa=A(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Aa=A(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),_m="data-recharts-item-index",km="data-recharts-item-data-key",Cn=60;function ld(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ni(e){for(var t=1;te.brush.height;function qP(e){var t=Aa(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Cn;return r+i}return r},0)}function WP(e){var t=Aa(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Cn;return r+i}return r},0)}function UP(e){var t=Oa(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function HP(e){var t=Oa(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var ye=A([Rt,Lt,Em,KP,qP,WP,UP,HP,Hp,yx],(e,t,r,n,i,a,o,u,l,s)=>{var c={left:(r.left||0)+i,right:(r.right||0)+a},f={top:(r.top||0)+o,bottom:(r.bottom||0)+u},d=ni(ni({},f),c),v=d.bottom;d.bottom+=n,d=AP(d,l,s);var p=e-d.left-d.right,y=t-d.top-d.bottom;return ni(ni({brushBottom:v},d),{},{width:Math.max(p,0),height:Math.max(y,0)})}),YP=A(ye,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),rc=A(Rt,Lt,(e,t)=>({x:0,y:0,width:e,height:t})),GP=h.createContext(null),Me=()=>h.useContext(GP)!=null,Sa=e=>e.brush,Ea=A([Sa,ye,Em],(e,t,r)=>({height:e.height,x:N(e.x)?e.x:t.left,y:N(e.y)?e.y:t.top+t.height+t.brushBottom-(r?.bottom||0),width:N(e.width)?e.width:t.width})),Zo={},Qo={},Jo={},cd;function VP(){return cd||(cd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n,{signal:i,edges:a}={}){let o,u=null;const l=a!=null&&a.includes("leading"),s=a==null||a.includes("trailing"),c=()=>{u!==null&&(r.apply(o,u),o=void 0,u=null)},f=()=>{s&&c(),y()};let d=null;const v=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,f()},n)},p=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{p(),o=void 0,u=null},m=()=>{c()},g=function(...x){if(i?.aborted)return;o=this,u=x;const w=d==null;v(),l&&w&&c()};return g.schedule=v,g.cancel=y,g.flush=m,i?.addEventListener("abort",y,{once:!0}),g}e.debounce=t})(Jo)),Jo}var sd;function XP(){return sd||(sd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=VP();function r(n,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:u=!0,maxWait:l}=a,s=Array(2);o&&(s[0]="leading"),u&&(s[1]="trailing");let c,f=null;const d=t.debounce(function(...y){c=n.apply(this,y),f=null},i,{edges:s}),v=function(...y){return l!=null&&(f===null&&(f=Date.now()),Date.now()-f>=l)?(c=n.apply(this,y),f=Date.now(),d.cancel(),d.schedule(),c):(d.apply(this,y),c)},p=()=>(d.flush(),c);return v.cancel=d.cancel,v.flush=p,v}e.debounce=r})(Qo)),Qo}var fd;function ZP(){return fd||(fd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=XP();function r(n,i=0,a={}){const{leading:o=!0,trailing:u=!0}=a;return t.debounce(n,i,{leading:o,maxWait:i,trailing:u})}e.throttle=r})(Zo)),Zo}var eu,dd;function QP(){return dd||(dd=1,eu=ZP().throttle),eu}var JP=QP();const eO=Qt(JP);var Di=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;ai[o++]))}},jm=(e,t,r)=>{var{width:n="100%",height:i="100%",aspect:a,maxHeight:o}=r,u=Ct(n)?e:Number(n),l=Ct(i)?t:Number(i);return a&&a>0&&(u?l=u/a:l&&(u=l*a),o&&l!=null&&l>o&&(l=o)),{calculatedWidth:u,calculatedHeight:l}},tO={width:0,height:0,overflow:"visible"},rO={width:0,overflowX:"visible"},nO={height:0,overflowY:"visible"},iO={},aO=e=>{var{width:t,height:r}=e,n=Ct(t),i=Ct(r);return n&&i?tO:n?rO:i?nO:iO};function oO(e){var{width:t,height:r,aspect:n}=e,i=t,a=r;return i===void 0&&a===void 0?(i="100%",a="100%"):i===void 0?i=n&&n>0?void 0:"100%":a===void 0&&(a=n&&n>0?void 0:"100%"),{width:i,height:a}}function se(e){return Number.isFinite(e)}function wt(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Xu(){return Xu=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:r,height:n}),[r,n]);return sO(i)?h.createElement(Cm.Provider,{value:i},t):null}var nc=()=>h.useContext(Cm),fO=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:u,maxHeight:l,children:s,debounce:c=0,id:f,className:d,onResize:v,style:p={}}=e,y=h.useRef(null),m=h.useRef();m.current=v,h.useImperativeHandle(t,()=>y.current);var[g,x]=h.useState({containerWidth:n.width,containerHeight:n.height}),w=h.useCallback((_,I)=>{x(M=>{var E=Math.round(_),j=Math.round(I);return M.containerWidth===E&&M.containerHeight===j?M:{containerWidth:E,containerHeight:j}})},[]);h.useEffect(()=>{if(y.current==null||typeof ResizeObserver>"u")return Sn;var _=j=>{var $,{width:L,height:z}=j[0].contentRect;w(L,z),($=m.current)===null||$===void 0||$.call(m,L,z)};c>0&&(_=eO(_,c,{trailing:!0,leading:!1}));var I=new ResizeObserver(_),{width:M,height:E}=y.current.getBoundingClientRect();return w(M,E),I.observe(y.current),()=>{I.disconnect()}},[w,c]);var{containerWidth:P,containerHeight:b}=g;Di(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:O,calculatedHeight:S}=jm(P,b,{width:i,height:a,aspect:r,maxHeight:l});return Di(O!=null&&O>0||S!=null&&S>0,`The width(%s) and height(%s) of chart should be greater than 0, diff --git a/webui/dist/assets/codemirror-BEE0n9kQ.js b/webui/dist/assets/codemirror-TZqPU532.js similarity index 99% rename from webui/dist/assets/codemirror-BEE0n9kQ.js rename to webui/dist/assets/codemirror-TZqPU532.js index 2ead8a87..cfe8cb2f 100644 --- a/webui/dist/assets/codemirror-BEE0n9kQ.js +++ b/webui/dist/assets/codemirror-TZqPU532.js @@ -1,4 +1,4 @@ -import{r as Se,j as zu}from"./router-Bz250laD.js";function xr(){return xr=Object.assign?Object.assign.bind():function(n){for(var e=1;e{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=bh[i])e=i+1;else return!0;if(e==t)return!1}}function hl(n){return n>=127462&&n<=127487}const cl=8205;function Nu(n,e,t=!0,i=!0){return(t?Sh:Xu)(n,e,i)}function Sh(n,e,t){if(e==n.length)return e;e&&xh(n.charCodeAt(e))&&kh(n.charCodeAt(e-1))&&e--;let i=zs(n,e);for(e+=fl(i);e=0&&hl(zs(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Xu(n,e,t){for(;e>0;){let i=Sh(n,e-2,t);if(i=56320&&n<57344}function kh(n){return n>=55296&&n<56320}function fl(n){return n<65536?1:2}class V{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ze.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),Ze.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ai(this),r=new Ai(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ai(this,e)}iterRange(e,t=this.length){return new wh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new vh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?V.empty:e.length<=32?new K(e):Ze.from(K.split(e,[]))}}class K extends V{constructor(e,t=Fu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new _u(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new K(ul(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Xn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new K(l,o.length+r.length));else{let a=l.length>>1;i.push(new K(l.slice(0,a)),new K(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof K))return super.replace(e,t,i);[e,t]=li(this,e,t);let s=Xn(this.text,Xn(i.text,ul(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new K(s,r):Ze.from(K.split(s,[]),r)}sliceString(e,t=this.length,i=` +import{r as Se,j as zu}from"./router-9vIXuQkh.js";function xr(){return xr=Object.assign?Object.assign.bind():function(n){for(var e=1;e{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=bh[i])e=i+1;else return!0;if(e==t)return!1}}function hl(n){return n>=127462&&n<=127487}const cl=8205;function Nu(n,e,t=!0,i=!0){return(t?Sh:Xu)(n,e,i)}function Sh(n,e,t){if(e==n.length)return e;e&&xh(n.charCodeAt(e))&&kh(n.charCodeAt(e-1))&&e--;let i=zs(n,e);for(e+=fl(i);e=0&&hl(zs(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Xu(n,e,t){for(;e>0;){let i=Sh(n,e-2,t);if(i=56320&&n<57344}function kh(n){return n>=55296&&n<56320}function fl(n){return n<65536?1:2}class V{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ze.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),Ze.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ai(this),r=new Ai(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ai(this,e)}iterRange(e,t=this.length){return new wh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new vh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?V.empty:e.length<=32?new K(e):Ze.from(K.split(e,[]))}}class K extends V{constructor(e,t=Fu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new _u(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new K(ul(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Xn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new K(l,o.length+r.length));else{let a=l.length>>1;i.push(new K(l.slice(0,a)),new K(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof K))return super.replace(e,t,i);[e,t]=li(this,e,t);let s=Xn(this.text,Xn(i.text,ul(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new K(s,r):Ze.from(K.split(s,[]),r)}sliceString(e,t=this.length,i=` `){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new K(i,s)),i=[],s=-1);return s>-1&&t.push(new K(i,s)),t}}class Ze extends V{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=li(this,e,t),i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new Ze(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` `){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ze))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new K(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ze)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof K&&a&&(p=c[c.length-1])instanceof K&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new K(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ze.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ze(l,t)}}V.empty=new K([""],0);function Fu(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Xn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof K?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof K?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(s instanceof K){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof K?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class wh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ai(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class vh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},Ai.prototype[Symbol.iterator]=wh.prototype[Symbol.iterator]=vh.prototype[Symbol.iterator]=function(){return this});class _u{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function li(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function pe(n,e,t=!0,i=!0){return Nu(n,e,t,i)}function Uu(n){return n>=56320&&n<57344}function Hu(n){return n>=55296&&n<56320}function Te(n,e){let t=n.charCodeAt(e);if(!Hu(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Uu(i)?(t-55296<<10)+(i-56320)+65536:t}function So(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Ye(n){return n<65536?1:2}const wr=/\r\n?|\n/;var de=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(de||(de={}));class it{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=de.Simple&&h>=e&&(i==de.TrackDel&&se||i==de.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new it(e)}static create(e){return new it(e)}}class se extends it{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return vr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Tr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&&kt(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?V.of(d.split(i||wr)):d:V.empty,m=p.length;if(f==u&&m==0)return;fo&&Oe(s,f-o,-1),Oe(s,u-f,m),kt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new se(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function kt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function Tr(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Bi(n),l=new Bi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);Oe(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Bi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?V.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?V.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Wt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Wt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new Wt(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Wt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function Ch(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let xo=0;class A{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=xo++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new A(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:ko),!!e.static,e.enables)}of(e){return new Fn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function ko(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Fn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=xo++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Cr(f,c)){let d=i(f);if(l?!dl(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=ns(u,p);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===f.facet(g):g instanceof he?u.field(g,!1)==f.field(g,!1):!0)||(l?dl(d=i(f),m,s):s(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function dl(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(On).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(On),o=s.facet(On),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,On.of({field:this,create:e})]}get extension(){return this}}const $t={lowest:4,low:3,default:2,high:1,highest:0};function Si(n){return e=>new Ph(e,n)}const Mt={highest:Si($t.highest),high:Si($t.high),default:Si($t.default),low:Si($t.low),lowest:Si($t.lowest)};class Ph{constructor(e,t){this.inner=e,this.prec=t}}class vs{of(e){return new Pr(this,e)}reconfigure(e){return vs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Pr{constructor(e,t){this.compartment=e,this.inner=t}}class is{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Gu(e,t,o))u instanceof he?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,ko(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>ju(g,p,d))}}let f=h.map(u=>u(l));return new is(e,o,f,l,a,r)}}function Gu(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Pr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Pr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Ph)r(o.inner,o.prec);else if(o instanceof he)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Fn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,$t.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,$t.default),i.reduce((o,l)=>o.concat(l))}function Mi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function ns(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Qh=A.define(),Qr=A.define({combine:n=>n.some(e=>e),static:!0}),Ah=A.define({combine:n=>n.length?n[0]:void 0,static:!0}),Mh=A.define(),Rh=A.define(),Dh=A.define(),Eh=A.define({combine:n=>n.length?n[0]:!1});class st{constructor(e,t){this.type=e,this.value=t}static define(){return new Zu}}class Zu{of(e){return new st(this,e)}}class Yu{constructor(e){this.map=e}of(e){return new q(this,e)}}class q{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new q(this.type,t)}is(e){return this.type==e}static define(e={}){return new Yu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}q.reconfigure=q.define();q.appendConfig=q.define();class ie{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Ch(i,t.newLength),r.some(l=>l.type==ie.time)||(this.annotations=r.concat(ie.time.of(Date.now())))}static create(e,t,i,s,r,o){return new ie(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ie.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ie.time=st.define();ie.userEvent=st.define();ie.addToHistory=st.define();ie.remote=st.define();function Ku(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof ie?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof ie?n=r[0]:n=$h(e,ti(r),!1)}return n}function ed(n){let e=n.startState,t=e.facet(Dh),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=qh(i,Ar(e,r,n.changes.newLength),!0))}return i==n?n:ie.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const td=[];function ti(n){return n==null?td:Array.isArray(n)?n:[n]}var Y=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Y||(Y={}));const id=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Mr;try{Mr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nd(n){if(Mr)return Mr.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||id.test(t)))return!0}return!1}function sd(n){return e=>{if(!/\S/.test(e))return Y.Space;if(nd(e))return Y.Word;for(let t=0;t-1)return Y.Word;return Y.Other}}class I{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(q.reconfigure)?(t=null,i=l.value):l.is(q.appendConfig)&&(t=null,i=ti(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=is.resolve(i,s,this),r=new I(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Qr)?e.newSelection:e.newSelection.asSingle();new I(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=ti(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return I.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=is.resolve(e.extensions||[],new Map),i=e.doc instanceof V?e.doc:V.of((e.doc||"").split(t.staticFacet(I.lineSeparator)||wr)),s=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return Ch(s,i.length),t.staticFacet(Qr)||(s=s.asSingle()),new I(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(I.tabSize)}get lineBreak(){return this.facet(I.lineSeparator)||` diff --git a/webui/dist/assets/dnd-B_gmzEl7.js b/webui/dist/assets/dnd-BiPfFtVp.js similarity index 99% rename from webui/dist/assets/dnd-B_gmzEl7.js rename to webui/dist/assets/dnd-BiPfFtVp.js index 3d96b92e..2cb9ef46 100644 --- a/webui/dist/assets/dnd-B_gmzEl7.js +++ b/webui/dist/assets/dnd-BiPfFtVp.js @@ -1,4 +1,4 @@ -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:` +import{r as c,R as P,b as Oe}from"./router-9vIXuQkh.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. diff --git a/webui/dist/assets/icons-1LFGNRso.js b/webui/dist/assets/icons-1LFGNRso.js deleted file mode 100644 index 48f6131d..00000000 --- a/webui/dist/assets/icons-1LFGNRso.js +++ /dev/null @@ -1 +0,0 @@ -import{r as s}from"./router-Bz250laD.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const v=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:n,iconNode:k,...h},i)=>s.createElement("svg",{ref:i,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",y),...!n&&!x(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>s.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=s.forwardRef(({className:o,...y},n)=>s.createElement(v,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...y}));return c.displayName=d(t),c};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],g2=e("activity",g);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],u2=e("arrow-left",u);const f=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],f2=e("arrow-right",f);const w=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],w2=e("arrow-up-down",w);const N=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],N2=e("arrow-up",N);const $=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$2=e("ban",$);const z=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],z2=e("book-open",z);const b=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],b2=e("bot",b);const q=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],q2=e("boxes",q);const C=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],C2=e("bug",C);const j=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],j2=e("calendar",j);const A=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],A2=e("chart-column",A);const L=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],L2=e("check",L);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],V2=e("chevron-down",V);const H=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],H2=e("chevron-left",H);const S=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],S2=e("chevron-right",S);const P=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],P2=e("chevron-up",P);const U=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],U2=e("chevrons-left",U);const D=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],D2=e("chevrons-right",D);const T=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],T2=e("chevrons-up-down",T);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],B2=e("circle-alert",B);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],E2=e("circle-check",E);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],R2=e("circle-question-mark",R);const Z=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Z2=e("circle-user-round",Z);const F=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],F2=e("circle-user",F);const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],O2=e("circle-x",O);const G=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],G2=e("circle",G);const I=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],I2=e("clipboard-list",I);const W=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],W2=e("clock",W);const K=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],K2=e("code-xml",K);const Q=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],Q2=e("container",Q);const X=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],X2=e("copy",X);const J=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],J2=e("database",J);const Y=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Y2=e("dollar-sign",Y);const e1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],e0=e("download",e1);const a1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],a0=e("external-link",a1);const t1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],t0=e("eye-off",t1);const c1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],c0=e("eye",c1);const o1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],o0=e("file-question-mark",o1);const n1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],n0=e("file-search",n1);const s1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],s0=e("file-text",s1);const y1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],y0=e("folder-open",y1);const h1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],h0=e("funnel",h1);const d1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],d0=e("globe",d1);const r1=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],r0=e("graduation-cap",r1);const k1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],k0=e("grip-vertical",k1);const i1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],i0=e("hard-drive",i1);const p1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],p0=e("hash",p1);const l1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],l0=e("heart",l1);const _1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],_0=e("house",_1);const M1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],M0=e("image",M1);const x1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],x0=e("info",x1);const m1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],m0=e("key",m1);const v1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],v0=e("layers",v1);const g1=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],g0=e("layout-grid",g1);const u1=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],u0=e("list-checks",u1);const f1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],f0=e("loader-circle",f1);const w1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],w0=e("lock",w1);const N1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],N0=e("log-out",N1);const $1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],$0=e("menu",$1);const z1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],z0=e("message-circle",z1);const b1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],b0=e("message-square",b1);const q1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],q0=e("moon",q1);const C1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],C0=e("network",C1);const j1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],j0=e("package",j1);const A1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],A0=e("palette",A1);const L1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],L0=e("panels-top-left",L1);const V1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],V0=e("pause",V1);const H1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],H0=e("pen",H1);const S1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],S0=e("pencil",S1);const P1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],P0=e("play",P1);const U1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],U0=e("plus",U1);const D1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],D0=e("power",D1);const T1=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],T0=e("puzzle",T1);const B1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],B0=e("refresh-cw",B1);const E1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],E0=e("rotate-ccw",E1);const R1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],R0=e("rotate-cw",R1);const Z1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Z0=e("save",Z1);const F1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],F0=e("search",F1);const O1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],O0=e("send",O1);const G1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],G0=e("server",G1);const I1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],I0=e("settings-2",I1);const W1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],W0=e("settings",W1);const K1=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],K0=e("share-2",K1);const Q1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Q0=e("shield",Q1);const X1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],X0=e("skip-forward",X1);const J1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],J0=e("sliders-vertical",J1);const Y1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],Y0=e("smile",Y1);const e2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ee=e("sparkles",e2);const a2=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],ae=e("square-pen",a2);const t2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],te=e("star",t2);const c2=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ce=e("sun",c2);const o2=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],oe=e("tag",o2);const n2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ne=e("terminal",n2);const s2=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],se=e("thumbs-down",s2);const y2=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],ye=e("thumbs-up",y2);const h2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],he=e("trash-2",h2);const d2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],de=e("trending-up",d2);const r2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],re=e("triangle-alert",r2);const k2=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],ke=e("type",k2);const i2=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],ie=e("upload",i2);const p2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],pe=e("user",p2);const l2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],le=e("users",l2);const _2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],_e=e("wifi-off",_2);const M2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Me=e("wifi",M2);const x2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xe=e("x",x2);const m2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],me=e("zap",m2);export{L0 as $,g2 as A,b2 as B,B2 as C,Y2 as D,t0 as E,s0 as F,F0 as G,i0 as H,x0 as I,_0 as J,m0 as K,f0 as L,b0 as M,u2 as N,U0 as O,D0 as P,V2 as Q,B0 as R,W0 as S,de as T,ie as U,P2 as V,n0 as W,xe as X,k0 as Y,me as Z,Z0 as _,E0 as a,K2 as a0,S0 as a1,U2 as a2,H2 as a3,S2 as a4,D2 as a5,T2 as a6,K0 as a7,j0 as a8,G0 as a9,Me as aA,_e as aB,H0 as aC,O0 as aD,G2 as aE,o0 as aF,l0 as aG,w2 as aH,q2 as aI,F2 as aJ,A2 as aK,N2 as aL,J0 as aM,$0 as aN,z2 as aO,N0 as aP,C2 as aQ,v0 as aa,u0 as ab,oe as ac,r0 as ad,Q2 as ae,y0 as af,M0 as ag,h0 as ah,ae as ai,$2 as aj,p0 as ak,z0 as al,d0 as am,le as an,C0 as ao,V0 as ap,P0 as aq,j2 as ar,ke as as,te as at,ye as au,se as av,R0 as aw,I0 as ax,g0 as ay,Z2 as az,E2 as b,T0 as c,I2 as d,J2 as e,W2 as f,A0 as g,Q0 as h,re as i,L2 as j,X2 as k,c0 as l,O2 as m,he as n,e0 as o,ce as p,q0 as q,w0 as r,R2 as s,ne as t,a0 as u,ee as v,pe as w,Y0 as x,X0 as y,f2 as z}; diff --git a/webui/dist/assets/icons-C3pAHJin.js b/webui/dist/assets/icons-C3pAHJin.js new file mode 100644 index 00000000..1d013c54 --- /dev/null +++ b/webui/dist/assets/icons-C3pAHJin.js @@ -0,0 +1 @@ +import{r as y}from"./router-9vIXuQkh.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const v=y.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:s="",children:n,iconNode:k,...h},i)=>y.createElement("svg",{ref:i,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",s),...!n&&!x(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>y.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=y.forwardRef(({className:o,...s},n)=>y.createElement(v,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...s}));return c.displayName=d(t),c};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],u2=e("activity",g);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],f2=e("arrow-left",u);const f=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],w2=e("arrow-right",f);const w=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],N2=e("arrow-up-down",w);const N=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],$2=e("arrow-up",N);const $=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],z2=e("ban",$);const z=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],q2=e("book-open",z);const q=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],b2=e("bot",q);const b=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],C2=e("boxes",b);const C=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],j2=e("bug",C);const j=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],A2=e("calendar",j);const A=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],L2=e("chart-column",A);const L=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],V2=e("check",L);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],H2=e("chevron-down",V);const H=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],S2=e("chevron-left",H);const S=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],P2=e("chevron-right",S);const P=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],U2=e("chevron-up",P);const U=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],B2=e("chevrons-left",U);const B=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],D2=e("chevrons-right",B);const D=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],R2=e("chevrons-up-down",D);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],T2=e("circle-alert",R);const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],E2=e("circle-check",T);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Z2=e("circle-question-mark",E);const Z=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],F2=e("circle-user-round",Z);const F=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],G2=e("circle-user",F);const G=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],O2=e("circle-x",G);const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],I2=e("circle",O);const I=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],W2=e("clipboard-list",I);const W=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],K2=e("clock",W);const K=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Q2=e("code-xml",K);const Q=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],X2=e("container",Q);const X=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],J2=e("copy",X);const J=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Y2=e("database",J);const Y=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],e0=e("dollar-sign",Y);const e1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],a0=e("download",e1);const a1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],t0=e("external-link",a1);const t1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],c0=e("eye-off",t1);const c1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],o0=e("eye",c1);const o1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],n0=e("file-question-mark",o1);const n1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],y0=e("file-search",n1);const y1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],s0=e("file-text",y1);const s1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],h0=e("folder-open",s1);const h1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],d0=e("funnel",h1);const d1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],r0=e("git-branch",d1);const r1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],k0=e("globe",r1);const k1=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],i0=e("graduation-cap",k1);const i1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],p0=e("grip-vertical",i1);const p1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],l0=e("hard-drive",p1);const l1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],_0=e("hash",l1);const _1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],M0=e("heart",_1);const M1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],x0=e("house",M1);const x1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],m0=e("image",x1);const m1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],v0=e("info",m1);const v1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],g0=e("key",v1);const g1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],u0=e("layers",g1);const u1=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],f0=e("layout-grid",u1);const f1=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],w0=e("list-checks",f1);const w1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],N0=e("loader-circle",w1);const N1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],$0=e("lock",N1);const $1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],z0=e("log-out",$1);const z1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],q0=e("menu",z1);const q1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],b0=e("message-circle",q1);const b1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],C0=e("message-square",b1);const C1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],j0=e("moon",C1);const j1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],A0=e("network",j1);const A1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],L0=e("package",A1);const L1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],V0=e("palette",L1);const V1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],H0=e("panels-top-left",V1);const H1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],S0=e("pause",H1);const S1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],P0=e("pen",S1);const P1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],U0=e("pencil",P1);const U1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],B0=e("play",U1);const B1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],D0=e("plus",B1);const D1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],R0=e("power",D1);const R1=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],T0=e("puzzle",R1);const T1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],E0=e("refresh-cw",T1);const E1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Z0=e("rotate-ccw",E1);const Z1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],F0=e("rotate-cw",Z1);const F1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],G0=e("save",F1);const G1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],O0=e("search",G1);const O1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],I0=e("send",O1);const I1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],W0=e("server",I1);const W1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],K0=e("settings-2",W1);const K1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Q0=e("settings",K1);const Q1=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],X0=e("share-2",Q1);const X1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],J0=e("shield",X1);const J1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Y0=e("skip-forward",J1);const Y1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],ee=e("sliders-vertical",Y1);const e2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],ae=e("smile",e2);const a2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],te=e("sparkles",a2);const t2=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],ce=e("square-pen",t2);const c2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],oe=e("star",c2);const o2=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ne=e("sun",o2);const n2=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],ye=e("tag",n2);const y2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],se=e("terminal",y2);const s2=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],he=e("thumbs-down",s2);const h2=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],de=e("thumbs-up",h2);const d2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],re=e("trash-2",d2);const r2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],ke=e("trending-up",r2);const k2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ie=e("triangle-alert",k2);const i2=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],pe=e("type",i2);const p2=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],le=e("upload",p2);const l2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],_e=e("user",l2);const _2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Me=e("users",_2);const M2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],xe=e("wifi-off",M2);const x2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],me=e("wifi",x2);const m2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ve=e("x",m2);const v2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ge=e("zap",v2);export{H0 as $,u2 as A,b2 as B,T2 as C,e0 as D,c0 as E,s0 as F,O0 as G,l0 as H,v0 as I,x0 as J,g0 as K,N0 as L,C0 as M,f2 as N,D0 as O,R0 as P,H2 as Q,E0 as R,Q0 as S,ke as T,le as U,U2 as V,y0 as W,ve as X,p0 as Y,ge as Z,G0 as _,Z0 as a,Q2 as a0,U0 as a1,B2 as a2,S2 as a3,P2 as a4,D2 as a5,R2 as a6,X0 as a7,L0 as a8,W0 as a9,F2 as aA,me as aB,xe as aC,P0 as aD,I0 as aE,I2 as aF,n0 as aG,M0 as aH,N2 as aI,C2 as aJ,G2 as aK,L2 as aL,$2 as aM,ee as aN,q0 as aO,q2 as aP,z0 as aQ,j2 as aR,u0 as aa,w0 as ab,ye as ac,i0 as ad,X2 as ae,h0 as af,m0 as ag,d0 as ah,ce as ai,z2 as aj,_0 as ak,b0 as al,k0 as am,Me as an,A0 as ao,S0 as ap,B0 as aq,A2 as ar,pe as as,F0 as at,K0 as au,oe as av,f0 as aw,de as ax,he as ay,r0 as az,E2 as b,T0 as c,W2 as d,Y2 as e,K2 as f,V0 as g,J0 as h,ie as i,V2 as j,J2 as k,o0 as l,O2 as m,re as n,a0 as o,ne as p,j0 as q,$0 as r,Z2 as s,se as t,t0 as u,te as v,_e as w,ae as x,Y0 as y,w2 as z}; diff --git a/webui/dist/assets/index-BNRBabgA.css b/webui/dist/assets/index-BNRBabgA.css deleted file mode 100644 index b8a3172e..00000000 --- a/webui/dist/assets/index-BNRBabgA.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-16{inset:4rem}.inset-8{inset:2rem}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-24{bottom:6rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/3{right:33.333333%}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.right-8{right:2rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-3\/4{top:75%}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-1{margin-top:-.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[140px\]{height:140px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[600px\]{height:600px}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[calc\(85vh-220px\)\]{height:calc(85vh - 220px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[140px\]{min-height:140px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[600px\]{width:600px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[100px\]{max-width:100px}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-32{--tw-translate-x: 8rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[ping_3s_ease-in-out_infinite\]{animation:ping 3s ease-in-out infinite}.animate-\[ping_3s_ease-in-out_infinite_0\.5s\]{animation:ping 3s ease-in-out infinite .5s}.animate-\[ping_3s_ease-in-out_infinite_1s\]{animation:ping 3s ease-in-out infinite 1s}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[1fr_1fr_90px_32px\]{grid-template-columns:1fr 1fr 90px 32px}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-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\/20{border-color:#f59e0b33}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/10{border-color:hsl(var(--primary) / .1)}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/50{background-color:hsl(var(--card) / .5)}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-red-500{fill:#ef4444}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/10{color:hsl(var(--muted-foreground) / .1)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-150{transition-delay:.15s}.delay-300{transition-delay:.3s}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-900:hover{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-2xl:hover{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-y-1{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-green-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(20 83 45 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-purple-900\/30:is(.dark *){background-color:#581c874d}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/20:is(.dark *){background-color:#450a0a33}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-200:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-amber-500:is(.dark *){--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-amber-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-2\.5{height:.625rem}.sm\:h-24{height:6rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-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-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-4{padding:1rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:pb-4{padding-bottom:1rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>div\]\:bg-green-500>div{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}.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-BNVFwwkr.js b/webui/dist/assets/index-BNVFwwkr.js deleted file mode 100644 index 34bf4b02..00000000 --- a/webui/dist/assets/index-BNVFwwkr.js +++ /dev/null @@ -1,90 +0,0 @@ -import{r as m,j as e,L as br,e as ua,R as Ts,b as Ky,f as Qy,g as Yy,h as Jy,k as Ws,l as Xy,m as Zy,O as vg,n as Wy}from"./router-Bz250laD.js";import{a as e0,b as s0,g as t0}from"./react-vendor-BmxF9s7Q.js";import{N as a0,c as l0,O as Ar,P as n0,g as lm}from"./utils-BXc2jIuz.js";import{L as Ng,T as bg,C as yg,R as r0,a as wg,V as i0,b as c0,S as _g,c as o0,d as Sg,I as d0,e as Cg,f as u0,g as kg,h as m0,i as x0,j as h0,O as Tg,P as f0,k as Eg,l as Mg,D as Ag,A as zg,m as Dg,n as p0,o as g0,p as Og,q as j0,r as Rg,s as v0,t as N0,u as Lg,v as b0,w as y0,x as Ug,y as Bg,F as $g,z as Hg,B as w0,E as _0,G as Ig,H as S0,J as C0,K as k0,M as T0,N as E0,Q as M0,U as A0,W as z0,X as D0,Y as O0,Z as R0,_ as L0,$ as U0,a0 as B0,a1 as $0,a2 as Pg,a3 as H0,a4 as I0}from"./radix-extra-Dp24oM_w.js";import{R as P0,T as G0,L as q0,g as F0,C as uo,X as mo,Y as Ci,h as V0,B as nm,j as xo,P as K0,k as Q0,l as Y0}from"./charts-DbiuC1q1.js";import{S as J0,H as Gg,O as qg,o as X0,C as Fg,p as Z0,T as Vg,D as Kg,R as W0,q as ew,I as Qg,J as sw,K as Yg,L as Jg,M as tw,N as Xg,V as aw,Q as Zg,U as Wg,X as lw,Y as nw,Z as ej,_ as rw,$ as iw,a0 as sj,a1 as cw,e as tj,f as zo,c as Do,P as An,d as Oo,b as Zl,h as ow,l as dw,m as uw,u as wm,r as mw,a as xw,a2 as hw,a3 as aj,a4 as fw,a5 as pw,a6 as gw,a7 as lj,a8 as nj,a9 as rj,aa as ij,ab as cj,ac as oj,ad as jw}from"./radix-core-C_kRl1e_.js";import{R as zt,a as Ui,C as Dt,b as oa,L as Js,P as Vi,Z as Sn,F as Ha,c as vw,S as zn,d as Nw,M as Wl,A as bw,D as yw,e as Cr,f as Nl,T as ww,X as Da,g as _w,h as Sw,I as Jt,i as Qt,j as _t,k as _o,E as Bi,l as Xt,m as dj,H as Cw,n as ns,o as Yt,U as $i,p as uj,q as mj,r as Pp,K as Am,s as xj,t as kw,u as vo,v as Tw,B as Mi,w as kr,x as zm,y as Ew,z as Mw,G as Vt,J as Ro,N as en,O as lt,Q as Oa,V as Tr,W as Dm,Y as hj,_ as Ki,$ as fj,a0 as pj,a1 as Cn,a2 as zr,a3 as Wa,a4 as ba,a5 as Dr,a6 as Om,a7 as gj,a8 as ca,a9 as yl,aa as kn,ab as Tn,ac as Rm,ad as Aw,ae as zw,af as Dw,ag as jj,ah as No,ai as En,aj as Ow,ak as Er,al as Rw,am as _m,an as Sm,ao as vj,ap as Lw,aq as Uw,ar as Gp,as as Bw,at as vl,au as rm,av as qp,aw as Nj,ax as $w,ay as bj,az as im,aA as Hw,aB as Iw,aC as Pw,aD as Gw,aE as yj,aF as wj,aG as So,aH as qw,aI as _j,aJ as Sj,aK as Fw,aL as Vw,aM as Fp,aN as Kw,aO as Qw,aP as Yw,aQ as Jw}from"./icons-1LFGNRso.js";import{S as Xw,p as Zw,j as Ww,a as e1,E as Vp,R as s1,o as t1}from"./codemirror-BEE0n9kQ.js";import{u as Cj,a as Co,s as kj,K as Tj,P as Ej,b as Mj,D as Aj,c as zj,S as Dj,v as a1,d as Oj,C as Rj,h as l1}from"./dnd-B_gmzEl7.js";import{_ as ma,c as n1,g as Lj,D as r1,z as ho}from"./misc-ChwNwoVu.js";import{D as i1,U as c1}from"./uppy-CcUbCiwl.js";import{M as o1,r as d1,a as u1,b as m1}from"./markdown-kUhwkcQP.js";import{c as x1,H as ko,P as To,u as h1,d as f1,R as p1,B as g1,e as j1,C as v1,M as N1,f as b1}from"./reactflow-DLoXAt4c.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))c(u);new MutationObserver(u=>{for(const x of u)if(x.type==="childList")for(const h of x.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function i(u){const x={};return u.integrity&&(x.integrity=u.integrity),u.referrerPolicy&&(x.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?x.credentials="include":u.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function c(u){if(u.ep)return;u.ep=!0;const x=i(u);fetch(u.href,x)}})();var cm={exports:{}},ki={},om={exports:{}},dm={};var Kp;function y1(){return Kp||(Kp=1,(function(l){function n(A,Y){var H=A.length;A.push(Y);e:for(;0>>1,$=A[U];if(0>>1;U<_e;){var Ne=2*(U+1)-1,Se=A[Ne],V=Ne+1,ye=A[V];if(0>u(Se,H))V<$&&0>u(ye,Se)?(A[U]=ye,A[V]=H,U=V):(A[U]=Se,A[Ne]=H,U=Ne);else if(V<$&&0>u(ye,H))A[U]=ye,A[V]=H,U=V;else break e}}return Y}function u(A,Y){var H=A.sortIndex-Y.sortIndex;return H!==0?H:A.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 p=[],g=[],v=1,N=null,y=3,w=!1,b=!1,L=!1,D=!1,T=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function S(A){for(var Y=i(g);Y!==null;){if(Y.callback===null)c(g);else if(Y.startTime<=A)c(g),Y.sortIndex=Y.expirationTime,n(p,Y);else break;Y=i(g)}}function C(A){if(L=!1,S(A),!b)if(i(p)!==null)b=!0,P||(P=!0,be());else{var Y=i(g);Y!==null&&je(C,Y.startTime-A)}}var P=!1,M=-1,Z=5,G=-1;function ce(){return D?!0:!(l.unstable_now()-GA&&ce());){var U=N.callback;if(typeof U=="function"){N.callback=null,y=N.priorityLevel;var $=U(N.expirationTime<=A);if(A=l.unstable_now(),typeof $=="function"){N.callback=$,S(A),Y=!0;break s}N===i(p)&&c(p),S(A)}else c(p);N=i(p)}if(N!==null)Y=!0;else{var _e=i(g);_e!==null&&je(C,_e.startTime-A),Y=!1}}break e}finally{N=null,y=H,w=!1}Y=void 0}}finally{Y?be():P=!1}}}var be;if(typeof O=="function")be=function(){O(de)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,pe=me.port2;me.port1.onmessage=de,be=function(){pe.postMessage(null)}}else be=function(){T(de,0)};function je(A,Y){M=T(function(){A(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(A){A.callback=null},l.unstable_forceFrameRate=function(A){0>A||125U?(A.sortIndex=H,n(g,A),i(p)===null&&A===i(g)&&(L?(F(M),M=-1):L=!0,je(C,H-U))):(A.sortIndex=$,n(p,A),b||w||(b=!0,P||(P=!0,be()))),A},l.unstable_shouldYield=ce,l.unstable_wrapCallback=function(A){var Y=y;return function(){var H=y;y=Y;try{return A.apply(this,arguments)}finally{y=H}}}})(dm)),dm}var Qp;function w1(){return Qp||(Qp=1,om.exports=y1()),om.exports}var Yp;function _1(){if(Yp)return ki;Yp=1;var l=w1(),n=e0(),i=s0();function c(s){var t="https://react.dev/errors/"+s;if(1$||(s.current=U[$],U[$]=null,$--)}function Se(s,t){$++,U[$]=s.current,s.current=t}var V=_e(null),ye=_e(null),W=_e(null),ue=_e(null);function ke(s,t){switch(Se(W,t),Se(ye,s),Se(V,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?up(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=up(t),s=mp(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Ne(V),Se(V,s)}function J(){Ne(V),Ne(ye),Ne(W)}function ee(s){s.memoizedState!==null&&Se(ue,s);var t=V.current,a=mp(t,s.type);t!==a&&(Se(ye,s),Se(V,a))}function De(s){ye.current===s&&(Ne(V),Ne(ye)),ue.current===s&&(Ne(ue),yi._currentValue=H)}var Fe,ge;function as(s){if(Fe===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Fe=t&&t[1]||"",ge=-1)":-1o||R[r]!==te[o]){var xe=` -`+R[r].replace(" at new "," at ");return s.displayName&&xe.includes("")&&(xe=xe.replace("",s.displayName)),xe}while(1<=r&&0<=o);break}}}finally{ae=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?as(a):""}function ie(s,t){switch(s.tag){case 26:case 27:case 5:return as(s.type);case 16:return as("Lazy");case 13:return s.child!==t&&t!==null?as("Suspense Fallback"):as("Suspense");case 19:return as("SuspenseList");case 0:case 15:return Ee(s.type,!1);case 11:return Ee(s.type.render,!1);case 1:return Ee(s.type,!0);case 31:return as("Activity");default:return""}}function ve(s){try{var t="",a=null;do t+=ie(s,a),a=s,s=s.return;while(s);return t}catch(r){return` -Error generating stack: `+r.message+` -`+r.stack}}var Me=Object.prototype.hasOwnProperty,Ze=l.unstable_scheduleCallback,js=l.unstable_cancelCallback,Ot=l.unstable_shouldYield,rs=l.unstable_requestPaint,Ps=l.unstable_now,Q=l.unstable_getCurrentPriorityLevel,Ge=l.unstable_ImmediatePriority,He=l.unstable_UserBlockingPriority,Ve=l.unstable_NormalPriority,Bs=l.unstable_LowPriority,Ce=l.unstable_IdlePriority,cs=l.log,Es=l.unstable_setDisableYieldValue,zs=null,es=null;function We(s){if(typeof cs=="function"&&Es(s),es&&typeof es.setStrictMode=="function")try{es.setStrictMode(zs,s)}catch{}}var vs=Math.clz32?Math.clz32:it,mt=Math.log,Rt=Math.LN2;function it(s){return s>>>=0,s===0?32:31-(mt(s)/Rt|0)|0}var ss=256,St=262144,$t=4194304;function Mt(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 Ga(s,t,a){var r=s.pendingLanes;if(r===0)return 0;var o=0,d=s.suspendedLanes,j=s.pingedLanes;s=s.warmLanes;var _=r&134217727;return _!==0?(r=_&~d,r!==0?o=Mt(r):(j&=_,j!==0?o=Mt(j):a||(a=_&~s,a!==0&&(o=Mt(a))))):(_=r&~d,_!==0?o=Mt(_):j!==0?o=Mt(j):a||(a=r&~s,a!==0&&(o=Mt(a)))),o===0?0:t!==0&&t!==o&&(t&d)===0&&(d=o&-o,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:o}function qa(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function Rn(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function X(){var s=$t;return $t<<=1,($t&62914560)===0&&($t=4194304),s}function z(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function q(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Be(s,t,a,r,o,d){var j=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var _=s.entanglements,R=s.expirationTimes,te=s.hiddenUpdates;for(a=j&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var IN=/[\n"\\]/g;function wa(s){return s.replace(IN,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Zo(s,t,a,r,o,d,j,_){s.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?s.type=j:s.removeAttribute("type"),t!=null?j==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+ya(t)):s.value!==""+ya(t)&&(s.value=""+ya(t)):j!=="submit"&&j!=="reset"||s.removeAttribute("value"),t!=null?Wo(s,j,ya(t)):a!=null?Wo(s,j,ya(a)):r!=null&&s.removeAttribute("value"),o==null&&d!=null&&(s.defaultChecked=!!d),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.name=""+ya(_):s.removeAttribute("name")}function lx(s,t,a,r,o,d,j,_){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(s.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){Xo(s);return}a=a!=null?""+ya(a):"",t=t!=null?""+ya(t):a,_||t===s.value||(s.value=t),s.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,s.checked=_?s.checked:!!r,s.defaultChecked=!!r,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.name=j),Xo(s)}function Wo(s,t,a){t==="number"&&ec(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function In(s,t,a,r){if(s=s.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ld=!1;if(tl)try{var Hr={};Object.defineProperty(Hr,"passive",{get:function(){ld=!0}}),window.addEventListener("test",Hr,Hr),window.removeEventListener("test",Hr,Hr)}catch{ld=!1}var Tl=null,nd=null,tc=null;function ux(){if(tc)return tc;var s,t=nd,a=t.length,r,o="value"in Tl?Tl.value:Tl.textContent,d=o.length;for(s=0;s=Gr),gx=" ",jx=!1;function vx(s,t){switch(s){case"keyup":return fb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nx(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Fn=!1;function gb(s,t){switch(s){case"compositionend":return Nx(t);case"keypress":return t.which!==32?null:(jx=!0,gx);case"textInput":return s=t.data,s===gx&&jx?null:s;default:return null}}function jb(s,t){if(Fn)return s==="compositionend"||!dd&&vx(s,t)?(s=ux(),tc=nd=Tl=null,Fn=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-s};s=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Tx(a)}}function Mx(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Mx(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function Ax(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=ec(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=ec(s.document)}return t}function xd(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 Cb=tl&&"documentMode"in document&&11>=document.documentMode,Vn=null,hd=null,Kr=null,fd=!1;function zx(s,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;fd||Vn==null||Vn!==ec(r)||(r=Vn,"selectionStart"in r&&xd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Kr&&Vr(Kr,r)||(Kr=r,r=Yc(hd,"onSelect"),0>=j,o-=j,Fa=1<<32-vs(t)+o|a<os?(Cs=$e,$e=null):Cs=$e.sibling;var As=ne(K,$e,se[os],he);if(As===null){$e===null&&($e=Cs);break}s&&$e&&As.alternate===null&&t(K,$e),I=d(As,I,os),Ms===null?qe=As:Ms.sibling=As,Ms=As,$e=Cs}if(os===se.length)return a(K,$e),ks&&ll(K,os),qe;if($e===null){for(;osos?(Cs=$e,$e=null):Cs=$e.sibling;var Jl=ne(K,$e,As.value,he);if(Jl===null){$e===null&&($e=Cs);break}s&&$e&&Jl.alternate===null&&t(K,$e),I=d(Jl,I,os),Ms===null?qe=Jl:Ms.sibling=Jl,Ms=Jl,$e=Cs}if(As.done)return a(K,$e),ks&&ll(K,os),qe;if($e===null){for(;!As.done;os++,As=se.next())As=fe(K,As.value,he),As!==null&&(I=d(As,I,os),Ms===null?qe=As:Ms.sibling=As,Ms=As);return ks&&ll(K,os),qe}for($e=r($e);!As.done;os++,As=se.next())As=oe($e,K,os,As.value,he),As!==null&&(s&&As.alternate!==null&&$e.delete(As.key===null?os:As.key),I=d(As,I,os),Ms===null?qe=As:Ms.sibling=As,Ms=As);return s&&$e.forEach(function(Vy){return t(K,Vy)}),ks&&ll(K,os),qe}function Fs(K,I,se,he){if(typeof se=="object"&&se!==null&&se.type===L&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case w:e:{for(var qe=se.key;I!==null;){if(I.key===qe){if(qe=se.type,qe===L){if(I.tag===7){a(K,I.sibling),he=o(I,se.props.children),he.return=K,K=he;break e}}else if(I.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===Z&&pn(qe)===I.type){a(K,I.sibling),he=o(I,se.props),Wr(he,se),he.return=K,K=he;break e}a(K,I);break}else t(K,I);I=I.sibling}se.type===L?(he=un(se.props.children,K.mode,he,se.key),he.return=K,K=he):(he=mc(se.type,se.key,se.props,null,K.mode,he),Wr(he,se),he.return=K,K=he)}return j(K);case b:e:{for(qe=se.key;I!==null;){if(I.key===qe)if(I.tag===4&&I.stateNode.containerInfo===se.containerInfo&&I.stateNode.implementation===se.implementation){a(K,I.sibling),he=o(I,se.children||[]),he.return=K,K=he;break e}else{a(K,I);break}else t(K,I);I=I.sibling}he=yd(se,K.mode,he),he.return=K,K=he}return j(K);case Z:return se=pn(se),Fs(K,I,se,he)}if(je(se))return Ae(K,I,se,he);if(be(se)){if(qe=be(se),typeof qe!="function")throw Error(c(150));return se=qe.call(se),Ke(K,I,se,he)}if(typeof se.then=="function")return Fs(K,I,vc(se),he);if(se.$$typeof===O)return Fs(K,I,fc(K,se),he);Nc(K,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,I!==null&&I.tag===6?(a(K,I.sibling),he=o(I,se),he.return=K,K=he):(a(K,I),he=bd(se,K.mode,he),he.return=K,K=he),j(K)):a(K,I)}return function(K,I,se,he){try{Zr=0;var qe=Fs(K,I,se,he);return ar=null,qe}catch($e){if($e===tr||$e===gc)throw $e;var Ms=ha(29,$e,null,K.mode);return Ms.lanes=he,Ms.return=K,Ms}finally{}}}var jn=sh(!0),th=sh(!1),Dl=!1;function Od(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rd(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 Ol(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Rl(s,t,a){var r=s.updateQueue;if(r===null)return null;if(r=r.shared,(Ds&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=uc(s),$x(s,null,a),t}return dc(s,r,t,a),uc(s)}function ei(s,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,_s(s,a)}}function Ld(s,t){var a=s.updateQueue,r=s.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var o=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var j={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?o=d=j:d=d.next=j,a=a.next}while(a!==null);d===null?o=d=t:d=d.next=t}else o=d=t;a={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:d,shared:r.shared,callbacks:r.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=t:s.next=t,a.lastBaseUpdate=t}var Ud=!1;function si(){if(Ud){var s=sr;if(s!==null)throw s}}function ti(s,t,a,r){Ud=!1;var o=s.updateQueue;Dl=!1;var d=o.firstBaseUpdate,j=o.lastBaseUpdate,_=o.shared.pending;if(_!==null){o.shared.pending=null;var R=_,te=R.next;R.next=null,j===null?d=te:j.next=te,j=R;var xe=s.alternate;xe!==null&&(xe=xe.updateQueue,_=xe.lastBaseUpdate,_!==j&&(_===null?xe.firstBaseUpdate=te:_.next=te,xe.lastBaseUpdate=R))}if(d!==null){var fe=o.baseState;j=0,xe=te=R=null,_=d;do{var ne=_.lane&-536870913,oe=ne!==_.lane;if(oe?(Ss&ne)===ne:(r&ne)===ne){ne!==0&&ne===er&&(Ud=!0),xe!==null&&(xe=xe.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Ae=s,Ke=_;ne=t;var Fs=a;switch(Ke.tag){case 1:if(Ae=Ke.payload,typeof Ae=="function"){fe=Ae.call(Fs,fe,ne);break e}fe=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Ke.payload,ne=typeof Ae=="function"?Ae.call(Fs,fe,ne):Ae,ne==null)break e;fe=N({},fe,ne);break e;case 2:Dl=!0}}ne=_.callback,ne!==null&&(s.flags|=64,oe&&(s.flags|=8192),oe=o.callbacks,oe===null?o.callbacks=[ne]:oe.push(ne))}else oe={lane:ne,tag:_.tag,payload:_.payload,callback:_.callback,next:null},xe===null?(te=xe=oe,R=fe):xe=xe.next=oe,j|=ne;if(_=_.next,_===null){if(_=o.shared.pending,_===null)break;oe=_,_=oe.next,oe.next=null,o.lastBaseUpdate=oe,o.shared.pending=null}}while(!0);xe===null&&(R=fe),o.baseState=R,o.firstBaseUpdate=te,o.lastBaseUpdate=xe,d===null&&(o.shared.lanes=0),Hl|=j,s.lanes=j,s.memoizedState=fe}}function ah(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function lh(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;sd?d:8;var j=A.T,_={};A.T=_,tu(s,!1,t,a);try{var R=o(),te=A.S;if(te!==null&&te(_,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var xe=Rb(R,r);ni(s,t,xe,va(s))}else ni(s,t,r,va(s))}catch(fe){ni(s,t,{then:function(){},status:"rejected",reason:fe},va())}finally{Y.p=d,j!==null&&_.types!==null&&(j.types=_.types),A.T=j}}function Ib(){}function eu(s,t,a,r){if(s.tag!==5)throw Error(c(476));var o=Lh(s).queue;Rh(s,o,t,H,a===null?Ib:function(){return Uh(s),a(r)})}function Lh(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cl,lastRenderedState:H},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cl,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function Uh(s){var t=Lh(s);t.next===null&&(t=s.alternate.memoizedState),ni(s,t.next.queue,{},va())}function su(){return Pt(yi)}function Bh(){return wt().memoizedState}function $h(){return wt().memoizedState}function Pb(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=va();s=Ol(a);var r=Rl(t,s,a);r!==null&&(ra(r,t,a),ei(r,t,a)),t={cache:Md()},s.payload=t;return}t=t.return}}function Gb(s,t,a){var r=va();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Mc(s)?Ih(t,a):(a=vd(s,t,a,r),a!==null&&(ra(a,s,r),Ph(a,t,r)))}function Hh(s,t,a){var r=va();ni(s,t,a,r)}function ni(s,t,a,r){var o={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Mc(s))Ih(t,o);else{var d=s.alternate;if(s.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var j=t.lastRenderedState,_=d(j,a);if(o.hasEagerState=!0,o.eagerState=_,xa(_,j))return dc(s,t,o,0),Ks===null&&oc(),!1}catch{}finally{}if(a=vd(s,t,o,r),a!==null)return ra(a,s,r),Ph(a,t,r),!0}return!1}function tu(s,t,a,r){if(r={lane:2,revertLane:Ou(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Mc(s)){if(t)throw Error(c(479))}else t=vd(s,a,r,2),t!==null&&ra(t,s,2)}function Mc(s){var t=s.alternate;return s===is||t!==null&&t===is}function Ih(s,t){nr=wc=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function Ph(s,t,a){if((a&4194048)!==0){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,_s(s,a)}}var ri={readContext:Pt,use:Cc,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useLayoutEffect:xt,useInsertionEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useSyncExternalStore:xt,useId:xt,useHostTransitionStatus:xt,useFormState:xt,useActionState:xt,useOptimistic:xt,useMemoCache:xt,useCacheRefresh:xt};ri.useEffectEvent=xt;var Gh={readContext:Pt,use:Cc,useCallback:function(s,t){return Kt().memoizedState=[s,t===void 0?null:t],s},useContext:Pt,useEffect:Ch,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,Tc(4194308,4,Mh.bind(null,t,s),a)},useLayoutEffect:function(s,t){return Tc(4194308,4,s,t)},useInsertionEffect:function(s,t){Tc(4,2,s,t)},useMemo:function(s,t){var a=Kt();t=t===void 0?null:t;var r=s();if(vn){We(!0);try{s()}finally{We(!1)}}return a.memoizedState=[r,t],r},useReducer:function(s,t,a){var r=Kt();if(a!==void 0){var o=a(t);if(vn){We(!0);try{a(t)}finally{We(!1)}}}else o=t;return r.memoizedState=r.baseState=o,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},r.queue=s,s=s.dispatch=Gb.bind(null,is,s),[r.memoizedState,s]},useRef:function(s){var t=Kt();return s={current:s},t.memoizedState=s},useState:function(s){s=Yd(s);var t=s.queue,a=Hh.bind(null,is,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:Zd,useDeferredValue:function(s,t){var a=Kt();return Wd(a,s,t)},useTransition:function(){var s=Yd(!1);return s=Rh.bind(null,is,s.queue,!0,!1),Kt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var r=is,o=Kt();if(ks){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),Ks===null)throw Error(c(349));(Ss&127)!==0||dh(r,t,a)}o.memoizedState=a;var d={value:a,getSnapshot:t};return o.queue=d,Ch(mh.bind(null,r,d,s),[s]),r.flags|=2048,ir(9,{destroy:void 0},uh.bind(null,r,d,a,t),null),a},useId:function(){var s=Kt(),t=Ks.identifierPrefix;if(ks){var a=Va,r=Fa;a=(r&~(1<<32-vs(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=_c++,0<\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof r.is=="string"?j.createElement("select",{is:r.is}):j.createElement("select"),r.multiple?d.multiple=!0:r.size&&(d.size=r.size);break;default:d=typeof r.is=="string"?j.createElement(o,{is:r.is}):j.createElement(o)}}d[Ht]=t,d[ea]=r;e:for(j=t.child;j!==null;){if(j.tag===5||j.tag===6)d.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===t)break e;for(;j.sibling===null;){if(j.return===null||j.return===t)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}t.stateNode=d;e:switch(qt(d,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&dl(t)}}return at(t),pu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==r&&dl(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(c(166));if(s=W.current,Zn(t)){if(s=t.stateNode,a=t.memoizedProps,r=null,o=It,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}s[Ht]=t,s=!!(s.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||op(s.nodeValue,a)),s||Al(t,!0)}else s=Jc(s).createTextNode(r),s[Ht]=t,t.stateNode=s}return at(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(r=Zn(t),a!==null){if(s===null){if(!r)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(557));s[Ht]=t}else mn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;at(t),s=!1}else a=Cd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(pa(t),t):(pa(t),null);if((t.flags&128)!==0)throw Error(c(558))}return at(t),null;case 13:if(r=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=Zn(t),r!==null&&r.dehydrated!==null){if(s===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[Ht]=t}else mn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;at(t),o=!1}else o=Cd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(pa(t),t):(pa(t),null)}return pa(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,s=s!==null&&s.memoizedState!==null,a&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==o&&(r.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),Rc(t,t.updateQueue),at(t),null);case 4:return J(),s===null&&Bu(t.stateNode.containerInfo),at(t),null;case 10:return rl(t.type),at(t),null;case 19:if(Ne(yt),r=t.memoizedState,r===null)return at(t),null;if(o=(t.flags&128)!==0,d=r.rendering,d===null)if(o)ci(r,!1);else{if(ht!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(d=yc(s),d!==null){for(t.flags|=128,ci(r,!1),s=d.updateQueue,t.updateQueue=s,Rc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)Hx(a,s),a=a.sibling;return Se(yt,yt.current&1|2),ks&&ll(t,r.treeForkCount),t.child}s=s.sibling}r.tail!==null&&Ps()>Hc&&(t.flags|=128,o=!0,ci(r,!1),t.lanes=4194304)}else{if(!o)if(s=yc(d),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,Rc(t,s),ci(r,!0),r.tail===null&&r.tailMode==="hidden"&&!d.alternate&&!ks)return at(t),null}else 2*Ps()-r.renderingStartTime>Hc&&a!==536870912&&(t.flags|=128,o=!0,ci(r,!1),t.lanes=4194304);r.isBackwards?(d.sibling=t.child,t.child=d):(s=r.last,s!==null?s.sibling=d:t.child=d,r.last=d)}return r.tail!==null?(s=r.tail,r.rendering=s,r.tail=s.sibling,r.renderingStartTime=Ps(),s.sibling=null,a=yt.current,Se(yt,o?a&1|2:a&1),ks&&ll(t,r.treeForkCount),s):(at(t),null);case 22:case 23:return pa(t),$d(),r=t.memoizedState!==null,s!==null?s.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(at(t),t.subtreeFlags&6&&(t.flags|=8192)):at(t),a=t.updateQueue,a!==null&&Rc(t,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),s!==null&&Ne(fn),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),rl(Ct),at(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Qb(s,t){switch(_d(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return rl(Ct),J(),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(pa(t),t.alternate===null)throw Error(c(340));mn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(pa(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));mn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return Ne(yt),null;case 4:return J(),null;case 10:return rl(t.type),null;case 22:case 23:return pa(t),$d(),s!==null&&Ne(fn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return rl(Ct),null;case 25:return null;default:return null}}function hf(s,t){switch(_d(t),t.tag){case 3:rl(Ct),J();break;case 26:case 27:case 5:De(t);break;case 4:J();break;case 31:t.memoizedState!==null&&pa(t);break;case 13:pa(t);break;case 19:Ne(yt);break;case 10:rl(t.type);break;case 22:case 23:pa(t),$d(),s!==null&&Ne(fn);break;case 24:rl(Ct)}}function oi(s,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var o=r.next;a=o;do{if((a.tag&s)===s){r=void 0;var d=a.create,j=a.inst;r=d(),j.destroy=r}a=a.next}while(a!==o)}}catch(_){Hs(t,t.return,_)}}function Bl(s,t,a){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var d=o.next;r=d;do{if((r.tag&s)===s){var j=r.inst,_=j.destroy;if(_!==void 0){j.destroy=void 0,o=t;var R=a,te=_;try{te()}catch(xe){Hs(o,R,xe)}}}r=r.next}while(r!==d)}}catch(xe){Hs(t,t.return,xe)}}function ff(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{lh(t,a)}catch(r){Hs(s,s.return,r)}}}function pf(s,t,a){a.props=Nn(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(r){Hs(s,t,r)}}function di(s,t){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var r=s.stateNode;break;case 30:r=s.stateNode;break;default:r=s.stateNode}typeof a=="function"?s.refCleanup=a(r):a.current=r}}catch(o){Hs(s,t,o)}}function Ka(s,t){var a=s.ref,r=s.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(o){Hs(s,t,o)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){Hs(s,t,o)}else a.current=null}function gf(s){var t=s.type,a=s.memoizedProps,r=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(o){Hs(s,s.return,o)}}function gu(s,t,a){try{var r=s.stateNode;py(r,s.type,a,t),r[ea]=t}catch(o){Hs(s,s.return,o)}}function jf(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Fl(s.type)||s.tag===4}function ju(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||jf(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&&Fl(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 vu(s,t,a){var r=s.tag;if(r===5||r===6)s=s.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(s),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=sl));else if(r!==4&&(r===27&&Fl(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(vu(s,t,a),s=s.sibling;s!==null;)vu(s,t,a),s=s.sibling}function Lc(s,t,a){var r=s.tag;if(r===5||r===6)s=s.stateNode,t?a.insertBefore(s,t):a.appendChild(s);else if(r!==4&&(r===27&&Fl(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(Lc(s,t,a),s=s.sibling;s!==null;)Lc(s,t,a),s=s.sibling}function vf(s){var t=s.stateNode,a=s.memoizedProps;try{for(var r=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);qt(t,r,a),t[Ht]=s,t[ea]=a}catch(d){Hs(s,s.return,d)}}var ul=!1,Et=!1,Nu=!1,Nf=typeof WeakSet=="function"?WeakSet:Set,Ut=null;function Yb(s,t){if(s=s.containerInfo,Iu=ao,s=Ax(s),xd(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var o=r.anchorOffset,d=r.focusNode;r=r.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var j=0,_=-1,R=-1,te=0,xe=0,fe=s,ne=null;s:for(;;){for(var oe;fe!==a||o!==0&&fe.nodeType!==3||(_=j+o),fe!==d||r!==0&&fe.nodeType!==3||(R=j+r),fe.nodeType===3&&(j+=fe.nodeValue.length),(oe=fe.firstChild)!==null;)ne=fe,fe=oe;for(;;){if(fe===s)break s;if(ne===a&&++te===o&&(_=j),ne===d&&++xe===r&&(R=j),(oe=fe.nextSibling)!==null)break;fe=ne,ne=fe.parentNode}fe=oe}a=_===-1||R===-1?null:{start:_,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Pu={focusedElem:s,selectionRange:a},ao=!1,Ut=t;Ut!==null;)if(t=Ut,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Ut=s;else for(;Ut!==null;){switch(t=Ut,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"))),qt(d,r,a),d[Ht]=s,Lt(d),r=d;break e;case"link":var j=Cp("link","href",o).get(r+(a.href||""));if(j){for(var _=0;_Fs&&(j=Fs,Fs=Ke,Ke=j);var K=Ex(_,Ke),I=Ex(_,Fs);if(K&&I&&(oe.rangeCount!==1||oe.anchorNode!==K.node||oe.anchorOffset!==K.offset||oe.focusNode!==I.node||oe.focusOffset!==I.offset)){var se=fe.createRange();se.setStart(K.node,K.offset),oe.removeAllRanges(),Ke>Fs?(oe.addRange(se),oe.extend(I.node,I.offset)):(se.setEnd(I.node,I.offset),oe.addRange(se))}}}}for(fe=[],oe=_;oe=oe.parentNode;)oe.nodeType===1&&fe.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_a?32:a,A.T=null,a=ku,ku=null;var d=Pl,j=pl;if(At=0,mr=Pl=null,pl=0,(Ds&6)!==0)throw Error(c(331));var _=Ds;if(Ds|=4,Af(d.current),Tf(d,d.current,j,a),Ds=_,pi(0,!1),es&&typeof es.onPostCommitFiberRoot=="function")try{es.onPostCommitFiberRoot(zs,d)}catch{}return!0}finally{Y.p=o,A.T=r,Yf(s,t)}}function Xf(s,t,a){t=Sa(a,t),t=ru(s.stateNode,t,2),s=Rl(s,t,2),s!==null&&(q(s,2),Qa(s))}function Hs(s,t,a){if(s.tag===3)Xf(s,s,a);else for(;t!==null;){if(t.tag===3){Xf(t,s,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Il===null||!Il.has(r))){s=Sa(a,s),a=Xh(2),r=Rl(t,a,2),r!==null&&(Zh(a,r,t,s),q(r,2),Qa(r));break}}t=t.return}}function Au(s,t,a){var r=s.pingCache;if(r===null){r=s.pingCache=new Zb;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(a)||(wu=!0,o.add(a),s=ay.bind(null,s,t,a),t.then(s,s))}function ay(s,t,a){var r=s.pingCache;r!==null&&r.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,Ks===s&&(Ss&a)===a&&(ht===4||ht===3&&(Ss&62914560)===Ss&&300>Ps()-$c?(Ds&2)===0&&xr(s,0):_u|=a,ur===Ss&&(ur=0)),Qa(s)}function Zf(s,t){t===0&&(t=X()),s=dn(s,t),s!==null&&(q(s,t),Qa(s))}function ly(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),Zf(s,a)}function ny(s,t){var a=0;switch(s.tag){case 31:case 13:var r=s.stateNode,o=s.memoizedState;o!==null&&(a=o.retryLane);break;case 19:r=s.stateNode;break;case 22:r=s.stateNode._retryCache;break;default:throw Error(c(314))}r!==null&&r.delete(t),Zf(s,a)}function ry(s,t){return Ze(s,t)}var Vc=null,fr=null,zu=!1,Kc=!1,Du=!1,ql=0;function Qa(s){s!==fr&&s.next===null&&(fr===null?Vc=fr=s:fr=fr.next=s),Kc=!0,zu||(zu=!0,cy())}function pi(s,t){if(!Du&&Kc){Du=!0;do for(var a=!1,r=Vc;r!==null;){if(s!==0){var o=r.pendingLanes;if(o===0)var d=0;else{var j=r.suspendedLanes,_=r.pingedLanes;d=(1<<31-vs(42|s)+1)-1,d&=o&~(j&~_),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,tp(r,d))}else d=Ss,d=Ga(r,r===Ks?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(d&3)===0||qa(r,d)||(a=!0,tp(r,d));r=r.next}while(a);Du=!1}}function iy(){Wf()}function Wf(){Kc=zu=!1;var s=0;ql!==0&&jy()&&(s=ql);for(var t=Ps(),a=null,r=Vc;r!==null;){var o=r.next,d=ep(r,t);d===0?(r.next=null,a===null?Vc=o:a.next=o,o===null&&(fr=a)):(a=r,(s!==0||(d&3)!==0)&&(Kc=!0)),r=o}At!==0&&At!==5||pi(s),ql!==0&&(ql=0)}function ep(s,t){for(var a=s.suspendedLanes,r=s.pingedLanes,o=s.expirationTimes,d=s.pendingLanes&-62914561;0_)break;var xe=R.transferSize,fe=R.initiatorType;xe&&dp(fe)&&(R=R.responseEnd,j+=xe*(R<_?1:(_-te)/(R-te)))}if(--r,t+=8*(d+j)/(o.duration/1e3),s++,10"u"?null:document;function yp(s,t,a){var r=pr;if(r&&typeof t=="string"&&t){var o=wa(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),bp.has(o)||(bp.add(o),s={rel:s,crossOrigin:a,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),qt(t,"link",s),Lt(t),r.head.appendChild(t)))}}function ky(s){gl.D(s),yp("dns-prefetch",s,null)}function Ty(s,t){gl.C(s,t),yp("preconnect",s,t)}function Ey(s,t,a){gl.L(s,t,a);var r=pr;if(r&&s&&t){var o='link[rel="preload"][as="'+wa(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+wa(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+wa(a.imageSizes)+'"]')):o+='[href="'+wa(s)+'"]';var d=o;switch(t){case"style":d=gr(s);break;case"script":d=jr(s)}Aa.has(d)||(s=N({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),Aa.set(d,s),r.querySelector(o)!==null||t==="style"&&r.querySelector(Ni(d))||t==="script"&&r.querySelector(bi(d))||(t=r.createElement("link"),qt(t,"link",s),Lt(t),r.head.appendChild(t)))}}function My(s,t){gl.m(s,t);var a=pr;if(a&&s){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+wa(r)+'"][href="'+wa(s)+'"]',d=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=jr(s)}if(!Aa.has(d)&&(s=N({rel:"modulepreload",href:s},t),Aa.set(d,s),a.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(bi(d)))return}r=a.createElement("link"),qt(r,"link",s),Lt(r),a.head.appendChild(r)}}}function Ay(s,t,a){gl.S(s,t,a);var r=pr;if(r&&s){var o=$n(r).hoistableStyles,d=gr(s);t=t||"default";var j=o.get(d);if(!j){var _={loading:0,preload:null};if(j=r.querySelector(Ni(d)))_.loading=5;else{s=N({rel:"stylesheet",href:s,"data-precedence":t},a),(a=Aa.get(d))&&Yu(s,a);var R=j=r.createElement("link");Lt(R),qt(R,"link",s),R._p=new Promise(function(te,xe){R.onload=te,R.onerror=xe}),R.addEventListener("load",function(){_.loading|=1}),R.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Zc(j,t,r)}j={type:"stylesheet",instance:j,count:1,state:_},o.set(d,j)}}}function zy(s,t){gl.X(s,t);var a=pr;if(a&&s){var r=$n(a).hoistableScripts,o=jr(s),d=r.get(o);d||(d=a.querySelector(bi(o)),d||(s=N({src:s,async:!0},t),(t=Aa.get(o))&&Ju(s,t),d=a.createElement("script"),Lt(d),qt(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(o,d))}}function Dy(s,t){gl.M(s,t);var a=pr;if(a&&s){var r=$n(a).hoistableScripts,o=jr(s),d=r.get(o);d||(d=a.querySelector(bi(o)),d||(s=N({src:s,async:!0,type:"module"},t),(t=Aa.get(o))&&Ju(s,t),d=a.createElement("script"),Lt(d),qt(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(o,d))}}function wp(s,t,a,r){var o=(o=W.current)?Xc(o):null;if(!o)throw Error(c(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=gr(a.href),a=$n(o).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=gr(a.href);var d=$n(o).hoistableStyles,j=d.get(s);if(j||(o=o.ownerDocument||o,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(s,j),(d=o.querySelector(Ni(s)))&&!d._p&&(j.instance=d,j.state.loading=5),Aa.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},Aa.set(s,a),d||Oy(o,s,a,j.state))),t&&r===null)throw Error(c(528,""));return j}if(t&&r!==null)throw Error(c(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=jr(a),a=$n(o).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,s))}}function gr(s){return'href="'+wa(s)+'"'}function Ni(s){return'link[rel="stylesheet"]['+s+"]"}function _p(s){return N({},s,{"data-precedence":s.precedence,precedence:null})}function Oy(s,t,a,r){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=s.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),qt(t,"link",a),Lt(t),s.head.appendChild(t))}function jr(s){return'[src="'+wa(s)+'"]'}function bi(s){return"script[async]"+s}function Sp(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=s.querySelector('style[data-href~="'+wa(a.href)+'"]');if(r)return t.instance=r,Lt(r),r;var o=N({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(s.ownerDocument||s).createElement("style"),Lt(r),qt(r,"style",o),Zc(r,a.precedence,s),t.instance=r;case"stylesheet":o=gr(a.href);var d=s.querySelector(Ni(o));if(d)return t.state.loading|=4,t.instance=d,Lt(d),d;r=_p(a),(o=Aa.get(o))&&Yu(r,o),d=(s.ownerDocument||s).createElement("link"),Lt(d);var j=d;return j._p=new Promise(function(_,R){j.onload=_,j.onerror=R}),qt(d,"link",r),t.state.loading|=4,Zc(d,a.precedence,s),t.instance=d;case"script":return d=jr(a.src),(o=s.querySelector(bi(d)))?(t.instance=o,Lt(o),o):(r=a,(o=Aa.get(d))&&(r=N({},a),Ju(r,o)),s=s.ownerDocument||s,o=s.createElement("script"),Lt(o),qt(o,"link",r),s.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Zc(r,a.precedence,s));return t.instance}function Zc(s,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,d=o,j=0;j title"):null)}function Ry(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 Tp(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Ly(s,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=gr(r.href),d=t.querySelector(Ni(o));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=eo.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=d,Lt(d);return}d=t.ownerDocument||t,r=_p(r),(o=Aa.get(o))&&Yu(r,o),d=d.createElement("link"),Lt(d);var j=d;j._p=new Promise(function(_,R){j.onload=_,j.onerror=R}),qt(d,"link",r),a.instance=d}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=eo.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var Xu=0;function Uy(s,t){return s.stylesheets&&s.count===0&&to(s,s.stylesheets),0Xu?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function eo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)to(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var so=null;function to(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,so=new Map,t.forEach(By,s),so=null,eo.call(s))}function By(s,t){if(!(t.state.loading&4)){var a=so.get(s);if(a)var r=a.get(null);else{a=new Map,so.set(s,a);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(n){console.error(n)}}return l(),cm.exports=_1(),cm.exports}var C1=S1();function B(...l){return a0(l0(l))}const ze=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("rounded-xl border bg-card text-card-foreground shadow",l),...n}));ze.displayName="Card";const ts=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("flex flex-col space-y-1.5 p-6",l),...n}));ts.displayName="CardHeader";const ls=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("font-semibold leading-none tracking-tight",l),...n}));ls.displayName="CardTitle";const Vs=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("text-sm text-muted-foreground",l),...n}));Vs.displayName="CardDescription";const Ye=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("p-6 pt-0",l),...n}));Ye.displayName="CardContent";const Lo=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("flex items-center p-6 pt-0",l),...n}));Lo.displayName="CardFooter";const da=r0,Zt=m.forwardRef(({className:l,...n},i)=>e.jsx(Ng,{ref:i,className:B("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",l),...n}));Zt.displayName=Ng.displayName;const Xe=m.forwardRef(({className:l,...n},i)=>e.jsx(bg,{ref:i,className:B("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",l),...n}));Xe.displayName=bg.displayName;const ys=m.forwardRef(({className:l,...n},i)=>e.jsx(yg,{ref:i,className:B("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",l),...n}));ys.displayName=yg.displayName;const Je=m.forwardRef(({className:l,children:n,viewportRef:i,...c},u)=>e.jsxs(wg,{ref:u,className:B("relative overflow-hidden",l),...c,children:[e.jsx(i0,{ref:i,className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(Cm,{}),e.jsx(Cm,{orientation:"horizontal"}),e.jsx(c0,{})]}));Je.displayName=wg.displayName;const Cm=m.forwardRef(({className:l,orientation:n="vertical",...i},c)=>e.jsx(_g,{ref:c,orientation:n,className:B("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",l),...i,children:e.jsx(o0,{className:"relative flex-1 rounded-full bg-border"})}));Cm.displayName=_g.displayName;function Qs({className:l,...n}){return e.jsx("div",{className:B("animate-pulse rounded-md bg-primary/10",l),...n})}const Mn=m.forwardRef(({className:l,value:n,...i},c)=>e.jsx(Sg,{ref:c,className:B("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",l),...i,children:e.jsx(d0,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));Mn.displayName=Sg.displayName;async function we(l,n){const c=n?.body instanceof FormData?{...n?.headers}:{"Content-Type":"application/json",...n?.headers},u={...n,credentials:"include",headers:c},x=await fetch(l,u);if(x.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return x}function Os(){return{"Content-Type":"application/json"}}async function k1(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(l){console.error("登出请求失败:",l)}window.location.href="/auth"}async function Hi(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const T1={light:"",dark:".dark"},Uj=m.createContext(null);function Bj(){const l=m.useContext(Uj);if(!l)throw new Error("useChart must be used within a ");return l}const yr=m.forwardRef(({id:l,className:n,children:i,config:c,...u},x)=>{const h=m.useId(),f=`chart-${l||h.replace(/:/g,"")}`;return e.jsx(Uj.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:x,className:B("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",n),...u,children:[e.jsx(E1,{id:f,config:c}),e.jsx(P0,{children:i})]})})});yr.displayName="Chart";const E1=({id:l,config:n})=>{const i=Object.entries(n).filter(([,c])=>c.theme||c.color);return i.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(T1).map(([c,u])=>` -${u} [data-chart=${l}] { -${i.map(([x,h])=>{const f=h.theme?.[c]||h.color;return f?` --color-${x}: ${f};`:null}).join(` -`)} -} -`).join(` -`)}}):null},Ti=G0,wr=m.forwardRef(({active:l,payload:n,className:i,indicator:c="dot",hideLabel:u=!1,hideIndicator:x=!1,label:h,labelFormatter:f,labelClassName:p,formatter:g,color:v,nameKey:N,labelKey:y},w)=>{const{config:b}=Bj(),L=m.useMemo(()=>{if(u||!n?.length)return null;const[T]=n,F=`${y||T?.dataKey||T?.name||"value"}`,O=km(b,T,F),S=!y&&typeof h=="string"?b[h]?.label||h:O?.label;return f?e.jsx("div",{className:B("font-medium",p),children:f(S,n)}):S?e.jsx("div",{className:B("font-medium",p),children:S}):null},[h,f,n,u,p,b,y]);if(!l||!n?.length)return null;const D=n.length===1&&c!=="dot";return e.jsxs("div",{ref:w,className:B("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",i),children:[D?null:L,e.jsx("div",{className:"grid gap-1.5",children:n.filter(T=>T.type!=="none").map((T,F)=>{const O=`${N||T.name||T.dataKey||"value"}`,S=km(b,T,O),C=v||T.payload.fill||T.color;return e.jsx("div",{className:B("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",c==="dot"&&"items-center"),children:g&&T?.value!==void 0&&T.name?g(T.value,T.name,T,F,T.payload):e.jsxs(e.Fragment,{children:[S?.icon?e.jsx(S.icon,{}):!x&&e.jsx("div",{className:B("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":c==="dot","w-1":c==="line","w-0 border-[1.5px] border-dashed bg-transparent":c==="dashed","my-0.5":D&&c==="dashed"}),style:{"--color-bg":C,"--color-border":C}}),e.jsxs("div",{className:B("flex flex-1 justify-between leading-none",D?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[D?L:null,e.jsx("span",{className:"text-muted-foreground",children:S?.label||T.name})]}),T.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:T.value.toLocaleString()})]})]})},T.dataKey)})})]})});wr.displayName="ChartTooltip";const M1=q0,$j=m.forwardRef(({className:l,hideIcon:n=!1,payload:i,verticalAlign:c="bottom",nameKey:u},x)=>{const{config:h}=Bj();return i?.length?e.jsx("div",{ref:x,className:B("flex items-center justify-center gap-4",c==="top"?"pb-3":"pt-3",l),children:i.filter(f=>f.type!=="none").map(f=>{const p=`${u||f.dataKey||"value"}`,g=km(h,f,p);return e.jsxs("div",{className:B("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[g?.icon&&!n?e.jsx(g.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:f.color}}),g?.label]},f.value)})}):null});$j.displayName="ChartLegend";function km(l,n,i){if(typeof n!="object"||n===null)return;const c="payload"in n&&typeof n.payload=="object"&&n.payload!==null?n.payload:void 0;let u=i;return i in n&&typeof n[i]=="string"?u=n[i]:c&&i in c&&typeof c[i]=="string"&&(u=c[i]),u in l?l[u]:l[i]}const Mr=Ar("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),k=m.forwardRef(({className:l,variant:n,size:i,asChild:c=!1,...u},x)=>{const h=c?J0:"button";return e.jsx(h,{className:B(Mr({variant:n,size:i,className:l})),ref:x,...u})});k.displayName="Button";const A1=Ar("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 Te({className:l,variant:n,...i}){return e.jsx("div",{className:B(A1({variant:n}),l),...i})}async function z1(){const l=await we("/api/webui/system/restart",{method:"POST",headers:Os()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"重启失败")}return await l.json()}async function D1(){const l=await we("/api/webui/system/status",{method:"GET",headers:Os()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取状态失败")}return await l.json()}const Nr={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},Hj=m.createContext(null);function Dn({children:l,onRestartComplete:n,onRestartFailed:i,healthCheckUrl:c="/api/webui/system/status",maxAttempts:u=Nr.MAX_ATTEMPTS}){const[x,h]=m.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),[f,p]=m.useState({}),g=m.useCallback(()=>{f.progress&&clearInterval(f.progress),f.elapsed&&clearInterval(f.elapsed),f.check&&clearTimeout(f.check),p({})},[f]),v=m.useCallback(()=>{g(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u})},[g,u]),N=m.useCallback(async()=>{try{const D=new AbortController,T=setTimeout(()=>D.abort(),Nr.CHECK_TIMEOUT),F=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:D.signal});return clearTimeout(T),F.ok}catch{return!1}},[c]),y=m.useCallback(()=>{let D=0;const T=async()=>{if(D++,h(O=>({...O,status:"checking",checkAttempts:D})),await N())g(),h(O=>({...O,status:"success",progress:100})),setTimeout(()=>{n?.(),window.location.href="/auth"},Nr.SUCCESS_REDIRECT_DELAY);else if(D>=u){g();const O=`健康检查超时 (${D}/${u})`;h(S=>({...S,status:"failed",error:O})),i?.(O)}else{const O=setTimeout(T,Nr.CHECK_INTERVAL);p(S=>({...S,check:O}))}};T()},[N,g,u,n,i]),w=m.useCallback(()=>{h(D=>({...D,status:"checking",checkAttempts:0,error:void 0})),y()},[y]),b=m.useCallback(async D=>{const{delay:T=0,skipApiCall:F=!1}=D??{};if(x.status!=="idle"&&x.status!=="failed")return;if(g(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),T>0&&await new Promise(C=>setTimeout(C,T)),F)h(C=>({...C,status:"restarting"}));else try{h(C=>({...C,status:"restarting"})),await Promise.race([z1(),new Promise(C=>setTimeout(C,5e3))])}catch{}const O=setInterval(()=>{h(C=>({...C,progress:C.progress>=90?C.progress:C.progress+1}))},Nr.PROGRESS_INTERVAL),S=setInterval(()=>{h(C=>({...C,elapsedTime:C.elapsedTime+1}))},1e3);p({progress:O,elapsed:S}),setTimeout(()=>{y()},Nr.INITIAL_DELAY)},[x.status,g,u,y]),L={state:x,isRestarting:x.status!=="idle",triggerRestart:b,resetState:v,retryHealthCheck:w};return e.jsx(Hj.Provider,{value:L,children:l})}function sn(){const l=m.useContext(Hj);if(!l)throw new Error("useRestart must be used within a RestartProvider");return l}function O1(){try{return sn()}catch{return null}}const R1=(l,n,i,c,u)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Js,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"准备重启",description:u??"正在发送重启请求...",tip:"🔄 正在准备重启麦麦..."},restarting:{icon:e.jsx(Js,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"正在重启麦麦",description:u??"请稍候,麦麦正在重启中...",tip:"🔄 配置已保存,正在重启主程序..."},checking:{icon:e.jsx(Js,{className:"h-16 w-16 text-primary animate-spin"}),title:"检查服务状态",description:`等待服务恢复... (${n}/${i})`,tip:"⏳ 正在等待服务恢复,请勿关闭页面..."},success:{icon:e.jsx(oa,{className:"h-16 w-16 text-green-500"}),title:"重启成功",description:"正在跳转到登录页面...",tip:"✅ 配置已生效,服务运行正常"},failed:{icon:e.jsx(Dt,{className:"h-16 w-16 text-destructive"}),title:"重启超时",description:"服务未能在预期时间内恢复",tip:"⚠️ 如果长时间无响应,请尝试手动重启"}})[l];function On({visible:l,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x=!0,className:h}){const f=O1();return(f?f.isRestarting:l)?f?e.jsx(Ij,{state:f.state,onRetry:f.retryHealthCheck,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):e.jsx(L1,{onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):null}function Ij({state:l,onRetry:n,onComplete:i,onFailed:c,title:u,description:x,showAnimation:h,className:f}){const{status:p,progress:g,elapsedTime:v,checkAttempts:N,maxAttempts:y}=l;m.useEffect(()=>{p==="success"&&i?i():p==="failed"&&c&&c()},[p,i,c]);const w=R1(p,N,y,u,x),b=L=>{const D=Math.floor(L/60),T=L%60;return`${D}:${T.toString().padStart(2,"0")}`};return e.jsxs("div",{className:B("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(U1,{}),e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8 relative z-10",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsxs("div",{className:"relative",children:[w.icon,(p==="restarting"||p==="checking")&&e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/20 animate-ping"})]}),e.jsx("h2",{className:"text-2xl font-bold",children:w.title}),e.jsx("p",{className:"text-muted-foreground text-center",children:w.description})]}),p!=="failed"&&p!=="idle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Mn,{value:g,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[g,"%"]}),e.jsxs("span",{children:["已用时: ",b(v)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:w.tip})}),p==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(k,{onClick:()=>window.location.reload(),variant:"default",className:"flex-1",children:[e.jsx(zt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(k,{onClick:n,variant:"secondary",className:"flex-1",children:[e.jsx(Ui,{className:"mr-2 h-4 w-4"}),"重试检测"]})]})]})]})}function L1({onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x}){const[h,f]=m.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=m.useCallback(()=>{let g=0;const v=60,N=async()=>{g++,f(y=>({...y,status:"checking",checkAttempts:g}));try{if((await fetch("/api/webui/system/status",{method:"GET",signal:AbortSignal.timeout(3e3)})).ok){f(w=>({...w,status:"success",progress:100})),setTimeout(()=>{l?.(),window.location.href="/auth"},1500);return}}catch{}g>=v?(f(y=>({...y,status:"failed"})),n?.()):setTimeout(N,2e3)};N()},[l,n]);return m.useEffect(()=>{const g=setInterval(()=>{f(y=>({...y,progress:y.progress>=90?y.progress:y.progress+1}))},200),v=setInterval(()=>{f(y=>({...y,elapsedTime:y.elapsedTime+1}))},1e3),N=setTimeout(()=>{p()},3e3);return()=>{clearInterval(g),clearInterval(v),clearTimeout(N)}},[p]),e.jsx(Ij,{state:h,onRetry:p,onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x})}function U1(){return e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsxs("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px]",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite]"}),e.jsx("div",{className:"absolute inset-8 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_0.5s]"}),e.jsx("div",{className:"absolute inset-16 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_1s]"})]}),e.jsx("div",{className:"absolute top-1/4 left-1/4 w-2 h-2 bg-primary/20 rounded-full animate-bounce"}),e.jsx("div",{className:"absolute top-3/4 right-1/4 w-3 h-3 bg-primary/15 rounded-full animate-bounce delay-150"}),e.jsx("div",{className:"absolute top-1/2 right-1/3 w-2 h-2 bg-primary/20 rounded-full animate-bounce delay-300"})]})}function B1(){return e.jsx(Dn,{children:e.jsx(H1,{})})}const $1=l=>{const n=[];for(let i=0;i{try{w(!0);const U=await n0.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");N({hitokoto:U.data.hitokoto,from:U.data.from||U.data.from_who||"未知"})}catch(U){console.error("获取一言失败:",U),N({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{w(!1)}},[]),O=m.useCallback(async()=>{try{const U=await we("/api/webui/system/status");if(U.ok){const $=await U.json();L($)}else L(null)}catch(U){console.error("获取机器人状态失败:",U),L(null)}},[]),S=async()=>{await D()},C=m.useCallback(async()=>{try{const U=await we(`/api/webui/statistics/dashboard?hours=${h}`);if(U.ok){const $=await U.json();n($)}c(!1),x(100)}catch(U){console.error("Failed to fetch dashboard data:",U),c(!1),x(100)}},[h]);if(m.useEffect(()=>{if(!i)return;x(0);const U=setTimeout(()=>x(15),200),$=setTimeout(()=>x(30),800),_e=setTimeout(()=>x(45),2e3),Ne=setTimeout(()=>x(60),4e3),Se=setTimeout(()=>x(75),6500),V=setTimeout(()=>x(85),9e3),ye=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(U),clearTimeout($),clearTimeout(_e),clearTimeout(Ne),clearTimeout(Se),clearTimeout(V),clearTimeout(ye)}},[i]),m.useEffect(()=>{C(),F(),O()},[C,F,O]),m.useEffect(()=>{if(!p)return;const U=setInterval(()=>{C(),O()},3e4);return()=>clearInterval(U)},[p,C,O]),i||!l)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(zt,{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(Mn,{value:u,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u,"%"]})]})]})});const{summary:P,model_stats:M=[],hourly_data:Z=[],daily_data:G=[],recent_activity:ce=[]}=l,de=P??{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=U=>{const $=Math.floor(U/3600),_e=Math.floor(U%3600/60);return`${$}小时${_e}分钟`},me=U=>{const $=U.toLocaleString("zh-CN");return U>=1e9?{display:`${(U/1e9).toFixed(2)}B`,exact:$,needsExact:!0}:U>=1e6?{display:`${(U/1e6).toFixed(2)}M`,exact:$,needsExact:!0}:U>=1e4?{display:`${(U/1e3).toFixed(1)}K`,exact:$,needsExact:!0}:U>=1e3?{display:`${(U/1e3).toFixed(2)}K`,exact:$,needsExact:!0}:{display:$,exact:$,needsExact:!1}},pe=U=>{const $=`¥${U.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return U>=1e6?{display:`¥${(U/1e6).toFixed(2)}M`,exact:$,needsExact:!0}:U>=1e4?{display:`¥${(U/1e3).toFixed(1)}K`,exact:$,needsExact:!0}:U>=1e3?{display:`¥${(U/1e3).toFixed(2)}K`,exact:$,needsExact:!0}:{display:$,exact:$,needsExact:!1}},je=U=>new Date(U).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),A=$1(M.length),Y=M.map((U,$)=>({name:U.model_name,value:U.request_count,fill:A[$]})),H={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(da,{value:h.toString(),onValueChange:U=>f(Number(U)),children:e.jsxs(Zt,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(Xe,{value:"24",children:"24小时"}),e.jsx(Xe,{value:"168",children:"7天"}),e.jsx(Xe,{value:"720",children:"30天"})]})}),e.jsxs(k,{variant:p?"default":"outline",size:"sm",onClick:()=>g(!p),className:"gap-2",children:[e.jsx(zt,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:C,children:e.jsx(zt,{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(Qs,{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(k,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:F,disabled:y,children:e.jsx(zt,{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(ze,{className:"lg:col-span-1",children:[e.jsx(ts,{className:"pb-3",children:e.jsxs(ls,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Vi,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(Ye,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:b?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(Te,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(oa,{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(Te,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Dt,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),b&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",b.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",be(b.uptime)]})]})]})})]}),e.jsxs(ze,{children:[e.jsx(ts,{className:"pb-3",children:e.jsxs(ls,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Sn,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(Ye,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:S,disabled:T,className:"gap-2",children:[e.jsx(Ui,{className:`h-4 w-4 ${T?"animate-spin":""}`}),T?"重启中...":"重启麦麦"]}),e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(br,{to:"/logs",children:[e.jsx(Ha,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(br,{to:"/plugins",children:[e.jsx(vw,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(br,{to:"/settings",children:[e.jsx(zn,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(ze,{children:[e.jsxs(ts,{className:"pb-3",children:[e.jsxs(ls,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Nw,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(Vs,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(Ye,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(br,{to:"/survey/webui-feedback",children:[e.jsx(Ha,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(br,{to:"/survey/maibot-feedback",children:[e.jsx(Wl,{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(ze,{children:[e.jsxs(ts,{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(bw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ye,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[me(de.total_requests).display,me(de.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",me(de.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(ze,{children:[e.jsxs(ts,{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(yw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ye,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[pe(de.total_cost).display,pe(de.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",pe(de.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:de.cost_per_hour>0?`¥${de.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(ze,{children:[e.jsxs(ts,{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(Cr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ye,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[me(de.total_tokens).display,me(de.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",me(de.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:de.tokens_per_hour>0?`${me(de.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(ze,{children:[e.jsxs(ts,{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(Sn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ye,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[de.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(ze,{children:[e.jsxs(ts,{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(Nl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ye,{children:e.jsxs("div",{className:"text-xl font-bold",children:[be(de.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",de.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(ze,{children:[e.jsxs(ts,{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(Wl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ye,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[me(de.total_messages).display,me(de.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",me(de.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",me(de.total_replies).display,me(de.total_replies).needsExact&&e.jsxs("span",{children:["(",me(de.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(ze,{children:[e.jsxs(ts,{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(ww,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ye,{children:[e.jsx("div",{className:"text-xl font-bold",children:de.total_messages>0?`¥${(de.total_cost/de.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(da,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(Zt,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(Xe,{value:"trends",children:"趋势"}),e.jsx(Xe,{value:"models",children:"模型"}),e.jsx(Xe,{value:"activity",children:"活动"}),e.jsx(Xe,{value:"daily",children:"日统计"})]}),e.jsxs(ys,{value:"trends",className:"space-y-4",children:[e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"请求趋势"}),e.jsxs(Vs,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(Ye,{children:e.jsx(yr,{config:H,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(F0,{data:Z,children:[e.jsx(uo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(mo,{dataKey:"timestamp",tickFormatter:U=>je(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ci,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ti,{content:e.jsx(wr,{labelFormatter:U=>je(U)})}),e.jsx(V0,{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(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"花费趋势"}),e.jsx(Vs,{children:"API调用成本变化"})]}),e.jsx(Ye,{children:e.jsx(yr,{config:H,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(nm,{data:Z,children:[e.jsx(uo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(mo,{dataKey:"timestamp",tickFormatter:U=>je(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ci,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ti,{content:e.jsx(wr,{labelFormatter:U=>je(U)})}),e.jsx(xo,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"Token消耗"}),e.jsx(Vs,{children:"Token使用量变化"})]}),e.jsx(Ye,{children:e.jsx(yr,{config:H,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(nm,{data:Z,children:[e.jsx(uo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(mo,{dataKey:"timestamp",tickFormatter:U=>je(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ci,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ti,{content:e.jsx(wr,{labelFormatter:U=>je(U)})}),e.jsx(xo,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(ys,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"模型请求分布"}),e.jsxs(Vs,{children:["各模型使用占比 (共 ",M.length," 个模型)"]})]}),e.jsx(Ye,{children:e.jsx(yr,{config:Object.fromEntries(M.map((U,$)=>[U.model_name,{label:U.model_name,color:A[$]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(K0,{children:[e.jsx(Ti,{content:e.jsx(wr,{})}),e.jsx(Q0,{data:Y,cx:"50%",cy:"50%",labelLine:!1,label:({name:U,percent:$})=>$&&$<.05?"":`${U} ${$?($*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:Y.map((U,$)=>e.jsx(Y0,{fill:U.fill},`cell-${$}`))})]})})})]}),e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"模型详细统计"}),e.jsx(Vs,{children:"请求数、花费和性能"})]}),e.jsx(Ye,{children:e.jsx(Je,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:M.map((U,$)=>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:U.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${$%5+1}))`}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),e.jsx("span",{className:"ml-1 font-medium",children:U.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",U.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:[(U.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:[U.avg_response_time.toFixed(2),"s"]})]})]})]},$))})})})]})]})}),e.jsx(ys,{value:"activity",children:e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"最近活动"}),e.jsx(Vs,{children:"最新的API调用记录"})]}),e.jsx(Ye,{children:e.jsx(Je,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:ce.map((U,$)=>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:U.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:U.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:je(U.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:U.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",U.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[U.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${U.status==="success"?"text-green-600":"text-red-600"}`,children:U.status})]})]})]},$))})})})]})}),e.jsx(ys,{value:"daily",children:e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"每日统计"}),e.jsx(Vs,{children:"最近7天的数据汇总"})]}),e.jsx(Ye,{children:e.jsx(yr,{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(nm,{data:G,children:[e.jsx(uo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(mo,{dataKey:"timestamp",tickFormatter:U=>{const $=new Date(U);return`${$.getMonth()+1}/${$.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ci,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ci,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ti,{content:e.jsx(wr,{labelFormatter:U=>new Date(U).toLocaleDateString("zh-CN")})}),e.jsx(M1,{content:e.jsx($j,{})}),e.jsx(xo,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(xo,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(On,{})]})})}const I1={theme:"system",setTheme:()=>null},Pj=m.createContext(I1),Lm=()=>{const l=m.useContext(Pj);if(l===void 0)throw new Error("useTheme must be used within a ThemeProvider");return l},P1=(l,n,i)=>{const c=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||c){n(l);return}const u=i.clientX,x=i.clientY,h=Math.hypot(Math.max(u,innerWidth-u),Math.max(x,innerHeight-x));document.startViewTransition(()=>{n(l)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${u}px ${x}px)`,`circle(${h}px at ${u}px ${x}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Gj=m.createContext(void 0),qj=()=>{const l=m.useContext(Gj);if(l===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return l},Pe=m.forwardRef(({className:l,...n},i)=>e.jsx(Cg,{className:B("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",l),...n,ref:i,children:e.jsx(u0,{className:B("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Pe.displayName=Cg.displayName;const G1=Ar("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),E=m.forwardRef(({className:l,...n},i)=>e.jsx(Gg,{ref:i,className:B(G1(),l),...n}));E.displayName=Gg.displayName;const re=m.forwardRef(({className:l,type:n,...i},c)=>e.jsx("input",{type:n,className:B("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l),ref:c,...i}));re.displayName="Input";const q1=5,F1=5e3;let um=0;function V1(){return um=(um+1)%Number.MAX_SAFE_INTEGER,um.toString()}const mm=new Map,Xp=l=>{if(mm.has(l))return;const n=setTimeout(()=>{mm.delete(l),Ri({type:"REMOVE_TOAST",toastId:l})},F1);mm.set(l,n)},K1=(l,n)=>{switch(n.type){case"ADD_TOAST":return{...l,toasts:[n.toast,...l.toasts].slice(0,q1)};case"UPDATE_TOAST":return{...l,toasts:l.toasts.map(i=>i.id===n.toast.id?{...i,...n.toast}:i)};case"DISMISS_TOAST":{const{toastId:i}=n;return i?Xp(i):l.toasts.forEach(c=>{Xp(c.id)}),{...l,toasts:l.toasts.map(c=>c.id===i||i===void 0?{...c,open:!1}:c)}}case"REMOVE_TOAST":return n.toastId===void 0?{...l,toasts:[]}:{...l,toasts:l.toasts.filter(i=>i.id!==n.toastId)}}},bo=[];let yo={toasts:[]};function Ri(l){yo=K1(yo,l),bo.forEach(n=>{n(yo)})}function Ft({...l}){const n=V1(),i=u=>Ri({type:"UPDATE_TOAST",toast:{...u,id:n}}),c=()=>Ri({type:"DISMISS_TOAST",toastId:n});return Ri({type:"ADD_TOAST",toast:{...l,id:n,open:!0,onOpenChange:u=>{u||c()}}}),{id:n,dismiss:c,update:i}}function et(){const[l,n]=m.useState(yo);return m.useEffect(()=>(bo.push(n),()=>{const i=bo.indexOf(n);i>-1&&bo.splice(i,1)}),[l]),{...l,toast:Ft,dismiss:i=>Ri({type:"DISMISS_TOAST",toastId:i})}}const Q1=[{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 Y1(l){const n=Q1.map(c=>({id:c.id,label:c.label,description:c.description,passed:c.validate(l)}));return{isValid:n.every(c=>c.passed),rules:n}}const Uo="0.12.0",Um="MaiBot Dashboard",J1=`${Um} v${Uo}`,X1=(l="v")=>`${l}${Uo}`,ia={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"},Ja={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function pt(l){const n=Fj(l),i=localStorage.getItem(n);if(i===null)return Ja[l];const c=Ja[l];if(typeof c=="boolean")return i==="true";if(typeof c=="number"){const u=parseFloat(i);return isNaN(u)?c:u}return i}function _r(l,n){const i=Fj(l);localStorage.setItem(i,String(n)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:l,value:n}}))}function Z1(){return{theme:pt("theme"),accentColor:pt("accentColor"),enableAnimations:pt("enableAnimations"),enableWavesBackground:pt("enableWavesBackground"),logCacheSize:pt("logCacheSize"),logAutoScroll:pt("logAutoScroll"),logFontSize:pt("logFontSize"),logLineSpacing:pt("logLineSpacing"),dataSyncInterval:pt("dataSyncInterval"),wsReconnectInterval:pt("wsReconnectInterval"),wsMaxReconnectAttempts:pt("wsMaxReconnectAttempts")}}function W1(){const l=Z1(),n=localStorage.getItem(ia.COMPLETED_TOURS),i=n?JSON.parse(n):[];return{...l,completedTours:i}}function e2(l){const n=[],i=[];for(const[c,u]of Object.entries(l)){if(c==="completedTours"){Array.isArray(u)?(localStorage.setItem(ia.COMPLETED_TOURS,JSON.stringify(u)),n.push("completedTours")):i.push("completedTours");continue}if(c in Ja){const x=c,h=Ja[x];if(typeof u==typeof h){if(x==="theme"&&!["light","dark","system"].includes(u)){i.push(c);continue}if(x==="logFontSize"&&!["xs","sm","base"].includes(u)){i.push(c);continue}_r(x,u),n.push(c)}else i.push(c)}else i.push(c)}return{success:n.length>0,imported:n,skipped:i}}function s2(){for(const l of Object.keys(Ja))_r(l,Ja[l]);localStorage.removeItem(ia.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function t2(){const l=[],n=[],i=[];for(let c=0;cc.size-i.size),{used:l,items:localStorage.length,details:n}}function a2(l){if(l===0)return"0 B";const n=1024,i=["B","KB","MB"],c=Math.floor(Math.log(l)/Math.log(n));return parseFloat((l/Math.pow(n,c)).toFixed(2))+" "+i[c]}function Fj(l){return{theme:ia.THEME,accentColor:ia.ACCENT_COLOR,enableAnimations:ia.ENABLE_ANIMATIONS,enableWavesBackground:ia.ENABLE_WAVES_BACKGROUND,logCacheSize:ia.LOG_CACHE_SIZE,logAutoScroll:ia.LOG_AUTO_SCROLL,logFontSize:ia.LOG_FONT_SIZE,logLineSpacing:ia.LOG_LINE_SPACING,dataSyncInterval:ia.DATA_SYNC_INTERVAL,wsReconnectInterval:ia.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:ia.WS_MAX_RECONNECT_ATTEMPTS}[l]}const Na=m.forwardRef(({className:l,...n},i)=>e.jsxs(kg,{ref:i,className:B("relative flex w-full touch-none select-none items-center",l),...n,children:[e.jsx(m0,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(x0,{className:"absolute h-full bg-primary"})}),e.jsx(h0,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));Na.displayName=kg.displayName;class l2{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return pt("logCacheSize")}getMaxReconnectAttempts(){return pt("wsMaxReconnectAttempts")}getReconnectInterval(){return pt("wsReconnectInterval")}getWebSocketUrl(n){let i;{const c=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host;i=`${c}//${u}/ws/logs`}return n?`${i}?token=${encodeURIComponent(n)}`:i}async getWsToken(){try{const n=await we("/api/webui/ws-token",{method:"GET",credentials:"include"});if(!n.ok)return console.error("获取 WebSocket token 失败:",n.status),null;const i=await n.json();return i.success&&i.token?i.token:null}catch(n){return console.error("获取 WebSocket token 失败:",n),null}}async connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;if(window.location.pathname==="/auth"){console.log("📡 在登录页面,跳过 WebSocket 连接");return}if(!await Hi()){console.log("📡 未登录,跳过 WebSocket 连接");return}const i=await this.getWsToken();if(!i){console.log("📡 无法获取 WebSocket token,跳过连接");return}const c=this.getWebSocketUrl(i);try{this.ws=new WebSocket(c),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=u=>{try{if(u.data==="pong")return;const x=JSON.parse(u.data);this.notifyLog(x)}catch(x){console.error("解析日志消息失败:",x)}},this.ws.onerror=u=>{console.error("❌ WebSocket 错误:",u),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(u){console.error("创建 WebSocket 连接失败:",u),this.attemptReconnect()}}attemptReconnect(){const n=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=n)return;this.reconnectAttempts+=1;const i=this.getReconnectInterval(),c=Math.min(i*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(n){return this.logCallbacks.add(n),()=>this.logCallbacks.delete(n)}onConnectionChange(n){return this.connectionCallbacks.add(n),n(this.isConnected),()=>this.connectionCallbacks.delete(n)}notifyLog(n){if(!this.logCache.some(c=>c.id===n.id)){this.logCache.push(n);const c=this.getMaxCacheSize();this.logCache.length>c&&(this.logCache=this.logCache.slice(-c)),this.logCallbacks.forEach(u=>{try{u(n)}catch(x){console.error("日志回调执行失败:",x)}})}}notifyConnection(n){this.connectionCallbacks.forEach(i=>{try{i(n)}catch(c){console.error("连接状态回调执行失败:",c)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const wn=new l2;typeof window<"u"&&setTimeout(()=>{wn.connect()},100);const Is=W0,Bo=ew,n2=X0,Vj=m.forwardRef(({className:l,...n},i)=>e.jsx(qg,{ref:i,className:B("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",l),...n}));Vj.displayName=qg.displayName;const Rs=m.forwardRef(({className:l,children:n,preventOutsideClose:i=!1,...c},u)=>e.jsxs(n2,{children:[e.jsx(Vj,{}),e.jsxs(Fg,{ref:u,className:B("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",l),onPointerDownOutside:i?x=>x.preventDefault():void 0,onInteractOutside:i?x=>x.preventDefault():void 0,...c,children:[n,e.jsxs(Z0,{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(Da,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rs.displayName=Fg.displayName;const Ls=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col space-y-1.5 text-center sm:text-left",l),...n});Ls.displayName="DialogHeader";const rt=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});rt.displayName="DialogFooter";const Us=m.forwardRef(({className:l,...n},i)=>e.jsx(Vg,{ref:i,className:B("text-lg font-semibold leading-none tracking-tight",l),...n}));Us.displayName=Vg.displayName;const Zs=m.forwardRef(({className:l,...n},i)=>e.jsx(Kg,{ref:i,className:B("text-sm text-muted-foreground",l),...n}));Zs.displayName=Kg.displayName;const gs=p0,vt=g0,r2=f0,Kj=m.forwardRef(({className:l,...n},i)=>e.jsx(Tg,{className:B("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",l),...n,ref:i}));Kj.displayName=Tg.displayName;const ds=m.forwardRef(({className:l,...n},i)=>e.jsxs(r2,{children:[e.jsx(Kj,{}),e.jsx(Eg,{ref:i,className:B("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",l),...n})]}));ds.displayName=Eg.displayName;const us=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col space-y-2 text-center sm:text-left",l),...n});us.displayName="AlertDialogHeader";const ms=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});ms.displayName="AlertDialogFooter";const xs=m.forwardRef(({className:l,...n},i)=>e.jsx(Mg,{ref:i,className:B("text-lg font-semibold",l),...n}));xs.displayName=Mg.displayName;const hs=m.forwardRef(({className:l,...n},i)=>e.jsx(Ag,{ref:i,className:B("text-sm text-muted-foreground",l),...n}));hs.displayName=Ag.displayName;const fs=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(zg,{ref:c,className:B(Mr({variant:n}),l),...i}));fs.displayName=zg.displayName;const ps=m.forwardRef(({className:l,...n},i)=>e.jsx(Dg,{ref:i,className:B(Mr({variant:"outline"}),"mt-2 sm:mt-0",l),...n}));ps.displayName=Dg.displayName;function i2(){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(da,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(Zt,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Xe,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(_w,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(Xe,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Sw,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(Xe,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(zn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(Xe,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Jt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Je,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(ys,{value:"appearance",className:"mt-0",children:e.jsx(c2,{})}),e.jsx(ys,{value:"security",className:"mt-0",children:e.jsx(o2,{})}),e.jsx(ys,{value:"other",className:"mt-0",children:e.jsx(d2,{})}),e.jsx(ys,{value:"about",className:"mt-0",children:e.jsx(u2,{})})]})]})]})}function Wp(l){const n=document.documentElement,c={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[l];if(c)n.style.setProperty("--primary",c.hsl),c.gradient?(n.style.setProperty("--primary-gradient",c.gradient),n.classList.add("has-gradient")):(n.style.removeProperty("--primary-gradient"),n.classList.remove("has-gradient"));else if(l.startsWith("#")){const u=x=>{x=x.replace("#","");const h=parseInt(x.substring(0,2),16)/255,f=parseInt(x.substring(2,4),16)/255,p=parseInt(x.substring(4,6),16)/255,g=Math.max(h,f,p),v=Math.min(h,f,p);let N=0,y=0;const w=(g+v)/2;if(g!==v){const b=g-v;switch(y=w>.5?b/(2-g-v):b/(g+v),g){case h:N=((f-p)/b+(flocalStorage.getItem("accent-color")||"blue");m.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";Wp(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),Wp(g)};return e.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[e.jsx(xm,{value:"light",current:l,onChange:n,label:"浅色",description:"始终使用浅色主题"}),e.jsx(xm,{value:"dark",current:l,onChange:n,label:"深色",description:"始终使用深色主题"}),e.jsx(xm,{value:"system",current:l,onChange:n,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(za,{value:"blue",current:h,onChange:p,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(za,{value:"purple",current:h,onChange:p,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(za,{value:"green",current:h,onChange:p,label:"绿色",colorClass:"bg-green-500"}),e.jsx(za,{value:"orange",current:h,onChange:p,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(za,{value:"pink",current:h,onChange:p,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(za,{value:"red",current:h,onChange:p,label:"红色",colorClass:"bg-red-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(za,{value:"gradient-sunset",current:h,onChange:p,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(za,{value:"gradient-ocean",current:h,onChange:p,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(za,{value:"gradient-forest",current:h,onChange:p,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(za,{value:"gradient-aurora",current:h,onChange:p,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(za,{value:"gradient-fire",current:h,onChange:p,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(za,{value:"gradient-twilight",current:h,onChange:p,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:h.startsWith("#")?h:"#3b82f6",onChange:g=>p(g.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),e.jsx("div",{className:"flex-1",children:e.jsx(re,{type:"text",value:h,onChange:g=>p(g.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(E,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Pe,{id:"animations",checked:i,onCheckedChange:c})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(E,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Pe,{id:"waves-background",checked:u,onCheckedChange:x})]})})]})]})]})}function o2(){const l=ua(),[n,i]=m.useState(""),[c,u]=m.useState(""),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[g,v]=m.useState(!1),[N,y]=m.useState(!1),[w,b]=m.useState(!1),[L,D]=m.useState(!1),[T,F]=m.useState(""),[O,S]=m.useState(!1),{toast:C}=et(),P=m.useMemo(()=>Y1(c),[c]),M=async me=>{if(!n){C({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(me),b(!0),C({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{C({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},Z=async()=>{if(!c.trim()){C({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!P.isValid){const me=P.rules.filter(pe=>!pe.passed).map(pe=>pe.label).join(", ");C({title:"格式错误",description:`Token 不符合要求: ${me}`,variant:"destructive"});return}v(!0);try{const me=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),pe=await me.json();me.ok&&pe.success?(u(""),i(c.trim()),C({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{l({to:"/auth"})},1500)):C({title:"更新失败",description:pe.message||"无法更新 Token",variant:"destructive"})}catch(me){console.error("更新 Token 错误:",me),C({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{v(!1)}},G=async()=>{y(!0);try{const me=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),pe=await me.json();me.ok&&pe.success?(i(pe.token),F(pe.token),D(!0),S(!1),C({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):C({title:"生成失败",description:pe.message||"无法生成新 Token",variant:"destructive"})}catch(me){console.error("生成 Token 错误:",me),C({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},ce=async()=>{try{await navigator.clipboard.writeText(T),S(!0),C({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{C({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},de=()=>{D(!1),setTimeout(()=>{F(""),S(!1)},300),setTimeout(()=>{l({to:"/auth"})},500)},be=me=>{me||de()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Is,{open:L,onOpenChange:be,children:e.jsxs(Rs,{className:"sm:max-w-md",children:[e.jsxs(Ls,{children:[e.jsxs(Us,{className:"flex items-center gap-2",children:[e.jsx(Qt,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(Zs,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(E,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:T})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qt,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"重要提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),e.jsx("li",{children:"请立即复制并保存到安全的位置"}),e.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),e.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),e.jsxs(rt,{className:"gap-2 sm:gap-0",children:[e.jsx(k,{variant:"outline",onClick:ce,className:"gap-2",children:O?e.jsxs(e.Fragment,{children:[e.jsx(_t,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(_o,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(k,{onClick:de,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(re,{id:"current-token",type:x?"text":"password",value:n||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{n?h(!x):C({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(Bi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(k,{variant:"outline",size:"icon",onClick:()=>M(n),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!n,children:w?e.jsx(_t,{className:"h-4 w-4 text-green-500"}):e.jsx(_o,{className:"h-4 w-4"})}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsxs(k,{variant:"outline",disabled:N,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(zt,{className:B("h-4 w-4",N&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重新生成 Token"}),e.jsx(hs,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:G,children:"确认生成"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{id:"new-token",type:f?"text":"password",value:c,onChange:me=>u(me.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:f?"隐藏":"显示",children:f?e.jsx(Bi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"})})]}),c&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),e.jsx("div",{className:"space-y-1.5",children:P.rules.map(me=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[me.passed?e.jsx(oa,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(dj,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:B(me.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:me.label})]},me.id))}),P.isValid&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(k,{onClick:Z,disabled:g||!P.isValid||!c,className:"w-full sm:w-auto",children:g?"更新中...":"更新自定义 Token"})]})]}),e.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[e.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),e.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),e.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),e.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),e.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),e.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),e.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function d2(){const l=ua(),{toast:n}=et(),[i,c]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(()=>pt("logCacheSize")),[p,g]=m.useState(()=>pt("wsReconnectInterval")),[v,N]=m.useState(()=>pt("wsMaxReconnectAttempts")),[y,w]=m.useState(()=>pt("dataSyncInterval")),[b,L]=m.useState(()=>Zp()),[D,T]=m.useState(!1),[F,O]=m.useState(!1),S=m.useRef(null);if(u)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const C=()=>{L(Zp())},P=A=>{const Y=A[0];f(Y),_r("logCacheSize",Y)},M=A=>{const Y=A[0];g(Y),_r("wsReconnectInterval",Y)},Z=A=>{const Y=A[0];N(Y),_r("wsMaxReconnectAttempts",Y)},G=A=>{const Y=A[0];w(Y),_r("dataSyncInterval",Y)},ce=()=>{wn.clearLogs(),n({title:"日志已清除",description:"日志缓存已清空"})},de=()=>{const A=t2();C(),n({title:"缓存已清除",description:`已清除 ${A.clearedKeys.length} 项缓存数据`})},be=()=>{T(!0);try{const A=W1(),Y=JSON.stringify(A,null,2),H=new Blob([Y],{type:"application/json"}),U=URL.createObjectURL(H),$=document.createElement("a");$.href=U,$.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild($),$.click(),document.body.removeChild($),URL.revokeObjectURL(U),n({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(A){console.error("导出设置失败:",A),n({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{T(!1)}},me=A=>{const Y=A.target.files?.[0];if(!Y)return;O(!0);const H=new FileReader;H.onload=U=>{try{const $=U.target?.result,_e=JSON.parse($),Ne=e2(_e);Ne.success?(f(pt("logCacheSize")),g(pt("wsReconnectInterval")),N(pt("wsMaxReconnectAttempts")),w(pt("dataSyncInterval")),C(),n({title:"导入成功",description:`成功导入 ${Ne.imported.length} 项设置${Ne.skipped.length>0?`,跳过 ${Ne.skipped.length} 项`:""}`}),(Ne.imported.includes("theme")||Ne.imported.includes("accentColor"))&&n({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):n({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch($){console.error("导入设置失败:",$),n({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{O(!1),S.current&&(S.current.value="")}},H.readAsText(Y)},pe=()=>{s2(),f(Ja.logCacheSize),g(Ja.wsReconnectInterval),N(Ja.wsMaxReconnectAttempts),w(Ja.dataSyncInterval),C(),n({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},je=async()=>{c(!0);try{const A=await we("/api/webui/setup/reset",{method:"POST"}),Y=await A.json();A.ok&&Y.success?(n({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{l({to:"/setup"})},1e3)):n({title:"重置失败",description:Y.message||"无法重置配置状态",variant:"destructive"})}catch(A){console.error("重置配置状态错误:",A),n({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{c(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Cr,{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(Cw,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(k,{variant:"ghost",size:"sm",onClick:C,className:"h-7 px-2",children:e.jsx(zt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:a2(b.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[b.items," 个存储项"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(Na,{value:[h],onValueChange:P,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制日志查看器最多缓存的日志条数,较大的值会占用更多内存"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[y," 秒"]})]}),e.jsx(Na,{value:[y],onValueChange:G,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制首页统计数据的自动刷新间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[p/1e3," 秒"]})]}),e.jsx(Na,{value:[p],onValueChange:M,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"日志 WebSocket 连接断开后的重连基础间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[v," 次"]})]}),e.jsx(Na,{value:[v],onValueChange:Z,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"连接失败后的最大重连尝试次数"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:ce,className:"gap-2",children:[e.jsx(ns,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(ns,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认清除本地缓存"}),e.jsx(hs,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:de,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(Yt,{className:"h-5 w-5"}),"导入/导出设置"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"导出当前的界面设置以便备份,或从之前导出的文件中恢复设置。"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(k,{variant:"outline",onClick:be,disabled:D,className:"gap-2",children:[e.jsx(Yt,{className:"h-4 w-4"}),D?"导出中...":"导出设置"]}),e.jsx("input",{ref:S,type:"file",accept:".json",onChange:me,className:"hidden"}),e.jsxs(k,{variant:"outline",onClick:()=>S.current?.click(),disabled:F,className:"gap-2",children:[e.jsx($i,{className:"h-4 w-4"}),F?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(Ui,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重置所有设置"}),e.jsx(hs,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:pe,children:"确认重置"})]})]})]})})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsxs(k,{variant:"outline",disabled:i,className:"gap-2",children:[e.jsx(Ui,{className:B("h-4 w-4",i&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重新配置"}),e.jsx(hs,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:je,children:"确认重置"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Qt,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsxs(k,{variant:"destructive",className:"gap-2",children:[e.jsx(Qt,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认触发错误"}),e.jsx(hs,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function u2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:B("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",Um]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",Uo]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(Je,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(dt,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(dt,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(dt,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(dt,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(dt,{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(dt,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(dt,{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(dt,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(dt,{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(dt,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(dt,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(dt,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(dt,{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(dt,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(dt,{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(dt,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(dt,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(dt,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(dt,{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(dt,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(dt,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(dt,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(dt,{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 dt({name:l,description:n,license:i}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:l}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:n})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:i})]})}function xm({value:l,current:n,onChange:i,label:c,description:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:B("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:c}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:u})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[l==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),l==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),l==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function za({value:l,current:n,onChange:i,label:c,colorClass:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:B("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:B("h-8 w-8 sm:h-10 sm:w-10 rounded-full",u)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:c})]})]})}const m2=Date.now()%1e6;class x2{grad3;p;perm;constructor(n=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let i=0;i<256;i++)this.p[i]=Math.floor(Math.random()*256);this.perm=[];for(let i=0;i<512;i++)this.perm[i]=this.p[i&255]}dot(n,i,c){return n[0]*i+n[1]*c}mix(n,i,c){return(1-c)*n+c*i}fade(n){return n*n*n*(n*(n*6-15)+10)}perlin2(n,i){const c=Math.floor(n)&255,u=Math.floor(i)&255;n-=Math.floor(n),i-=Math.floor(i);const x=this.fade(n),h=this.fade(i),f=this.perm[c]+u,p=this.perm[f],g=this.perm[f+1],v=this.perm[c+1]+u,N=this.perm[v],y=this.perm[v+1];return this.mix(this.mix(this.dot(this.grad3[p%12],n,i),this.dot(this.grad3[N%12],n-1,i),x),this.mix(this.dot(this.grad3[g%12],n,i-1),this.dot(this.grad3[y%12],n-1,i-1),x),h)}}function eg(){const l=m.useRef(null),n=m.useRef(null),i=m.useRef(void 0),[c]=m.useState(()=>new x2(m2)),u=m.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:c,bounding:null});return m.useEffect(()=>{const x=n.current,h=l.current;if(!x||!h)return;const f=u.current;f.noise=c;const p=()=>{const D=x.getBoundingClientRect();f.bounding=D,h.style.width=`${D.width}px`,h.style.height=`${D.height}px`},g=()=>{if(!f.bounding)return;const{width:D,height:T}=f.bounding;f.lines=[],f.paths.forEach(ce=>ce.remove()),f.paths=[];const F=10,O=32,S=D+200,C=T+30,P=Math.ceil(S/F),M=Math.ceil(C/O),Z=(D-F*P)/2,G=(T-O*M)/2;for(let ce=0;ce<=P;ce++){const de=[];for(let me=0;me<=M;me++){const pe={x:Z+F*ce,y:G+O*me,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};de.push(pe)}const be=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(be),f.paths.push(be),f.lines.push(de)}},v=D=>{const{lines:T,mouse:F,noise:O}=f;T.forEach(S=>{S.forEach(C=>{const P=O.perlin2((C.x+D*.0125)*.002,(C.y+D*.005)*.0015)*12;C.wave.x=Math.cos(P)*32,C.wave.y=Math.sin(P)*16;const M=C.x-F.sx,Z=C.y-F.sy,G=Math.hypot(M,Z),ce=Math.max(175,F.vs);if(G{const F={x:D.x+D.wave.x+(T?D.cursor.x:0),y:D.y+D.wave.y+(T?D.cursor.y:0)};return F.x=Math.round(F.x*10)/10,F.y=Math.round(F.y*10)/10,F},y=()=>{const{lines:D,paths:T}=f;D.forEach((F,O)=>{let S=N(F[0],!1),C=`M ${S.x} ${S.y}`;F.forEach((P,M)=>{const Z=M===F.length-1;S=N(P,!Z),C+=`L ${S.x} ${S.y}`}),T[O].setAttribute("d",C)})},w=D=>{const{mouse:T}=f;T.sx+=(T.x-T.sx)*.1,T.sy+=(T.y-T.sy)*.1;const F=T.x-T.lx,O=T.y-T.ly,S=Math.hypot(F,O);T.v=S,T.vs+=(S-T.vs)*.1,T.vs=Math.min(100,T.vs),T.lx=T.x,T.ly=T.y,T.a=Math.atan2(O,F),x&&(x.style.setProperty("--x",`${T.sx}px`),x.style.setProperty("--y",`${T.sy}px`)),v(D),y(),i.current=requestAnimationFrame(w)},b=D=>{if(!f.bounding)return;const{mouse:T}=f;T.x=D.pageX-f.bounding.left,T.y=D.pageY-f.bounding.top+window.scrollY,T.set||(T.sx=T.x,T.sy=T.y,T.lx=T.x,T.ly=T.y,T.set=!0)},L=()=>{p(),g()};return p(),g(),window.addEventListener("resize",L),window.addEventListener("mousemove",b),i.current=requestAnimationFrame(w),()=>{window.removeEventListener("resize",L),window.removeEventListener("mousemove",b),i.current&&cancelAnimationFrame(i.current)}},[c]),e.jsxs("div",{ref:n,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:l,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` - path { - fill: none; - stroke: hsl(var(--primary) / 0.20); - stroke-width: 1px; - } - `})})]})}function h2(){const[l,n]=m.useState(""),[i,c]=m.useState(!1),[u,x]=m.useState(""),[h,f]=m.useState(!0),p=ua(),{enableWavesBackground:g,setEnableWavesBackground:v}=qj(),{theme:N,setTheme:y}=Lm();m.useEffect(()=>{(async()=>{try{await Hi()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const b=N==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":N,L=()=>{y(b==="dark"?"light":"dark")},D=async T=>{if(T.preventDefault(),x(""),!l.trim()){x("请输入 Access Token");return}c(!0),console.log("开始验证 token...");try{const F=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:l.trim()})});console.log("Token 验证响应状态:",F.status);const O=await F.json();if(console.log("Token 验证响应数据:",O),F.ok&&O.valid){console.log("Token 验证成功,准备跳转..."),console.log("is_first_setup:",O.is_first_setup),await new Promise(C=>setTimeout(C,100));const S=await Hi();console.log("跳转前认证状态检查:",S),O.is_first_setup?(console.log("跳转到首次配置页面"),p({to:"/setup"})):(console.log("跳转到首页"),p({to:"/"}))}else console.error("Token 验证失败:",O.message),x(O.message||"Token 验证失败,请检查后重试")}catch(F){console.error("Token 验证错误:",F),x("连接服务器失败,请检查网络连接")}finally{c(!1)}};return h?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(eg,{}),e.jsx("div",{className:"text-muted-foreground",children:"正在检查登录状态..."})]}):e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(eg,{}),e.jsxs(ze,{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:b==="dark"?"切换到浅色模式":"切换到深色模式",children:b==="dark"?e.jsx(uj,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(mj,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(ts,{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(Pp,{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(Vs,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(Ye,{children:e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(Am,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(re,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:l,onChange:T=>n(T.target.value),className:B("pl-10",u&&"border-red-500 focus-visible:ring-red-500"),disabled:i,autoFocus:!0,autoComplete:"off"})]})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(Dt,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:u})]}),e.jsx(k,{type:"submit",className:"w-full",disabled:i,children:i?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),e.jsxs(Is,{children:[e.jsx(Bo,{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(xj,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Rs,{className:"sm:max-w-md",children:[e.jsxs(Ls,{children:[e.jsxs(Us,{className:"flex items-center gap-2",children:[e.jsx(Pp,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(Zs,{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(kw,{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(Ha,{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(Dt,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"安全提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),e.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),e.jsxs(gs,{children:[e.jsx(vt,{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(Sn,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsxs(xs,{className:"flex items-center gap-2",children:[e.jsx(Sn,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(hs,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>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:J1})})]})}const Ys=m.forwardRef(({className:l,...n},i)=>e.jsx("textarea",{className:B("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l),ref:i,...n}));Ys.displayName="Textarea";const Or=m.forwardRef(({className:l,orientation:n="horizontal",decorative:i=!0,...c},u)=>e.jsx(Og,{ref:u,decorative:i,orientation:n,className:B("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",l),...c}));Or.displayName=Og.displayName;function f2({config:l,onChange:n}){const i=u=>{u.trim()&&!l.alias_names.includes(u.trim())&&n({...l,alias_names:[...l.alias_names,u.trim()]})},c=u=>{n({...l,alias_names:l.alias_names.filter((x,h)=>h!==u)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(re,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:l.qq_account||"",onChange:u=>n({...l,qq_account:Number(u.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(re,{id:"nickname",placeholder:"请输入机器人的昵称",value:l.nickname,onChange:u=>n({...l,nickname:u.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:l.alias_names.map((u,x)=>e.jsxs(Te,{variant:"secondary",className:"gap-1",children:[u,e.jsx("button",{type:"button",onClick:()=>c(x),className:"ml-1 hover:text-destructive",children:e.jsx(Da,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:u=>{u.key==="Enter"&&(i(u.target.value),u.target.value="")}}),e.jsx(k,{type:"button",variant:"outline",onClick:()=>{const u=document.getElementById("alias_input");u&&(i(u.value),u.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function p2({config:l,onChange:n}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(Ys,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:l.personality,onChange:i=>n({...l,personality:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(Ys,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:l.reply_style,onChange:i=>n({...l,reply_style:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(Ys,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:l.interest,onChange:i=>n({...l,interest:i.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(Or,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(Ys,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:l.plan_style,onChange:i=>n({...l,plan_style:i.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(Ys,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:l.private_plan_style,onChange:i=>n({...l,private_plan_style:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function g2({config:l,onChange:n}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(l.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(re,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:l.emoji_chance,onChange:i=>n({...l,emoji_chance:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(re,{id:"max_reg_num",type:"number",min:"1",max:"200",value:l.max_reg_num,onChange:i=>n({...l,max_reg_num:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Pe,{id:"do_replace",checked:l.do_replace,onCheckedChange:i=>n({...l,do_replace:i})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(re,{id:"check_interval",type:"number",min:"1",max:"120",value:l.check_interval,onChange:i=>n({...l,check_interval:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(Or,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Pe,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:i=>n({...l,steal_emoji:i})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Pe,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:i=>n({...l,content_filtration:i})})]}),l.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(re,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:l.filtration_prompt,onChange:i=>n({...l,filtration_prompt:i.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function j2({config:l,onChange:n}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Pe,{id:"enable_tool",checked:l.enable_tool,onCheckedChange:i=>n({...l,enable_tool:i})})]}),e.jsx(Or,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Pe,{id:"all_global",checked:l.all_global,onCheckedChange:i=>n({...l,all_global:i})})]})]})}function v2({config:l,onChange:n}){const[i,c]=m.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(vo,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{id:"siliconflow_api_key",type:i?"text":"password",placeholder:"sk-...",value:l.api_key,onChange:u=>n({api_key:u.target.value}),className:"font-mono pr-10"}),e.jsx(k,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>c(!i),children:i?e.jsx(Bi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Xt,{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 N2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Os()});if(!l.ok)throw new Error("读取Bot配置失败");const i=(await l.json()).config.bot||{};return{qq_account:i.qq_account||0,nickname:i.nickname||"",alias_names:i.alias_names||[]}}async function b2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Os()});if(!l.ok)throw new Error("读取人格配置失败");const i=(await l.json()).config.personality||{};return{personality:i.personality||"",reply_style:i.reply_style||"",interest:i.interest||"",plan_style:i.plan_style||"",private_plan_style:i.private_plan_style||""}}async function y2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Os()});if(!l.ok)throw new Error("读取表情包配置失败");const i=(await l.json()).config.emoji||{};return{emoji_chance:i.emoji_chance??.4,max_reg_num:i.max_reg_num??40,do_replace:i.do_replace??!0,check_interval:i.check_interval??10,steal_emoji:i.steal_emoji??!0,content_filtration:i.content_filtration??!1,filtration_prompt:i.filtration_prompt||""}}async function w2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Os()});if(!l.ok)throw new Error("读取其他配置失败");const i=(await l.json()).config,c=i.tool||{},u=i.expression||{};return{enable_tool:c.enable_tool??!0,all_global:u.all_global_jargon??!0}}async function _2(){const l=await we("/api/webui/config/model",{method:"GET",headers:Os()});if(!l.ok)throw new Error("读取模型配置失败");return{api_key:((await l.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function S2(l){const n=await we("/api/webui/config/bot/section/bot",{method:"POST",headers:Os(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存Bot基础配置失败")}return await n.json()}async function C2(l){const n=await we("/api/webui/config/bot/section/personality",{method:"POST",headers:Os(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存人格配置失败")}return await n.json()}async function k2(l){const n=await we("/api/webui/config/bot/section/emoji",{method:"POST",headers:Os(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存表情包配置失败")}return await n.json()}async function T2(l){const n=[];n.push(we("/api/webui/config/bot/section/tool",{method:"POST",headers:Os(),body:JSON.stringify({enable_tool:l.enable_tool})})),n.push(we("/api/webui/config/bot/section/expression",{method:"POST",headers:Os(),body:JSON.stringify({all_global_jargon:l.all_global})}));const i=await Promise.all(n);for(const c of i)if(!c.ok){const u=await c.json();throw new Error(u.detail||"保存其他配置失败")}return{success:!0}}async function E2(l){const n=await we("/api/webui/config/model",{method:"GET",headers:Os()});if(!n.ok)throw new Error("读取模型配置失败");const c=(await n.json()).config,u=c.api_providers||[],x=u.findIndex(p=>p.name==="SiliconFlow");x>=0?u[x]={...u[x],api_key:l.api_key}:u.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:l.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...c,api_providers:u},f=await we("/api/webui/config/model",{method:"POST",headers:Os(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"保存模型配置失败")}return await f.json()}async function sg(){const l=await we("/api/webui/setup/complete",{method:"POST"});if(!l.ok){const n=await l.json();throw new Error(n.message||"标记配置完成失败")}return await l.json()}function M2(){return e.jsx(Dn,{children:e.jsx(A2,{})})}function A2(){const l=ua(),{toast:n}=et(),{triggerRestart:i}=sn(),[c,u]=m.useState(0),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[g,v]=m.useState(!0),[N,y]=m.useState({qq_account:0,nickname:"",alias_names:[]}),[w,b]=m.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.请控制你的发言频率,不要太过频繁的发言 -4.如果有人对你感到厌烦,请减少回复 -5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[L,D]=m.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[T,F]=m.useState({enable_tool:!0,all_global:!0}),[O,S]=m.useState({api_key:""}),C=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Mi},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:kr},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:zm},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:zn},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:Am}],P=(c+1)/C.length*100;m.useEffect(()=>{(async()=>{try{v(!0);const[pe,je,A,Y,H]=await Promise.all([N2(),b2(),y2(),w2(),_2()]);y(pe),b(je),D(A),F(Y),S(H)}catch(pe){n({title:"加载配置失败",description:pe instanceof Error?pe.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{v(!1)}})()},[n]);const M=async()=>{p(!0);try{switch(c){case 0:await S2(N);break;case 1:await C2(w);break;case 2:await k2(L);break;case 3:await T2(T);break;case 4:await E2(O);break}return n({title:"保存成功",description:`${C[c].title}配置已保存`}),!0}catch(me){return n({title:"保存失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},Z=async()=>{await M()&&c{c>0&&u(c-1)},ce=async()=>{h(!0);try{if(!await M()){h(!1);return}await sg(),n({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),await i()}catch(me){n({title:"配置失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}finally{h(!1)}},de=async()=>{try{await sg(),l({to:"/"})}catch(me){n({title:"跳过失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},be=()=>{switch(c){case 0:return e.jsx(f2,{config:N,onChange:y});case 1:return e.jsx(p2,{config:w,onChange:b});case 2:return e.jsx(g2,{config:L,onChange:D});case 3:return e.jsx(j2,{config:T,onChange:F});case 4:return e.jsx(v2,{config:O,onChange:S});default:return null}};return e.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[e.jsx(On,{}),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(Tw,{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:["让我们一起完成 ",Um," 的初始配置"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",c+1," / ",C.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(P),"%"]})]}),e.jsx(Mn,{value:P,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:C.map((me,pe)=>{const je=me.icon;return e.jsxs("div",{className:B("flex flex-1 flex-col items-center gap-1 md:gap-2",pel({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Ro,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(k,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(en,{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 z2=Ts.memo(function({config:n,onChange:i}){const c=()=>{i({...n,platforms:[...n.platforms,""]})},u=g=>{i({...n,platforms:n.platforms.filter((v,N)=>N!==g)})},x=(g,v)=>{const N=[...n.platforms];N[g]=v,i({...n,platforms:N})},h=()=>{i({...n,alias_names:[...n.alias_names,""]})},f=g=>{i({...n,alias_names:n.alias_names.filter((v,N)=>N!==g)})},p=(g,v)=>{const N=[...n.alias_names];N[g]=v,i({...n,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(E,{htmlFor:"platform",children:"平台"}),e.jsx(re,{id:"platform",value:n.platform,onChange:g=>i({...n,platform:g.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(re,{id:"qq_account",value:n.qq_account,onChange:g=>i({...n,qq_account:g.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"nickname",children:"昵称"}),e.jsx(re,{id:"nickname",value:n.nickname,onChange:g=>i({...n,nickname:g.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{children:"其他平台账号"}),e.jsxs(k,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[n.platforms.map((g,v)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:g,onChange:N=>x(v,N.target.value),placeholder:"wx:114514"}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除平台账号 "',g||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(v),children:"删除"})]})]})]})]},v)),n.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(E,{children:"别名"}),e.jsxs(k,{onClick:h,size:"sm",variant:"outline",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[n.alias_names.map((g,v)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:g,onChange:N=>p(v,N.target.value),placeholder:"小麦"}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除别名 "',g||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>f(v),children:"删除"})]})]})]})]},v)),n.alias_names.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}),D2=Ts.memo(function({config:n,onChange:i}){const c=()=>{i({...n,states:[...n.states,""]})},u=h=>{i({...n,states:n.states.filter((f,p)=>p!==h)})},x=(h,f)=>{const p=[...n.states];p[h]=f,i({...n,states:p})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"personality",children:"人格特质"}),e.jsx(Ys,{id:"personality",value:n.personality,onChange:h=>i({...n,personality:h.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(Ys,{id:"reply_style",value:n.reply_style,onChange:h=>i({...n,reply_style:h.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"interest",children:"兴趣"}),e.jsx(Ys,{id:"interest",value:n.interest,onChange:h=>i({...n,interest:h.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(Ys,{id:"plan_style",value:n.plan_style,onChange:h=>i({...n,plan_style:h.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(Ys,{id:"visual_style",value:n.visual_style,onChange:h=>i({...n,visual_style:h.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(Ys,{id:"private_plan_style",value:n.private_plan_style,onChange:h=>i({...n,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{children:"状态列表(人格多样性)"}),e.jsxs(k,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),e.jsx("div",{className:"space-y-2",children:n.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ys,{value:h,onChange:p=>x(f,p.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsx(hs,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(f),children:"删除"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"state_probability",children:"状态替换概率"}),e.jsx(re,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:n.state_probability,onChange:h=>i({...n,state_probability:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}),Le=rw,Ue=iw,Oe=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(Qg,{ref:c,className:B("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",l),...i,children:[n,e.jsx(sw,{asChild:!0,children:e.jsx(Oa,{className:"h-4 w-4 opacity-50"})})]}));Oe.displayName=Qg.displayName;const Yj=m.forwardRef(({className:l,...n},i)=>e.jsx(Yg,{ref:i,className:B("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Tr,{className:"h-4 w-4"})}));Yj.displayName=Yg.displayName;const Jj=m.forwardRef(({className:l,...n},i)=>e.jsx(Jg,{ref:i,className:B("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Oa,{className:"h-4 w-4"})}));Jj.displayName=Jg.displayName;const Re=m.forwardRef(({className:l,children:n,position:i="popper",...c},u)=>e.jsx(tw,{children:e.jsxs(Xg,{ref:u,className:B("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",i==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",l),position:i,...c,children:[e.jsx(Yj,{}),e.jsx(aw,{className:B("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(Jj,{})]})}));Re.displayName=Xg.displayName;const O2=m.forwardRef(({className:l,...n},i)=>e.jsx(Zg,{ref:i,className:B("px-2 py-1.5 text-sm font-semibold",l),...n}));O2.displayName=Zg.displayName;const le=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(Wg,{ref:c,className:B("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),...i,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(lw,{children:e.jsx(_t,{className:"h-4 w-4"})})}),e.jsx(nw,{children:n})]}));le.displayName=Wg.displayName;const R2=m.forwardRef(({className:l,...n},i)=>e.jsx(ej,{ref:i,className:B("-mx-1 my-1 h-px bg-muted",l),...n}));R2.displayName=ej.displayName;const Xa=v0,Za=N0,Ia=m.forwardRef(({className:l,align:n="center",sideOffset:i=4,...c},u)=>e.jsx(j0,{children:e.jsx(Rg,{ref:u,align:n,sideOffset:i,className:B("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",l),...c})}));Ia.displayName=Rg.displayName;const L2=Ts.memo(function({value:n,onChange:i}){const c=m.useMemo(()=>{const w=n.split("-");if(w.length===2){const[b,L]=w,[D,T]=b.split(":"),[F,O]=L.split(":");return{startHour:D?D.padStart(2,"0"):"00",startMinute:T?T.padStart(2,"0"):"00",endHour:F?F.padStart(2,"0"):"23",endMinute:O?O.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[n]),[u,x]=m.useState(c.startHour),[h,f]=m.useState(c.startMinute),[p,g]=m.useState(c.endHour),[v,N]=m.useState(c.endMinute);m.useEffect(()=>{x(c.startHour),f(c.startMinute),g(c.endHour),N(c.endMinute)},[c]);const y=(w,b,L,D)=>{const T=`${w}:${b}-${L}:${D}`;i(T)};return e.jsxs(Xa,{children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(Nl,{className:"h-4 w-4 mr-2"}),n||"选择时间段"]})}),e.jsx(Ia,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-xs",children:"小时"}),e.jsxs(Le,{value:u,onValueChange:w=>{x(w),y(w,h,p,v)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsx(Re,{children:Array.from({length:24},(w,b)=>b).map(w=>e.jsx(le,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-xs",children:"分钟"}),e.jsxs(Le,{value:h,onValueChange:w=>{f(w),y(u,w,p,v)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsx(Re,{children:Array.from({length:60},(w,b)=>b).map(w=>e.jsx(le,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-xs",children:"小时"}),e.jsxs(Le,{value:p,onValueChange:w=>{g(w),y(u,h,w,v)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsx(Re,{children:Array.from({length:24},(w,b)=>b).map(w=>e.jsx(le,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-xs",children:"分钟"}),e.jsxs(Le,{value:v,onValueChange:w=>{N(w),y(u,h,p,w)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsx(Re,{children:Array.from({length:60},(w,b)=>b).map(w=>e.jsx(le,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]})]})})]})}),U2=Ts.memo(function({rule:n}){const i=`{ target = "${n.target}", time = "${n.time}", value = ${n.value.toFixed(1)} }`;return e.jsxs(Xa,{children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx(Xt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ia,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:i}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),B2=Ts.memo(function({config:n,onChange:i}){const c=()=>{i({...n,talk_value_rules:[...n.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},u=h=>{i({...n,talk_value_rules:n.talk_value_rules.filter((f,p)=>p!==h)})},x=(h,f,p)=>{const g=[...n.talk_value_rules];g[h]={...g[h],[f]:p},i({...n,talk_value_rules:g})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(re,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:n.talk_value,onChange:h=>i({...n,talk_value:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"mentioned_bot_reply",checked:n.mentioned_bot_reply,onCheckedChange:h=>i({...n,mentioned_bot_reply:h})}),e.jsx(E,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(re,{id:"max_context_size",type:"number",min:"1",value:n.max_context_size,onChange:h=>i({...n,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(re,{id:"planner_smooth",type:"number",step:"1",min:"0",value:n.planner_smooth,onChange:h=>i({...n,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"enable_talk_value_rules",checked:n.enable_talk_value_rules,onCheckedChange:h=>i({...n,enable_talk_value_rules:h})}),e.jsx(E,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"include_planner_reasoning",checked:n.include_planner_reasoning,onCheckedChange:h=>i({...n,include_planner_reasoning:h})}),e.jsx(E,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),n.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),e.jsxs(k,{onClick:c,size:"sm",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),n.talk_value_rules&&n.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:n.talk_value_rules.map((h,f)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",f+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U2,{rule:h}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{variant:"ghost",size:"sm",children:e.jsx(ns,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除规则 #",f+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(f),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Le,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?x(f,"target",""):x(f,"target","qq::group")},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"global",children:"全局配置"}),e.jsx(le,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),g=p[0]||"qq",v=p[1]||"",N=p[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Le,{value:g,onValueChange:y=>{x(f,"target",`${y}:${v}:${N}`)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(re,{value:v,onChange:y=>{x(f,"target",`${g}:${y.target.value}:${N}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Le,{value:N,onValueChange:y=>{x(f,"target",`${g}:${v}:${y}`)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"group",children:"群组(group)"}),e.jsx(le,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",h.target||"(未设置)"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(L2,{value:h.time,onChange:p=>x(f,"time",p)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{htmlFor:`rule-value-${f}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(re,{id:`rule-value-${f}`,type:"number",step:"0.01",min:"0.01",max:"1",value:h.value,onChange:p=>{const g=parseFloat(p.target.value);isNaN(g)||x(f,"value",Math.max(.01,Math.min(1,g)))},className:"w-20 h-8 text-xs"})]}),e.jsx(Na,{value:[h.value],onValueChange:p=>x(f,"value",p[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (极少发言)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (正常)"})]})]})]})]},f))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}),$2=Ts.memo(function({config:n,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{checked:n.enable_asr,onCheckedChange:c=>i({...n,enable_asr:c})}),e.jsx(E,{className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}),H2=Ts.memo(function({config:n,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{checked:n.enable,onCheckedChange:c=>i({...n,enable:c})}),e.jsx(E,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),n.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"LPMM 模式"}),e.jsxs(Le,{value:n.lpmm_mode,onValueChange:c=>i({...n,lpmm_mode:c}),children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"classic",children:"经典模式"}),e.jsx(le,{value:"agent",children:"Agent 模式"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"同义词搜索 TopK"}),e.jsx(re,{type:"number",min:"1",value:n.rag_synonym_search_top_k,onChange:c=>i({...n,rag_synonym_search_top_k:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"同义词阈值"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"1",value:n.rag_synonym_threshold,onChange:c=>i({...n,rag_synonym_threshold:parseFloat(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"实体提取线程数"}),e.jsx(re,{type:"number",min:"1",value:n.info_extraction_workers,onChange:c=>i({...n,info_extraction_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"嵌入向量维度"}),e.jsx(re,{type:"number",min:"1",value:n.embedding_dimension,onChange:c=>i({...n,embedding_dimension:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"嵌入并发线程数"}),e.jsx(re,{type:"number",min:"1",value:n.max_embedding_workers,onChange:c=>i({...n,max_embedding_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"每批嵌入条数"}),e.jsx(re,{type:"number",min:"1",value:n.embedding_chunk_size,onChange:c=>i({...n,embedding_chunk_size:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"同义实体数上限"}),e.jsx(re,{type:"number",min:"1",value:n.max_synonym_entities,onChange:c=>i({...n,max_synonym_entities:parseInt(c.target.value)})})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{checked:n.enable_ppr,onCheckedChange:c=>i({...n,enable_ppr:c})}),e.jsx(E,{className:"cursor-pointer",children:"启用 PPR (低配机器可关闭)"})]})]})]})]})}),I2=Ts.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.useState("WARNING"),f=()=>{c&&!n.suppress_libraries.includes(c)&&(i({...n,suppress_libraries:[...n.suppress_libraries,c]}),u(""))},p=b=>{i({...n,suppress_libraries:n.suppress_libraries.filter(L=>L!==b)})},g=()=>{c&&!n.library_log_levels[c]&&(i({...n,library_log_levels:{...n.library_log_levels,[c]:x}}),u(""),h("WARNING"))},v=b=>{const L={...n.library_log_levels};delete L[b],i({...n,library_log_levels:L})},N=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],y=["FULL","compact","lite"],w=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"日期格式"}),e.jsx(re,{value:n.date_style,onChange:b=>i({...n,date_style:b.target.value}),placeholder:"例如: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"日志级别样式"}),e.jsxs(Le,{value:n.log_level_style,onValueChange:b=>i({...n,log_level_style:b}),children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsx(Re,{children:y.map(b=>e.jsx(le,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"日志文本颜色"}),e.jsxs(Le,{value:n.color_text,onValueChange:b=>i({...n,color_text:b}),children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsx(Re,{children:w.map(b=>e.jsx(le,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"全局日志级别"}),e.jsxs(Le,{value:n.log_level,onValueChange:b=>i({...n,log_level:b}),children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsx(Re,{children:N.map(b=>e.jsx(le,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"控制台日志级别"}),e.jsxs(Le,{value:n.console_log_level,onValueChange:b=>i({...n,console_log_level:b}),children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsx(Re,{children:N.map(b=>e.jsx(le,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"文件日志级别"}),e.jsxs(Le,{value:n.file_log_level,onValueChange:b=>i({...n,file_log_level:b}),children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsx(Re,{children:N.map(b=>e.jsx(le,{value:b,children:b},b))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:c,onChange:b=>u(b.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),f())}}),e.jsx(k,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(lt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:n.suppress_libraries.map(b=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:b}),e.jsx(k,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>p(b),children:e.jsx(ns,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),e.jsxs("div",{children:[e.jsx(E,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:c,onChange:b=>u(b.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Le,{value:x,onValueChange:h,children:[e.jsx(Oe,{className:"w-32",children:e.jsx(Ue,{})}),e.jsx(Re,{children:N.map(b=>e.jsx(le,{value:b,children:b},b))})]}),e.jsx(k,{onClick:g,size:"sm",children:e.jsx(lt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(n.library_log_levels).map(([b,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:b}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:L}),e.jsx(k,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>v(b),children:e.jsx(ns,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},b))})]})]})}),P2=Ts.memo(function({config:n,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Pe,{checked:n.show_prompt,onCheckedChange:c=>i({...n,show_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Pe,{checked:n.show_replyer_prompt,onCheckedChange:c=>i({...n,show_replyer_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Pe,{checked:n.show_replyer_reasoning,onCheckedChange:c=>i({...n,show_replyer_reasoning:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Pe,{checked:n.show_jargon_prompt,onCheckedChange:c=>i({...n,show_jargon_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Pe,{checked:n.show_memory_prompt,onCheckedChange:c=>i({...n,show_memory_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Pe,{checked:n.show_planner_prompt,onCheckedChange:c=>i({...n,show_planner_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Pe,{checked:n.show_lpmm_paragraph,onCheckedChange:c=>i({...n,show_lpmm_paragraph:c})})]})]})]})}),G2=Ts.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.useState(""),f=()=>{c&&!n.auth_token.includes(c)&&(i({...n,auth_token:[...n.auth_token,c]}),u(""))},p=N=>{i({...n,auth_token:n.auth_token.filter((y,w)=>w!==N)})},g=()=>{x&&!n.api_server_allowed_api_keys.includes(x)&&(i({...n,api_server_allowed_api_keys:[...n.api_server_allowed_api_keys,x]}),h(""))},v=N=>{i({...n,api_server_allowed_api_keys:n.api_server_allowed_api_keys.filter((y,w)=>w!==N)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"旧版 API 认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"用于旧版 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:c,onChange:N=>u(N.target.value),placeholder:"输入认证令牌",onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),f())}}),e.jsx(k,{onClick:f,size:"sm",children:e.jsx(lt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:n.auth_token.map((N,y)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:N}),e.jsx(k,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>p(y),children:e.jsx(ns,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},y))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"新版 API Server 配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"启用新版 API Server"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否启用额外的新版 API Server(额外监听端口)"})]}),e.jsx(Pe,{checked:n.enable_api_server,onCheckedChange:N=>i({...n,enable_api_server:N})})]}),n.enable_api_server&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"主机地址"}),e.jsx(re,{value:n.api_server_host,onChange:N=>i({...n,api_server_host:N.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"端口号"}),e.jsx(re,{type:"number",value:n.api_server_port,onChange:N=>i({...n,api_server_port:parseInt(N.target.value)}),placeholder:"8090"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{checked:n.api_server_use_wss,onCheckedChange:N=>i({...n,api_server_use_wss:N})}),e.jsx(E,{children:"启用 WSS 安全连接"})]}),n.api_server_use_wss&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"SSL 证书文件路径"}),e.jsx(re,{value:n.api_server_cert_file,onChange:N=>i({...n,api_server_cert_file:N.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"SSL 密钥文件路径"}),e.jsx(re,{value:n.api_server_key_file,onChange:N=>i({...n,api_server_key_file:N.target.value}),placeholder:"key.pem"})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"mb-2 block",children:"允许的 API Key 列表"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"为空则允许所有连接"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:x,onChange:N=>h(N.target.value),placeholder:"输入 API Key",onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),g())}}),e.jsx(k,{onClick:g,size:"sm",children:e.jsx(lt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:n.api_server_allowed_api_keys.map((N,y)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:N}),e.jsx(k,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>v(y),children:e.jsx(ns,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},y))})]})]})]})]})]})}),q2=Ts.memo(function({config:n,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Pe,{checked:n.enable,onCheckedChange:c=>i({...n,enable:c})})]})]})}),F2=Ts.memo(function({emojiConfig:n,memoryConfig:i,toolConfig:c,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(Pe,{id:"enable_tool",checked:c.enable_tool,onCheckedChange:f=>h({...c,enable_tool:f})}),e.jsx(E,{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(E,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(re,{id:"max_agent_iterations",type:"number",min:"1",value:i.max_agent_iterations,onChange:f=>x({...i,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(E,{htmlFor:"agent_timeout_seconds",children:"最长回忆时间(秒)"}),e.jsx(re,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:i.agent_timeout_seconds??120,onChange:f=>x({...i,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(Pe,{id:"enable_jargon_detection",checked:i.enable_jargon_detection??!0,onCheckedChange:f=>x({...i,enable_jargon_detection:f})}),e.jsx(E,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"启用黑话识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"记忆检索过程中是否启用黑话识别"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"global_memory",checked:i.global_memory??!1,onCheckedChange:f=>x({...i,global_memory:f})}),e.jsx(E,{htmlFor:"global_memory",className:"cursor-pointer",children:"全局记忆查询"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许记忆检索在所有聊天记录中进行全局查询(忽略当前聊天流)"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(re,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:n.emoji_chance,onChange:f=>u({...n,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(E,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(re,{id:"max_reg_num",type:"number",min:"1",value:n.max_reg_num,onChange:f=>u({...n,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(E,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(re,{id:"check_interval",type:"number",min:"1",value:n.check_interval,onChange:f=>u({...n,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(Pe,{id:"do_replace",checked:n.do_replace,onCheckedChange:f=>u({...n,do_replace:f})}),e.jsx(E,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"steal_emoji",checked:n.steal_emoji,onCheckedChange:f=>u({...n,steal_emoji:f})}),e.jsx(E,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"content_filtration",checked:n.content_filtration,onCheckedChange:f=>u({...n,content_filtration:f})}),e.jsx(E,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),n.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(E,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(re,{id:"filtration_prompt",value:n.filtration_prompt,onChange:f=>u({...n,filtration_prompt:f.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),V2=Ts.memo(function({member:n,groupIndex:i,memberIndex:c,availableChatIds:u,onUpdate:x,onRemove:h}){const f=u.includes(n)||n==="*",[p,g]=m.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(re,{value:n,onChange:v=>x(i,c,v.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),u.length>0&&e.jsx(k,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Le,{value:n,onValueChange:v=>x(i,c,v),children:[e.jsx(Oe,{className:"flex-1",children:e.jsx(Ue,{placeholder:"选择聊天流"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"*",children:"* (全局共享)"}),u.map((v,N)=>e.jsx(le,{value:v,children:v},N))]})]}),e.jsx(k,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除组成员 "',n||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>h(i,c),children:"删除"})]})]})]})]})}),K2=Ts.memo(function({config:n,onChange:i}){const c=()=>{i({...n,learning_list:[...n.learning_list,["","enable","enable","1.0"]]})},u=y=>{i({...n,learning_list:n.learning_list.filter((w,b)=>b!==y)})},x=(y,w,b)=>{const L=[...n.learning_list];L[y][w]=b,i({...n,learning_list:L})},h=({rule:y})=>{const w=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return e.jsxs(Xa,{children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx(Xt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ia,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},f=()=>{i({...n,expression_groups:[...n.expression_groups,[]]})},p=y=>{i({...n,expression_groups:n.expression_groups.filter((w,b)=>b!==y)})},g=y=>{const w=[...n.expression_groups];w[y]=[...w[y],""],i({...n,expression_groups:w})},v=(y,w)=>{const b=[...n.expression_groups];b[y]=b[y].filter((L,D)=>D!==w),i({...n,expression_groups:b})},N=(y,w,b)=>{const L=[...n.expression_groups];L[y][w]=b,i({...n,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(k,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[n.learning_list.map((y,w)=>{const b=n.learning_list.some((S,C)=>C!==w&&S[0]===""),L=y[0]==="",D=y[0].split(":"),T=D[0]||"qq",F=D[1]||"",O=D[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["规则 ",w+1," ",L&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:y}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除学习规则 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(w),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Le,{value:L?"global":"specific",onValueChange:S=>{S==="global"?x(w,0,""):x(w,0,"qq::group")},disabled:b&&!L,children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"global",children:"全局配置"}),e.jsx(le,{value:"specific",disabled:b&&!L,children:"详细配置"})]})]}),b&&!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(E,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Le,{value:T,onValueChange:S=>{x(w,0,`${S}:${F}:${O}`)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(re,{value:F,onChange:S=>{x(w,0,`${T}:${S.target.value}:${O}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Le,{value:O,onValueChange:S=>{x(w,0,`${T}:${F}:${S}`)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"group",children:"群组(group)"}),e.jsx(le,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Pe,{checked:y[1]==="enable",onCheckedChange:S=>x(w,1,S?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Pe,{checked:y[2]==="enable",onCheckedChange:S=>x(w,2,S?"enable":"disable")})]})}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-xs font-medium",children:"学习强度"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"5",value:y[3],onChange:S=>{const C=parseFloat(S.target.value);isNaN(C)||x(w,3,Math.max(0,Math.min(5,C)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),e.jsx(Na,{value:[parseFloat(y[3])||1],onValueChange:S=>x(w,3,S[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0 (不学习)"}),e.jsx("span",{children:"2.5"}),e.jsx("span",{children:"5.0 (快速学习)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},w)}),n.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达反思配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦主动向管理员询问表达方式是否合适的功能"})]}),e.jsx(Pe,{checked:n.reflect,onCheckedChange:y=>i({...n,reflect:y})})]}),n.reflect&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const w=(n.reflect_operator_id||"").split(":"),b=w[0]||"qq",L=w[1]||"",D=w[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Le,{value:b,onValueChange:T=>{i({...n,reflect_operator_id:`${T}:${L}:${D}`})},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(re,{value:L,onChange:T=>{i({...n,reflect_operator_id:`${b}:${T.target.value}:${D}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Le,{value:D,onValueChange:T=>{i({...n,reflect_operator_id:`${b}:${L}:${T}`})},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"private",children:"私聊(private)"}),e.jsx(le,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",n.reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会向此操作员询问表达方式是否合适"})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思"})]}),e.jsxs(k,{onClick:()=>{i({...n,allow_reflect:[...n.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(n.allow_reflect||[]).map((y,w)=>{const b=y.split(":"),L=b[0]||"qq",D=b[1]||"",T=b[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Le,{value:L,onValueChange:F=>{const O=[...n.allow_reflect];O[w]=`${F}:${D}:${T}`,i({...n,allow_reflect:O})},children:[e.jsx(Oe,{className:"w-24",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"qq",children:"QQ"}),e.jsx(le,{value:"wx",children:"微信"})]})]}),e.jsx(re,{value:D,onChange:F=>{const O=[...n.allow_reflect];O[w]=`${L}:${F.target.value}:${T}`,i({...n,allow_reflect:O})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Le,{value:T,onValueChange:F=>{const O=[...n.allow_reflect];O[w]=`${L}:${D}:${F}`,i({...n,allow_reflect:O})},children:[e.jsx(Oe,{className:"w-32",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"group",children:"群组"}),e.jsx(le,{value:"private",children:"私聊"})]})]}),e.jsx(k,{onClick:()=>{i({...n,allow_reflect:n.allow_reflect.filter((F,O)=>O!==w)})},size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})]},w)}),(!n.allow_reflect||n.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"列表为空,所有聊天流都可以进行表达反思"})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),e.jsxs(k,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[n.expression_groups.map((y,w)=>{const b=n.learning_list.map(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:["共享组 ",w+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{onClick:()=>g(w),size:"sm",variant:"outline",children:e.jsx(lt,{className:"h-4 w-4"})}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除共享组 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>p(w),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:y.map((L,D)=>e.jsx(V2,{member:L,groupIndex:w,memberIndex:D,availableChatIds:b,onUpdate:N,onRemove:v},`${w}-${D}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},w)}),n.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"黑话设置"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"all_global_jargon",checked:n.all_global_jargon??!1,onCheckedChange:y=>i({...n,all_global_jargon:y})}),e.jsx(E,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"全局黑话模式"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"开启后,新增的黑话将默认设为全局(所有聊天流共享)。关闭后,已记录的全局黑话不会改变,需要手动删除。"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"enable_jargon_explanation",checked:n.enable_jargon_explanation??!0,onCheckedChange:y=>i({...n,enable_jargon_explanation:y})}),e.jsx(E,{htmlFor:"enable_jargon_explanation",className:"cursor-pointer",children:"启用黑话解释"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"在回复前尝试对上下文中的黑话进行解释。关闭可减少一次LLM调用,仅影响回复前的黑话匹配与解释,不影响黑话学习。"})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"jargon_mode",children:"黑话解释来源模式"}),e.jsxs(Le,{value:n.jargon_mode??"context",onValueChange:y=>i({...n,jargon_mode:y}),children:[e.jsx(Oe,{id:"jargon_mode",className:"mt-2",children:e.jsx(Ue,{placeholder:"选择黑话解释来源"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"context",children:"上下文模式(自动匹配黑话)"}),e.jsx(le,{value:"planner",children:"Planner模式(使用unknown_words列表)"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["上下文模式:使用上下文自动匹配黑话并解释",e.jsx("br",{}),"Planner模式:仅使用Planner在reply动作中给出的unknown_words列表进行黑话检索"]})]})]})]})});function Q2({regex:l,reaction:n,onRegexChange:i,onReactionChange:c}){const[u,x]=m.useState(!1),[h,f]=m.useState(""),[p,g]=m.useState(null),[v,N]=m.useState(""),[y,w]=m.useState({}),[b,L]=m.useState(""),D=m.useRef(null),[T,F]=m.useState("build"),O=M=>M.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),S=(M,Z=0)=>{const G=D.current;if(!G)return;const ce=G.selectionStart||0,de=G.selectionEnd||0,be=l.substring(0,ce)+M+l.substring(de);i(be),setTimeout(()=>{const me=ce+M.length+Z;G.setSelectionRange(me,me),G.focus()},0)};m.useEffect(()=>{if(!l||!h){p!==null&&g(null),Object.keys(y).length>0&&w({}),b!==n&&L(n),v!==""&&N("");return}try{const M=O(l),Z=new RegExp(M,"g"),G=h.match(Z);g(G),N("");const de=new RegExp(M).exec(h);if(de&&de.groups){w(de.groups);let be=n;Object.entries(de.groups).forEach(([me,pe])=>{be=be.replace(new RegExp(`\\[${me}\\]`,"g"),pe||"")}),L(be)}else w({}),L(n)}catch(M){N(M.message),g(null),w({}),L(n)}},[l,h,n,p,y,b,v]);const C=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const M=O(l),Z=new RegExp(M,"g");let G=0;const ce=[];let de;for(;(de=Z.exec(h))!==null;)de.index>G&&ce.push(e.jsx("span",{children:h.substring(G,de.index)},`text-${G}`)),ce.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:de[0]},`match-${de.index}`)),G=de.index+de[0].length;return G)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return e.jsxs(Is,{open:u,onOpenChange:x,children:[e.jsx(Bo,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx(Dm,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Rs,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"正则表达式编辑器"}),e.jsx(Zs,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Je,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(da,{value:T,onValueChange:M=>F(M),className:"w-full",children:[e.jsxs(Zt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"build",children:"🔧 构建器"}),e.jsx(Xe,{value:"test",children:"🧪 测试器"})]}),e.jsxs(ys,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(re,{ref:D,value:l,onChange:M=>i(M.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(Ys,{value:n,onChange:M=>c(M.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[P.map(M=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:M.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:M.items.map(Z=>e.jsx(k,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>S(Z.pattern,Z.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:Z.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Z.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Z.desc})]})},Z.label))})]},M.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>i("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(k,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>i("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(k,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>i("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(ys,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:l||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(Ys,{id:"test-text",value:h,onChange:M=>f(M.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:p&&p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",p.length," 处)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(Je,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:C()})})]}),Object.keys(y).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Je,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(y).map(([M,Z])=>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:["[",M,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Z})]},M))})})]}),Object.keys(y).length>0&&n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(Je,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:b})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const Y2=Ts.memo(function({keywordReactionConfig:n,responsePostProcessConfig:i,chineseTypoConfig:c,responseSplitterConfig:u,onKeywordReactionChange:x,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:p}){const g=()=>{x({...n,regex_rules:[...n.regex_rules,{regex:[""],reaction:""}]})},v=S=>{x({...n,regex_rules:n.regex_rules.filter((C,P)=>P!==S)})},N=(S,C,P)=>{const M=[...n.regex_rules];C==="regex"&&typeof P=="string"?M[S]={...M[S],regex:[P]}:C==="reaction"&&typeof P=="string"&&(M[S]={...M[S],reaction:P}),x({...n,regex_rules:M})},y=()=>{x({...n,keyword_rules:[...n.keyword_rules,{keywords:[],reaction:""}]})},w=S=>{x({...n,keyword_rules:n.keyword_rules.filter((C,P)=>P!==S)})},b=(S,C,P)=>{const M=[...n.keyword_rules];typeof P=="string"&&(M[S]={...M[S],reaction:P}),x({...n,keyword_rules:M})},L=S=>{const C=[...n.keyword_rules];C[S]={...C[S],keywords:[...C[S].keywords||[],""]},x({...n,keyword_rules:C})},D=(S,C)=>{const P=[...n.keyword_rules];P[S]={...P[S],keywords:(P[S].keywords||[]).filter((M,Z)=>Z!==C)},x({...n,keyword_rules:P})},T=(S,C,P)=>{const M=[...n.keyword_rules],Z=[...M[S].keywords||[]];Z[C]=P,M[S]={...M[S],keywords:Z},x({...n,keyword_rules:M})},F=({rule:S})=>{const C=`{ regex = [${(S.regex||[]).map(P=>`"${P}"`).join(", ")}], reaction = "${S.reaction}" }`;return e.jsxs(Xa,{children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx(Xt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ia,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Je,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:C})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},O=({rule:S})=>{const C=`[[keyword_reaction.keyword_rules]] -keywords = [${(S.keywords||[]).map(P=>`"${P}"`).join(", ")}] -reaction = "${S.reaction}"`;return e.jsxs(Xa,{children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx(Xt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ia,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Je,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:C})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),e.jsxs(k,{onClick:g,size:"sm",variant:"outline",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.regex_rules.map((S,C)=>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:["正则规则 ",C+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q2,{regex:S.regex&&S.regex[0]||"",reaction:S.reaction,onRegexChange:P=>N(C,"regex",P),onReactionChange:P=>N(C,"reaction",P)}),e.jsx(F,{rule:S}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除正则规则 ",C+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>v(C),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(re,{value:S.regex&&S.regex[0]||"",onChange:P=>N(C,"regex",P.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Ys,{value:S.reaction,onChange:P=>N(C,"reaction",P.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},C)),n.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(k,{onClick:y,size:"sm",variant:"outline",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.keyword_rules.map((S,C)=>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:["关键词规则 ",C+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{rule:S}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除关键词规则 ",C+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>w(C),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(k,{onClick:()=>L(C),size:"sm",variant:"ghost",children:[e.jsx(lt,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(S.keywords||[]).map((P,M)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{value:P,onChange:Z=>T(C,M,Z.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(k,{onClick:()=>D(C,M),size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})]},M)),(!S.keywords||S.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Ys,{value:S.reaction,onChange:P=>b(C,"reaction",P.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},C)),n.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"enable_response_post_process",checked:i.enable_response_post_process,onCheckedChange:S=>h({...i,enable_response_post_process:S})}),e.jsx(E,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),i.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Pe,{id:"enable_chinese_typo",checked:c.enable,onCheckedChange:S=>f({...c,enable:S})}),e.jsx(E,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),c.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(re,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.error_rate,onChange:S=>f({...c,error_rate:parseFloat(S.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(re,{id:"min_freq",type:"number",min:"0",value:c.min_freq,onChange:S=>f({...c,min_freq:parseInt(S.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(re,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:c.tone_error_rate,onChange:S=>f({...c,tone_error_rate:parseFloat(S.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(re,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.word_replace_rate,onChange:S=>f({...c,word_replace_rate:parseFloat(S.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Pe,{id:"enable_response_splitter",checked:u.enable,onCheckedChange:S=>p({...u,enable:S})}),e.jsx(E,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),u.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(re,{id:"max_length",type:"number",min:"1",value:u.max_length,onChange:S=>p({...u,max_length:parseInt(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(re,{id:"max_sentence_num",type:"number",min:"1",value:u.max_sentence_num,onChange:S=>p({...u,max_sentence_num:parseInt(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"enable_kaomoji_protection",checked:u.enable_kaomoji_protection,onCheckedChange:S=>p({...u,enable_kaomoji_protection:S})}),e.jsx(E,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"enable_overflow_return_all",checked:u.enable_overflow_return_all,onCheckedChange:S=>p({...u,enable_overflow_return_all:S})}),e.jsx(E,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),J2=Ts.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.useState(""),[f,p]=m.useState(!1),g=n.allowed_ips?n.allowed_ips.split(",").map(T=>T.trim()).filter(T=>T):[],v=n.trusted_proxies?n.trusted_proxies.split(",").map(T=>T.trim()).filter(T=>T):[],N=()=>{if(!c.trim())return;const T=[...g,c.trim()];i({...n,allowed_ips:T.join(",")}),u("")},y=T=>{const F=g.filter((O,S)=>S!==T);i({...n,allowed_ips:F.join(",")})},w=()=>{if(!x.trim())return;const T=[...v,x.trim()];i({...n,trusted_proxies:T.join(",")}),h("")},b=T=>{const F=v.filter((O,S)=>S!==T);i({...n,trusted_proxies:F.join(",")})},L=T=>{!T&&n.enabled?p(!0):i({...n,enabled:T})},D=()=>{i({...n,enabled:!1}),p(!1)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"WebUI 服务配置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{checked:n.enabled,onCheckedChange:L}),e.jsx(E,{className:"cursor-pointer",children:"启用 WebUI"})]}),n.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"运行模式"}),e.jsxs(Le,{value:n.mode,onValueChange:T=>i({...n,mode:T}),children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"选择运行模式"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"development",children:"开发模式"}),e.jsx(le,{value:"production",children:"生产模式"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"监听地址"}),e.jsx(re,{value:n.host,onChange:T=>i({...n,host:T.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"端口号"}),e.jsx(re,{type:"number",value:n.port,onChange:T=>i({...n,port:parseInt(T.target.value)}),placeholder:"8001"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"防爬虫模式"}),e.jsxs(Le,{value:n.anti_crawler_mode,onValueChange:T=>i({...n,anti_crawler_mode:T}),children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"选择防爬虫模式"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"false",children:"禁用"}),e.jsx(le,{value:"basic",children:"基础(只记录不阻止)"}),e.jsx(le,{value:"loose",children:"宽松"}),e.jsx(le,{value:"strict",children:"严格"})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(E,{children:"IP 白名单"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:c,onChange:T=>u(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.preventDefault(),N())},placeholder:"输入IP地址后按回车或点击添加"}),e.jsx(k,{type:"button",size:"sm",onClick:N,disabled:!c.trim(),children:e.jsx(lt,{className:"h-4 w-4"})})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.map((T,F)=>e.jsxs(Te,{variant:"secondary",className:"flex items-center gap-1",children:[T,e.jsx("button",{type:"button",onClick:()=>y(F),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Da,{className:"h-3 w-3"})})]},F))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持精确IP、CIDR格式和通配符(如:127.0.0.1、192.168.1.0/24)"})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(E,{children:"信任的代理 IP"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:x,onChange:T=>h(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.preventDefault(),w())},placeholder:"输入代理IP后按回车或点击添加"}),e.jsx(k,{type:"button",size:"sm",onClick:w,disabled:!x.trim(),children:e.jsx(lt,{className:"h-4 w-4"})})]}),v.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:v.map((T,F)=>e.jsxs(Te,{variant:"secondary",className:"flex items-center gap-1",children:[T,e.jsx("button",{type:"button",onClick:()=>b(F),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Da,{className:"h-3 w-3"})})]},F))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有来自这些IP的X-Forwarded-For头才被信任"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{checked:n.trust_xff,onCheckedChange:T=>i({...n,trust_xff:T})}),e.jsx(E,{className:"cursor-pointer",children:"启用 X-Forwarded-For 代理解析"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{checked:n.secure_cookie,onCheckedChange:T=>i({...n,secure_cookie:T})}),e.jsx(E,{className:"cursor-pointer",children:"启用安全 Cookie(仅 HTTPS)"})]})]})]}),e.jsx(gs,{open:f,onOpenChange:p,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"警告:即将关闭 WebUI"}),e.jsxs(hs,{children:["关闭 WebUI 后,在您下次重启麦麦之前,WebUI 界面将无法访问。",e.jsx("br",{}),e.jsx("br",{}),"您需要通过修改配置文件或命令行重新启用 WebUI 才能再次访问此界面。",e.jsx("br",{}),e.jsx("br",{}),"确定要关闭 WebUI 吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{variant:"destructive",onClick:D,children:"确认关闭"})]})]})})]})}),tn="/api/webui/config";async function tg(){const n=await(await we(`${tn}/bot`)).json();if(!n.success)throw new Error("获取配置数据失败");return n.config}async function Xl(){const n=await(await we(`${tn}/model`)).json();if(!n.success)throw new Error("获取模型配置数据失败");return n.config}async function ag(l){const i=await(await we(`${tn}/bot`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function X2(){const n=await(await we(`${tn}/bot/raw`)).json();if(!n.success)throw new Error("获取配置源代码失败");return n.content}async function Z2(l){const i=await(await we(`${tn}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:l})})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function Li(l){const i=await(await we(`${tn}/model`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function W2(l,n){const c=await(await we(`${tn}/bot/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function Tm(l,n){const c=await(await we(`${tn}/model/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function e_(l,n="openai",i="/models"){const c=new URLSearchParams({provider_name:l,parser:n,endpoint:i}),u=await we(`/api/webui/models/list?${c}`);if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.detail||`获取模型列表失败 (${u.status})`)}const x=await u.json();if(!x.success)throw new Error("获取模型列表失败");return x.models}async function s_(l){const n=new URLSearchParams({provider_name:l}),i=await we(`/api/webui/models/test-connection-by-name?${n}`,{method:"POST"});if(!i.ok){const c=await i.json().catch(()=>({}));throw new Error(c.detail||`测试连接失败 (${i.status})`)}return await i.json()}const t_=Ar("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"}}),gt=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx("div",{ref:c,role:"alert",className:B(t_({variant:n}),l),...i}));gt.displayName="Alert";const _n=m.forwardRef(({className:l,...n},i)=>e.jsx("h5",{ref:i,className:B("mb-1 font-medium leading-none tracking-tight",l),...n}));_n.displayName="AlertTitle";const jt=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("text-sm [&_p]:leading-relaxed",l),...n}));jt.displayName="AlertDescription";const a_={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(l,n){let i;if(!n.inString&&(i=l.match(/^('''|"""|'|")/))&&(n.stringType=i[0],n.inString=!0),l.sol()&&!n.inString&&n.inArray===0&&(n.lhs=!0),n.inString){for(;n.inString;)if(l.match(n.stringType))n.inString=!1;else if(l.peek()==="\\")l.next(),l.next();else{if(l.eol())break;l.match(/^.[^\\\"\']*/)}return n.lhs?"property":"string"}else{if(n.inArray&&l.peek()==="]")return l.next(),n.inArray--,"bracket";if(n.lhs&&l.peek()==="["&&l.skipTo("]"))return l.next(),l.peek()==="]"&&l.next(),"atom";if(l.peek()==="#")return l.skipToEnd(),"comment";if(l.eatSpace())return null;if(n.lhs&&l.eatWhile(function(c){return c!="="&&c!=" "}))return"property";if(n.lhs&&l.peek()==="=")return l.next(),n.lhs=!1,null;if(!n.lhs&&l.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!n.lhs&&(l.match("true")||l.match("false")))return"atom";if(!n.lhs&&l.peek()==="[")return n.inArray++,l.next(),"bracket";if(!n.lhs&&l.match(/^\-?\d+(?:\.\d+)?/))return"number";l.eatSpace()||l.next()}return null},languageData:{commentTokens:{line:"#"}}},l_={python:[Zw()],json:[Ww(),e1()],toml:[Xw.define(a_)],text:[]};function Xj({value:l,onChange:n,language:i="text",readOnly:c=!1,height:u="400px",minHeight:x,maxHeight:h,placeholder:f,theme:p="dark",className:g=""}){const[v,N]=m.useState(!1);if(m.useEffect(()=>{N(!0)},[]),!v)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${g}`,style:{height:u,minHeight:x,maxHeight:h}});const y=[...l_[i]||[],Vp.lineWrapping];return c&&y.push(Vp.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${g}`,children:e.jsx(s1,{value:l,height:u,minHeight:x,maxHeight:h,theme:p==="dark"?t1:void 0,extensions:y,onChange:n,placeholder:f,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function n_({id:l,index:n,itemType:i,itemFields:c,value:u,onChange:x,onRemove:h,disabled:f,canRemove:p,placeholder:g}){const{attributes:v,listeners:N,setNodeRef:y,transform:w,transition:b,isDragging:L}=Oj({id:l,disabled:f}),D={transform:Rj.Transform.toString(w),transition:b};return e.jsxs("div",{ref:y,style:D,className:B("flex items-start gap-2 group",L&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:B("flex-shrink-0 p-2 cursor-grab active:cursor-grabbing","text-muted-foreground hover:text-foreground transition-colors","opacity-0 group-hover:opacity-100 focus:opacity-100",f&&"cursor-not-allowed opacity-30"),...v,...N,children:e.jsx(hj,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:i==="object"&&c?e.jsx(r_,{value:u,onChange:x,fields:c,disabled:f}):i==="number"?e.jsx(re,{type:"number",value:u??"",onChange:T=>x(parseFloat(T.target.value)||0),placeholder:g??`第 ${n+1} 项`,disabled:f,className:"font-mono"}):e.jsx(re,{type:"text",value:u??"",onChange:T=>x(T.target.value),placeholder:g??`第 ${n+1} 项`,disabled:f})}),e.jsx(k,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:B("flex-shrink-0 text-muted-foreground hover:text-destructive","opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity"),children:e.jsx(ns,{className:"h-4 w-4"})})]})}function r_({value:l,onChange:n,fields:i,disabled:c}){const u=m.useCallback((h,f)=>{n({...l,[h]:f})},[l,n]),x=(h,f)=>{const p=l?.[h];if(f.type==="boolean"||f.type==="switch")return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(Pe,{checked:!!(p??f.default),onCheckedChange:g=>u(h,g),disabled:c})]});if(f.type==="slider"||f.type==="number"&&f.min!=null&&f.max!=null){const g=p??f.default??f.min??0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e.jsx(Na,{value:[g],onValueChange:v=>u(h,v[0]),min:f.min??0,max:f.max??100,step:f.step??1,disabled:c,className:"py-1"})]})}return f.type==="select"&&f.choices?e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsxs(Le,{value:String(p??f.default??""),onValueChange:g=>u(h,g),disabled:c,children:[e.jsx(Oe,{className:"h-8 text-sm",children:e.jsx(Ue,{placeholder:f.placeholder??"请选择"})}),e.jsx(Re,{children:f.choices.map(g=>e.jsx(le,{value:String(g),children:String(g)},String(g)))})]})]}):f.type==="number"?e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(re,{type:"number",value:p??f.default??"",onChange:g=>u(h,parseFloat(g.target.value)||0),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(re,{type:"text",value:p??f.default??"",onChange:g=>u(h,g.target.value),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]})};return e.jsx(ze,{className:"p-3 space-y-2 bg-muted/30",children:Object.entries(i).map(([h,f])=>e.jsx("div",{children:x(h,f)},h))})}function i_({value:l,onChange:n,itemType:i="string",itemFields:c,minItems:u,maxItems:x,disabled:h,placeholder:f}){const p=m.useMemo(()=>Array.isArray(l)?l:typeof l=="string"&&l.trim()?l.split(",").map(O=>O.trim()):[],[l]),[g]=m.useState(()=>new Map),v=m.useCallback(O=>(g.has(O)||g.set(O,`item-${Date.now()}-${O}-${Math.random().toString(36).slice(2)}`),g.get(O)),[g]),N=m.useMemo(()=>{const O=[];for(let S=0;S{const{active:S,over:C}=O;if(C&&S.id!==C.id){const P=N.indexOf(S.id),M=N.indexOf(C.id),Z=Mj(p,P,M);n(Z)}},[p,N,n]),b=m.useCallback(()=>{if(x!=null&&p.length>=x)return;let O;i==="object"&&c?O=Object.fromEntries(Object.entries(c).map(([S,C])=>[S,C.default??""])):i==="number"?O=0:O="",n([...p,O])},[p,x,i,c,n]),L=m.useCallback((O,S)=>{const C=[...p];C[O]=S,n(C)},[p,n]),D=m.useCallback(O=>{if(u!=null&&p.length<=u)return;const S=p.filter((C,P)=>P!==O);g.delete(O),n(S)},[p,u,g,n]),T=x==null||p.lengthu;return e.jsxs("div",{className:"space-y-2",children:[p.length===0?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-4 justify-center border border-dashed rounded-md",children:[e.jsx(Dt,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(Aj,{sensors:y,collisionDetection:zj,onDragEnd:w,children:e.jsx(Dj,{items:N,strategy:a1,children:e.jsx("div",{className:"space-y-2",children:p.map((O,S)=>e.jsx(n_,{id:N[S],index:S,itemType:i,itemFields:c,value:O,onChange:C=>L(S,C),onRemove:()=>D(S),disabled:h,canRemove:F,placeholder:f},N[S]))})})}),e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:b,disabled:h||!T,className:"w-full",children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加项目",x!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",p.length,"/",x,")"]})]}),(u!=null||x!=null)&&(u!==null||x!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:u!=null&&x!=null?`允许 ${u} - ${x} 项`:u!=null?`至少 ${u} 项`:`最多 ${x} 项`})]})}function c_(l,n,i,c={}){const{debounceMs:u=2e3,onSaveSuccess:x,onSaveError:h}=c,f=m.useRef(null),p=m.useCallback(async(y,w)=>{try{n(!0),await W2(y,w),i(!1),x?.()}catch(b){console.error(`自动保存 ${y} 失败:`,b),i(!0),h?.(b instanceof Error?b:new Error(String(b)))}finally{n(!1)}},[n,i,x,h]),g=m.useCallback((y,w)=>{l||(i(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(y,w)},u))},[l,i,p,u]),v=m.useCallback(async(y,w)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(y,w)},[p]),N=m.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return m.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:v,cancelPendingAutoSave:N}}function Bt(l,n,i,c){m.useEffect(()=>{l&&!i&&c(n,l)},[l])}const o_=500;function d_(){return e.jsx(Dn,{children:e.jsx(u_,{})})}function u_(){const[l,n]=m.useState(!0),[i,c]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState("visual"),[v,N]=m.useState(""),[y,w]=m.useState(!1),{toast:b}=et(),{triggerRestart:L,isRestarting:D}=sn(),[T,F]=m.useState(null),[O,S]=m.useState(null),[C,P]=m.useState(null),[M,Z]=m.useState(null),[G,ce]=m.useState(null),[de,be]=m.useState(null),[me,pe]=m.useState(null),[je,A]=m.useState(null),[Y,H]=m.useState(null),[U,$]=m.useState(null),[_e,Ne]=m.useState(null),[Se,V]=m.useState(null),[ye,W]=m.useState(null),[ue,ke]=m.useState(null),[J,ee]=m.useState(null),[De,Fe]=m.useState(null),[ge,as]=m.useState(null),[ae,Ee]=m.useState(null),ie=m.useRef(!0),ve=m.useRef({}),Me=m.useCallback(Ce=>{ve.current=Ce,F(Ce.bot),S(Ce.personality);const cs=Ce.chat;cs.talk_value_rules||(cs.talk_value_rules=[]),P(cs),Z(Ce.expression),ce(Ce.emoji),be(Ce.memory),pe(Ce.tool),A(Ce.voice),H(Ce.lpmm_knowledge),$(Ce.keyword_reaction),Ne(Ce.response_post_process),V(Ce.chinese_typo),W(Ce.response_splitter),ke(Ce.log),ee(Ce.debug),Fe(Ce.maim_message),as(Ce.telemetry),Ee(Ce.webui)},[]),Ze=m.useCallback(()=>({...ve.current,bot:T,personality:O,chat:C,expression:M,emoji:G,memory:de,tool:me,voice:je,lpmm_knowledge:Y,keyword_reaction:U,response_post_process:_e,chinese_typo:Se,response_splitter:ye,log:ue,debug:J,maim_message:De,telemetry:ge,webui:ae}),[T,O,C,M,G,de,me,je,Y,U,_e,Se,ye,ue,J,De,ge,ae]),js=m.useCallback(async()=>{try{const cs=(await X2()).replace(/"([^"]*)"/g,(Es,zs)=>`"${zs.replace(/\\n/g,` -`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);N(cs),w(!1)}catch(Ce){b({variant:"destructive",title:"加载失败",description:Ce instanceof Error?Ce.message:"加载源代码失败"})}},[b]),Ot=m.useCallback(async()=>{try{n(!0);const Ce=await tg();Me(Ce),f(!1),ie.current=!1,await js()}catch(Ce){console.error("加载配置失败:",Ce),b({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{n(!1)}},[b,js,Me]);m.useEffect(()=>{Ot()},[Ot]);const{triggerAutoSave:rs,cancelPendingAutoSave:Ps}=c_(ie.current,x,f);Bt(T,"bot",ie.current,rs),Bt(O,"personality",ie.current,rs),Bt(C,"chat",ie.current,rs),Bt(M,"expression",ie.current,rs),Bt(G,"emoji",ie.current,rs),Bt(de,"memory",ie.current,rs),Bt(me,"tool",ie.current,rs),Bt(je,"voice",ie.current,rs),Bt(Y,"lpmm_knowledge",ie.current,rs),Bt(U,"keyword_reaction",ie.current,rs),Bt(_e,"response_post_process",ie.current,rs),Bt(Se,"chinese_typo",ie.current,rs),Bt(ye,"response_splitter",ie.current,rs),Bt(ue,"log",ie.current,rs),Bt(J,"debug",ie.current,rs),Bt(De,"maim_message",ie.current,rs),Bt(ge,"telemetry",ie.current,rs),Bt(ae,"webui",ie.current,rs);const Q=async()=>{try{c(!0);const Ce=v.replace(/"([^"]*)"/g,(cs,Es)=>`"${Es.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await Z2(Ce),f(!1),w(!1),b({title:"保存成功",description:"配置已保存"}),await Ot()}catch(Ce){w(!0),b({variant:"destructive",title:"保存失败",description:Ce instanceof Error?Ce.message:"保存配置失败"})}finally{c(!1)}},Ge=async Ce=>{if(h){b({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(g(Ce),Ce==="source")await js();else try{const cs=await tg();Me(cs),f(!1)}catch(cs){console.error("加载配置失败:",cs),b({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},He=async()=>{try{c(!0),Ps(),await ag(Ze()),f(!1),b({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Ce){console.error("保存配置失败:",Ce),b({title:"保存失败",description:Ce.message,variant:"destructive"})}finally{c(!1)}},Ve=async()=>{await L()},Bs=async()=>{try{c(!0),Ps(),await ag(Ze()),f(!1),b({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ce=>setTimeout(Ce,o_)),await Ve()}catch(Ce){console.error("保存失败:",Ce),b({title:"保存失败",description:Ce.message,variant:"destructive"})}finally{c(!1)}};return l?e.jsx(Je,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(k,{onClick:p==="visual"?He:Q,disabled:i||u||!h||D,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(Ki,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:i?"保存中":u?"自动":h?"保存":"已保存"})]}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsxs(k,{disabled:i||u||D,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(Vi,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:D?"重启中":h?"保存重启":"重启"})]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重启麦麦?"}),e.jsx(hs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:h?Bs:Ve,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(da,{value:p,onValueChange:Ce=>Ge(Ce),className:"w-full",children:e.jsxs(Zt,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(Xe,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(fj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(Xe,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(pj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(gt,{children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(jt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(gt,{children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(jt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",y&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Xj,{value:v,onChange:Ce=>{N(Ce),f(!0),y&&w(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),p==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(da,{defaultValue:"bot",className:"w-full",children:[e.jsxs(Zt,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(Xe,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(Xe,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(Xe,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(Xe,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(Xe,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(Xe,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(Xe,{value:"voice",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"语音"}),e.jsx(Xe,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(Xe,{value:"webui",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"WebUI"}),e.jsx(Xe,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(ys,{value:"bot",className:"space-y-4",children:T&&e.jsx(z2,{config:T,onChange:F})}),e.jsx(ys,{value:"personality",className:"space-y-4",children:O&&e.jsx(D2,{config:O,onChange:S})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:C&&e.jsx(B2,{config:C,onChange:P})}),e.jsx(ys,{value:"expression",className:"space-y-4",children:M&&e.jsx(K2,{config:M,onChange:Z})}),e.jsx(ys,{value:"features",className:"space-y-4",children:G&&de&&me&&e.jsx(F2,{emojiConfig:G,memoryConfig:de,toolConfig:me,onEmojiChange:ce,onMemoryChange:be,onToolChange:pe})}),e.jsx(ys,{value:"processing",className:"space-y-4",children:U&&_e&&Se&&ye&&e.jsx(Y2,{keywordReactionConfig:U,responsePostProcessConfig:_e,chineseTypoConfig:Se,responseSplitterConfig:ye,onKeywordReactionChange:$,onResponsePostProcessChange:Ne,onChineseTypoChange:V,onResponseSplitterChange:W})}),e.jsx(ys,{value:"voice",className:"space-y-4",children:je&&e.jsx($2,{config:je,onChange:A})}),e.jsx(ys,{value:"lpmm",className:"space-y-4",children:Y&&e.jsx(H2,{config:Y,onChange:H})}),e.jsx(ys,{value:"webui",className:"space-y-4",children:ae&&e.jsx(J2,{config:ae,onChange:Ee})}),e.jsxs(ys,{value:"other",className:"space-y-4",children:[ue&&e.jsx(I2,{config:ue,onChange:ke}),J&&e.jsx(P2,{config:J,onChange:ee}),De&&e.jsx(G2,{config:De,onChange:Fe}),ge&&e.jsx(q2,{config:ge,onChange:as})]})]})}),e.jsx(On,{})]})})}const wl=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:i,className:B("w-full caption-bottom text-sm",l),...n})}));wl.displayName="Table";const _l=m.forwardRef(({className:l,...n},i)=>e.jsx("thead",{ref:i,className:B("[&_tr]:border-b",l),...n}));_l.displayName="TableHeader";const Sl=m.forwardRef(({className:l,...n},i)=>e.jsx("tbody",{ref:i,className:B("[&_tr:last-child]:border-0",l),...n}));Sl.displayName="TableBody";const m_=m.forwardRef(({className:l,...n},i)=>e.jsx("tfoot",{ref:i,className:B("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",l),...n}));m_.displayName="TableFooter";const nt=m.forwardRef(({className:l,...n},i)=>e.jsx("tr",{ref:i,className:B("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",l),...n}));nt.displayName="TableRow";const Qe=m.forwardRef(({className:l,...n},i)=>e.jsx("th",{ref:i,className:B("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));Qe.displayName="TableHead";const Ie=m.forwardRef(({className:l,...n},i)=>e.jsx("td",{ref:i,className:B("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));Ie.displayName="TableCell";const x_=m.forwardRef(({className:l,...n},i)=>e.jsx("caption",{ref:i,className:B("mt-4 text-sm text-muted-foreground",l),...n}));x_.displayName="TableCaption";const $o=m.forwardRef(({className:l,...n},i)=>e.jsx(ma,{ref:i,className:B("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",l),...n}));$o.displayName=ma.displayName;const Ho=m.forwardRef(({className:l,...n},i)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Vt,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ma.Input,{ref:i,className:B("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",l),...n})]}));Ho.displayName=ma.Input.displayName;const Io=m.forwardRef(({className:l,...n},i)=>e.jsx(ma.List,{ref:i,className:B("max-h-[300px] overflow-y-auto overflow-x-hidden",l),...n}));Io.displayName=ma.List.displayName;const Po=m.forwardRef((l,n)=>e.jsx(ma.Empty,{ref:n,className:"py-6 text-center text-sm",...l}));Po.displayName=ma.Empty.displayName;const Ii=m.forwardRef(({className:l,...n},i)=>e.jsx(ma.Group,{ref:i,className:B("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",l),...n}));Ii.displayName=ma.Group.displayName;const h_=m.forwardRef(({className:l,...n},i)=>e.jsx(ma.Separator,{ref:i,className:B("-mx-1 h-px bg-border",l),...n}));h_.displayName=ma.Separator.displayName;const Pi=m.forwardRef(({className:l,...n},i)=>e.jsx(ma.Item,{ref:i,className:B("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",l),...n}));Pi.displayName=ma.Item.displayName;const Xs=m.forwardRef(({className:l,...n},i)=>e.jsx(sj,{ref:i,className:B("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",l),...n,children:e.jsx(cw,{className:B("grid place-content-center text-current"),children:e.jsx(_t,{className:"h-4 w-4"})})}));Xs.displayName=sj.displayName;const Zj=m.createContext(null),Wj="maibot-completed-tours";function f_(){try{const l=localStorage.getItem(Wj);return l?new Set(JSON.parse(l)):new Set}catch{return new Set}}function lg(l){localStorage.setItem(Wj,JSON.stringify([...l]))}function p_({children:l}){const[n,i]=m.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=m.useState(()=>new Map),[u,x]=m.useState(f_),[,h]=m.useState(0),f=m.useCallback((O,S)=>{c.set(O,S),h(C=>C+1)},[c]),p=m.useCallback(O=>{c.delete(O),i(S=>S.activeTourId===O?{...S,activeTourId:null,isRunning:!1,stepIndex:0}:S)},[c]),g=m.useCallback((O,S=0)=>{c.has(O)&&i({activeTourId:O,stepIndex:S,isRunning:!0})},[c]),v=m.useCallback(()=>{i(O=>({...O,isRunning:!1}))},[]),N=m.useCallback(O=>{i(S=>({...S,stepIndex:O}))},[]),y=m.useCallback(()=>{i(O=>({...O,stepIndex:O.stepIndex+1}))},[]),w=m.useCallback(()=>{i(O=>({...O,stepIndex:Math.max(0,O.stepIndex-1)}))},[]),b=m.useCallback(()=>n.activeTourId?c.get(n.activeTourId)||[]:[],[n.activeTourId,c]),L=m.useCallback(O=>{x(S=>{const C=new Set(S);return C.add(O),lg(C),C})},[]),D=m.useCallback(O=>{const{action:S,index:C,status:P,type:M}=O,Z=["finished","skipped"];if(S==="close"){i(G=>({...G,isRunning:!1,stepIndex:0}));return}Z.includes(P)?i(G=>(P==="finished"&&G.activeTourId&&setTimeout(()=>L(G.activeTourId),0),{...G,isRunning:!1,stepIndex:0})):M==="step:after"&&(S==="next"?i(G=>({...G,stepIndex:C+1})):S==="prev"&&i(G=>({...G,stepIndex:C-1})))},[L]),T=m.useCallback(O=>u.has(O),[u]),F=m.useCallback(O=>{x(S=>{const C=new Set(S);return C.delete(O),lg(C),C})},[]);return e.jsx(Zj.Provider,{value:{state:n,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:v,goToStep:N,nextStep:y,prevStep:w,getCurrentSteps:b,handleJoyrideCallback:D,isTourCompleted:T,markTourCompleted:L,resetTourCompleted:F},children:l})}function Bm(){const l=m.useContext(Zj);if(!l)throw new Error("useTour must be used within a TourProvider");return l}const g_={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)"}},j_={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function v_(){const{state:l,getCurrentSteps:n,handleJoyrideCallback:i}=Bm(),c=n(),[u,x]=m.useState(!1),h=m.useRef(l.stepIndex),f=m.useRef(null);m.useEffect(()=>{h.current!==l.stepIndex&&(x(!1),h.current=l.stepIndex)},[l.stepIndex]),m.useEffect(()=>{if(!l.isRunning||c.length===0){x(!1);return}const N=c[l.stepIndex];if(!N){x(!1);return}const y=N.target;if(y==="body"){x(!0);return}x(!1);const w=setTimeout(()=>{const b=()=>{const F=document.querySelector(y);if(F){const O=F.getBoundingClientRect();if(O.width>0&&O.height>0)return!0}return!1};if(b()){setTimeout(()=>x(!0),100);return}const L=setInterval(()=>{b()&&(clearInterval(L),setTimeout(()=>x(!0),100))},100),D=setTimeout(()=>{clearInterval(L),x(!0)},5e3),T=()=>{clearInterval(L),clearTimeout(D)};f.current=T},150);return()=>{clearTimeout(w),f.current&&(f.current(),f.current=null)}},[l.isRunning,l.stepIndex,c]);const[p,g]=m.useState(null);if(m.useEffect(()=>{let N=document.getElementById("tour-portal-container");return N||(N=document.createElement("div"),N.id="tour-portal-container",N.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(N)),g(N),()=>{}},[]),!l.isRunning||c.length===0||!u)return null;const v=e.jsx(n1,{steps:c,stepIndex:l.stepIndex,run:l.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:i,styles:g_,locale:j_,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${l.stepIndex}`);return p?Ky.createPortal(v,p):v}const Ya="model-assignment-tour",ev=[{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}],sv={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"},Ai=[{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 ng(l){return l?l.replace(/\/+$/,"").toLowerCase():""}function N_(l){if(!l)return null;const n=ng(l);return Ai.find(i=>i.id!=="custom"&&ng(i.base_url)===n)||null}const fo=l=>({...l,max_retry:l.max_retry??2,timeout:l.timeout??30,retry_interval:l.retry_interval??10}),b_=l=>{const n={};return l?(l.name?.trim()||(n.name="请输入提供商名称"),l.base_url?.trim()||(n.base_url="请输入基础 URL"),l.api_key?.trim()||(n.api_key="请输入 API Key"),{isValid:Object.keys(n).length===0,errors:n}):{isValid:!1,errors:{name:"提供商数据为空"}}};function y_(){return e.jsx(Dn,{children:e.jsx(w_,{})})}function w_(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[v,N]=m.useState(!1),[y,w]=m.useState(null),[b,L]=m.useState(null),[D,T]=m.useState("custom"),[F,O]=m.useState(!1),[S,C]=m.useState(!1),[P,M]=m.useState(null),[Z,G]=m.useState(!1),[ce,de]=m.useState(""),[be,me]=m.useState(new Set),[pe,je]=m.useState(!1),[A,Y]=m.useState(1),[H,U]=m.useState(20),[$,_e]=m.useState(""),[Ne,Se]=m.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[V,ye]=m.useState({}),[W,ue]=m.useState(new Set),[ke,J]=m.useState(new Map),{toast:ee}=et(),De=ua(),{state:Fe,goToStep:ge,registerTour:as}=Bm(),{triggerRestart:ae,isRestarting:Ee}=sn(),ie=m.useRef(null),ve=m.useRef(!0);m.useEffect(()=>{as(Ya,ev)},[as]),m.useEffect(()=>{if(Fe.activeTourId===Ya&&Fe.isRunning){const X=sv[Fe.stepIndex];X&&!window.location.pathname.endsWith(X.replace("/config/",""))&&De({to:X})}},[Fe.stepIndex,Fe.activeTourId,Fe.isRunning,De]);const Me=m.useRef(Fe.stepIndex);m.useEffect(()=>{if(Fe.activeTourId===Ya&&Fe.isRunning){const X=Me.current,z=Fe.stepIndex;X>=3&&X<=9&&z<3&&N(!1),X>=10&&z>=3&&z<=9&&(ye({}),T("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),L(null),G(!1),N(!0)),Me.current=z}},[Fe.stepIndex,Fe.activeTourId,Fe.isRunning]),m.useEffect(()=>{if(Fe.activeTourId!==Ya||!Fe.isRunning)return;const X=z=>{const q=z.target,Be=Fe.stepIndex;Be===2&&q.closest('[data-tour="add-provider-button"]')?setTimeout(()=>ge(3),300):Be===9&&q.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>ge(10),300)};return document.addEventListener("click",X,!0),()=>document.removeEventListener("click",X,!0)},[Fe,ge]),m.useEffect(()=>{Ze()},[]);const Ze=async()=>{try{c(!0);const X=await Xl();n(X.api_providers||[]),g(!1),ve.current=!1}catch(X){console.error("加载配置失败:",X)}finally{c(!1)}},js=async()=>{await ae()},Ot=async()=>{try{x(!0),ie.current&&clearTimeout(ie.current);const X=l.map(st=>({...st,max_retry:st.max_retry??2,timeout:st.timeout??30,retry_interval:st.retry_interval??10})),{shouldProceed:z}=await rs(X,"restart");if(!z){x(!1);return}const q=await Xl(),Be=new Set(X.map(st=>st.name)),_s=(q.models||[]).filter(st=>Be.has(st.api_provider));q.api_providers=X,q.models=_s,await Li(q),g(!1),ee({title:"保存成功",description:"正在重启麦麦..."}),await js()}catch(X){console.error("保存配置失败:",X),ee({title:"保存失败",description:X.message,variant:"destructive"}),x(!1)}},rs=m.useCallback(async(X,z="auto")=>{try{const q=await Xl(),Be=new Set(l.map(bt=>bt.name)),ct=new Set(X.map(bt=>bt.name)),_s=Array.from(Be).filter(bt=>!ct.has(bt));if(_s.length===0)return{shouldProceed:!0,providers:X};const Nt=(q.models||[]).filter(bt=>_s.includes(bt.api_provider));return Nt.length===0?{shouldProceed:!0,providers:X}:(Se({isOpen:!0,providersToDelete:_s,affectedModels:Nt,pendingProviders:X,context:z,oldProviders:[...l]}),{shouldProceed:!1,providers:X})}catch(q){return console.error("检查删除影响失败:",q),{shouldProceed:!0,providers:X}}},[l]),Ps=async()=>{try{(Ne.context==="auto"?f:x)(!0),Se(bt=>({...bt,isOpen:!1}));const z=await Xl(),q=Ne.pendingProviders.map(fo),Be=new Set(q.map(bt=>bt.name)),_s=(z.models||[]).filter(bt=>Be.has(bt.api_provider)),st=new Set(Ne.affectedModels.map(bt=>bt.name)),Nt=z.model_task_config;Nt&&Object.keys(Nt).forEach(bt=>{const ln=Nt[bt];ln&&Array.isArray(ln.model_list)&&(ln.model_list=ln.model_list.filter(Xi=>!st.has(Xi)))}),z.api_providers=q,z.models=_s,z.model_task_config=Nt,await Li(z),n(Ne.pendingProviders),g(!1),ee({title:"删除成功",description:`已删除 ${Ne.providersToDelete.length} 个提供商和 ${Ne.affectedModels.length} 个关联模型`}),Se({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),me(new Set),Ne.context==="restart"&&await js()}catch(X){console.error("删除失败:",X),ee({title:"删除失败",description:X.message,variant:"destructive"})}finally{Ne.context==="auto"?f(!1):x(!1)}},Q=()=>{Ne.oldProviders.length>0&&n(Ne.oldProviders),Se({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},Ge=m.useCallback(async X=>{if(ve.current)return;const{shouldProceed:z}=await rs(X,"auto");if(!z){g(!0);return}try{f(!0);const q=X.map(fo);await Tm("api_providers",q),g(!1)}catch(q){console.error("自动保存失败:",q),ee({title:"自动保存失败",description:q.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[l,rs]);m.useEffect(()=>{if(!ve.current)return g(!0),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{Ge(l)},2e3),()=>{ie.current&&clearTimeout(ie.current)}},[l,Ge]);const He=async()=>{try{x(!0),ie.current&&clearTimeout(ie.current);const X=l.map(fo),{shouldProceed:z}=await rs(X,"manual");if(!z){x(!1);return}const q=await Xl(),Be=new Set(X.map(st=>st.name)),ct=q.models||[],_s=ct.filter(st=>{const Nt=Be.has(st.api_provider);return Nt||console.warn(`模型 "${st.name}" 引用了已删除的提供商 "${st.api_provider}",将被移除`),Nt});if(ct.length!==_s.length){const st=ct.length-_s.length;ee({title:"注意",description:`已自动移除 ${st} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",X),q.api_providers=X,q.models=_s,console.log("完整配置数据:",q),await Li(q),g(!1),ee({title:"保存成功",description:"模型提供商配置已保存"})}catch(X){console.error("保存配置失败:",X),ee({title:"保存失败",description:X.message,variant:"destructive"})}finally{x(!1)}},Ve=(X,z)=>{if(ye({}),X){const q=Ai.find(Be=>Be.base_url===X.base_url&&Be.client_type===X.client_type);T(q?.id||"custom"),w(X)}else T("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});L(z),G(!1),N(!0)},Bs=m.useCallback(X=>{T(X),O(!1);const z=Ai.find(q=>q.id===X);z&&z.id!=="custom"?w(q=>({...q,name:z.name,base_url:z.base_url,client_type:z.client_type})):z?.id==="custom"&&w(q=>({...q,name:"",base_url:"",client_type:"openai"}))},[]),Ce=m.useMemo(()=>D!=="custom",[D]),cs=m.useCallback(async()=>{if(y?.api_key)try{await navigator.clipboard.writeText(y.api_key),ee({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ee({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[y?.api_key,ee]),Es=()=>{if(!y)return;const{isValid:X,errors:z}=b_(y);if(!X){ye(z);return}ye({});const q=fo(y);if(b!==null){const Be=[...l];Be[b]=q,n(Be)}else n([...l,q]);N(!1),w(null),L(null)},zs=X=>{if(!X&&y){const z={...y,max_retry:y.max_retry??2,timeout:y.timeout??30,retry_interval:y.retry_interval??10};w(z)}N(X)},es=X=>{M(X),C(!0)},We=async()=>{if(P!==null){const X=l.filter((q,Be)=>Be!==P),{shouldProceed:z}=await rs(X,"manual");z&&(n(X),ee({title:"删除成功",description:"提供商已从列表中移除"}))}C(!1),M(null)},vs=X=>{const z=new Set(be);z.has(X)?z.delete(X):z.add(X),me(z)},mt=()=>{if(be.size===ss.length)me(new Set);else{const X=ss.map((z,q)=>l.findIndex(Be=>Be===ss[q]));me(new Set(X))}},Rt=()=>{if(be.size===0){ee({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}je(!0)},it=async()=>{const X=l.filter((q,Be)=>!be.has(Be)),{shouldProceed:z}=await rs(X,"manual");z&&(n(X),me(new Set),ee({title:"批量删除成功",description:`已删除 ${be.size} 个提供商`})),je(!1)},ss=m.useMemo(()=>{if(!ce)return l;const X=ce.toLowerCase();return l.filter(z=>z.name.toLowerCase().includes(X)||z.base_url.toLowerCase().includes(X)||z.client_type.toLowerCase().includes(X))},[l,ce]),{totalPages:St,paginatedProviders:$t}=m.useMemo(()=>{const X=Math.ceil(ss.length/H),z=ss.slice((A-1)*H,A*H);return{totalPages:X,paginatedProviders:z}},[ss,A,H]),Mt=m.useCallback(()=>{const X=parseInt($);X>=1&&X<=St&&(Y(X),_e(""))},[$,St]),Ga=async X=>{ue(z=>new Set(z).add(X));try{const z=await s_(X);J(q=>new Map(q).set(X,z)),z.network_ok?z.api_key_valid===!0?ee({title:"连接正常",description:`${X} 网络连接正常,API Key 有效 (${z.latency_ms}ms)`}):z.api_key_valid===!1?ee({title:"连接正常但 Key 无效",description:`${X} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):ee({title:"网络连接正常",description:`${X} 可以访问 (${z.latency_ms}ms)`}):ee({title:"连接失败",description:z.error||"无法连接到提供商",variant:"destructive"})}catch(z){ee({title:"测试失败",description:z.message,variant:"destructive"})}finally{ue(z=>{const q=new Set(z);return q.delete(X),q})}},qa=async()=>{for(const X of l)await Ga(X.name)},Rn=X=>{const z=W.has(X),q=ke.get(X);return z?e.jsxs(Te,{variant:"secondary",className:"gap-1",children:[e.jsx(Js,{className:"h-3 w-3 animate-spin"}),"测试中"]}):q?q.network_ok?q.api_key_valid===!0?e.jsxs(Te,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(oa,{className:"h-3 w-3"}),"正常"]}):q.api_key_valid===!1?e.jsxs(Te,{variant:"destructive",className:"gap-1",children:[e.jsx(Dt,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Te,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(oa,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Te,{variant:"destructive",className:"gap-1",children:[e.jsx(dj,{className:"h-3 w-3"}),"离线"]}):null};return i?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[be.size>0&&e.jsxs(k,{onClick:Rt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ns,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",be.size,")"]}),e.jsxs(k,{onClick:qa,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:l.length===0||W.size>0,children:[e.jsx(Sn,{className:"mr-2 h-4 w-4"}),W.size>0?`测试中 (${W.size})`:"测试全部"]}),e.jsxs(k,{onClick:()=>Ve(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(lt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(k,{onClick:He,disabled:u||h||!p||Ee,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(Ki,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),u?"保存中...":h?"自动保存中...":p?"保存配置":"已保存"]}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsxs(k,{disabled:u||h||Ee,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(Vi,{className:"mr-2 h-4 w-4"}),Ee?"重启中...":p?"保存并重启":"重启麦麦"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重启麦麦?"}),e.jsx(hs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:p?Ot:js,children:p?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(gt,{children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(jt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Je,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索提供商名称、URL 或类型...",value:ce,onChange:X=>de(X.target.value),className:"pl-9"})]}),ce&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",ss.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:ss.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:ce?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):$t.map((X,z)=>{const q=l.findIndex(Be=>Be===X);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:X.name}),Rn(X.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:X.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>Ga(X.name),disabled:W.has(X.name),title:"测试连接",children:W.has(X.name)?e.jsx(Js,{className:"h-4 w-4 animate-spin"}):e.jsx(Sn,{className:"h-4 w-4"})}),e.jsx(k,{variant:"default",size:"sm",onClick:()=>Ve(X,q),children:e.jsx(Cn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(k,{size:"sm",onClick:()=>es(q),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(ns,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),e.jsx("p",{className:"font-medium",children:X.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:X.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:X.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:X.retry_interval})]})]})]},z)})}),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(wl,{children:[e.jsx(_l,{children:e.jsxs(nt,{children:[e.jsx(Qe,{className:"w-12",children:e.jsx(Xs,{checked:be.size===ss.length&&ss.length>0,onCheckedChange:mt})}),e.jsx(Qe,{children:"状态"}),e.jsx(Qe,{children:"名称"}),e.jsx(Qe,{children:"基础URL"}),e.jsx(Qe,{children:"客户端类型"}),e.jsx(Qe,{className:"text-right",children:"最大重试"}),e.jsx(Qe,{className:"text-right",children:"超时(秒)"}),e.jsx(Qe,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Qe,{className:"text-right",children:"操作"})]})}),e.jsx(Sl,{children:$t.length===0?e.jsx(nt,{children:e.jsx(Ie,{colSpan:9,className:"text-center text-muted-foreground py-8",children:ce?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):$t.map((X,z)=>{const q=l.findIndex(Be=>Be===X);return e.jsxs(nt,{children:[e.jsx(Ie,{children:e.jsx(Xs,{checked:be.has(q),onCheckedChange:()=>vs(q)})}),e.jsx(Ie,{children:Rn(X.name)||e.jsx(Te,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ie,{className:"font-medium",children:X.name}),e.jsx(Ie,{className:"max-w-xs truncate",title:X.base_url,children:X.base_url}),e.jsx(Ie,{children:X.client_type}),e.jsx(Ie,{className:"text-right",children:X.max_retry}),e.jsx(Ie,{className:"text-right",children:X.timeout}),e.jsx(Ie,{className:"text-right",children:X.retry_interval}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>Ga(X.name),disabled:W.has(X.name),title:"测试连接",children:W.has(X.name)?e.jsx(Js,{className:"h-4 w-4 animate-spin"}):e.jsx(Sn,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"default",size:"sm",onClick:()=>Ve(X,q),children:[e.jsx(Cn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(k,{size:"sm",onClick:()=>es(q),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},z)})})]})})}),ss.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Le,{value:H.toString(),onValueChange:X=>{U(parseInt(X)),Y(1),me(new Set)},children:[e.jsx(Oe,{id:"page-size-provider",className:"w-20",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(A-1)*H+1," 到"," ",Math.min(A*H,ss.length)," 条,共 ",ss.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>Y(1),disabled:A===1,className:"hidden sm:flex",children:e.jsx(zr,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>Y(X=>Math.max(1,X-1)),disabled:A===1,children:[e.jsx(Wa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:$,onChange:X=>_e(X.target.value),onKeyDown:X=>X.key==="Enter"&&Mt(),placeholder:A.toString(),className:"w-16 h-8 text-center",min:1,max:St}),e.jsx(k,{variant:"outline",size:"sm",onClick:Mt,disabled:!$,className:"h-8",children:"跳转"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>Y(X=>X+1),disabled:A>=St,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>Y(St),disabled:A>=St,className:"hidden sm:flex",children:e.jsx(Dr,{className:"h-4 w-4"})})]})]})]}),e.jsx(Is,{open:v,onOpenChange:zs,children:e.jsxs(Rs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:Fe.isRunning,children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:b!==null?"编辑提供商":"添加提供商"}),e.jsx(Zs,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:X=>{X.preventDefault(),Es()},autoComplete:"off",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[e.jsx(E,{htmlFor:"template",children:"提供商模板"}),e.jsxs(Xa,{open:F,onOpenChange:O,children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",role:"combobox","aria-expanded":F,className:"w-full justify-between",children:[D?Ai.find(X=>X.id===D)?.display_name:"选择提供商模板...",e.jsx(Om,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ia,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs($o,{children:[e.jsx(Ho,{placeholder:"搜索提供商模板..."}),e.jsx(Je,{className:"h-[300px]",children:e.jsxs(Io,{className:"max-h-none overflow-visible",children:[e.jsx(Po,{children:"未找到匹配的模板"}),e.jsx(Ii,{children:Ai.map(X=>e.jsxs(Pi,{value:X.display_name,onSelect:()=>Bs(X.id),children:[e.jsx(_t,{className:`mr-2 h-4 w-4 ${D===X.id?"opacity-100":"opacity-0"}`}),X.display_name]},X.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(E,{htmlFor:"name",className:V.name?"text-destructive":"",children:"名称 *"}),e.jsx(re,{id:"name",value:y?.name||"",onChange:X=>{w(z=>z?{...z,name:X.target.value}:null),V.name&&ye(z=>({...z,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:V.name?"border-destructive focus-visible:ring-destructive":""}),V.name&&e.jsx("p",{className:"text-xs text-destructive",children:V.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(E,{htmlFor:"base_url",className:V.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(re,{id:"base_url",value:y?.base_url||"",onChange:X=>{w(z=>z?{...z,base_url:X.target.value}:null),V.base_url&&ye(z=>({...z,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:Ce,className:`${Ce?"bg-muted cursor-not-allowed":""} ${V.base_url?"border-destructive focus-visible:ring-destructive":""}`}),V.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:V.base_url}),Ce&&!V.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(E,{htmlFor:"api_key",className:V.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{id:"api_key",type:Z?"text":"password",value:y?.api_key||"",onChange:X=>{w(z=>z?{...z,api_key:X.target.value}:null),V.api_key&&ye(z=>({...z,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${V.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(k,{type:"button",variant:"outline",size:"icon",onClick:()=>G(!Z),title:Z?"隐藏密钥":"显示密钥",children:Z?e.jsx(Bi,{className:"h-4 w-4"}):e.jsx(Xt,{className:"h-4 w-4"})}),e.jsx(k,{type:"button",variant:"outline",size:"icon",onClick:cs,title:"复制密钥",children:e.jsx(_o,{className:"h-4 w-4"})})]}),V.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:V.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Le,{value:y?.client_type||"openai",onValueChange:X=>w(z=>z?{...z,client_type:X}:null),disabled:Ce,children:[e.jsx(Oe,{id:"client_type",className:Ce?"bg-muted cursor-not-allowed":"",children:e.jsx(Ue,{placeholder:"选择客户端类型"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"openai",children:"OpenAI"}),e.jsx(le,{value:"gemini",children:"Gemini"})]})]}),Ce&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(re,{id:"max_retry",type:"number",min:"0",value:y?.max_retry??"",onChange:X=>{const z=X.target.value===""?null:parseInt(X.target.value);w(q=>q?{...q,max_retry:z}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(re,{id:"timeout",type:"number",min:"1",value:y?.timeout??"",onChange:X=>{const z=X.target.value===""?null:parseInt(X.target.value);w(q=>q?{...q,timeout:z}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(re,{id:"retry_interval",type:"number",min:"1",value:y?.retry_interval??"",onChange:X=>{const z=X.target.value===""?null:parseInt(X.target.value);w(q=>q?{...q,retry_interval:z}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(rt,{children:[e.jsx(k,{type:"button",variant:"outline",onClick:()=>N(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(k,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(gs,{open:S,onOpenChange:C,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除提供商 "',P!==null?l[P]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:We,children:"删除"})]})]})}),e.jsx(gs,{open:pe,onOpenChange:je,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",be.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:it,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(gs,{open:Ne.isOpen,onOpenChange:X=>Se(z=>({...z,isOpen:X})),children:e.jsxs(ds,{className:"max-w-2xl",children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除提供商"}),e.jsx(hs,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:Ne.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",Ne.affectedModels.length," 个关联的模型:"]}),e.jsx(Je,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:Ne.affectedModels.map((X,z)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-mono text-muted-foreground",children:"•"}),e.jsx("span",{className:"ml-2 font-medium",children:X.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",X.model_identifier,")"]})]},z))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:Q,children:"取消"}),e.jsx(fs,{onClick:Ps,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),e.jsx(On,{})]})}function tv(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function av(l){return typeof l=="boolean"?"boolean":typeof l=="number"?"number":"string"}function __(l,n){switch(n){case"boolean":return l==="true";case"number":{const i=parseFloat(l);return isNaN(i)?0:i}default:return l}}function rg(l){return Object.entries(l).map(([n,i])=>({id:tv(),key:n,value:i,type:av(i)}))}function hm(l){const n={};for(const i of l)i.key.trim()&&(n[i.key.trim()]=i.value);return n}function fm(l){if(!l.trim())return{valid:!0,parsed:{}};try{const n=JSON.parse(l);if(typeof n!="object"||n===null||Array.isArray(n))return{valid:!1,error:"必须是一个 JSON 对象 {}"};for(const[i,c]of Object.entries(n))if(c!==null&&!["string","number","boolean"].includes(typeof c))return{valid:!1,error:`键 "${i}" 的值类型不支持(仅支持 string/number/boolean)`};return{valid:!0,parsed:n}}catch{return{valid:!1,error:"JSON 格式错误"}}}function S_(l){switch(l){case"boolean":return"布尔";case"number":return"数字";default:return"字符串"}}function C_(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 k_({value:l,onChange:n,className:i,placeholder:c="添加额外参数..."}){const[u,x]=m.useState("list"),h=m.useMemo(()=>rg(l||{}),[l]),f=m.useMemo(()=>Object.keys(l||{}).length>0?JSON.stringify(l,null,2):"",[l]),[p,g]=m.useState(h),[v,N]=m.useState(f),[y,w]=m.useState(null);m.useEffect(()=>{g(h),N(f)},[h,f]);const b=m.useMemo(()=>{const S=fm(v);return S.valid&&S.parsed?{success:!0,data:S.parsed}:{success:!1,data:{}}},[v]),L=m.useCallback(S=>{const C=S;if(C==="json"&&u==="list"){const P=hm(p);N(Object.keys(P).length>0?JSON.stringify(P,null,2):""),w(null)}else if(C==="list"&&u==="json"){const P=fm(v);P.valid&&P.parsed&&(g(rg(P.parsed)),w(null))}x(C)},[u,p,v]),D=m.useCallback(()=>{const S={id:tv(),key:"",value:"",type:"string"},C=[...p,S];g(C)},[p]),T=m.useCallback(S=>{const C=p.filter(P=>P.id!==S);g(C),n(hm(C))},[p,n]),F=m.useCallback((S,C,P)=>{const M=p.map(Z=>{if(Z.id!==S)return Z;if(C==="type"){const G=P;let ce;return G==="boolean"?ce=Z.value==="true"||Z.value===!0:G==="number"?ce=typeof Z.value=="number"?Z.value:parseFloat(String(Z.value))||0:ce=String(Z.value),{...Z,type:G,value:ce}}else return C==="value"?{...Z,value:__(P,Z.type)}:{...Z,[C]:P}});g(M),n(hm(M))},[p,n]),O=m.useCallback(S=>{N(S);const C=fm(S);C.valid&&C.parsed?(w(null),n(C.parsed)):w(C.error||"JSON 格式错误")},[n]);return e.jsxs("div",{className:B("space-y-3",i),children:[e.jsx(E,{className:"text-sm font-medium",children:"额外参数"}),e.jsxs(da,{value:u,onValueChange:L,className:"w-full",children:[e.jsxs(Zt,{className:"h-8 p-0.5 bg-muted/60",children:[e.jsx(Xe,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"键值对"}),e.jsx(Xe,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON"})]}),e.jsxs(ys,{value:"list",className:"mt-3 space-y-2",children:[p.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:c}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 text-xs text-muted-foreground px-1",children:[e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),p.map(S=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 items-center",children:[e.jsx(re,{value:S.key,onChange:C=>F(S.id,"key",C.target.value),placeholder:"key",className:"h-8 text-sm"}),S.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Pe,{checked:S.value===!0,onCheckedChange:C=>F(S.id,"value",String(C))}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:S.value?"true":"false"})]}):e.jsx(re,{type:S.type==="number"?"number":"text",value:S.value,onChange:C=>F(S.id,"value",C.target.value),placeholder:"value",className:"h-8 text-sm",step:S.type==="number"?"any":void 0}),e.jsxs(Le,{value:S.type,onValueChange:C=>F(S.id,"type",C),children:[e.jsx(Oe,{className:"h-8 text-xs",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"string",children:"字符串"}),e.jsx(le,{value:"number",children:"数字"}),e.jsx(le,{value:"boolean",children:"布尔"})]})]}),e.jsx(k,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>T(S.id),children:e.jsx(ns,{className:"h-4 w-4"})})]},S.id))]}),e.jsxs(k,{type:"button",variant:"outline",size:"sm",className:"w-full h-8",onClick:D,children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),"添加参数"]})]}),e.jsx(ys,{value:"json",className:"mt-3",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),y?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(Dt,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:y})]}):v.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(_t,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(Ys,{value:v,onChange:S=>O(S.target.value),placeholder:`{ - "key": "value" -}`,className:B("font-mono text-sm min-h-[140px] h-[140px] resize-y flex-1",y&&"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:b.success&&Object.keys(b.data).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(b.data).map(([S,C])=>{const P=av(C);return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("code",{className:"px-1.5 py-0.5 bg-background rounded text-xs font-medium",children:S}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:B("font-mono",P==="boolean"&&(C?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),P==="number"&&"text-blue-600 dark:text-blue-400",P==="string"&&"text-amber-600 dark:text-amber-400"),children:P==="string"?`"${C}"`:String(C)}),e.jsx(Te,{variant:"secondary",className:B("h-5 text-[10px] px-1.5",C_(P)),children:S_(P)})]},S)})}):b.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})]})}const Rr="https://maibot-plugin-stats.maibot-webui.workers.dev";async function T_(l){const n=new URLSearchParams;l?.status&&n.set("status",l.status),l?.page&&n.set("page",l.page.toString()),l?.page_size&&n.set("page_size",l.page_size.toString()),l?.search&&n.set("search",l.search),l?.sort_by&&n.set("sort_by",l.sort_by),l?.sort_order&&n.set("sort_order",l.sort_order);const i=await fetch(`${Rr}/pack?${n.toString()}`);if(!i.ok)throw new Error(`获取 Pack 列表失败: ${i.status}`);return i.json()}async function E_(l){const n=await fetch(`${Rr}/pack/${l}`);if(!n.ok)throw new Error(`获取 Pack 失败: ${n.status}`);const i=await n.json();if(!i.success)throw new Error(i.error||"获取 Pack 失败");return i.pack}async function M_(l){const i=await(await fetch(`${Rr}/pack`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.error||"创建 Pack 失败");return i}async function A_(l,n){await fetch(`${Rr}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})}async function lv(l,n){const c=await(await fetch(`${Rr}/pack/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})).json();if(!c.success)throw new Error(c.error||"点赞失败");return{likes:c.likes,liked:c.liked}}async function nv(l,n){return(await(await fetch(`${Rr}/pack/like/check?pack_id=${l}&user_id=${n}`)).json()).liked||!1}async function z_(l){const n=await we("/api/webui/config/model");if(!n.ok)throw new Error("获取当前模型配置失败");const i=await n.json(),c=i.config||i;console.log("=== Pack Conflict Detection ==="),console.log("Pack providers:",l.providers),console.log("Local providers:",c.api_providers);const u={existing_providers:[],new_providers:[],conflicting_models:[]},x=c.api_providers||[];for(const f of l.providers){console.log(` -Checking pack provider: ${f.name}`),console.log(` Pack URL: ${f.base_url}`),console.log(` Normalized: ${pm(f.base_url)}`);const p=x.filter(g=>{const v=pm(g.base_url),N=pm(f.base_url);return console.log(` Comparing with local "${g.name}": ${g.base_url}`),console.log(` Local normalized: ${v}`),console.log(` Match: ${v===N}`),v===N});p.length>0?(console.log(` ✓ Matched with ${p.length} local provider(s):`,p.map(g=>g.name).join(", ")),u.existing_providers.push({pack_provider:f,local_providers:p.map(g=>({name:g.name,base_url:g.base_url}))})):(console.log(" ✗ No match found - will need API key"),u.new_providers.push(f))}const h=c.models||[];console.log(` -=== Model Conflict Detection ===`);for(const f of l.models){const p=h.find(g=>g.name===f.name);p&&(console.log(`Model conflict: ${f.name}`),u.conflicting_models.push({pack_model:f.name,local_model:p.name}))}return console.log(` -=== Detection Summary ===`),console.log(`Existing providers: ${u.existing_providers.length}`),console.log(`New providers: ${u.new_providers.length}`),console.log(`Conflicting models: ${u.conflicting_models.length}`),console.log(`=========================== -`),u}async function D_(l,n,i,c){const u=await we("/api/webui/config/model");if(!u.ok)throw new Error("获取当前模型配置失败");const x=await u.json(),h=x.config||x;if(n.apply_providers){const p=n.selected_providers?l.providers.filter(g=>n.selected_providers.includes(g.name)):l.providers;for(const g of p){if(i[g.name])continue;const v=c[g.name];if(!v)throw new Error(`提供商 "${g.name}" 缺少 API Key`);const N={...g,api_key:v},y=h.api_providers.findIndex(w=>w.name===g.name);y>=0?h.api_providers[y]=N:h.api_providers.push(N)}}if(n.apply_models){const p=n.selected_models?l.models.filter(g=>n.selected_models.includes(g.name)):l.models;for(const g of p){const v=i[g.api_provider]||g.api_provider,N={...g,api_provider:v},y=h.models.findIndex(w=>w.name===g.name);y>=0?h.models[y]=N:h.models.push(N)}}if(n.apply_task_config){const p=n.selected_tasks||Object.keys(l.task_config);for(const g of p){const v=l.task_config[g];if(!v)continue;const N=new Set(n.selected_models||l.models.map(b=>b.name)),y=v.model_list.filter(b=>N.has(b));if(y.length===0)continue;const w={...v,model_list:y};if(n.task_mode==="replace")h.model_task_config[g]=w;else{const b=h.model_task_config[g];if(b){const L=[...new Set([...b.model_list,...y])];h.model_task_config[g]={...b,model_list:L}}else h.model_task_config[g]=w}}}if(!(await we("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("保存配置失败")}async function O_(l){const n=await we("/api/webui/config/model");if(!n.ok)throw new Error("获取当前模型配置失败");const i=await n.json();if(!i.success||!i.config)throw new Error("获取配置失败");const c=i.config;let u=(c.api_providers||[]).map(g=>({name:g.name,base_url:g.base_url,client_type:g.client_type,max_retry:g.max_retry,timeout:g.timeout,retry_interval:g.retry_interval}));l.selectedProviders&&(u=u.filter(g=>l.selectedProviders.includes(g.name)));let x=c.models||[];l.selectedModels&&(x=x.filter(g=>l.selectedModels.includes(g.name)));const h={},f=c.model_task_config||{},p=l.selectedTasks||Object.keys(f);for(const g of p)f[g]&&(h[g]=f[g]);return{providers:u,models:x,task_config:h}}function pm(l){try{const n=new URL(l);return`${n.protocol}//${n.host}${n.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return l.toLowerCase().replace(/\/$/,"")}}function rv(){const l="maibot_pack_user_id";let n=localStorage.getItem(l);return n||(n="pack_user_"+Math.random().toString(36).substring(2,15),localStorage.setItem(l,n)),n}const R_={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"},L_=["官方推荐","性价比","高性能","免费模型","国内可用","海外模型","OpenAI","Claude","Gemini","国产模型","多模态","轻量级"];function U_({trigger:l}){const[n,i]=m.useState(!1),[c,u]=m.useState(1),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[g,v]=m.useState([]),[N,y]=m.useState([]),[w,b]=m.useState({}),[L,D]=m.useState(new Set),[T,F]=m.useState(new Set),[O,S]=m.useState(new Set),[C,P]=m.useState(""),[M,Z]=m.useState(""),[G,ce]=m.useState(""),[de,be]=m.useState([]);m.useEffect(()=>{n&&c===1&&me()},[n,c]);const me=async()=>{h(!0);try{const V=await O_({name:"",description:"",author:""});v(V.providers),y(V.models),b(V.task_config),D(new Set(V.providers.map(ye=>ye.name))),F(new Set(V.models.map(ye=>ye.name))),S(new Set(Object.keys(V.task_config)))}catch(V){console.error("加载配置失败:",V),Ft({title:"加载当前配置失败",variant:"destructive"})}finally{h(!1)}},pe=V=>{const ye=new Set(L),W=new Set(T),ue=new Set(O);ye.has(V)?(ye.delete(V),N.filter(J=>J.api_provider===V).forEach(J=>W.delete(J.name)),Object.entries(w).forEach(([J,ee])=>{ee.model_list&&(ee.model_list.some(Fe=>W.has(Fe))||ue.delete(J))})):(ye.add(V),N.filter(J=>J.api_provider===V).forEach(J=>W.add(J.name)),Object.entries(w).forEach(([J,ee])=>{ee.model_list&&ee.model_list.some(Fe=>{const ge=N.find(as=>as.name===Fe);return ge&&ge.api_provider===V})&&ue.add(J)})),D(ye),F(W),S(ue)},je=V=>{const ye=new Set(T),W=new Set(O);ye.has(V)?(ye.delete(V),Object.entries(w).forEach(([ue,ke])=>{ke.model_list&&(ke.model_list.some(ee=>ye.has(ee))||W.delete(ue))})):(ye.add(V),Object.entries(w).forEach(([ue,ke])=>{ke.model_list&&ke.model_list.includes(V)&&W.add(ue)})),F(ye),S(W)},A=V=>{const ye=new Set(O);ye.has(V)?ye.delete(V):ye.add(V),S(ye)},Y=V=>{de.includes(V)?be(de.filter(ye=>ye!==V)):de.length<5?be([...de,V]):Ft({title:"最多选择 5 个标签",variant:"destructive"})},H=()=>{L.size===g.length?D(new Set):D(new Set(g.map(V=>V.name)))},U=()=>{T.size===N.length?F(new Set):F(new Set(N.map(V=>V.name)))},$=()=>{const V=Object.keys(w);O.size===V.length?S(new Set):S(new Set(V))},_e=async()=>{if(!C.trim()){Ft({title:"请输入模板名称",variant:"destructive"});return}if(!M.trim()){Ft({title:"请输入模板描述",variant:"destructive"});return}if(!G.trim()){Ft({title:"请输入作者名称",variant:"destructive"});return}if(L.size===0&&T.size===0&&O.size===0){Ft({title:"请至少选择一项配置",variant:"destructive"});return}p(!0);try{const V=g.filter(ue=>L.has(ue.name)),ye=N.filter(ue=>T.has(ue.name)),W={};for(const[ue,ke]of Object.entries(w))O.has(ue)&&(W[ue]=ke);await M_({name:C.trim(),description:M.trim(),author:G.trim(),tags:de,providers:V,models:ye,task_config:W}),Ft({title:"模板已提交审核,审核通过后将显示在市场中"}),i(!1),Ne()}catch(V){console.error("提交失败:",V),Ft({title:V instanceof Error?V.message:"提交失败",variant:"destructive"})}finally{p(!1)}},Ne=()=>{u(1),P(""),Z(""),ce(""),be([]),D(new Set),F(new Set),S(new Set)},Se=2;return e.jsxs(Is,{open:n,onOpenChange:i,children:[e.jsx(Bo,{asChild:!0,children:l||e.jsxs(k,{variant:"outline",children:[e.jsx(gj,{className:"w-4 h-4 mr-2"}),"分享配置"]})}),e.jsxs(Rs,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs(Ls,{children:[e.jsxs(Us,{className:"flex items-center gap-2",children:[e.jsx(ca,{className:"w-5 h-5"}),"分享配置模板"]}),e.jsxs(Zs,{children:["步骤 ",c," / ",Se,":",c===1&&"选择要分享的配置",c===2&&"填写模板信息"]})]}),e.jsx(Je,{className:"h-[calc(85vh-220px)] pr-4",children:x?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Js,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在加载当前配置..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(gt,{children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsx(_n,{children:"安全提示"}),e.jsxs(jt,{children:["分享的配置将",e.jsx("strong",{children:"不包含"})," API Key,其他用户需要自行配置。"]})]}),e.jsxs(da,{defaultValue:"providers",className:"w-full",children:[e.jsxs(Zt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"providers",children:[e.jsx(yl,{className:"w-4 h-4 mr-2"}),"API 提供商",e.jsxs(Te,{variant:"secondary",className:"ml-2",children:[L.size,"/",g.length]})]}),e.jsxs(Xe,{value:"models",children:[e.jsx(kn,{className:"w-4 h-4 mr-2"}),"模型配置",e.jsxs(Te,{variant:"secondary",className:"ml-2",children:[T.size,"/",N.length]})]}),e.jsxs(Xe,{value:"tasks",children:[e.jsx(Tn,{className:"w-4 h-4 mr-2"}),"任务配置",e.jsxs(Te,{variant:"secondary",className:"ml-2",children:[O.size,"/",Object.keys(w).length]})]})]}),e.jsx(ys,{value:"providers",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(k,{variant:"ghost",size:"sm",onClick:H,children:L.size===g.length?"取消全选":"全选"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无提供商配置"}):g.map(V=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Xs,{id:`provider-${V.name}`,checked:L.has(V.name),onCheckedChange:()=>pe(V.name)}),e.jsxs(E,{htmlFor:`provider-${V.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:V.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:V.base_url})]}),e.jsx(Te,{variant:"outline",className:"text-xs",children:V.client_type})]},V.name))]})}),e.jsx(ys,{value:"models",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(k,{variant:"ghost",size:"sm",onClick:U,children:T.size===N.length?"取消全选":"全选"})}),N.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无模型配置"}):N.map(V=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Xs,{id:`model-${V.name}`,checked:T.has(V.name),onCheckedChange:()=>je(V.name)}),e.jsxs(E,{htmlFor:`model-${V.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:V.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:V.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:V.api_provider})]},V.name))]})}),e.jsx(ys,{value:"tasks",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(k,{variant:"ghost",size:"sm",onClick:$,children:O.size===Object.keys(w).length?"取消全选":"全选"})}),Object.keys(w).length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无任务配置"}):Object.entries(w).map(([V,ye])=>e.jsxs("div",{className:"space-y-2 p-2 rounded hover:bg-muted",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:`task-${V}`,checked:O.has(V),onCheckedChange:()=>A(V)}),e.jsx(E,{htmlFor:`task-${V}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:R_[V]||V})}),e.jsxs(Te,{variant:"outline",className:"text-xs",children:[ye.model_list.length," 个模型"]})]}),ye.model_list&&ye.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:ye.model_list.map(W=>{const ue=N.find(J=>J.name===W),ke=T.has(W);return e.jsxs(Te,{variant:ke?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>je(W),children:[W,ue&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",ue.api_provider,")"]})]},W)})})]},V))]})})]})]}),c===2&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 text-sm p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(yl,{className:"w-4 h-4"}),L.size," 个提供商"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(kn,{className:"w-4 h-4"}),T.size," 个模型"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Tn,{className:"w-4 h-4"}),O.size," 个任务"]})]}),e.jsx(Or,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"pack-name",children:"模板名称 *"}),e.jsx(re,{id:"pack-name",placeholder:"例如:高性价比国产模型配置",value:C,onChange:V=>P(V.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[C.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"pack-description",children:"模板描述 *"}),e.jsx(Ys,{id:"pack-description",placeholder:"详细描述这个配置模板的特点、适用场景等...",value:M,onChange:V=>Z(V.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[M.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"pack-author",children:"作者名称 *"}),e.jsx(re,{id:"pack-author",placeholder:"你的昵称或 ID",value:G,onChange:V=>ce(V.target.value),maxLength:30})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"标签(可选,最多 5 个)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:L_.map(V=>e.jsxs(Te,{variant:de.includes(V)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>Y(V),children:[de.includes(V)&&e.jsx(_t,{className:"w-3 h-3 mr-1"}),e.jsx(Rm,{className:"w-3 h-3 mr-1"}),V]},V))})]})]}),e.jsxs(gt,{children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsx(_n,{children:"审核说明"}),e.jsx(jt,{children:"提交后需要经过审核才能在市场中展示。审核通常在 1-3 个工作日内完成。"})]})]})]})}),e.jsxs(rt,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(k,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{variant:"outline",onClick:()=>{i(!1),Ne()},disabled:f,children:"取消"}),cu(c+1),disabled:x||L.size===0&&T.size===0&&O.size===0,children:"下一步"}):e.jsxs(k,{onClick:_e,disabled:f,children:[f&&e.jsx(Js,{className:"w-4 h-4 mr-2 animate-spin"}),"提交审核"]})]})]})]})]})}function B_({value:l,label:n,onRemove:i}){const{attributes:c,listeners:u,setNodeRef:x,transform:h,transition:f,isDragging:p}=Oj({id:l}),g={transform:Rj.Transform.toString(h),transition:f,opacity:p?.5:1},v=y=>{y.preventDefault(),y.stopPropagation(),i(l)},N=y=>{y.stopPropagation()};return e.jsx("div",{ref:x,style:g,className:B("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(Te,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...c,...u,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(hj,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:n}),e.jsx("button",{type:"button",className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive",onClick:v,onPointerDown:N,onMouseDown:y=>y.stopPropagation(),children:e.jsx(Da,{className:"h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function $_({options:l,selected:n,onChange:i,placeholder:c="选择选项...",emptyText:u="未找到选项",className:x}){const[h,f]=m.useState(!1),p=Cj(Co(Ej,{activationConstraint:{distance:8}}),Co(Tj,{coordinateGetter:kj})),g=y=>{n.includes(y)?i(n.filter(w=>w!==y)):i([...n,y])},v=y=>{i(n.filter(w=>w!==y))},N=y=>{const{active:w,over:b}=y;if(b&&w.id!==b.id){const L=n.indexOf(w.id),D=n.indexOf(b.id);i(Mj(n,L,D))}};return e.jsxs(Xa,{open:h,onOpenChange:f,children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",role:"combobox","aria-expanded":h,className:B("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(Aj,{sensors:p,collisionDetection:zj,onDragEnd:N,children:e.jsx(Dj,{items:n,strategy:l1,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:n.length===0?e.jsx("span",{className:"text-muted-foreground",children:c}):n.map(y=>{const w=l.find(b=>b.value===y);return e.jsx(B_,{value:y,label:w?.label||y,onRemove:v},y)})})})}),e.jsx(Om,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Ia,{className:"w-full p-0",align:"start",children:e.jsxs($o,{children:[e.jsx(Ho,{placeholder:"搜索...",className:"h-9"}),e.jsxs(Io,{children:[e.jsx(Po,{children:u}),e.jsx(Ii,{children:l.map(y=>{const w=n.includes(y.value);return e.jsxs(Pi,{value:y.value,onSelect:()=>g(y.value),children:[e.jsx("div",{className:B("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",w?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(_t,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:y.label})]},y.value)})})]})]})})]})}const $a=Ts.memo(function({title:n,description:i,taskConfig:c,modelNames:u,onChange:x,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:p}){const g=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:n}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:i})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":p,children:[e.jsx(E,{children:"模型列表"}),e.jsx($_,{options:u.map(v=>({label:v,value:v})),selected:c.model_list||[],onChange:g,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!h&&e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{children:"温度"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"1",value:c.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(Na,{value:[c.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(E,{children:"最大 Token"}),e.jsx(re,{type:"number",step:"1",min:"1",value:c.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(E,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(re,{type:"number",step:"1",min:"1",value:c.slow_threshold??15,onChange: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:"模型响应时间超过此阈值将输出警告日志"})]})]})]})}),H_=Ts.memo(function({paginatedModels:n,allModels:i,onEdit:c,onDelete:u,isModelUsed:x,searchQuery:h}){return n.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:h?"未找到匹配的模型":"暂无模型配置"}):e.jsx("div",{className:"md:hidden space-y-3",children:n.map((f,p)=>{const g=i.findIndex(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(Te,{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(k,{variant:"default",size:"sm",onClick:()=>c(f,g),children:[e.jsx(Cn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(k,{size:"sm",onClick:()=>u(g),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),e.jsx("p",{className:"font-medium",children:f.api_provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"模型温度"}),e.jsx("p",{className:"font-medium",children:f.temperature!=null?f.temperature:e.jsx("span",{className:"text-muted-foreground",children:"默认"})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_in,"/M"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_out,"/M"]})]})]})]},p)})})}),I_=Ts.memo(function({paginatedModels:n,allModels:i,filteredModels:c,selectedModels:u,onEdit:x,onDelete:h,onToggleSelection:f,onToggleSelectAll:p,isModelUsed:g,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(wl,{children:[e.jsx(_l,{children:e.jsxs(nt,{children:[e.jsx(Qe,{className:"w-12",children:e.jsx(Xs,{checked:u.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(Qe,{className:"w-24",children:"使用状态"}),e.jsx(Qe,{children:"模型名称"}),e.jsx(Qe,{children:"模型标识符"}),e.jsx(Qe,{children:"提供商"}),e.jsx(Qe,{className:"text-center",children:"温度"}),e.jsx(Qe,{className:"text-right",children:"输入价格"}),e.jsx(Qe,{className:"text-right",children:"输出价格"}),e.jsx(Qe,{className:"text-right",children:"操作"})]})}),e.jsx(Sl,{children:n.length===0?e.jsx(nt,{children:e.jsx(Ie,{colSpan:9,className:"text-center text-muted-foreground py-8",children:v?"未找到匹配的模型":"暂无模型配置"})}):n.map((N,y)=>{const w=i.findIndex(L=>L===N),b=g(N.name);return e.jsxs(nt,{children:[e.jsx(Ie,{children:e.jsx(Xs,{checked:u.has(w),onCheckedChange:()=>f(w)})}),e.jsx(Ie,{children:e.jsx(Te,{variant:b?"default":"secondary",className:b?"bg-green-600 hover:bg-green-700":"",children:b?"已使用":"未使用"})}),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(k,{variant:"default",size:"sm",onClick:()=>x(N,w),children:[e.jsx(Cn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(k,{size:"sm",onClick:()=>h(w),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},y)})})]})})})}),P_=300*1e3,ig=new Map,G_=[10,20,50,100],q_=Ts.memo(function({page:n,pageSize:i,totalItems:c,jumpToPage:u,onPageChange:x,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:p,onSelectionClear:g}){const v=Math.ceil(c/i),N=w=>{h(parseInt(w)),x(1),g?.()},y=w=>{w.key==="Enter"&&p()};return c===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Le,{value:i.toString(),onValueChange:N,children:[e.jsx(Oe,{id:"page-size-model",className:"w-20",children:e.jsx(Ue,{})}),e.jsx(Re,{children:G_.map(w=>e.jsx(le,{value:w.toString(),children:w},w))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(n-1)*i+1," 到"," ",Math.min(n*i,c)," 条,共 ",c," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:n===1,className:"hidden sm:flex",children:e.jsx(zr,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,n-1)),disabled:n===1,children:[e.jsx(Wa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:u,onChange:w=>f(w.target.value),onKeyDown:y,placeholder:n.toString(),className:"w-16 h-8 text-center",min:1,max:v}),e.jsx(k,{variant:"outline",size:"sm",onClick:p,disabled:!u,className:"h-8",children:"跳转"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>x(n+1),disabled:n>=v,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>x(v),disabled:n>=v,className:"hidden sm:flex",children:e.jsx(Dr,{className:"h-4 w-4"})})]})]})});function F_(l){const{models:n,taskConfig:i,debounceMs:c=2e3,onSavingChange:u,onUnsavedChange:x}=l,h=m.useRef(null),f=m.useRef(null),p=m.useRef(!0),g=m.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),v=m.useCallback(w=>{const b={model_identifier:w.model_identifier,name:w.name,api_provider:w.api_provider,price_in:w.price_in??0,price_out:w.price_out??0,force_stream_mode:w.force_stream_mode??!1,extra_params:w.extra_params??{}};return w.temperature!=null&&(b.temperature=w.temperature),w.max_tokens!=null&&(b.max_tokens=w.max_tokens),b},[]),N=m.useCallback(async w=>{try{u?.(!0);const b=w.map(v);await Tm("models",b),x?.(!1)}catch(b){console.error("自动保存模型列表失败:",b),x?.(!0)}finally{u?.(!1)}},[u,x,v]),y=m.useCallback(async w=>{try{u?.(!0),await Tm("model_task_config",w),x?.(!1)}catch(b){console.error("自动保存任务配置失败:",b),x?.(!0)}finally{u?.(!1)}},[u,x]);return m.useEffect(()=>{if(!p.current)return x?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{N(n)},c),()=>{h.current&&clearTimeout(h.current)}},[n,N,c,x]),m.useEffect(()=>{if(!(p.current||!i))return x?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{y(i)},c),()=>{f.current&&clearTimeout(f.current)}},[i,y,c,x]),m.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function V_(l={}){const{onCloseEditDialog:n}=l,i=ua(),{registerTour:c,startTour:u,state:x,goToStep:h}=Bm(),f=m.useRef(x.stepIndex);return m.useEffect(()=>{c(Ya,ev)},[c]),m.useEffect(()=>{if(x.activeTourId===Ya&&x.isRunning){const g=sv[x.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&i({to:g})}},[x.stepIndex,x.activeTourId,x.isRunning,i]),m.useEffect(()=>{if(x.activeTourId===Ya&&x.isRunning){const g=f.current,v=x.stepIndex;g>=12&&g<=17&&v<12&&n?.(),f.current=v}},[x.stepIndex,x.activeTourId,x.isRunning,n]),m.useEffect(()=>{if(x.activeTourId!==Ya||!x.isRunning)return;const g=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",g,!0),()=>document.removeEventListener("click",g,!0)},[x,h]),{startTour:m.useCallback(()=>{u(Ya)},[u]),isRunning:x.isRunning&&x.activeTourId===Ya,stepIndex:x.stepIndex}}function K_(l){const{getProviderConfig:n}=l,[i,c]=m.useState([]),[u,x]=m.useState(!1),[h,f]=m.useState(null),[p,g]=m.useState(null),v=m.useCallback(()=>{c([]),f(null),g(null)},[]),N=m.useCallback(async(y,w=!1)=>{const b=n(y);if(!b?.base_url){c([]),g(null),f('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!b.api_key){c([]),g(null),f('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const L=N_(b.base_url);if(g(L),!L?.modelFetcher){c([]),f(null);return}const D=`${y}:${b.base_url}`,T=ig.get(D);if(!w&&T&&Date.now()-T.timestampO(!1)}),{clearTimers:ie,initialLoadRef:ve}=F_({models:l,taskConfig:p,onSavingChange:L,onUnsavedChange:T}),Me=m.useCallback(async()=>{try{N(!0);const z=await Xl(),q=z.models||[];n(q),f(q.map(_s=>_s.name));const Be=z.api_providers||[];c(Be.map(_s=>_s.name)),x(Be),g(z.model_task_config||null);const ct=z.model_task_config?.embedding?.model_list||[];ke.current=[...ct],T(!1),ve.current=!1}catch(z){console.error("加载配置失败:",z)}finally{N(!1)}},[ve]);m.useEffect(()=>{Me()},[Me]);const Ze=m.useCallback(z=>u.find(q=>q.name===z),[u]),{availableModels:js,fetchingModels:Ot,modelFetchError:rs,matchedTemplate:Ps,fetchModelsForProvider:Q,clearModels:Ge}=K_({getProviderConfig:Ze});m.useEffect(()=>{F&&S?.api_provider&&Q(S.api_provider)},[F,S?.api_provider,Q]);const He=async()=>{await ge()},Ve=z=>{const q={model_identifier:z.model_identifier,name:z.name,api_provider:z.api_provider,price_in:z.price_in??0,price_out:z.price_out??0,force_stream_mode:z.force_stream_mode??!1,extra_params:z.extra_params??{}};return z.temperature!=null&&(q.temperature=z.temperature),z.max_tokens!=null&&(q.max_tokens=z.max_tokens),q},Bs=async()=>{try{w(!0),ie();const z=await Xl();z.models=l.map(Ve),z.model_task_config=p,await Li(z),T(!1),Fe({title:"保存成功",description:"正在重启麦麦..."}),await He()}catch(z){console.error("保存配置失败:",z),Fe({title:"保存失败",description:z.message,variant:"destructive"}),w(!1)}},Ce=async()=>{try{w(!0),ie();const z=await Xl();z.models=l.map(Ve),z.model_task_config=p,await Li(z),T(!1),Fe({title:"保存成功",description:"模型配置已保存"}),await Me()}catch(z){console.error("保存配置失败:",z),Fe({title:"保存失败",description:z.message,variant:"destructive"})}finally{w(!1)}},cs=(z,q)=>{De({}),C(z||{model_identifier:"",name:"",api_provider:i[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),M(q),O(!0)},Es=()=>{if(!S)return;const z={};if(S.name?.trim()||(z.name="请输入模型名称"),S.api_provider?.trim()||(z.api_provider="请选择 API 提供商"),S.model_identifier?.trim()||(z.model_identifier="请输入模型标识符"),Object.keys(z).length>0){De(z);return}De({});const q={model_identifier:S.model_identifier,name:S.name,api_provider:S.api_provider,price_in:S.price_in??0,price_out:S.price_out??0,force_stream_mode:S.force_stream_mode??!1,extra_params:S.extra_params??{}};S.temperature!=null&&(q.temperature=S.temperature),S.max_tokens!=null&&(q.max_tokens=S.max_tokens);let Be,ct=null;if(P!==null?(ct=l[P].name,Be=[...l],Be[P]=q):Be=[...l,q],n(Be),f(Be.map(_s=>_s.name)),ct&&ct!==q.name&&p){const _s=st=>st.map(Nt=>Nt===ct?q.name:Nt);g({...p,utils:{...p.utils,model_list:_s(p.utils?.model_list||[])},utils_small:{...p.utils_small,model_list:_s(p.utils_small?.model_list||[])},tool_use:{...p.tool_use,model_list:_s(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:_s(p.replyer?.model_list||[])},planner:{...p.planner,model_list:_s(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:_s(p.vlm?.model_list||[])},voice:{...p.voice,model_list:_s(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:_s(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:_s(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:_s(p.lpmm_rdf_build?.model_list||[])},lpmm_qa:{...p.lpmm_qa,model_list:_s(p.lpmm_qa?.model_list||[])}})}O(!1),C(null),M(null)},zs=z=>{if(!z&&S){const q={...S,price_in:S.price_in??0,price_out:S.price_out??0};C(q)}O(z)},es=z=>{de(z),G(!0)},We=()=>{if(ce!==null){const z=l.filter((q,Be)=>Be!==ce);n(z),f(z.map(q=>q.name)),Fe({title:"删除成功",description:"模型已从列表中移除"})}G(!1),de(null)},vs=z=>{const q=new Set(pe);q.has(z)?q.delete(z):q.add(z),je(q)},mt=()=>{if(pe.size===Mt.length)je(new Set);else{const z=Mt.map((q,Be)=>l.findIndex(ct=>ct===Mt[Be]));je(new Set(z))}},Rt=()=>{if(pe.size===0){Fe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}Y(!0)},it=()=>{const z=l.filter((q,Be)=>!pe.has(Be));n(z),f(z.map(q=>q.name)),je(new Set),Y(!1),Fe({title:"批量删除成功",description:`已删除 ${pe.size} 个模型`})},ss=(z,q,Be)=>{if(p){if(z==="embedding"&&q==="model_list"&&Array.isArray(Be)){const ct=ke.current,_s=Be;if((ct.length!==_s.length||ct.some(Nt=>!_s.includes(Nt))||_s.some(Nt=>!ct.includes(Nt)))&&ct.length>0){J.current={field:q,value:Be},ue(!0);return}}g({...p,[z]:{...p[z],[q]:Be}}),z==="embedding"&&q==="model_list"&&Array.isArray(Be)&&(ke.current=[...Be])}},St=()=>{if(!p||!J.current)return;const{field:z,value:q}=J.current;g({...p,embedding:{...p.embedding,[z]:q}}),z==="model_list"&&Array.isArray(q)&&(ke.current=[...q]),J.current=null,ue(!1),Fe({title:"嵌入模型已更新",description:"建议重新生成知识库向量以确保最佳匹配精度"})},$t=()=>{J.current=null,ue(!1)},Mt=l.filter(z=>{if(!be)return!0;const q=be.toLowerCase();return z.name.toLowerCase().includes(q)||z.model_identifier.toLowerCase().includes(q)||z.api_provider.toLowerCase().includes(q)}),Ga=Math.ceil(Mt.length/$),qa=Mt.slice((H-1)*$,H*$),Rn=()=>{const z=parseInt(Ne);z>=1&&z<=Ga&&(U(z),Se(""))},X=z=>p?[p.utils?.model_list||[],p.utils_small?.model_list||[],p.tool_use?.model_list||[],p.replyer?.model_list||[],p.planner?.model_list||[],p.vlm?.model_list||[],p.voice?.model_list||[],p.embedding?.model_list||[],p.lpmm_entity_extract?.model_list||[],p.lpmm_rdf_build?.model_list||[],p.lpmm_qa?.model_list||[]].some(Be=>Be.includes(z)):!1;return v?e.jsx(Je,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(U_,{trigger:e.jsxs(k,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(gj,{className:"mr-2 h-4 w-4"}),"分享配置"]})}),e.jsxs(k,{onClick:Ce,disabled:y||b||!D||as,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(Ki,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),y?"保存中...":b?"自动保存中...":D?"保存配置":"已保存"]}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsxs(k,{disabled:y||b||as,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(Vi,{className:"mr-2 h-4 w-4"}),as?"重启中...":D?"保存并重启":"重启麦麦"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重启麦麦?"}),e.jsx(hs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:D?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:D?Bs:He,children:D?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(gt,{children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(jt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(gt,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:ae,children:[e.jsx(Aw,{className:"h-4 w-4 text-primary"}),e.jsxs(jt,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(k,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(da,{defaultValue:"models",className:"w-full",children:[e.jsxs(Zt,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(Xe,{value:"models",children:"添加模型"}),e.jsx(Xe,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(ys,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[pe.size>0&&e.jsxs(k,{onClick:Rt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ns,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",pe.size,")"]}),e.jsxs(k,{onClick:()=>cs(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(lt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索模型名称、标识符或提供商...",value:be,onChange:z=>me(z.target.value),className:"pl-9"})]}),be&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Mt.length," 个结果"]})]}),e.jsx(H_,{paginatedModels:qa,allModels:l,onEdit:cs,onDelete:es,isModelUsed:X,searchQuery:be}),e.jsx(I_,{paginatedModels:qa,allModels:l,filteredModels:Mt,selectedModels:pe,onEdit:cs,onDelete:es,onToggleSelection:vs,onToggleSelectAll:mt,isModelUsed:X,searchQuery:be}),e.jsx(q_,{page:H,pageSize:$,totalItems:Mt.length,jumpToPage:Ne,onPageChange:U,onPageSizeChange:_e,onJumpToPageChange:Se,onJumpToPage:Rn,onSelectionClear:()=>je(new Set)})]}),e.jsxs(ys,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),p&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx($a,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:p.utils,modelNames:h,onChange:(z,q)=>ss("utils",z,q),dataTour:"task-model-select"}),e.jsx($a,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:p.utils_small,modelNames:h,onChange:(z,q)=>ss("utils_small",z,q)}),e.jsx($a,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:p.tool_use,modelNames:h,onChange:(z,q)=>ss("tool_use",z,q)}),e.jsx($a,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:p.replyer,modelNames:h,onChange:(z,q)=>ss("replyer",z,q)}),e.jsx($a,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:p.planner,modelNames:h,onChange:(z,q)=>ss("planner",z,q)}),e.jsx($a,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:p.vlm,modelNames:h,onChange:(z,q)=>ss("vlm",z,q),hideTemperature:!0}),e.jsx($a,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:p.voice,modelNames:h,onChange:(z,q)=>ss("voice",z,q),hideTemperature:!0,hideMaxTokens:!0}),e.jsx($a,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:p.embedding,modelNames:h,onChange:(z,q)=>ss("embedding",z,q),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx($a,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(z,q)=>ss("lpmm_entity_extract",z,q)}),e.jsx($a,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(z,q)=>ss("lpmm_rdf_build",z,q)}),e.jsx($a,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:p.lpmm_qa,modelNames:h,onChange:(z,q)=>ss("lpmm_qa",z,q)})]})]})]})]}),e.jsx(Is,{open:F,onOpenChange:zs,children:e.jsxs(Rs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Ee,children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:P!==null?"编辑模型":"添加模型"}),e.jsx(Zs,{children:"配置模型的基本信息和参数"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[e.jsx(E,{htmlFor:"model_name",className:ee.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(re,{id:"model_name",value:S?.name||"",onChange:z=>{C(q=>q?{...q,name:z.target.value}:null),ee.name&&De(q=>({...q,name:void 0}))},placeholder:"例如: qwen3-30b",className:ee.name?"border-destructive focus-visible:ring-destructive":""}),ee.name?e.jsx("p",{className:"text-xs text-destructive",children:ee.name}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[e.jsx(E,{htmlFor:"api_provider",className:ee.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Le,{value:S?.api_provider||"",onValueChange:z=>{C(q=>q?{...q,api_provider:z}:null),Ge(),ee.api_provider&&De(q=>({...q,api_provider:void 0}))},children:[e.jsx(Oe,{id:"api_provider",className:ee.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Ue,{placeholder:"选择提供商"})}),e.jsx(Re,{children:i.map(z=>e.jsx(le,{value:z,children:z},z))})]}),ee.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:ee.api_provider})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{htmlFor:"model_identifier",className:ee.model_identifier?"text-destructive":"",children:"模型标识符 *"}),Ps?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Te,{variant:"secondary",className:"text-xs",children:Ps.display_name}),e.jsx(k,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>S?.api_provider&&Q(S.api_provider,!0),disabled:Ot,children:Ot?e.jsx(Js,{className:"h-3 w-3 animate-spin"}):e.jsx(zt,{className:"h-3 w-3"})})]})]}),Ps?.modelFetcher?e.jsxs(Xa,{open:V,onOpenChange:ye,children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",role:"combobox","aria-expanded":V,className:"w-full justify-between font-normal",disabled:Ot||!!rs,children:[Ot?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Js,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):rs?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):S?.model_identifier?e.jsx("span",{className:"truncate",children:S.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(Om,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ia,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs($o,{children:[e.jsx(Ho,{placeholder:"搜索模型..."}),e.jsx(Je,{className:"h-[300px]",children:e.jsxs(Io,{className:"max-h-none overflow-visible",children:[e.jsx(Po,{children:rs?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:rs}),!rs.includes("API Key")&&e.jsx(k,{variant:"link",size:"sm",onClick:()=>S?.api_provider&&Q(S.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(Ii,{heading:"可用模型",children:js.map(z=>e.jsxs(Pi,{value:z.id,onSelect:()=>{C(q=>q?{...q,model_identifier:z.id}:null),ye(!1)},children:[e.jsx(_t,{className:`mr-2 h-4 w-4 ${S?.model_identifier===z.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:z.id}),z.name!==z.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:z.name})]})]},z.id))}),e.jsx(Ii,{heading:"手动输入",children:e.jsxs(Pi,{value:"__manual_input__",onSelect:()=>{ye(!1)},children:[e.jsx(Cn,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(re,{id:"model_identifier",value:S?.model_identifier||"",onChange:z=>{C(q=>q?{...q,model_identifier:z.target.value}:null),ee.model_identifier&&De(q=>({...q,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:ee.model_identifier?"border-destructive focus-visible:ring-destructive":""}),ee.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:ee.model_identifier}),rs&&Ps?.modelFetcher&&!ee.model_identifier&&e.jsxs(gt,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsx(jt,{className:"text-xs",children:rs})]}),Ps?.modelFetcher&&e.jsx(re,{value:S?.model_identifier||"",onChange:z=>{C(q=>q?{...q,model_identifier:z.target.value}:null),ee.model_identifier&&De(q=>({...q,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${ee.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!ee.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:rs?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':Ps?.modelFetcher?`已识别为 ${Ps.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(re,{id:"price_in",type:"number",step:"0.1",min:"0",value:S?.price_in??"",onChange:z=>{const q=z.target.value===""?null:parseFloat(z.target.value);C(Be=>Be?{...Be,price_in:q}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(re,{id:"price_out",type:"number",step:"0.1",min:"0",value:S?.price_out??"",onChange:z=>{const q=z.target.value===""?null:parseFloat(z.target.value);C(Be=>Be?{...Be,price_out:q}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Pe,{id:"enable_model_temperature",checked:S?.temperature!=null,onCheckedChange:z=>{C(z?q=>q?{...q,temperature:.5}:null:q=>q?{...q,temperature:null}:null)}})]}),S?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:S.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(Na,{value:[S.temperature],onValueChange:z=>C(q=>q?{...q,temperature:z[0]}:null),min:0,max:1,step:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Pe,{id:"enable_model_max_tokens",checked:S?.max_tokens!=null,onCheckedChange:z=>{C(z?q=>q?{...q,max_tokens:2048}:null:q=>q?{...q,max_tokens:null}:null)}})]}),S?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-sm",children:"最大 Token 数"}),e.jsx(re,{type:"number",min:"1",max:"128000",value:S.max_tokens,onChange:z=>{const q=parseInt(z.target.value);!isNaN(q)&&q>=1&&C(Be=>Be?{...Be,max_tokens:q}: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(Pe,{id:"force_stream_mode",checked:S?.force_stream_mode||!1,onCheckedChange:z=>C(q=>q?{...q,force_stream_mode:z}:null)}),e.jsx(E,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsx(k_,{value:S?.extra_params||{},onChange:z=>C(q=>q?{...q,extra_params:z}:null),placeholder:"添加额外参数(如 enable_thinking、top_p 等)..."})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>O(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(k,{onClick:Es,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(gs,{open:Z,onOpenChange:G,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除模型 "',ce!==null?l[ce]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:We,children:"删除"})]})]})}),e.jsx(gs,{open:A,onOpenChange:Y,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",pe.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:it,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(gs,{open:W,onOpenChange:ue,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsxs(xs,{className:"flex items-center gap-2",children:[e.jsx(Qt,{className:"h-5 w-5 text-amber-500"}),"更换嵌入模型警告"]}),e.jsx(hs,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"注意:"}),"更换嵌入模型可能会影响知识库的匹配精度!"]}),e.jsxs("ul",{className:"space-y-2 ml-4 list-disc text-muted-foreground",children:[e.jsx("li",{children:"不同的嵌入模型会产生不同的向量表示"}),e.jsx("li",{children:"这可能导致现有知识库的检索结果不准确"}),e.jsx("li",{children:"建议更换嵌入模型后重新生成所有知识库的向量"})]}),e.jsx("p",{className:"text-foreground font-medium",children:"确定要更换嵌入模型吗?"})]})})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:$t,children:"取消"}),e.jsx(fs,{onClick:St,className:"bg-amber-600 hover:bg-amber-700",children:"确认更换"})]})]})}),e.jsx(On,{})]})})}const Gi=Lg,qi=b0,Fi=y0,Go="/api/webui/config";async function J_(){const n=await(await we(`${Go}/adapter-config/path`)).json();return!n.success||!n.path?null:{path:n.path,lastModified:n.lastModified}}async function cg(l){const i=await(await we(`${Go}/adapter-config/path`,{method:"POST",headers:Os(),body:JSON.stringify({path:l})})).json();if(!i.success)throw new Error(i.message||"保存路径失败")}async function og(l){const i=await(await we(`${Go}/adapter-config?path=${encodeURIComponent(l)}`)).json();if(!i.success)throw new Error("读取配置文件失败");return i.content}async function dg(l,n){const c=await(await we(`${Go}/adapter-config`,{method:"POST",headers:Os(),body:JSON.stringify({path:l,content:n})})).json();if(!c.success)throw new Error(c.message||"保存配置失败")}const ft={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"}},gm={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:ca},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:zw}};function X_(l,n){let i=l.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function Z_(l,n,i){let c=l.split(/\r\n|\n|\r/g),u="",x=(Math.log10(n+1)|0)+1;for(let h=n-1;h<=n+1;h++){let f=c[h-1];f&&(u+=h.toString().padEnd(x," "),u+=": ",u+=f,u+=` -`,h===n&&(u+=" ".repeat(x+i+2),u+=`^ -`))}return u}class ws extends Error{line;column;codeblock;constructor(n,i){const[c,u]=X_(i.toml,i.ptr),x=Z_(i.toml,c,u);super(`Invalid TOML document: ${n} - -${x}`,i),this.line=c,this.column=u,this.codeblock=x}}function W_(l,n){let i=0;for(;l[n-++i]==="\\";);return--i&&i%2}function Eo(l,n=0,i=l.length){let c=l.indexOf(` -`,n);return l[c-1]==="\r"&&c--,c<=i?c:-1}function $m(l,n){for(let i=n;i-1&&i!=="'"&&W_(l,n));return n>-1&&(n+=c.length,c.length>1&&(l[n]===i&&n++,l[n]===i&&n++)),n}let eS=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Sr extends Date{#s=!1;#t=!1;#e=null;constructor(n){let i=!0,c=!0,u="Z";if(typeof n=="string"){let x=n.match(eS);x?(x[1]||(i=!1,n=`0000-01-01T${n}`),c=!!x[2],c&&n[10]===" "&&(n=n.replace(" ","T")),x[2]&&+x[2]>23?n="":(u=x[3]||null,n=n.toUpperCase(),!u&&c&&(n+="Z"))):n=""}super(n),isNaN(this.getTime())||(this.#s=i,this.#t=c,this.#e=u)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let n=super.toISOString();if(this.isDate())return n.slice(0,10);if(this.isTime())return n.slice(11,23);if(this.#e===null)return n.slice(0,-1);if(this.#e==="Z")return n;let i=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return i=this.#e[0]==="-"?i:-i,new Date(this.getTime()-i*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(n,i="Z"){let c=new Sr(n);return c.#e=i,c}static wrapAsLocalDateTime(n){let i=new Sr(n);return i.#e=null,i}static wrapAsLocalDate(n){let i=new Sr(n);return i.#t=!1,i.#e=null,i}static wrapAsLocalTime(n){let i=new Sr(n);return i.#s=!1,i.#e=null,i}}let sS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,tS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,aS=/^[+-]?0[0-9_]/,lS=/^[0-9a-f]{4,8}$/i,mg={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function cv(l,n=0,i=l.length){let c=l[n]==="'",u=l[n++]===l[n]&&l[n]===l[n+1];u&&(i-=2,l[n+=2]==="\r"&&n++,l[n]===` -`&&n++);let x=0,h,f="",p=n;for(;n-1&&($m(l,x),u=u.slice(0,x));let h=u.trimEnd();if(!c){let f=u.indexOf(` -`,h.length);if(f>-1)throw new ws("newlines are not allowed in inline tables",{toml:l,ptr:n+f})}return[h,x]}function Hm(l,n,i,c,u){if(c===0)throw new ws("document contains excessively nested structures. aborting.",{toml:l,ptr:n});let x=l[n];if(x==="["||x==="{"){let[p,g]=x==="["?oS(l,n,c,u):cS(l,n,c,u),v=i?ug(l,g,",",i):g;if(g-v&&i==="}"){let N=Eo(l,g,v);if(N>-1)throw new ws("newlines are not allowed in inline tables",{toml:l,ptr:N})}return[p,v]}let h;if(x==='"'||x==="'"){h=iv(l,n);let p=cv(l,n,h);if(i){if(h=bl(l,h,i!=="]"),l[h]&&l[h]!==","&&l[h]!==i&&l[h]!==` -`&&l[h]!=="\r")throw new ws("unexpected character encountered",{toml:l,ptr:h});h+=+(l[h]===",")}return[p,h]}h=ug(l,n,",",i);let f=rS(l,n,h-+(l[h-1]===","),i==="]");if(!f[0])throw new ws("incomplete key-value declaration: no value specified",{toml:l,ptr:n});return i&&f[1]>-1&&(h=bl(l,n+f[1]),h+=+(l[h]===",")),[nS(f[0],l,n,u),h]}let iS=/^[a-zA-Z0-9-_]+[ \t]*$/;function Em(l,n,i="="){let c=n-1,u=[],x=l.indexOf(i,n);if(x<0)throw new ws("incomplete key-value: cannot find end of key",{toml:l,ptr:n});do{let h=l[n=++c];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===l[n+1]&&h===l[n+2])throw new ws("multiline strings are not allowed in keys",{toml:l,ptr:n});let f=iv(l,n);if(f<0)throw new ws("unfinished string encountered",{toml:l,ptr:n});c=l.indexOf(".",f);let p=l.slice(f,c<0||c>x?x:c),g=Eo(p);if(g>-1)throw new ws("newlines are not allowed in keys",{toml:l,ptr:n+c+g});if(p.trimStart())throw new ws("found extra tokens after the string part",{toml:l,ptr:f});if(xx?x:c);if(!iS.test(f))throw new ws("only letter, numbers, dashes and underscores are allowed in keys",{toml:l,ptr:n});u.push(f.trimEnd())}}while(c+1&&cu===""||u===null||u===void 0?x:u,i={inner:{version:n(l.inner.version,ft.inner.version)},nickname:{nickname:n(l.nickname.nickname,ft.nickname.nickname)},napcat_server:{host:n(l.napcat_server.host,ft.napcat_server.host),port:n(l.napcat_server.port||0,ft.napcat_server.port),token:n(l.napcat_server.token,ft.napcat_server.token),heartbeat_interval:n(l.napcat_server.heartbeat_interval||0,ft.napcat_server.heartbeat_interval)},maibot_server:{host:n(l.maibot_server.host,ft.maibot_server.host),port:n(l.maibot_server.port||0,ft.maibot_server.port)},chat:{group_list_type:n(l.chat.group_list_type,ft.chat.group_list_type),group_list:l.chat.group_list||[],private_list_type:n(l.chat.private_list_type,ft.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??ft.chat.ban_qq_bot,enable_poke:l.chat.enable_poke??ft.chat.enable_poke},voice:{use_tts:l.voice.use_tts??ft.voice.use_tts},debug:{level:n(l.debug.level,ft.debug.level)}};let c=hS(i);return c=fS(c),c}catch(n){throw console.error("TOML 生成失败:",n),new Error(`无法生成 TOML 文件: ${n instanceof Error?n.message:"未知错误"}`)}}function fS(l){const n=l.split(` -`),i=[];for(let c=0;c"|?*\x00-\x1F]/.test(l)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function pS(){const[l,n]=m.useState("upload"),[i,c]=m.useState(null),[u,x]=m.useState(""),[h,f]=m.useState(""),[p,g]=m.useState("oneclick"),[v,N]=m.useState(""),[y,w]=m.useState(!1),[b,L]=m.useState(!1),[D,T]=m.useState(!1),[F,O]=m.useState(!1),[S,C]=m.useState(null),[P,M]=m.useState(!1),Z=m.useRef(null),{toast:G}=et(),ce=m.useRef(null),de=W=>{if(f(W),W.trim()){const ue=Nm(W);N(ue.error)}else N("")},be=m.useCallback(async W=>{const ue=gm[W];L(!0);try{const ke=await og(ue.path),J=jm(ke);c(J),g(W),f(ue.path),await cg(ue.path),G({title:"加载成功",description:`已从${ue.name}预设加载配置`})}catch(ke){console.error("加载预设配置失败:",ke),G({title:"加载失败",description:ke instanceof Error?ke.message:"无法读取预设配置文件",variant:"destructive"})}finally{L(!1)}},[G]),me=m.useCallback(async W=>{const ue=Nm(W);if(!ue.valid){N(ue.error),G({title:"路径无效",description:ue.error,variant:"destructive"});return}N(""),L(!0);try{const ke=await og(W),J=jm(ke);c(J),f(W),await cg(W),G({title:"加载成功",description:"已从配置文件加载"})}catch(ke){console.error("加载配置失败:",ke),G({title:"加载失败",description:ke instanceof Error?ke.message:"无法读取配置文件",variant:"destructive"})}finally{L(!1)}},[G]);m.useEffect(()=>{(async()=>{try{const ue=await J_();if(ue&&ue.path){f(ue.path);const ke=Object.entries(gm).find(([,J])=>J.path===ue.path);ke?(n("preset"),g(ke[0]),await be(ke[0])):(n("path"),await me(ue.path))}}catch(ue){console.error("加载保存的路径失败:",ue)}})()},[me,be]);const pe=m.useCallback(W=>{l!=="path"&&l!=="preset"||!h||(ce.current&&clearTimeout(ce.current),ce.current=setTimeout(async()=>{w(!0);try{const ue=vm(W);await dg(h,ue),G({title:"自动保存成功",description:"配置已保存到文件"})}catch(ue){console.error("自动保存失败:",ue),G({title:"自动保存失败",description:ue instanceof Error?ue.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},1e3))},[l,h,G]),je=async()=>{if(!i||!h)return;const W=Nm(h);if(!W.valid){G({title:"保存失败",description:W.error,variant:"destructive"});return}w(!0);try{const ue=vm(i);await dg(h,ue),G({title:"保存成功",description:"配置已保存到文件"})}catch(ue){console.error("保存失败:",ue),G({title:"保存失败",description:ue instanceof Error?ue.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},A=async()=>{h&&await me(h)},Y=W=>{if(W!==l){if(i){C(W),T(!0);return}H(W)}},H=W=>{c(null),x(""),N(""),n(W),W==="preset"&&be("oneclick"),G({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[W]})},U=()=>{S&&(H(S),C(null)),T(!1)},$=()=>{if(i){O(!0);return}_e()},_e=()=>{f(""),c(null),N(""),G({title:"已清空",description:"路径和配置已清空"})},Ne=()=>{_e(),O(!1)},Se=W=>{const ue=W.target.files?.[0];if(!ue)return;const ke=new FileReader;ke.onload=J=>{try{const ee=J.target?.result,De=jm(ee);c(De),x(ue.name),G({title:"上传成功",description:`已加载配置文件:${ue.name}`})}catch(ee){console.error("解析配置文件失败:",ee),G({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},ke.readAsText(ue)},V=()=>{if(!i)return;const W=vm(i),ue=new Blob([W],{type:"text/plain;charset=utf-8"}),ke=URL.createObjectURL(ue),J=document.createElement("a");J.href=ke,J.download=u||"config.toml",document.body.appendChild(J),J.click(),document.body.removeChild(J),URL.revokeObjectURL(ke),G({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ye=()=>{c(JSON.parse(JSON.stringify(ft))),x("config.toml"),G({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(Dt,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(Gi,{open:P,onOpenChange:M,children:e.jsxs(ze,{children:[e.jsx(ts,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(ls,{children:"工作模式"}),e.jsx(Vs,{children:"选择配置文件的管理方式"})]}),e.jsx(qi,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(Oa,{className:`h-4 w-4 transition-transform duration-200 ${P?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(Fi,{children:e.jsxs(Ye,{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(ca,{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($i,{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(Dw,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),l==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(E,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(gm).map(([W,ue])=>{const ke=ue.icon,J=p===W;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${J?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(W),be(W)},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:ue.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ue.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:ue.path})]})]})},W)})})]}),l==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(re,{id:"config-path",value:h,onChange:W=>de(W.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(k,{onClick:()=>me(h),disabled:b||!h||!!v,className:"w-full sm:w-auto",children:b?e.jsxs(e.Fragment,{children:[e.jsx(zt,{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(gt,{children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsx(jt,{children:l==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]}):l==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]})})]}),l==="upload"&&!i&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:Z,type:"file",accept:".toml",className:"hidden",onChange:Se}),e.jsxs(k,{onClick:()=>Z.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx($i,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(k,{onClick:ye,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ha,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),l==="upload"&&i&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(k,{onClick:V,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Yt,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(l==="preset"||l==="path")&&i&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(k,{onClick:je,size:"sm",disabled:y||!!v,className:"w-full sm:w-auto",children:[e.jsx(Ki,{className:"mr-2 h-4 w-4"}),y?"保存中...":"立即保存"]}),e.jsxs(k,{onClick:A,size:"sm",variant:"outline",disabled:b,className:"w-full sm:w-auto",children:[e.jsx(zt,{className:`mr-2 h-4 w-4 ${b?"animate-spin":""}`}),"刷新"]}),l==="path"&&e.jsxs(k,{onClick:$,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ns,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),i?e.jsxs(da,{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(Zt,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(Xe,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),e.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),e.jsxs(Xe,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),e.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),e.jsxs(Xe,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),e.jsx("span",{className:"sm:hidden",children:"聊天"})]}),e.jsxs(Xe,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),e.jsx("span",{className:"sm:hidden",children:"语音"})]}),e.jsx(Xe,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(ys,{value:"napcat",className:"space-y-4",children:e.jsx(gS,{config:i,onChange:W=>{c(W),pe(W)}})}),e.jsx(ys,{value:"maibot",className:"space-y-4",children:e.jsx(jS,{config:i,onChange:W=>{c(W),pe(W)}})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:e.jsx(vS,{config:i,onChange:W=>{c(W),pe(W)}})}),e.jsx(ys,{value:"voice",className:"space-y-4",children:e.jsx(NS,{config:i,onChange:W=>{c(W),pe(W)}})}),e.jsx(ys,{value:"debug",className:"space-y-4",children:e.jsx(bS,{config:i,onChange:W=>{c(W),pe(W)}})})]}):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(Ha,{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(gs,{open:D,onOpenChange:T,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认切换模式"}),e.jsxs(hs,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>{T(!1),C(null)},children:"取消"}),e.jsx(fs,{onClick:U,children:"确认切换"})]})]})}),e.jsx(gs,{open:F,onOpenChange:O,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认清空路径"}),e.jsxs(hs,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>O(!1),children:"取消"}),e.jsx(fs,{onClick:Ne,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function gS({config:l,onChange:n}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(re,{id:"napcat-host",value:l.napcat_server.host,onChange:i=>n({...l,napcat_server:{...l.napcat_server,host:i.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(re,{id:"napcat-port",type:"number",value:l.napcat_server.port||"",onChange:i=>n({...l,napcat_server:{...l.napcat_server,port:i.target.value?parseInt(i.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(re,{id:"napcat-token",type:"password",value:l.napcat_server.token,onChange:i=>n({...l,napcat_server:{...l.napcat_server,token:i.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(re,{id:"napcat-heartbeat",type:"number",value:l.napcat_server.heartbeat_interval||"",onChange:i=>n({...l,napcat_server:{...l.napcat_server,heartbeat_interval:i.target.value?parseInt(i.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function jS({config:l,onChange:n}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(re,{id:"maibot-host",value:l.maibot_server.host,onChange:i=>n({...l,maibot_server:{...l.maibot_server,host:i.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(re,{id:"maibot-port",type:"number",value:l.maibot_server.port||"",onChange:i=>n({...l,maibot_server:{...l.maibot_server,port:i.target.value?parseInt(i.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function vS({config:l,onChange:n}){const i=x=>{const h={...l};x==="group"?h.chat.group_list=[...h.chat.group_list,0]:x==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],n(h)},c=(x,h)=>{const f={...l};x==="group"?f.chat.group_list=f.chat.group_list.filter((p,g)=>g!==h):x==="private"?f.chat.private_list=f.chat.private_list.filter((p,g)=>g!==h):f.chat.ban_user_id=f.chat.ban_user_id.filter((p,g)=>g!==h),n(f)},u=(x,h,f)=>{const p={...l};x==="group"?p.chat.group_list[h]=f:x==="private"?p.chat.private_list[h]=f:p.chat.ban_user_id[h]=f,n(p)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Le,{value:l.chat.group_list_type,onValueChange:x=>n({...l,chat:{...l.chat,group_list_type:x}}),children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(le,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(E,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(k,{onClick:()=>i("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ha,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),l.chat.group_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:f=>u("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>c("group",h),children:"删除"})]})]})]})]},h)),l.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Le,{value:l.chat.private_list_type,onValueChange:x=>n({...l,chat:{...l.chat,private_list_type:x}}),children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(le,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(E,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(k,{onClick:()=>i("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ha,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.private_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:f=>u("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>c("private",h),children:"删除"})]})]})]})]},h)),l.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-sm md:text-base",children:"全局禁止名单"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),e.jsxs(k,{onClick:()=>i("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ha,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.ban_user_id.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:f=>u("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(gs,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(k,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>c("ban",h),children:"删除"})]})]})]})]},h)),l.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Pe,{checked:l.chat.ban_qq_bot,onCheckedChange:x=>n({...l,chat:{...l.chat,ban_qq_bot:x}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Pe,{checked:l.chat.enable_poke,onCheckedChange:x=>n({...l,chat:{...l.chat,enable_poke:x}})})]})]})]})})}function NS({config:l,onChange:n}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Pe,{checked:l.voice.use_tts,onCheckedChange:i=>n({...l,voice:{use_tts:i}})})]})]})})}function bS({config:l,onChange:n}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Le,{value:l.debug.level,onValueChange:i=>n({...l,debug:{level:i}}),children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(le,{value:"INFO",children:"INFO(信息)"}),e.jsx(le,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(le,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(le,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const yS=["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"],wS=/^(aria-|data-)/,uv=l=>Object.fromEntries(Object.entries(l).filter(([n])=>wS.test(n)||yS.includes(n)));function _S(l,n){const i=uv(l);return Object.keys(l).some(c=>!Object.hasOwn(i,c)&&l[c]!==n[c])}class SS extends m.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(n){if(n.uppy!==this.props.uppy)this.uninstallPlugin(n),this.installPlugin();else if(_S(this.props,n)){const{uppy:i,...c}={...this.props,target:this.container};this.plugin.setOptions(c)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:n,...i}={id:"Dashboard",...this.props,inline:!0,target:this.container};n.use(i1,i),this.plugin=n.getPlugin(i.id)}uninstallPlugin(n=this.props){const{uppy:i}=n;i.removePlugin(this.plugin)}render(){return m.createElement("div",{className:"uppy-Container",ref:n=>{this.container=n},...uv(this.props)})}}function CS({src:l,alt:n="表情包",className:i,maxRetries:c=5,retryInterval:u=1500}){const[x,h]=m.useState("loading"),[f,p]=m.useState(0),[g,v]=m.useState(null),[N,y]=m.useState(l);l!==N&&(h("loading"),p(0),v(null),y(l));const w=m.useCallback(async()=>{try{const b=await fetch(l,{credentials:"include"});if(b.status===202){h("generating"),f{p(T=>T+1)},u):h("error");return}if(!b.ok){h("error");return}const L=await b.blob(),D=URL.createObjectURL(L);v(D),h("loaded")}catch(b){console.error("加载缩略图失败:",b),h("error")}},[l,f,c,u]);return m.useEffect(()=>{w()},[w]),m.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),x==="loading"||x==="generating"?e.jsx(Qs,{className:B("w-full h-full",i)}):x==="error"||!g?e.jsx("div",{className:B("w-full h-full flex items-center justify-center bg-muted",i),children:e.jsx(jj,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:n,className:B("w-full h-full object-contain",i)})}function mv({content:l,className:n=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${n}`,children:e.jsx(o1,{remarkPlugins:[u1,m1],rehypePlugins:[d1],components:{code({inline:i,className:c,children:u,...x}){return i?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...x,children:u}):e.jsx("code",{className:`${c} block bg-muted p-4 rounded-lg overflow-x-auto`,...x,children:u})},table({children:i,...c}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...c,children:i})})},th({children:i,...c}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...c,children:i})},td({children:i,...c}){return e.jsx("td",{className:"border border-border px-4 py-2",...c,children:i})},a({children:i,...c}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...c,children:i})},blockquote({children:i,...c}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...c,children:i})},h1({children:i,...c}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...c,children:i})},h2({children:i,...c}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...c,children:i})},h3({children:i,...c}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...c,children:i})},h4({children:i,...c}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...c,children:i})},ul({children:i,...c}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...c,children:i})},ol({children:i,...c}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...c,children:i})},p({children:i,...c}){return e.jsx("p",{className:"my-2 leading-relaxed",...c,children:i})},hr({...i}){return e.jsx("hr",{className:"my-4 border-border",...i})}},children:l})})}function kS({children:l,className:n}){return e.jsx(mv,{content:l,className:n})}const Ra="/api/webui/emoji";async function TS(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.is_registered!==void 0&&n.append("is_registered",l.is_registered.toString()),l.is_banned!==void 0&&n.append("is_banned",l.is_banned.toString()),l.format&&n.append("format",l.format),l.sort_by&&n.append("sort_by",l.sort_by),l.sort_order&&n.append("sort_order",l.sort_order);const i=await we(`${Ra}/list?${n}`,{});if(!i.ok)throw new Error(`获取表情包列表失败: ${i.statusText}`);return i.json()}async function ES(l){const n=await we(`${Ra}/${l}`,{});if(!n.ok)throw new Error(`获取表情包详情失败: ${n.statusText}`);return n.json()}async function MS(l,n){const i=await we(`${Ra}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok)throw new Error(`更新表情包失败: ${i.statusText}`);return i.json()}async function AS(l){const n=await we(`${Ra}/${l}`,{method:"DELETE"});if(!n.ok)throw new Error(`删除表情包失败: ${n.statusText}`);return n.json()}async function zS(){const l=await we(`${Ra}/stats/summary`,{});if(!l.ok)throw new Error(`获取统计数据失败: ${l.statusText}`);return l.json()}async function DS(l){const n=await we(`${Ra}/${l}/register`,{method:"POST"});if(!n.ok)throw new Error(`注册表情包失败: ${n.statusText}`);return n.json()}async function OS(l){const n=await we(`${Ra}/${l}/ban`,{method:"POST"});if(!n.ok)throw new Error(`封禁表情包失败: ${n.statusText}`);return n.json()}function RS(l,n=!1){return n?`${Ra}/${l}/thumbnail?original=true`:`${Ra}/${l}/thumbnail`}function LS(l){return`${Ra}/${l}/thumbnail?original=true`}async function US(l){const n=await we(`${Ra}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function BS(){return`${Ra}/upload`}function $S(){const[l,n]=m.useState([]),[i,c]=m.useState(null),[u,x]=m.useState(!1),[h,f]=m.useState(1),[p,g]=m.useState(0),[v,N]=m.useState(20),[y,w]=m.useState("all"),[b,L]=m.useState("all"),[D,T]=m.useState("all"),[F,O]=m.useState("usage_count"),[S,C]=m.useState("desc"),[P,M]=m.useState(null),[Z,G]=m.useState(!1),[ce,de]=m.useState(!1),[be,me]=m.useState(!1),[pe,je]=m.useState(new Set),[A,Y]=m.useState(!1),[H,U]=m.useState(""),[$,_e]=m.useState("medium"),[Ne,Se]=m.useState(!1),{toast:V}=et(),ye=m.useCallback(async()=>{try{x(!0);const ie=await TS({page:h,page_size:v,is_registered:y==="all"?void 0:y==="registered",is_banned:b==="all"?void 0:b==="banned",format:D==="all"?void 0:D,sort_by:F,sort_order:S});n(ie.data),g(ie.total)}catch(ie){const ve=ie instanceof Error?ie.message:"加载表情包列表失败";V({title:"错误",description:ve,variant:"destructive"})}finally{x(!1)}},[h,v,y,b,D,F,S,V]),W=async()=>{try{const ie=await zS();c(ie.data)}catch(ie){console.error("加载统计数据失败:",ie)}};m.useEffect(()=>{ye()},[ye]),m.useEffect(()=>{W()},[]);const ue=async ie=>{try{const ve=await ES(ie.id);M(ve.data),G(!0)}catch(ve){const Me=ve instanceof Error?ve.message:"加载详情失败";V({title:"错误",description:Me,variant:"destructive"})}},ke=ie=>{M(ie),de(!0)},J=ie=>{M(ie),me(!0)},ee=async()=>{if(P)try{await AS(P.id),V({title:"成功",description:"表情包已删除"}),me(!1),M(null),ye(),W()}catch(ie){const ve=ie instanceof Error?ie.message:"删除失败";V({title:"错误",description:ve,variant:"destructive"})}},De=async ie=>{try{await DS(ie.id),V({title:"成功",description:"表情包已注册"}),ye(),W()}catch(ve){const Me=ve instanceof Error?ve.message:"注册失败";V({title:"错误",description:Me,variant:"destructive"})}},Fe=async ie=>{try{await OS(ie.id),V({title:"成功",description:"表情包已封禁"}),ye(),W()}catch(ve){const Me=ve instanceof Error?ve.message:"封禁失败";V({title:"错误",description:Me,variant:"destructive"})}},ge=ie=>{const ve=new Set(pe);ve.has(ie)?ve.delete(ie):ve.add(ie),je(ve)},as=async()=>{try{const ie=await US(Array.from(pe));V({title:"批量删除完成",description:ie.message}),je(new Set),Y(!1),ye(),W()}catch(ie){V({title:"批量删除失败",description:ie instanceof Error?ie.message:"批量删除失败",variant:"destructive"})}},ae=()=>{const ie=parseInt(H),ve=Math.ceil(p/v);ie>=1&&ie<=ve?(f(ie),U("")):V({title:"无效的页码",description:`请输入1-${ve}之间的页码`,variant:"destructive"})},Ee=i?.formats?Object.keys(i.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),e.jsxs(k,{onClick:()=>Se(!0),className:"gap-2",children:[e.jsx($i,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[i&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(ze,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(Vs,{children:"总数"}),e.jsx(ls,{className:"text-2xl",children:i.total})]})}),e.jsx(ze,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(Vs,{children:"已注册"}),e.jsx(ls,{className:"text-2xl text-green-600",children:i.registered})]})}),e.jsx(ze,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(Vs,{children:"已封禁"}),e.jsx(ls,{className:"text-2xl text-red-600",children:i.banned})]})}),e.jsx(ze,{children:e.jsxs(ts,{className:"pb-2",children:[e.jsx(Vs,{children:"未注册"}),e.jsx(ls,{className:"text-2xl text-gray-600",children:i.unregistered})]})})]}),e.jsxs(ze,{children:[e.jsx(ts,{children:e.jsxs(ls,{className:"flex items-center gap-2",children:[e.jsx(No,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(Ye,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"排序方式"}),e.jsxs(Le,{value:`${F}-${S}`,onValueChange:ie=>{const[ve,Me]=ie.split("-");O(ve),C(Me),f(1)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(le,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(le,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(le,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(le,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(le,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(le,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(le,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"注册状态"}),e.jsxs(Le,{value:y,onValueChange:ie=>{w(ie),f(1)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),e.jsx(le,{value:"registered",children:"已注册"}),e.jsx(le,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"封禁状态"}),e.jsxs(Le,{value:b,onValueChange:ie=>{L(ie),f(1)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),e.jsx(le,{value:"banned",children:"已封禁"}),e.jsx(le,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"格式"}),e.jsxs(Le,{value:D,onValueChange:ie=>{T(ie),f(1)},children:[e.jsx(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),Ee.map(ie=>e.jsxs(le,{value:ie,children:[ie.toUpperCase()," (",i?.formats[ie],")"]},ie))]})]})]})]}),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:[pe.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",pe.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Le,{value:$,onValueChange:ie=>_e(ie),children:[e.jsx(Oe,{className:"w-24",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"small",children:"小"}),e.jsx(le,{value:"medium",children:"中"}),e.jsx(le,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Le,{value:v.toString(),onValueChange:ie=>{N(parseInt(ie)),f(1),je(new Set)},children:[e.jsx(Oe,{id:"emoji-page-size",className:"w-20",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"40",children:"40"}),e.jsx(le,{value:"60",children:"60"}),e.jsx(le,{value:"100",children:"100"})]})]}),pe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>je(new Set),children:"取消选择"}),e.jsxs(k,{variant:"destructive",size:"sm",onClick:()=>Y(!0),children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(k,{variant:"outline",size:"sm",onClick:ye,disabled:u,children:[e.jsx(zt,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"表情包列表"}),e.jsxs(Vs,{children:["共 ",p," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(Ye,{children:[l.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${$==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":$==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:l.map(ie=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${pe.has(ie.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>ge(ie.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${pe.has(ie.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 ${pe.has(ie.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:pe.has(ie.id)&&e.jsx(oa,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[ie.is_registered&&e.jsx(Te,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),ie.is_banned&&e.jsx(Te,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${$==="small"?"p-1":$==="medium"?"p-2":"p-3"}`,children:e.jsx(CS,{src:RS(ie.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${$==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Te,{variant:"outline",className:"text-[10px] px-1 py-0",children:ie.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[ie.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${$==="small"?"flex-wrap":""}`,children:[e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ve=>{ve.stopPropagation(),ke(ie)},title:"编辑",children:e.jsx(En,{className:"h-3 w-3"})}),e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ve=>{ve.stopPropagation(),ue(ie)},title:"详情",children:e.jsx(Jt,{className:"h-3 w-3"})}),!ie.is_registered&&e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:ve=>{ve.stopPropagation(),De(ie)},title:"注册",children:e.jsx(oa,{className:"h-3 w-3"})}),!ie.is_banned&&e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:ve=>{ve.stopPropagation(),Fe(ie)},title:"封禁",children:e.jsx(Ow,{className:"h-3 w-3"})}),e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:ve=>{ve.stopPropagation(),J(ie)},title:"删除",children:e.jsx(ns,{className:"h-3 w-3"})})]})]})]},ie.id))}),p>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(h-1)*v+1," 到"," ",Math.min(h*v,p)," 条,共 ",p," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(zr,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(ie=>Math.max(1,ie-1)),disabled:h===1,children:[e.jsx(Wa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:H,onChange:ie=>U(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&ae(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/v)}),e.jsx(k,{variant:"outline",size:"sm",onClick:ae,disabled:!H,className:"h-8",children:"跳转"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(ie=>ie+1),disabled:h>=Math.ceil(p/v),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(p/v)),disabled:h>=Math.ceil(p/v),className:"hidden sm:flex",children:e.jsx(Dr,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(HS,{emoji:P,open:Z,onOpenChange:G}),e.jsx(IS,{emoji:P,open:ce,onOpenChange:de,onSuccess:()=>{ye(),W()}}),e.jsx(PS,{open:Ne,onOpenChange:Se,onSuccess:()=>{ye(),W()}})]})}),e.jsx(gs,{open:A,onOpenChange:Y,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["你确定要删除选中的 ",pe.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:as,children:"确认删除"})]})]})}),e.jsx(Is,{open:be,onOpenChange:me,children:e.jsxs(Rs,{children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"确认删除"}),e.jsx(Zs,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>me(!1),children:"取消"}),e.jsx(k,{variant:"destructive",onClick:ee,children:"删除"})]})]})})]})}function HS({emoji:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Ls,{children:e.jsx(Us,{children:"表情包详情"})}),e.jsx(Je,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:LS(l.id),alt:l.description||"表情包",className:"w-full h-full object-cover",onError:u=>{const x=u.target;x.style.display="none";const h=x.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:l.id})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(Te,{variant:"outline",children:l.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.full_path})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"描述"}),l.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(kS,{className:"prose-sm",children:l.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:l.emotion?e.jsx("span",{className:"text-sm",children:l.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[l.is_registered&&e.jsx(Te,{variant:"default",className:"bg-green-600",children:"已注册"}),l.is_banned&&e.jsx(Te,{variant:"destructive",children:"已封禁"}),!l.is_registered&&!l.is_banned&&e.jsx(Te,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:l.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.record_time)})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.last_used_time)})]})]})})]})})}function IS({emoji:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=m.useState(""),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[v,N]=m.useState(!1),{toast:y}=et();m.useEffect(()=>{l&&(x(l.emotion||""),f(l.is_registered),g(l.is_banned))},[l]);const w=async()=>{if(l)try{N(!0);const b=u.split(/[,,]/).map(L=>L.trim()).filter(Boolean).join(",");await MS(l.id,{emotion:b||void 0,is_registered:h,is_banned:p}),y({title:"成功",description:"表情包信息已更新"}),i(!1),c()}catch(b){const L=b instanceof Error?b.message:"保存失败";y({title:"错误",description:L,variant:"destructive"})}finally{N(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Rs,{className:"max-w-2xl",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"编辑表情包"}),e.jsx(Zs,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(E,{children:"情绪"}),e.jsx(Ys,{value:u,onChange:b=>x(b.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"is_registered",checked:h,onCheckedChange:b=>{b===!0?(f(!0),g(!1)):f(!1)}}),e.jsx(E,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"is_banned",checked:p,onCheckedChange:b=>{b===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(E,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(k,{onClick:w,disabled:v,children:v?"保存中...":"保存"})]})]})}):null}function PS({open:l,onOpenChange:n,onSuccess:i}){const[c,u]=m.useState("select"),[x,h]=m.useState([]),[f,p]=m.useState(null),[g,v]=m.useState(!1),{toast:N}=et(),y=m.useMemo(()=>new c1({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);m.useEffect(()=>{const P=()=>{const M=y.getFiles();if(M.length===0)return;const Z=M.map(G=>({id:G.id,name:G.name,previewUrl:G.preview||URL.createObjectURL(G.data),emotion:"",description:"",isRegistered:!0,file:G.data}));h(Z),M.length===1?(p(Z[0].id),u("edit-single")):u("edit-multiple")};return y.on("upload",P),()=>{y.off("upload",P)}},[y]),m.useEffect(()=>{l||(y.cancelAll(),u("select"),h([]),p(null),v(!1))},[l,y]);const w=m.useCallback((P,M)=>{h(Z=>Z.map(G=>G.id===P?{...G,...M}:G))},[]),b=m.useCallback(P=>P.emotion.trim().length>0,[]),L=m.useMemo(()=>x.length>0&&x.every(b),[x,b]),D=m.useMemo(()=>x.find(P=>P.id===f)||null,[x,f]),T=m.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(u("select"),h([]),p(null))},[c]),F=m.useCallback(async()=>{if(!L){N({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}v(!0);let P=0,M=0;try{for(const Z of x){const G=new FormData;G.append("file",Z.file),G.append("emotion",Z.emotion),G.append("description",Z.description),G.append("is_registered",Z.isRegistered.toString());try{(await we(BS(),{method:"POST",body:G})).ok?P++:M++}catch{M++}}M===0?(N({title:"上传成功",description:`成功上传 ${P} 个表情包`}),n(!1),i()):(N({title:"部分上传失败",description:`成功 ${P} 个,失败 ${M} 个`,variant:"destructive"}),i())}finally{v(!1)}},[L,x,N,n,i]),O=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(SS,{uppy:y,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),S=()=>{const P=x[0];return P?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(k,{variant:"ghost",size:"sm",onClick:T,children:[e.jsx(en,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"编辑表情包信息"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"w-32 h-32 rounded-lg border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:P.previewUrl,alt:P.name,className:"max-w-full max-h-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate max-w-32",children:P.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"single-emotion",value:P.emotion,onChange:M=>w(P.id,{emotion:M.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:P.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"single-description",children:"描述"}),e.jsx(re,{id:"single-description",value:P.description,onChange:M=>w(P.id,{description:M.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"single-is-registered",checked:P.isRegistered,onCheckedChange:M=>w(P.id,{isRegistered:M===!0})}),e.jsx(E,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(rt,{children:e.jsx(k,{onClick:F,disabled:!L||g,children:g?"上传中...":"上传"})})]}):null},C=()=>{const P=x.filter(b).length,M=x.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(k,{variant:"ghost",size:"sm",onClick:T,children:[e.jsx(en,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",P,"/",M," 已完成)"]})]}),e.jsx(Te,{variant:L?"default":"secondary",children:L?e.jsxs(e.Fragment,{children:[e.jsx(_t,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(Da,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Je,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(Z=>{const G=b(Z),ce=f===Z.id;return e.jsxs("div",{onClick:()=>p(Z.id),className:` - flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all - ${ce?"ring-2 ring-primary":""} - ${G?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-border hover:border-muted-foreground/50"} - `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:Z.previewUrl,alt:Z.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:Z.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Z.emotion||"未填写情感标签"})]}),G?e.jsx(oa,{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"})]},Z.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:D?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:D.previewUrl,alt:D.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:D.name}),b(D)&&e.jsxs(Te,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(_t,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"multi-emotion",value:D.emotion,onChange:Z=>w(D.id,{emotion:Z.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:D.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"multi-description",children:"描述"}),e.jsx(re,{id:"multi-description",value:D.description,onChange:Z=>w(D.id,{description:Z.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"multi-is-registered",checked:D.isRegistered,onCheckedChange:Z=>w(D.id,{isRegistered:Z===!0})}),e.jsx(E,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"上传后立即注册"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(jj,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(rt,{children:e.jsx(k,{onClick:F,disabled:!L||g,children:g?"上传中...":`上传全部 (${M})`})})]})};return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Rs,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Ls,{children:[e.jsxs(Us,{className:"flex items-center gap-2",children:[e.jsx($i,{className:"h-5 w-5"}),c==="select"&&"上传表情包 - 选择文件",c==="edit-single"&&"上传表情包 - 填写信息",c==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(Zs,{children:[c==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",c==="edit-single"&&"请填写表情包的情感标签(必填)和描述",c==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[c==="select"&&O(),c==="edit-single"&&S(),c==="edit-multiple"&&C()]})]})})}const an="/api/webui/expression";async function GS(){const l=await we(`${an}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function qS(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id);const i=await we(`${an}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取表达方式列表失败")}return i.json()}async function FS(l){const n=await we(`${an}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取表达方式详情失败")}return n.json()}async function VS(l){const n=await we(`${an}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建表达方式失败")}return n.json()}async function KS(l,n){const i=await we(`${an}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新表达方式失败")}return i.json()}async function QS(l){const n=await we(`${an}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除表达方式失败")}return n.json()}async function YS(l){const n=await we(`${an}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除表达方式失败")}return n.json()}async function JS(){const l=await we(`${an}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}function XS(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[v,N]=m.useState(""),[y,w]=m.useState(null),[b,L]=m.useState(!1),[D,T]=m.useState(!1),[F,O]=m.useState(!1),[S,C]=m.useState(null),[P,M]=m.useState(new Set),[Z,G]=m.useState(!1),[ce,de]=m.useState(""),[be,me]=m.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[pe,je]=m.useState([]),[A,Y]=m.useState(new Map),{toast:H}=et(),U=async()=>{try{c(!0);const ee=await qS({page:h,page_size:p,search:v||void 0});n(ee.data),x(ee.total)}catch(ee){H({title:"加载失败",description:ee instanceof Error?ee.message:"无法加载表达方式",variant:"destructive"})}finally{c(!1)}},$=async()=>{try{const ee=await JS();ee?.data&&me(ee.data)}catch(ee){console.error("加载统计数据失败:",ee)}},_e=async()=>{try{const ee=await GS();if(ee?.data){je(ee.data);const De=new Map;ee.data.forEach(Fe=>{De.set(Fe.chat_id,Fe.chat_name)}),Y(De)}}catch(ee){console.error("加载聊天列表失败:",ee)}},Ne=ee=>A.get(ee)||ee;m.useEffect(()=>{U(),$(),_e()},[h,p,v]);const Se=async ee=>{try{const De=await FS(ee.id);w(De.data),L(!0)}catch(De){H({title:"加载详情失败",description:De instanceof Error?De.message:"无法加载表达方式详情",variant:"destructive"})}},V=ee=>{w(ee),T(!0)},ye=async ee=>{try{await QS(ee.id),H({title:"删除成功",description:`已删除表达方式: ${ee.situation}`}),C(null),U(),$()}catch(De){H({title:"删除失败",description:De instanceof Error?De.message:"无法删除表达方式",variant:"destructive"})}},W=ee=>{const De=new Set(P);De.has(ee)?De.delete(ee):De.add(ee),M(De)},ue=()=>{P.size===l.length&&l.length>0?M(new Set):M(new Set(l.map(ee=>ee.id)))},ke=async()=>{try{await YS(Array.from(P)),H({title:"批量删除成功",description:`已删除 ${P.size} 个表达方式`}),M(new Set),G(!1),U(),$()}catch(ee){H({title:"批量删除失败",description:ee instanceof Error?ee.message:"无法批量删除表达方式",variant:"destructive"})}},J=()=>{const ee=parseInt(ce),De=Math.ceil(u/p);ee>=1&&ee<=De?(f(ee),de("")):H({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(Wl,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs(k,{onClick:()=>O(!0),className:"gap-2",children:[e.jsx(lt,{className:"h-4 w-4"}),"新增表达方式"]})]})}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:be.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:be.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:be.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(E,{htmlFor:"search",children:"搜索"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Vt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索情境、风格或上下文...",value:v,onChange:ee=>N(ee.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:P.size>0&&e.jsxs("span",{children:["已选择 ",P.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Le,{value:p.toString(),onValueChange:ee=>{g(parseInt(ee)),f(1),M(new Set)},children:[e.jsx(Oe,{id:"page-size",className:"w-20",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]}),P.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>M(new Set),children:"取消选择"}),e.jsxs(k,{variant:"destructive",size:"sm",onClick:()=>G(!0),children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(wl,{children:[e.jsx(_l,{children:e.jsxs(nt,{children:[e.jsx(Qe,{className:"w-12",children:e.jsx(Xs,{checked:P.size===l.length&&l.length>0,onCheckedChange:ue})}),e.jsx(Qe,{children:"情境"}),e.jsx(Qe,{children:"风格"}),e.jsx(Qe,{children:"聊天"}),e.jsx(Qe,{className:"text-right",children:"操作"})]})}),e.jsx(Sl,{children:i?e.jsx(nt,{children:e.jsx(Ie,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(nt,{children:e.jsx(Ie,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ee=>e.jsxs(nt,{children:[e.jsx(Ie,{children:e.jsx(Xs,{checked:P.has(ee.id),onCheckedChange:()=>W(ee.id)})}),e.jsx(Ie,{className:"font-medium max-w-xs truncate",children:ee.situation}),e.jsx(Ie,{className:"max-w-xs truncate",children:ee.style}),e.jsx(Ie,{className:"max-w-[200px] truncate",title:Ne(ee.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:Ne(ee.chat_id)})}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(k,{variant:"default",size:"sm",onClick:()=>V(ee),children:[e.jsx(En,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Se(ee),title:"查看详情",children:e.jsx(Xt,{className:"h-4 w-4"})}),e.jsxs(k,{size:"sm",onClick:()=>C(ee),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ee.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(ee=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Xs,{checked:P.has(ee.id),onCheckedChange:()=>W(ee.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:ee.situation,children:ee.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:ee.style,children:ee.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:Ne(ee.chat_id),style:{wordBreak:"keep-all"},children:Ne(ee.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>V(ee),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(En,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>Se(ee),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(Xt,{className:"h-3 w-3"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>C(ee),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(ns,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ee.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(zr,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Wa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:ce,onChange:ee=>de(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&J(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(k,{variant:"outline",size:"sm",onClick:J,disabled:!ce,className:"h-8",children:"跳转"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Dr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(ZS,{expression:y,open:b,onOpenChange:L,chatNameMap:A}),e.jsx(WS,{open:F,onOpenChange:O,chatList:pe,onSuccess:()=>{U(),$(),O(!1)}}),e.jsx(e4,{expression:y,open:D,onOpenChange:T,chatList:pe,onSuccess:()=>{U(),$(),T(!1)}}),e.jsx(gs,{open:!!S,onOpenChange:()=>C(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除表达方式 "',S?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>S&&ye(S),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(s4,{open:Z,onOpenChange:G,onConfirm:ke,count:P.size})]})}function ZS({expression:l,open:n,onOpenChange:i,chatNameMap:c}){if(!l)return null;const u=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",x=h=>c.get(h)||h;return e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"表达方式详情"}),e.jsx(Zs,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ei,{label:"情境",value:l.situation}),e.jsx(Ei,{label:"风格",value:l.style}),e.jsx(Ei,{label:"聊天",value:x(l.chat_id)}),e.jsx(Ei,{icon:Er,label:"记录ID",value:l.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Ei,{icon:Nl,label:"创建时间",value:u(l.create_date)})})]}),e.jsx(rt,{children:e.jsx(k,{onClick:()=>i(!1),children:"关闭"})})]})})}function Ei({icon:l,label:n,value:i,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(E,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:B("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function WS({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=m.useState({situation:"",style:"",chat_id:""}),[h,f]=m.useState(!1),{toast:p}=et(),g=async()=>{if(!u.situation||!u.style||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{f(!0),await VS(u),p({title:"创建成功",description:"表达方式已创建"}),x({situation:"",style:"",chat_id:""}),c()}catch(v){p({title:"创建失败",description:v instanceof Error?v.message:"无法创建表达方式",variant:"destructive"})}finally{f(!1)}};return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"新增表达方式"}),e.jsx(Zs,{children:"创建新的表达方式记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"situation",value:u.situation,onChange:v=>x({...u,situation:v.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"style",value:u.style,onChange:v=>x({...u,style:v.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Le,{value:u.chat_id,onValueChange:v=>x({...u,chat_id:v}),children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:i.map(v=>e.jsx(le,{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(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(k,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function e4({expression:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=m.useState({}),[f,p]=m.useState(!1),{toast:g}=et();m.useEffect(()=>{l&&h({situation:l.situation,style:l.style,chat_id:l.chat_id})},[l]);const v=async()=>{if(l)try{p(!0),await KS(l.id,x),g({title:"保存成功",description:"表达方式已更新"}),u()}catch(N){g({title:"保存失败",description:N instanceof Error?N.message:"无法更新表达方式",variant:"destructive"})}finally{p(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"编辑表达方式"}),e.jsx(Zs,{children:"修改表达方式的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit_situation",children:"情境"}),e.jsx(re,{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(E,{htmlFor:"edit_style",children:"风格"}),e.jsx(re,{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(E,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Le,{value:x.chat_id||"",onValueChange:N=>h({...x,chat_id:N}),children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:c.map(N=>e.jsx(le,{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(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(k,{onClick:v,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function s4({open:l,onOpenChange:n,onConfirm:i,count:c}){return e.jsx(gs,{open:l,onOpenChange:n,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["您即将删除 ",c," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Cl="/api/webui/jargon";async function t4(){const l=await we(`${Cl}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function a4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id),l.is_jargon!==void 0&&l.is_jargon!==null&&n.append("is_jargon",l.is_jargon.toString()),l.is_global!==void 0&&n.append("is_global",l.is_global.toString());const i=await we(`${Cl}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取黑话列表失败")}return i.json()}async function l4(l){const n=await we(`${Cl}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取黑话详情失败")}return n.json()}async function n4(l){const n=await we(`${Cl}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建黑话失败")}return n.json()}async function r4(l,n){const i=await we(`${Cl}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新黑话失败")}return i.json()}async function i4(l){const n=await we(`${Cl}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除黑话失败")}return n.json()}async function c4(l){const n=await we(`${Cl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除黑话失败")}return n.json()}async function o4(){const l=await we(`${Cl}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取黑话统计失败")}return l.json()}async function d4(l,n){const i=new URLSearchParams;l.forEach(u=>i.append("ids",u.toString())),i.append("is_jargon",n.toString());const c=await we(`${Cl}/batch/set-jargon?${i}`,{method:"POST"});if(!c.ok){const u=await c.json();throw new Error(u.detail||"批量设置黑话状态失败")}return c.json()}function u4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[v,N]=m.useState(""),[y,w]=m.useState("all"),[b,L]=m.useState("all"),[D,T]=m.useState(null),[F,O]=m.useState(!1),[S,C]=m.useState(!1),[P,M]=m.useState(!1),[Z,G]=m.useState(null),[ce,de]=m.useState(new Set),[be,me]=m.useState(!1),[pe,je]=m.useState(""),[A,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:{}}),[H,U]=m.useState([]),{toast:$}=et(),_e=async()=>{try{c(!0);const ge=await a4({page:h,page_size:p,search:v||void 0,chat_id:y==="all"?void 0:y,is_jargon:b==="all"?void 0:b==="true"?!0:b==="false"?!1:void 0});n(ge.data),x(ge.total)}catch(ge){$({title:"加载失败",description:ge instanceof Error?ge.message:"无法加载黑话列表",variant:"destructive"})}finally{c(!1)}},Ne=async()=>{try{const ge=await o4();ge?.data&&Y(ge.data)}catch(ge){console.error("加载统计数据失败:",ge)}},Se=async()=>{try{const ge=await t4();ge?.data&&U(ge.data)}catch(ge){console.error("加载聊天列表失败:",ge)}};m.useEffect(()=>{_e(),Ne(),Se()},[h,p,v,y,b]);const V=async ge=>{try{const as=await l4(ge.id);T(as.data),O(!0)}catch(as){$({title:"加载详情失败",description:as instanceof Error?as.message:"无法加载黑话详情",variant:"destructive"})}},ye=ge=>{T(ge),C(!0)},W=async ge=>{try{await i4(ge.id),$({title:"删除成功",description:`已删除黑话: ${ge.content}`}),G(null),_e(),Ne()}catch(as){$({title:"删除失败",description:as instanceof Error?as.message:"无法删除黑话",variant:"destructive"})}},ue=ge=>{const as=new Set(ce);as.has(ge)?as.delete(ge):as.add(ge),de(as)},ke=()=>{ce.size===l.length&&l.length>0?de(new Set):de(new Set(l.map(ge=>ge.id)))},J=async()=>{try{await c4(Array.from(ce)),$({title:"批量删除成功",description:`已删除 ${ce.size} 个黑话`}),de(new Set),me(!1),_e(),Ne()}catch(ge){$({title:"批量删除失败",description:ge instanceof Error?ge.message:"无法批量删除黑话",variant:"destructive"})}},ee=async ge=>{try{await d4(Array.from(ce),ge),$({title:"操作成功",description:`已将 ${ce.size} 个词条设为${ge?"黑话":"非黑话"}`}),de(new Set),_e(),Ne()}catch(as){$({title:"操作失败",description:as instanceof Error?as.message:"批量设置失败",variant:"destructive"})}},De=()=>{const ge=parseInt(pe),as=Math.ceil(u/p);ge>=1&&ge<=as?(f(ge),je("")):$({title:"无效的页码",description:`请输入1-${as}之间的页码`,variant:"destructive"})},Fe=ge=>ge===!0?e.jsxs(Te,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(_t,{className:"h-3 w-3 mr-1"}),"是黑话"]}):ge===!1?e.jsxs(Te,{variant:"secondary",children:[e.jsx(Da,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Te,{variant:"outline",children:[e.jsx(xj,{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(Rw,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(k,{onClick:()=>M(!0),className:"gap-2",children:[e.jsx(lt,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:A.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:A.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:A.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:A.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:A.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:A.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:A.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Vt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索内容、含义...",value:v,onChange:ge=>N(ge.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{children:"聊天筛选"}),e.jsxs(Le,{value:y,onValueChange:w,children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"全部聊天"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部聊天"}),H.map(ge=>e.jsx(le,{value:ge.chat_id,children:ge.chat_name},ge.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{children:"状态筛选"}),e.jsxs(Le,{value:b,onValueChange:L,children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"全部状态"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部状态"}),e.jsx(le,{value:"true",children:"是黑话"}),e.jsx(le,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Le,{value:p.toString(),onValueChange:ge=>{g(parseInt(ge)),f(1),de(new Set)},children:[e.jsx(Oe,{id:"page-size",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]})]})]}),ce.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:["已选择 ",ce.size," 个"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>ee(!0),children:[e.jsx(_t,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>ee(!1),children:[e.jsx(Da,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>de(new Set),children:"取消选择"}),e.jsxs(k,{variant:"destructive",size:"sm",onClick:()=>me(!0),children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(wl,{children:[e.jsx(_l,{children:e.jsxs(nt,{children:[e.jsx(Qe,{className:"w-12",children:e.jsx(Xs,{checked:ce.size===l.length&&l.length>0,onCheckedChange:ke})}),e.jsx(Qe,{children:"内容"}),e.jsx(Qe,{children:"含义"}),e.jsx(Qe,{children:"聊天"}),e.jsx(Qe,{children:"状态"}),e.jsx(Qe,{className:"text-center",children:"次数"}),e.jsx(Qe,{className:"text-right",children:"操作"})]})}),e.jsx(Sl,{children:i?e.jsx(nt,{children:e.jsx(Ie,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(nt,{children:e.jsx(Ie,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ge=>e.jsxs(nt,{children:[e.jsx(Ie,{children:e.jsx(Xs,{checked:ce.has(ge.id),onCheckedChange:()=>ue(ge.id)})}),e.jsx(Ie,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[ge.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(_m,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:ge.content,children:ge.content})]})}),e.jsx(Ie,{className:"max-w-[200px] truncate",title:ge.meaning||"",children:ge.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ie,{className:"max-w-[150px] truncate",title:ge.chat_name||ge.chat_id,children:ge.chat_name||ge.chat_id}),e.jsx(Ie,{children:Fe(ge.is_jargon)}),e.jsx(Ie,{className:"text-center",children:ge.count}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(k,{variant:"default",size:"sm",onClick:()=>ye(ge),children:[e.jsx(En,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>V(ge),title:"查看详情",children:e.jsx(Xt,{className:"h-4 w-4"})}),e.jsxs(k,{size:"sm",onClick:()=>G(ge),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ge.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(ge=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Xs,{checked:ce.has(ge.id),onCheckedChange:()=>ue(ge.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:[ge.is_global&&e.jsx(_m,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:ge.content})]}),ge.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:ge.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[Fe(ge.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",ge.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",ge.chat_name||ge.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>ye(ge),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(En,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>V(ge),className:"text-xs px-2 py-1 h-auto",children:e.jsx(Xt,{className:"h-3 w-3"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>G(ge),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(ns,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ge.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(zr,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Wa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:pe,onChange:ge=>je(ge.target.value),onKeyDown:ge=>ge.key==="Enter"&&De(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(k,{variant:"outline",size:"sm",onClick:De,disabled:!pe,className:"h-8",children:"跳转"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Dr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(m4,{jargon:D,open:F,onOpenChange:O}),e.jsx(x4,{open:P,onOpenChange:M,chatList:H,onSuccess:()=>{_e(),Ne(),M(!1)}}),e.jsx(h4,{jargon:D,open:S,onOpenChange:C,chatList:H,onSuccess:()=>{_e(),Ne(),C(!1)}}),e.jsx(gs,{open:!!Z,onOpenChange:()=>G(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除黑话 "',Z?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>Z&&W(Z),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(gs,{open:be,onOpenChange:me,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["您即将删除 ",ce.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:J,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function m4({jargon:l,open:n,onOpenChange:i}){return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"黑话详情"}),e.jsx(Zs,{children:"查看黑话的完整信息"})]}),e.jsx(Je,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(bm,{icon:Er,label:"记录ID",value:l.id.toString(),mono:!0}),e.jsx(bm,{label:"使用次数",value:l.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:l.content})]}),l.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const c=JSON.parse(l.raw_content);return Array.isArray(c)?c.map((u,x)=>e.jsxs("div",{children:[x>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:u})]},x)):e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:l.meaning?e.jsx(mv,{content:l.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(bm,{label:"聊天",value:l.chat_name||l.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[l.is_jargon===!0&&e.jsx(Te,{variant:"default",className:"bg-green-600",children:"是黑话"}),l.is_jargon===!1&&e.jsx(Te,{variant:"secondary",children:"非黑话"}),l.is_jargon===null&&e.jsx(Te,{variant:"outline",children:"未判定"}),l.is_global&&e.jsx(Te,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),l.is_complete&&e.jsx(Te,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),l.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:l.inference_with_context})]}),l.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:l.inference_content_only})]})]})}),e.jsx(rt,{className:"flex-shrink-0",children:e.jsx(k,{onClick:()=>i(!1),children:"关闭"})})]})}):null}function bm({icon:l,label:n,value:i,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(E,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:B("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function x4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=m.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=m.useState(!1),{toast:p}=et(),g=async()=>{if(!u.content||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await n4(u),p({title:"创建成功",description:"黑话已创建"}),x({content:"",meaning:"",chat_id:"",is_global:!1}),c()}catch(v){p({title:"创建失败",description:v instanceof Error?v.message:"无法创建黑话",variant:"destructive"})}finally{f(!1)}};return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"新增黑话"}),e.jsx(Zs,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"content",value:u.content,onChange:v=>x({...u,content:v.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"meaning",children:"含义"}),e.jsx(Ys,{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(E,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Le,{value:u.chat_id,onValueChange:v=>x({...u,chat_id:v}),children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:i.map(v=>e.jsx(le,{value:v.chat_id,children:v.chat_name},v.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"is_global",checked:u.is_global,onCheckedChange:v=>x({...u,is_global:v})}),e.jsx(E,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(k,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function h4({jargon:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=m.useState({}),[f,p]=m.useState(!1),{toast:g}=et();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{p(!0),await r4(l.id,x),g({title:"保存成功",description:"黑话已更新"}),u()}catch(N){g({title:"保存失败",description:N instanceof Error?N.message:"无法更新黑话",variant:"destructive"})}finally{p(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"编辑黑话"}),e.jsx(Zs,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit_content",children:"内容"}),e.jsx(re,{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(E,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(Ys,{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(E,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Le,{value:x.chat_id||"",onValueChange:N=>h({...x,chat_id:N}),children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:c.map(N=>e.jsx(le,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"黑话状态"}),e.jsxs(Le,{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(Oe,{children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"null",children:"未判定"}),e.jsx(le,{value:"true",children:"是黑话"}),e.jsx(le,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"edit_is_global",checked:x.is_global,onCheckedChange:N=>h({...x,is_global:N})}),e.jsx(E,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(k,{onClick:v,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const Lr="/api/webui/person";async function f4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.is_known!==void 0&&n.append("is_known",l.is_known.toString()),l.platform&&n.append("platform",l.platform);const i=await we(`${Lr}/list?${n}`,{headers:Os()});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取人物列表失败")}return i.json()}async function p4(l){const n=await we(`${Lr}/${l}`,{headers:Os()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取人物详情失败")}return n.json()}async function g4(l,n){const i=await we(`${Lr}/${l}`,{method:"PATCH",headers:Os(),body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新人物信息失败")}return i.json()}async function j4(l){const n=await we(`${Lr}/${l}`,{method:"DELETE",headers:Os()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除人物信息失败")}return n.json()}async function v4(){const l=await we(`${Lr}/stats/summary`,{headers:Os()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}async function N4(l){const n=await we(`${Lr}/batch/delete`,{method:"POST",headers:Os(),body:JSON.stringify({person_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function b4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[v,N]=m.useState(""),[y,w]=m.useState(void 0),[b,L]=m.useState(void 0),[D,T]=m.useState(null),[F,O]=m.useState(!1),[S,C]=m.useState(!1),[P,M]=m.useState(null),[Z,G]=m.useState({total:0,known:0,unknown:0,platforms:{}}),[ce,de]=m.useState(new Set),[be,me]=m.useState(!1),[pe,je]=m.useState(""),{toast:A}=et(),Y=async()=>{try{c(!0);const J=await f4({page:h,page_size:p,search:v||void 0,is_known:y,platform:b});n(J.data),x(J.total)}catch(J){A({title:"加载失败",description:J instanceof Error?J.message:"无法加载人物信息",variant:"destructive"})}finally{c(!1)}},H=async()=>{try{const J=await v4();J?.data&&G(J.data)}catch(J){console.error("加载统计数据失败:",J)}};m.useEffect(()=>{Y(),H()},[h,p,v,y,b]);const U=async J=>{try{const ee=await p4(J.person_id);T(ee.data),O(!0)}catch(ee){A({title:"加载详情失败",description:ee instanceof Error?ee.message:"无法加载人物详情",variant:"destructive"})}},$=J=>{T(J),C(!0)},_e=async J=>{try{await j4(J.person_id),A({title:"删除成功",description:`已删除人物信息: ${J.person_name||J.nickname||J.user_id}`}),M(null),Y(),H()}catch(ee){A({title:"删除失败",description:ee instanceof Error?ee.message:"无法删除人物信息",variant:"destructive"})}},Ne=m.useMemo(()=>Object.keys(Z.platforms),[Z.platforms]),Se=J=>{const ee=new Set(ce);ee.has(J)?ee.delete(J):ee.add(J),de(ee)},V=()=>{ce.size===l.length&&l.length>0?de(new Set):de(new Set(l.map(J=>J.person_id)))},ye=()=>{if(ce.size===0){A({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}me(!0)},W=async()=>{try{const J=await N4(Array.from(ce));A({title:"批量删除完成",description:J.message}),de(new Set),me(!1),Y(),H()}catch(J){A({title:"批量删除失败",description:J instanceof Error?J.message:"批量删除失败",variant:"destructive"})}},ue=()=>{const J=parseInt(pe),ee=Math.ceil(u/p);J>=1&&J<=ee?(f(J),je("")):A({title:"无效的页码",description:`请输入1-${ee}之间的页码`,variant:"destructive"})},ke=J=>J?new Date(J*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Sm,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:Z.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:Z.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:Z.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(E,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(Vt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:v,onChange:J=>N(J.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Le,{value:y===void 0?"all":y.toString(),onValueChange:J=>{w(J==="all"?void 0:J==="true"),f(1)},children:[e.jsx(Oe,{id:"filter-known",className:"mt-1.5",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部"}),e.jsx(le,{value:"true",children:"已认识"}),e.jsx(le,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Le,{value:b||"all",onValueChange:J=>{L(J==="all"?void 0:J),f(1)},children:[e.jsx(Oe,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部平台"}),Ne.map(J=>e.jsxs(le,{value:J,children:[J," (",Z.platforms[J],")"]},J))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:ce.size>0&&e.jsxs("span",{children:["已选择 ",ce.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Le,{value:p.toString(),onValueChange:J=>{g(parseInt(J)),f(1),de(new Set)},children:[e.jsx(Oe,{id:"page-size",className:"w-20",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"10",children:"10"}),e.jsx(le,{value:"20",children:"20"}),e.jsx(le,{value:"50",children:"50"}),e.jsx(le,{value:"100",children:"100"})]})]}),ce.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>de(new Set),children:"取消选择"}),e.jsxs(k,{variant:"destructive",size:"sm",onClick:ye,children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(wl,{children:[e.jsx(_l,{children:e.jsxs(nt,{children:[e.jsx(Qe,{className:"w-12",children:e.jsx(Xs,{checked:l.length>0&&ce.size===l.length,onCheckedChange:V,"aria-label":"全选"})}),e.jsx(Qe,{children:"状态"}),e.jsx(Qe,{children:"名称"}),e.jsx(Qe,{children:"昵称"}),e.jsx(Qe,{children:"平台"}),e.jsx(Qe,{children:"用户ID"}),e.jsx(Qe,{children:"最后更新"}),e.jsx(Qe,{className:"text-right",children:"操作"})]})}),e.jsx(Sl,{children:i?e.jsx(nt,{children:e.jsx(Ie,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(nt,{children:e.jsx(Ie,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(J=>e.jsxs(nt,{children:[e.jsx(Ie,{children:e.jsx(Xs,{checked:ce.has(J.person_id),onCheckedChange:()=>Se(J.person_id),"aria-label":`选择 ${J.person_name||J.nickname||J.user_id}`})}),e.jsx(Ie,{children:e.jsx("div",{className:B("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",J.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:J.is_known?"已认识":"未认识"})}),e.jsx(Ie,{className:"font-medium",children:J.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ie,{children:J.nickname||"-"}),e.jsx(Ie,{children:J.platform}),e.jsx(Ie,{className:"font-mono text-sm",children:J.user_id}),e.jsx(Ie,{className:"text-sm text-muted-foreground",children:ke(J.last_know)}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(k,{variant:"default",size:"sm",onClick:()=>U(J),children:[e.jsx(Xt,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(k,{variant:"default",size:"sm",onClick:()=>$(J),children:[e.jsx(En,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(k,{size:"sm",onClick:()=>M(J),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},J.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(J=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Xs,{checked:ce.has(J.person_id),onCheckedChange:()=>Se(J.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:B("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",J.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:J.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:J.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),J.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",J.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),e.jsx("p",{className:"font-medium text-xs",children:J.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:J.user_id,children:J.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),e.jsx("p",{className:"text-xs",children:ke(J.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>U(J),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Xt,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>$(J),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(En,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>M(J),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(ns,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},J.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(zr,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Wa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"number",value:pe,onChange:J=>je(J.target.value),onKeyDown:J=>J.key==="Enter"&&ue(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(k,{variant:"outline",size:"sm",onClick:ue,disabled:!pe,className:"h-8",children:"跳转"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Dr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(y4,{person:D,open:F,onOpenChange:O}),e.jsx(w4,{person:D,open:S,onOpenChange:C,onSuccess:()=>{Y(),H(),C(!1)}}),e.jsx(gs,{open:!!P,onOpenChange:()=>M(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除人物信息 "',P?.person_name||P?.nickname||P?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>P&&_e(P),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(gs,{open:be,onOpenChange:me,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",ce.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:W,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function y4({person:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"人物详情"}),e.jsxs(Zs,{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(jl,{icon:kr,label:"人物名称",value:l.person_name}),e.jsx(jl,{icon:Wl,label:"昵称",value:l.nickname}),e.jsx(jl,{icon:Er,label:"用户ID",value:l.user_id,mono:!0}),e.jsx(jl,{icon:Er,label:"人物ID",value:l.person_id,mono:!0}),e.jsx(jl,{label:"平台",value:l.platform}),e.jsx(jl,{label:"状态",value:l.is_known?"已认识":"未认识"})]}),l.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:l.name_reason})]}),l.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:l.memory_points})]}),l.group_nick_name&&l.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:l.group_nick_name.map((u,x)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:u.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:u.group_nick_name})]},x))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(jl,{icon:Nl,label:"认识时间",value:c(l.know_times)}),e.jsx(jl,{icon:Nl,label:"首次记录",value:c(l.know_since)}),e.jsx(jl,{icon:Nl,label:"最后更新",value:c(l.last_know)})]})]}),e.jsx(rt,{children:e.jsx(k,{onClick:()=>i(!1),children:"关闭"})})]})})}function jl({icon:l,label:n,value:i,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(E,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:B("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function w4({person:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=m.useState({}),[h,f]=m.useState(!1),{toast:p}=et();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 g=async()=>{if(l)try{f(!0),await g4(l.person_id,u),p({title:"保存成功",description:"人物信息已更新"}),c()}catch(v){p({title:"保存失败",description:v instanceof Error?v.message:"无法更新人物信息",variant:"destructive"})}finally{f(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"编辑人物信息"}),e.jsxs(Zs,{children:["修改 ",l.person_name||l.nickname||l.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"person_name",children:"人物名称"}),e.jsx(re,{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(E,{htmlFor:"nickname",children:"昵称"}),e.jsx(re,{id:"nickname",value:u.nickname||"",onChange:v=>x({...u,nickname:v.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(Ys,{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(E,{htmlFor:"memory_points",children:"个人印象"}),e.jsx(Ys,{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(E,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Pe,{id:"is_known",checked:u.is_known,onCheckedChange:v=>x({...u,is_known:v})})]})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(k,{onClick:g,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var _4=x1();const hg=t0(_4),qm="/api/webui";async function S4(l=100,n="all"){const i=`${qm}/knowledge/graph?limit=${l}&node_type=${n}`,c=await fetch(i);if(!c.ok)throw new Error(`获取知识图谱失败: ${c.status}`);return c.json()}async function C4(){const l=await fetch(`${qm}/knowledge/stats`);if(!l.ok)throw new Error("获取知识图谱统计信息失败");return l.json()}async function k4(l){const n=await fetch(`${qm}/knowledge/search?query=${encodeURIComponent(l)}`);if(!n.ok)throw new Error("搜索知识节点失败");return n.json()}const xv=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(ko,{type:"target",position:To.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:l.content,children:l.label}),e.jsx(ko,{type:"source",position:To.Bottom})]}));xv.displayName="EntityNode";const hv=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(ko,{type:"target",position:To.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:l.content,children:l.label}),e.jsx(ko,{type:"source",position:To.Bottom})]}));hv.displayName="ParagraphNode";const T4={entity:xv,paragraph:hv};function E4(l,n){const i=new hg.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const c=[],u=[];return l.forEach(x=>{i.setNode(x.id,{width:150,height:50})}),n.forEach(x=>{i.setEdge(x.source,x.target)}),hg.layout(i),l.forEach(x=>{const h=i.node(x.id);c.push({id:x.id,type:x.type,position:{x:h.x-75,y:h.y-25},data:{label:x.content.slice(0,20)+(x.content.length>20?"...":""),content:x.content}})}),n.forEach((x,h)=>{const f={id:`edge-${h}`,source:x.source,target:x.target,animated:l.length<=200&&x.weight>5,style:{strokeWidth:Math.min(x.weight/2,5),opacity:.6}};x.weight>10&&l.length<100&&(f.label=`${x.weight.toFixed(0)}`),u.push(f)}),{nodes:c,edges:u}}function M4(){const l=ua(),[n,i]=m.useState(!1),[c,u]=m.useState(null),[x,h]=m.useState(""),[f,p]=m.useState("all"),[g,v]=m.useState(50),[N,y]=m.useState("50"),[w,b]=m.useState(!1),[L,D]=m.useState(!0),[T,F]=m.useState(!1),[O,S]=m.useState(!1),[C,P,M]=h1([]),[Z,G,ce]=f1([]),[de,be]=m.useState(0),[me,pe]=m.useState(null),[je,A]=m.useState(null),{toast:Y}=et(),H=m.useCallback(W=>W.type==="entity"?"#6366f1":W.type==="paragraph"?"#10b981":"#6b7280",[]),U=m.useCallback(async(W=!1)=>{try{if(!W&&g>200){S(!0);return}i(!0);const[ue,ke]=await Promise.all([S4(g,f),C4()]);if(u(ke),ue.nodes.length===0){Y({title:"提示",description:"知识库为空,请先导入知识数据"}),P([]),G([]);return}const{nodes:J,edges:ee}=E4(ue.nodes,ue.edges);P(J),G(ee),be(J.length),ke&&ke.total_nodes>g&&Y({title:"提示",description:`知识图谱包含 ${ke.total_nodes} 个节点,当前显示 ${J.length} 个`}),Y({title:"加载成功",description:`已加载 ${J.length} 个节点,${ee.length} 条边`})}catch(ue){console.error("加载知识图谱失败:",ue),Y({title:"加载失败",description:ue instanceof Error?ue.message:"未知错误",variant:"destructive"})}finally{i(!1)}},[g,f,Y]),$=m.useCallback(async()=>{if(!x.trim()){Y({title:"提示",description:"请输入搜索关键词"});return}try{const W=await k4(x);if(W.length===0){Y({title:"未找到",description:"没有找到匹配的节点"});return}const ue=new Set(W.map(ke=>ke.id));P(ke=>ke.map(J=>({...J,style:{...J.style,opacity:ue.has(J.id)?1:.3,filter:ue.has(J.id)?"brightness(1.2)":"brightness(0.8)"}}))),Y({title:"搜索完成",description:`找到 ${W.length} 个匹配节点`})}catch(W){console.error("搜索失败:",W),Y({title:"搜索失败",description:W instanceof Error?W.message:"未知错误",variant:"destructive"})}},[x,Y]),_e=m.useCallback(()=>{P(W=>W.map(ue=>({...ue,style:{...ue.style,opacity:1,filter:"brightness(1)"}})))},[]),Ne=m.useCallback(()=>{D(!1),F(!0),U()},[U]),Se=m.useCallback(()=>{S(!1),setTimeout(()=>{U(!0)},0)},[U]),V=m.useCallback((W,ue)=>{C.find(J=>J.id===ue.id)&&pe({id:ue.id,type:ue.type,content:ue.data.content})},[C]);m.useEffect(()=>{L||T&&U()},[g,f,L,T]);const ye=m.useCallback((W,ue)=>{const ke=C.find(De=>De.id===ue.source),J=C.find(De=>De.id===ue.target),ee=Z.find(De=>De.id===ue.id);ke&&J&&ee&&A({source:{id:ke.id,type:ke.type,content:ke.data.content},target:{id:J.id,type:J.type,content:J.data.content},edge:{source:ue.source,target:ue.target,weight:parseFloat(ue.label||"0")}})},[C,Z]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),c&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Te,{variant:"outline",className:"gap-1",children:[e.jsx(Cr,{className:"h-3 w-3"}),"节点: ",c.total_nodes]}),e.jsxs(Te,{variant:"outline",className:"gap-1",children:[e.jsx(vj,{className:"h-3 w-3"}),"边: ",c.total_edges]}),e.jsxs(Te,{variant:"outline",className:"gap-1",children:[e.jsx(Jt,{className:"h-3 w-3"}),"实体: ",c.entity_nodes]}),e.jsxs(Te,{variant:"outline",className:"gap-1",children:[e.jsx(Ha,{className:"h-3 w-3"}),"段落: ",c.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(re,{placeholder:"搜索节点内容...",value:x,onChange:W=>h(W.target.value),onKeyDown:W=>W.key==="Enter"&&$(),className:"flex-1"}),e.jsx(k,{onClick:$,size:"sm",children:e.jsx(Vt,{className:"h-4 w-4"})}),e.jsx(k,{onClick:_e,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Le,{value:f,onValueChange:W=>p(W),children:[e.jsx(Oe,{className:"w-[120px]",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部节点"}),e.jsx(le,{value:"entity",children:"仅实体"}),e.jsx(le,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Le,{value:g===1e4?"all":w?"custom":g.toString(),onValueChange:W=>{W==="custom"?(b(!0),y(g.toString())):W==="all"?(b(!1),v(1e4)):(b(!1),v(Number(W)))},children:[e.jsx(Oe,{className:"w-[120px]",children:e.jsx(Ue,{})}),e.jsxs(Re,{children:[e.jsx(le,{value:"50",children:"50 节点"}),e.jsx(le,{value:"100",children:"100 节点"}),e.jsx(le,{value:"200",children:"200 节点"}),e.jsx(le,{value:"500",children:"500 节点"}),e.jsx(le,{value:"1000",children:"1000 节点"}),e.jsx(le,{value:"all",children:"全部 (最多10000)"}),e.jsx(le,{value:"custom",children:"自定义..."})]})]}),w&&e.jsx(re,{type:"number",min:"50",value:N,onChange:W=>y(W.target.value),onBlur:()=>{const W=parseInt(N);!isNaN(W)&&W>=50?v(W):(y("50"),v(50))},onKeyDown:W=>{if(W.key==="Enter"){const ue=parseInt(N);!isNaN(ue)&&ue>=50?v(ue):(y("50"),v(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(k,{onClick:()=>U(),variant:"outline",size:"sm",disabled:n,children:e.jsx(zt,{className:B("h-4 w-4",n&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:n?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(zt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):C.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Cr,{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(p1,{nodes:C,edges:Z,onNodesChange:M,onEdgesChange:ce,onNodeClick:V,onEdgeClick:ye,nodeTypes:T4,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:de<=500,nodesDraggable:de<=1e3,attributionPosition:"bottom-left",children:[e.jsx(g1,{variant:j1.Dots,gap:12,size:1}),e.jsx(v1,{}),de<=500&&e.jsx(N1,{nodeColor:H,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(b1,{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:"段落节点"})]}),de>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:"已禁用动画"}),de>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Is,{open:!!me,onOpenChange:W=>!W&&pe(null),children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Ls,{children:e.jsx(Us,{children:"节点详情"})}),me&&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(Te,{variant:me.type==="entity"?"default":"secondary",children:me.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:me.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Je,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:me.content})})]})]})]})}),e.jsx(Is,{open:!!je,onOpenChange:W=>!W&&A(null),children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Ls,{children:e.jsx(Us,{children:"边详情"})}),je&&e.jsx(Je,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:je.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[je.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:je.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[je.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),e.jsx("div",{className:"mt-1",children:e.jsx(Te,{variant:"outline",className:"text-base font-mono",children:je.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(gs,{open:L,onOpenChange:D,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"加载知识图谱"}),e.jsxs(hs,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>l({to:"/"}),children:"取消 (返回首页)"}),e.jsx(fs,{onClick:Ne,children:"确认加载"})]})]})}),e.jsx(gs,{open:O,onOpenChange:S,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"⚠️ 节点数量较多"}),e.jsx(hs,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["您正在尝试加载 ",e.jsx("strong",{className:"text-orange-600",children:g>=1e4?"全部 (最多10000个)":g})," 个节点。"]}),e.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),e.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[e.jsx("li",{children:"页面加载时间较长"}),e.jsx("li",{children:"浏览器卡顿或崩溃"}),e.jsx("li",{children:"系统资源占用过高"})]}),e.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>{S(!1),g>200&&(v(50),b(!1))},children:"取消"}),e.jsx(fs,{onClick:Se,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function A4(){return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-none border-b bg-card/50 px-6 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"麦麦知识库管理"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"管理和组织麦麦的知识库内容"})]})})}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsxs(ze,{children:[e.jsxs(ts,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Cr,{className:"h-10 w-10 text-primary"})}),e.jsx(ls,{className:"text-2xl",children:"麦麦知识库管理"}),e.jsx(Vs,{className:"text-base",children:"功能开发中,敬请期待"})]}),e.jsx(Ye,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"此功能将提供知识库的创建、编辑、导入和管理能力"})})]})})})]})}function fg({className:l,classNames:n,showOutsideDays:i=!0,captionLayout:c="label",buttonVariant:u="ghost",formatters:x,components:h,...f}){const p=Lj();return e.jsx(r1,{showOutsideDays:i,className:B("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,l),captionLayout:c,formatters:{formatMonthDropdown:g=>g.toLocaleString("default",{month:"short"}),...x},classNames:{root:B("w-fit",p.root),months:B("relative flex flex-col gap-4 md:flex-row",p.months),month:B("flex w-full flex-col gap-4",p.month),nav:B("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:B(Mr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:B(Mr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:B("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:B("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:B("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",p.dropdown_root),dropdown:B("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:B("select-none font-medium",c==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",p.caption_label),table:"w-full border-collapse",weekdays:B("flex",p.weekdays),weekday:B("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:B("mt-2 flex w-full",p.week),week_number_header:B("w-[--cell-size] select-none",p.week_number_header),week_number:B("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:B("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",p.day),range_start:B("bg-accent rounded-l-md",p.range_start),range_middle:B("rounded-none",p.range_middle),range_end:B("bg-accent rounded-r-md",p.range_end),today:B("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:B("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:B("text-muted-foreground opacity-50",p.disabled),hidden:B("invisible",p.hidden),...n},components:{Root:({className:g,rootRef:v,...N})=>e.jsx("div",{"data-slot":"calendar",ref:v,className:B(g),...N}),Chevron:({className:g,orientation:v,...N})=>v==="left"?e.jsx(Wa,{className:B("size-4",g),...N}):v==="right"?e.jsx(ba,{className:B("size-4",g),...N}):e.jsx(Oa,{className:B("size-4",g),...N}),DayButton:z4,WeekNumber:({children:g,...v})=>e.jsx("td",{...v,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:g})}),...h},...f})}function z4({className:l,day:n,modifiers:i,...c}){const u=Lj(),x=m.useRef(null);return m.useEffect(()=>{i.focused&&x.current?.focus()},[i.focused]),e.jsx(k,{ref:x,variant:"ghost",size:"icon","data-day":n.date.toLocaleDateString(),"data-selected-single":i.selected&&!i.range_start&&!i.range_end&&!i.range_middle,"data-range-start":i.range_start,"data-range-end":i.range_end,"data-range-middle":i.range_middle,className:B("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",u.day,l),...c})}const po={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 D4(){const[l,n]=m.useState([]),[i,c]=m.useState(""),[u,x]=m.useState("all"),[h,f]=m.useState("all"),[p,g]=m.useState(void 0),[v,N]=m.useState(void 0),[y,w]=m.useState(!0),[b,L]=m.useState(!1),[D,T]=m.useState("xs"),[F,O]=m.useState(4),[S,C]=m.useState(!1),P=m.useRef(null);m.useEffect(()=>{const $=wn.getAllLogs();n($);const _e=wn.onLog(()=>{n(wn.getAllLogs())}),Ne=wn.onConnectionChange(Se=>{L(Se)});return()=>{_e(),Ne()}},[]);const M=m.useMemo(()=>{const $=new Set(l.map(_e=>_e.module).filter(_e=>_e&&_e.trim()!==""));return Array.from($).sort()},[l]),Z=$=>{switch($){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},G=$=>{switch($){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},ce=()=>{window.location.reload()},de=()=>{wn.clearLogs(),n([])},be=()=>{const $=je.map(V=>`${V.timestamp} [${V.level.padEnd(8)}] [${V.module}] ${V.message}`).join(` -`),_e=new Blob([$],{type:"text/plain;charset=utf-8"}),Ne=URL.createObjectURL(_e),Se=document.createElement("a");Se.href=Ne,Se.download=`logs-${lm(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Se.click(),URL.revokeObjectURL(Ne)},me=()=>{w(!y)},pe=()=>{g(void 0),N(void 0)},je=m.useMemo(()=>l.filter($=>{const _e=i===""||$.message.toLowerCase().includes(i.toLowerCase())||$.module.toLowerCase().includes(i.toLowerCase()),Ne=u==="all"||$.level===u,Se=h==="all"||$.module===h;let V=!0;if(p||v){const ye=new Date($.timestamp);if(p){const W=new Date(p);W.setHours(0,0,0,0),V=V&&ye>=W}if(v){const W=new Date(v);W.setHours(23,59,59,999),V=V&&ye<=W}}return _e&&Ne&&Se&&V}),[l,i,u,h,p,v]),A=po[D].rowHeight+F,Y=Qy({count:je.length,getScrollElement:()=>P.current,estimateSize:()=>A,overscan:50}),H=m.useRef(!1),U=m.useRef(je.length);return m.useEffect(()=>{const $=P.current;if(!$)return;const _e=()=>{if(H.current)return;const{scrollTop:Ne,scrollHeight:Se,clientHeight:V}=$,ye=Se-Ne-V;ye>100&&y?w(!1):ye<50&&!y&&w(!0)};return $.addEventListener("scroll",_e,{passive:!0}),()=>$.removeEventListener("scroll",_e)},[y]),m.useEffect(()=>{const $=je.length>U.current;U.current=je.length,y&&je.length>0&&$&&(H.current=!0,Y.scrollToIndex(je.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{H.current=!1})}))},[je.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:B("h-2 w-2 sm:h-2.5 sm:w-2.5 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:b?"已连接":"未连接"})]})]}),e.jsx(ze,{className:"p-2 sm:p-3",children:e.jsx(Gi,{open:S,onOpenChange:C,children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative min-w-0",children:[e.jsx(Vt,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索日志...",value:i,onChange:$=>c($.target.value),className:"pl-8 h-8 text-xs sm:text-sm"})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(k,{variant:y?"default":"outline",size:"sm",onClick:me,className:"h-8 px-2",title:y?"自动滚动":"已暂停",children:[y?e.jsx(Lw,{className:"h-3.5 w-3.5"}):e.jsx(Uw,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:y?"滚动":"暂停"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:de,className:"h-8 px-2",title:"清空日志",children:[e.jsx(ns,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden md:inline",children:"清空"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:be,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(Yt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(qi,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",className:"h-8 px-2",title:S?"收起筛选":"展开筛选",children:[e.jsx(No,{className:"h-3.5 w-3.5"}),S?e.jsx(Tr,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(Oa,{className:"h-3.5 w-3.5 ml-1"})]})})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground text-center sm:text-right -mt-1",children:[e.jsxs("span",{className:"font-mono",children:[je.length," / ",l.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(Fi,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Le,{value:u,onValueChange:x,children:[e.jsxs(Oe,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(No,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Ue,{placeholder:"级别"})]}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部级别"}),e.jsx(le,{value:"DEBUG",children:"DEBUG"}),e.jsx(le,{value:"INFO",children:"INFO"}),e.jsx(le,{value:"WARNING",children:"WARNING"}),e.jsx(le,{value:"ERROR",children:"ERROR"}),e.jsx(le,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Le,{value:h,onValueChange:f,children:[e.jsxs(Oe,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(No,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Ue,{placeholder:"模块"})]}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部模块"}),M.map($=>e.jsx(le,{value:$,children:$},$))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Xa,{children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",className:B("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Gp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?lm(p,"PP",{locale:ho}):"开始日期"})]})}),e.jsx(Ia,{className:"w-auto p-0",align:"start",children:e.jsx(fg,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:ho})})]}),e.jsxs(Xa,{children:[e.jsx(Za,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",className:B("w-full sm:flex-1 justify-start text-left font-normal h-8",!v&&"text-muted-foreground"),children:[e.jsx(Gp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:v?lm(v,"PP",{locale:ho}):"结束日期"})]})}),e.jsx(Ia,{className:"w-auto p-0",align:"start",children:e.jsx(fg,{mode:"single",selected:v,onSelect:N,initialFocus:!0,locale:ho})})]}),(p||v)&&e.jsxs(k,{variant:"outline",size:"sm",onClick:pe,className:"w-full sm:w-auto h-8",children:[e.jsx(Da,{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(Bw,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(po).map($=>e.jsx(k,{variant:D===$?"default":"outline",size:"sm",onClick:()=>T($),className:"h-6 px-2 text-xs",children:po[$].label},$))})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-[200px]",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(Na,{value:[F],onValueChange:([$])=>O($),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(k,{variant:"outline",size:"sm",onClick:ce,className:"flex-1 h-8",children:[e.jsx(zt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:be,className:"flex-1 h-8",children:[e.jsx(Yt,{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(ze,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:P,className:B("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:B("p-2 sm:p-3 font-mono relative",po[D].class),style:{height:`${Y.getTotalSize()}px`},children:je.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"暂无日志数据"}):Y.getVirtualItems().map($=>{const _e=je[$.index];return e.jsxs("div",{"data-index":$.index,ref:Y.measureElement,className:B("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",G(_e.level)),style:{transform:`translateY(${$.start}px)`,paddingTop:`${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:_e.timestamp}),e.jsxs("span",{className:B("font-semibold text-[10px]",Z(_e.level)),children:["[",_e.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate text-[10px]",children:_e.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words text-[10px]",children:_e.message})]}),e.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:_e.timestamp}),e.jsxs("span",{className:B("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",Z(_e.level)),children:["[",_e.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:_e.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:_e.message})]})]},$.key)})})})})})]})}const O4="Mai-with-u",R4="plugin-repo",L4="main",U4="plugin_details.json";async function B4(){try{const l=await we("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:O4,repo:R4,branch:L4,file_path:U4})});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const n=await l.json();if(!n.success||!n.data)throw new Error(n.error||"获取插件列表失败");return JSON.parse(n.data).filter(u=>!u?.id||!u?.manifest?(console.warn("跳过无效插件数据:",u),!1):!u.manifest.name||!u.manifest.version?(console.warn("跳过缺少必需字段的插件:",u.id),!1):!0).map(u=>({id:u.id,manifest:{manifest_version:u.manifest.manifest_version||1,name:u.manifest.name,version:u.manifest.version,description:u.manifest.description||"",author:u.manifest.author||{name:"Unknown"},license:u.manifest.license||"Unknown",host_application:u.manifest.host_application||{min_version:"0.0.0"},homepage_url:u.manifest.homepage_url,repository_url:u.manifest.repository_url,keywords:u.manifest.keywords||[],categories:u.manifest.categories||[],default_locale:u.manifest.default_locale||"zh-CN",locales_path:u.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(l){throw console.error("Failed to fetch plugin list:",l),l}}async function $4(){try{const l=await we("/api/webui/plugins/git-status");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to check Git status:",l),{installed:!1,error:"无法检测 Git 安装状态"}}}async function H4(){try{const l=await we("/api/webui/plugins/version");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to get Maimai version:",l),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function I4(l,n,i){const c=l.split(".").map(f=>parseInt(f)||0),u=c[0]||0,x=c[1]||0,h=c[2]||0;if(i.version_majorparseInt(N)||0),p=f[0]||0,g=f[1]||0,v=f[2]||0;if(i.version_major>p||i.version_major===p&&i.version_minor>g||i.version_major===p&&i.version_minor===g&&i.version_patch>v)return!1}return!0}async function P4(){try{const l=await we("/api/webui/ws-token");if(!l.ok)return console.error("获取 WebSocket token 失败:",l.status),null;const n=await l.json();return n.success&&n.token?n.token:null}catch(l){return console.error("获取 WebSocket token 失败:",l),null}}async function G4(l,n){const i=await P4();if(!i)return console.warn("无法获取 WebSocket token,可能未登录"),null;const c=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host,x=`${c}//${u}/api/webui/ws/plugin-progress?token=${encodeURIComponent(i)}`;try{const h=new WebSocket(x);return h.onopen=()=>{console.log("Plugin progress WebSocket connected");const f=setInterval(()=>{h.readyState===WebSocket.OPEN?h.send("ping"):clearInterval(f)},3e4)},h.onmessage=f=>{try{if(f.data==="pong")return;const p=JSON.parse(f.data);l(p)}catch(p){console.error("Failed to parse progress data:",p)}},h.onerror=f=>{console.error("Plugin progress WebSocket error:",f),n?.(f)},h.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},h}catch(h){return console.error("创建 WebSocket 连接失败:",h),null}}async function zi(){try{const l=await we("/api/webui/plugins/installed",{headers:Os()});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const n=await l.json();if(!n.success)throw new Error(n.message||"获取已安装插件列表失败");return n.plugins||[]}catch(l){return console.error("Failed to get installed plugins:",l),[]}}function go(l,n){return n.some(i=>i.id===l)}function jo(l,n){const i=n.find(c=>c.id===l);if(i)return i.manifest?.version||i.version}async function q4(l,n,i="main"){const c=await we("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:n,branch:i})});if(!c.ok){const u=await c.json();throw new Error(u.detail||"安装失败")}return await c.json()}async function F4(l){const n=await we("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"卸载失败")}return await n.json()}async function V4(l,n,i="main"){const c=await we("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:n,branch:i})});if(!c.ok){const u=await c.json();throw new Error(u.detail||"更新失败")}return await c.json()}async function K4(l){const n=await we(`/api/webui/plugins/config/${l}/schema`,{headers:Os()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置 Schema 失败")}catch{throw new Error(`获取配置 Schema 失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置 Schema 失败");return i.schema}async function Q4(l){const n=await we(`/api/webui/plugins/config/${l}`,{headers:Os()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置失败");return i.config}async function Y4(l){const n=await we(`/api/webui/plugins/config/${l}/raw`,{headers:Os()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置失败");return i.config}async function J4(l,n){const i=await we(`/api/webui/plugins/config/${l}`,{method:"PUT",headers:Os(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function X4(l,n){const i=await we(`/api/webui/plugins/config/${l}/raw`,{method:"PUT",headers:Os(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function Z4(l){const n=await we(`/api/webui/plugins/config/${l}/reset`,{method:"POST",headers:Os()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"重置配置失败")}return await n.json()}async function W4(l){const n=await we(`/api/webui/plugins/config/${l}/toggle`,{method:"POST",headers:Os()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"切换状态失败")}return await n.json()}const Yi="https://maibot-plugin-stats.maibot-webui.workers.dev";async function fv(l){try{const n=await fetch(`${Yi}/stats/${l}`);return n.ok?await n.json():(console.error("Failed to fetch plugin stats:",n.statusText),null)}catch(n){return console.error("Error fetching plugin stats:",n),null}}async function eC(l,n){try{const i=n||Fm(),c=await fetch(`${Yi}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:i})}),u=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...u}:{success:!1,error:u.error||"点赞失败"}}catch(i){return console.error("Error liking plugin:",i),{success:!1,error:"网络错误"}}}async function sC(l,n){try{const i=n||Fm(),c=await fetch(`${Yi}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:i})}),u=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...u}:{success:!1,error:u.error||"点踩失败"}}catch(i){return console.error("Error disliking plugin:",i),{success:!1,error:"网络错误"}}}async function tC(l,n,i,c){if(n<1||n>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const u=c||Fm(),x=await fetch(`${Yi}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,rating:n,comment:i,user_id:u})}),h=await x.json();return x.status===429?{success:!1,error:"每天最多评分 3 次"}:x.ok?{success:!0,...h}:{success:!1,error:h.error||"评分失败"}}catch(u){return console.error("Error rating plugin:",u),{success:!1,error:"网络错误"}}}async function aC(l){try{const n=await fetch(`${Yi}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l})}),i=await n.json();return n.status===429?(console.warn("Download recording rate limited"),{success:!0}):n.ok?{success:!0,...i}:(console.error("Failed to record download:",i.error),{success:!1,error:i.error})}catch(n){return console.error("Error recording download:",n),{success:!1,error:"网络错误"}}}function lC(){const l=navigator,n=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,l.deviceMemory||0].join("|");let i=0;for(let c=0;c{x(!0);const T=await fv(l);T&&c(T),x(!1)};m.useEffect(()=>{w()},[l]);const b=async()=>{const T=await eC(l);T.success?(y({title:"已点赞",description:"感谢你的支持!"}),w()):y({title:"点赞失败",description:T.error||"未知错误",variant:"destructive"})},L=async()=>{const T=await sC(l);T.success?(y({title:"已反馈",description:"感谢你的反馈!"}),w()):y({title:"操作失败",description:T.error||"未知错误",variant:"destructive"})},D=async()=>{if(h===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const T=await tC(l,h,p||void 0);T.success?(y({title:"评分成功",description:"感谢你的评价!"}),N(!1),f(0),g(""),w()):y({title:"评分失败",description:T.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(Yt,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(vl,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):i?n?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${i.downloads.toLocaleString()}`,children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx("span",{children:i.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${i.rating.toFixed(1)} (${i.rating_count} 条评价)`,children:[e.jsx(vl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:i.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${i.likes}`,children:[e.jsx(rm,{className:"h-4 w-4"}),e.jsx("span",{children:i.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Yt,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(vl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:i.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[i.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(rm,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(qp,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:b,children:[e.jsx(rm,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:L,children:[e.jsx(qp,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Is,{open:v,onOpenChange:N,children:[e.jsx(Bo,{asChild:!0,children:e.jsxs(k,{variant:"default",size:"sm",children:[e.jsx(vl,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Rs,{children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"为插件评分"}),e.jsx(Zs,{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(T=>e.jsx("button",{onClick:()=>f(T),className:"focus:outline-none",children:e.jsx(vl,{className:`h-8 w-8 transition-colors ${T<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},T))}),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(Ys,{value:p,onChange:T=>g(T.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[p.length," / 500"]})]})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>N(!1),children:"取消"}),e.jsx(k,{onClick:D,disabled:h===0,children:"提交评分"})]})]})]})]}),i.recent_ratings&&i.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),e.jsx("div",{className:"space-y-3",children:i.recent_ratings.map((T,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(O=>e.jsx(vl,{className:`h-3 w-3 ${O<=T.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},O))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(T.created_at).toLocaleDateString()})]}),T.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:T.comment})]},F))})]})]}):null}const pg={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function rC(){return e.jsx(Dn,{children:e.jsx(iC,{})})}function iC(){const l=ua(),{triggerRestart:n,isRestarting:i}=sn(),[c,u]=m.useState(null),[x,h]=m.useState(""),[f,p]=m.useState("all"),[g,v]=m.useState("all"),[N,y]=m.useState(!0),[w,b]=m.useState([]),[L,D]=m.useState(!0),[T,F]=m.useState(null),[O,S]=m.useState(null),[C,P]=m.useState(null),[M,Z]=m.useState(null),[,G]=m.useState([]),[ce,de]=m.useState({}),[be,me]=m.useState(!1),[pe,je]=m.useState(null),[A,Y]=m.useState("main"),[H,U]=m.useState(""),[$,_e]=m.useState("preset"),[Ne,Se]=m.useState(!1),{toast:V}=et(),ye=async ae=>{const Ee=ae.map(async Me=>{try{const Ze=await fv(Me.id);return{id:Me.id,stats:Ze}}catch(Ze){return console.warn(`Failed to load stats for ${Me.id}:`,Ze),{id:Me.id,stats:null}}}),ie=await Promise.all(Ee),ve={};ie.forEach(({id:Me,stats:Ze})=>{Ze&&(ve[Me]=Ze)}),de(ve)};m.useEffect(()=>{let ae=null,Ee=!1;return(async()=>{if(ae=await G4(ve=>{Ee||(P(ve),ve.stage==="success"?setTimeout(()=>{Ee||P(null)},2e3):ve.stage==="error"&&(D(!1),F(ve.error||"加载失败")))},ve=>{console.error("WebSocket error:",ve),Ee||V({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ve=>{if(!ae){ve();return}const Me=()=>{ae&&ae.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ve()):ae&&ae.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ve()):setTimeout(Me,100)};Me()}),!Ee){const ve=await $4();S(ve),ve.installed||V({title:"Git 未安装",description:ve.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!Ee){const ve=await H4();Z(ve)}if(!Ee)try{D(!0),F(null);const ve=await B4();if(!Ee){const Me=await zi();G(Me);const Ze=ve.map(js=>{const Ot=go(js.id,Me),rs=jo(js.id,Me);return{...js,installed:Ot,installed_version:rs}});for(const js of Me)!Ze.some(rs=>rs.id===js.id)&&js.manifest&&Ze.push({id:js.id,manifest:{manifest_version:js.manifest.manifest_version||1,name:js.manifest.name,version:js.manifest.version,description:js.manifest.description||"",author:js.manifest.author,license:js.manifest.license||"Unknown",host_application:js.manifest.host_application,homepage_url:js.manifest.homepage_url,repository_url:js.manifest.repository_url,keywords:js.manifest.keywords||[],categories:js.manifest.categories||[],default_locale:js.manifest.default_locale||"zh-CN",locales_path:js.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:js.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});b(Ze),ye(Ze)}}catch(ve){if(!Ee){const Me=ve instanceof Error?ve.message:"加载插件列表失败";F(Me),V({title:"加载失败",description:Me,variant:"destructive"})}}finally{Ee||D(!1)}})(),()=>{Ee=!0,ae&&ae.close()}},[V]);const W=ae=>{if(!ae.installed&&M&&!ue(ae))return e.jsxs(Te,{variant:"destructive",className:"gap-1",children:[e.jsx(Dt,{className:"h-3 w-3"}),"不兼容"]});if(ae.installed){const Ee=ae.installed_version?.trim(),ie=ae.manifest.version?.trim();if(Ee!==ie){const ve=Ee?.split(".").map(Number)||[0,0,0],Me=ie?.split(".").map(Number)||[0,0,0];for(let Ze=0;Ze<3;Ze++){if((Me[Ze]||0)>(ve[Ze]||0))return e.jsxs(Te,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Dt,{className:"h-3 w-3"}),"可更新"]});if((Me[Ze]||0)<(ve[Ze]||0))break}}return e.jsxs(Te,{variant:"default",className:"gap-1",children:[e.jsx(oa,{className:"h-3 w-3"}),"已安装"]})}return null},ue=ae=>!M||!ae.manifest?.host_application?!0:I4(ae.manifest.host_application.min_version,ae.manifest.host_application.max_version,M),ke=ae=>{if(!ae.installed||!ae.installed_version||!ae.manifest?.version)return!1;const Ee=ae.installed_version.trim(),ie=ae.manifest.version.trim();if(Ee===ie)return!1;const ve=Ee.split(".").map(Number),Me=ie.split(".").map(Number);for(let Ze=0;Ze<3;Ze++){if((Me[Ze]||0)>(ve[Ze]||0))return!0;if((Me[Ze]||0)<(ve[Ze]||0))return!1}return!1},J=w.filter(ae=>{if(!ae.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",ae.id),!1;const Ee=x===""||ae.manifest.name?.toLowerCase().includes(x.toLowerCase())||ae.manifest.description?.toLowerCase().includes(x.toLowerCase())||ae.manifest.keywords&&ae.manifest.keywords.some(Ze=>Ze.toLowerCase().includes(x.toLowerCase())),ie=f==="all"||ae.manifest.categories&&ae.manifest.categories.includes(f);let ve=!0;g==="installed"?ve=ae.installed===!0:g==="updates"&&(ve=ae.installed===!0&&ke(ae));const Me=!N||!M||ue(ae);return Ee&&ie&&ve&&Me}),ee=()=>{u(null)},De=ae=>{if(!O?.installed){V({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(M&&!ue(ae)){V({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}je(ae),Y("main"),U(""),_e("preset"),Se(!1),me(!0)},Fe=async()=>{if(!pe)return;const ae=$==="custom"?H:A;if(!ae||ae.trim()===""){V({title:"分支名称不能为空",variant:"destructive"});return}try{me(!1),await q4(pe.id,pe.manifest.repository_url||"",ae),aC(pe.id).catch(ie=>{console.warn("Failed to record download:",ie)}),V({title:"安装成功",description:`${pe.manifest.name} 已成功安装`});const Ee=await zi();G(Ee),b(ie=>ie.map(ve=>{if(ve.id===pe.id){const Me=go(ve.id,Ee),Ze=jo(ve.id,Ee);return{...ve,installed:Me,installed_version:Ze}}return ve}))}catch(Ee){V({title:"安装失败",description:Ee instanceof Error?Ee.message:"未知错误",variant:"destructive"})}finally{je(null)}},ge=async ae=>{try{await F4(ae.id),V({title:"卸载成功",description:`${ae.manifest.name} 已成功卸载`});const Ee=await zi();G(Ee),b(ie=>ie.map(ve=>{if(ve.id===ae.id){const Me=go(ve.id,Ee),Ze=jo(ve.id,Ee);return{...ve,installed:Me,installed_version:Ze}}return ve}))}catch(Ee){V({title:"卸载失败",description:Ee instanceof Error?Ee.message:"未知错误",variant:"destructive"})}},as=async ae=>{if(!O?.installed){V({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const Ee=await V4(ae.id,ae.manifest.repository_url||"","main");V({title:"更新成功",description:`${ae.manifest.name} 已从 ${Ee.old_version} 更新到 ${Ee.new_version}`});const ie=await zi();G(ie),b(ve=>ve.map(Me=>{if(Me.id===ae.id){const Ze=go(Me.id,ie),js=jo(Me.id,ie);return{...Me,installed:Ze,installed_version:js}}return Me}))}catch(Ee){V({title:"更新失败",description:Ee instanceof Error?Ee.message:"未知错误",variant:"destructive"})}};return e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(k,{variant:"outline",onClick:()=>n(),disabled:i,children:[e.jsx(Nj,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(k,{onClick:()=>l({to:"/plugin-mirrors"}),children:[e.jsx($w,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]})]}),e.jsx(ze,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:e.jsx(Ye,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["安装、卸载或更新插件后,需要",e.jsx("span",{className:"font-semibold",children:"重启麦麦"}),"才能使更改生效"]})]})})}),O&&!O.installed&&e.jsxs(ze,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(ts,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Qt,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(ls,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(Vs,{className:"text-orange-800 dark:text-orange-200",children:O.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(Ye,{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(ze,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索插件...",value:x,onChange:ae=>h(ae.target.value),className:"pl-9"})]}),e.jsxs(Le,{value:f,onValueChange:p,children:[e.jsx(Oe,{className:"w-full sm:w-[200px]",children:e.jsx(Ue,{placeholder:"选择分类"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"all",children:"全部分类"}),e.jsx(le,{value:"Group Management",children:"群组管理"}),e.jsx(le,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(le,{value:"Utility Tools",children:"实用工具"}),e.jsx(le,{value:"Content Generation",children:"内容生成"}),e.jsx(le,{value:"Multimedia",children:"多媒体"}),e.jsx(le,{value:"External Integration",children:"外部集成"}),e.jsx(le,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(le,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"compatible-only",checked:N,onCheckedChange:ae=>y(ae===!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(da,{value:g,onValueChange:v,className:"w-full",children:e.jsxs(Zt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"all",children:["全部插件 (",w.filter(ae=>{if(!ae.manifest)return!1;const Ee=x===""||ae.manifest.name?.toLowerCase().includes(x.toLowerCase())||ae.manifest.description?.toLowerCase().includes(x.toLowerCase())||ae.manifest.keywords&&ae.manifest.keywords.some(Me=>Me.toLowerCase().includes(x.toLowerCase())),ie=f==="all"||ae.manifest.categories&&ae.manifest.categories.includes(f),ve=!N||!M||ue(ae);return Ee&&ie&&ve}).length,")"]}),e.jsxs(Xe,{value:"installed",children:["已安装 (",w.filter(ae=>{if(!ae.manifest)return!1;const Ee=x===""||ae.manifest.name?.toLowerCase().includes(x.toLowerCase())||ae.manifest.description?.toLowerCase().includes(x.toLowerCase())||ae.manifest.keywords&&ae.manifest.keywords.some(Me=>Me.toLowerCase().includes(x.toLowerCase())),ie=f==="all"||ae.manifest.categories&&ae.manifest.categories.includes(f),ve=!N||!M||ue(ae);return ae.installed&&Ee&&ie&&ve}).length,")"]}),e.jsxs(Xe,{value:"updates",children:["可更新 (",w.filter(ae=>{if(!ae.manifest)return!1;const Ee=x===""||ae.manifest.name?.toLowerCase().includes(x.toLowerCase())||ae.manifest.description?.toLowerCase().includes(x.toLowerCase())||ae.manifest.keywords&&ae.manifest.keywords.some(Me=>Me.toLowerCase().includes(x.toLowerCase())),ie=f==="all"||ae.manifest.categories&&ae.manifest.categories.includes(f),ve=!N||!M||ue(ae);return ae.installed&&ke(ae)&&Ee&&ie&&ve}).length,")"]})]})}),C&&C.stage==="loading"&&C.operation==="fetch"&&e.jsx(ze,{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(Js,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm font-medium",children:"加载插件列表"})]}),e.jsxs("span",{className:"text-sm font-medium",children:[C.progress,"%"]})]}),e.jsx(Mn,{value:C.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:C.message}),C.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",C.loaded_plugins," / ",C.total_plugins," 个插件"]})]})}),C&&C.stage==="error"&&C.error&&e.jsx(ze,{className:"border-destructive bg-destructive/10",children:e.jsx(ts,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Qt,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(ls,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(Vs,{className:"text-destructive/80",children:C.error})]})]})})}),L?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Js,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):T?e.jsx(ze,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Qt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:T}),e.jsx(k,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):J.length===0?e.jsx(ze,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Vt,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x||f!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(ae=>e.jsxs(ze,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(ts,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(ls,{className:"text-xl",children:ae.manifest?.name||ae.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[ae.manifest?.categories&&ae.manifest.categories[0]&&e.jsx(Te,{variant:"secondary",className:"text-xs whitespace-nowrap",children:pg[ae.manifest.categories[0]]||ae.manifest.categories[0]}),W(ae)]})]}),e.jsx(Vs,{className:"line-clamp-2",children:ae.manifest?.description||"无描述"})]}),e.jsx(Ye,{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(Yt,{className:"h-4 w-4"}),e.jsx("span",{children:(ce[ae.id]?.downloads??ae.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(vl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(ce[ae.id]?.rating??ae.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[ae.manifest?.keywords&&ae.manifest.keywords.slice(0,3).map(Ee=>e.jsx(Te,{variant:"outline",className:"text-xs",children:Ee},Ee)),ae.manifest?.keywords&&ae.manifest.keywords.length>3&&e.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",ae.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",ae.manifest?.version||"unknown"," · ",ae.manifest?.author?.name||"Unknown"]}),ae.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[ae.manifest.host_application.min_version,ae.manifest.host_application.max_version?` - ${ae.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(Lo,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>u(ae),children:"查看详情"}),ae.installed?ke(ae)?e.jsxs(k,{size:"sm",disabled:!O?.installed,title:O?.installed?void 0:"Git 未安装",onClick:()=>as(ae),children:[e.jsx(zt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(k,{variant:"destructive",size:"sm",disabled:!O?.installed,title:O?.installed?void 0:"Git 未安装",onClick:()=>ge(ae),children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(k,{size:"sm",disabled:!O?.installed||C?.operation==="install"||M!==null&&!ue(ae),title:O?.installed?M!==null&&!ue(ae)?`不兼容当前版本 (需要 ${ae.manifest?.host_application?.min_version||"未知"}${ae.manifest?.host_application?.max_version?` - ${ae.manifest.host_application.max_version}`:"+"},当前 ${M?.version})`:void 0:"Git 未安装",onClick:()=>De(ae),children:[e.jsx(Yt,{className:"h-4 w-4 mr-1"}),C?.operation==="install"&&C?.plugin_id===ae.id?"安装中...":"安装"]})]})}),C&&(C.stage==="loading"||C.stage==="success"||C.stage==="error")&&C.operation!=="fetch"&&C.plugin_id===ae.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${C.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":C.stage==="error"?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900":"bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[C.stage==="loading"?e.jsx(Js,{className:"h-3 w-3 animate-spin"}):C.stage==="success"?e.jsx(oa,{className:"h-3 w-3 text-green-600"}):e.jsx(Dt,{className:"h-3 w-3 text-red-600"}),e.jsx("span",{className:`text-xs font-medium ${C.stage==="success"?"text-green-700 dark:text-green-300":C.stage==="error"?"text-red-700 dark:text-red-300":""}`,children:C.stage==="loading"?e.jsxs(e.Fragment,{children:[C.operation==="install"&&"正在安装",C.operation==="uninstall"&&"正在卸载",C.operation==="update"&&"正在更新"]}):C.stage==="success"?e.jsxs(e.Fragment,{children:[C.operation==="install"&&"安装完成",C.operation==="uninstall"&&"卸载完成",C.operation==="update"&&"更新完成"]}):e.jsxs(e.Fragment,{children:[C.operation==="install"&&"安装失败",C.operation==="uninstall"&&"卸载失败",C.operation==="update"&&"更新失败"]})})]}),C.stage!=="error"&&e.jsxs("span",{className:`text-xs font-medium ${C.stage==="success"?"text-green-700 dark:text-green-300":""}`,children:[C.progress,"%"]})]}),C.stage!=="error"&&e.jsx(Mn,{value:C.progress,className:`h-1.5 ${C.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${C.stage==="success"?"text-green-600 dark:text-green-400 truncate":C.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:C.stage==="error"?C.error||C.message||"操作失败":C.message})]})})]},ae.id))}),e.jsx(Is,{open:c!==null,onOpenChange:ee,children:c&&c.manifest&&e.jsx(Rs,{className:"max-w-2xl max-h-[80vh] p-0 flex flex-col",children:e.jsx(Je,{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-6",children:[e.jsx(Ls,{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(Us,{className:"text-2xl",children:c.manifest.name}),e.jsxs(Zs,{children:["作者: ",c.manifest.author?.name||"Unknown",c.manifest.author?.url&&e.jsx("a",{href:c.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:e.jsx(vo,{className:"h-3 w-3 inline"})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[c.manifest.categories&&c.manifest.categories[0]&&e.jsx(Te,{variant:"secondary",children:pg[c.manifest.categories[0]]||c.manifest.categories[0]}),W(c)]})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(nC,{pluginId:c.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",c.manifest?.version||"unknown"]}),c.installed&&c.installed_version&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",c.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:(ce[c.id]?.downloads??c.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(vl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(ce[c.id]?.rating??c.rating??0).toFixed(1)," (",ce[c.id]?.rating_count??c.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:c.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:[c.manifest.host_application?.min_version||"未知",c.manifest.host_application?.max_version?` - ${c.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:c.manifest.keywords&&c.manifest.keywords.map(ae=>e.jsx(Te,{variant:"outline",children:ae},ae))})]}),c.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:c.detailed_description})]}),!c.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:c.manifest.description||"无描述"})]}),e.jsxs("div",{className:"space-y-2",children:[c.manifest.homepage_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"主页: "}),e.jsx("a",{href:c.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:c.manifest.homepage_url})]}),c.manifest.repository_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"仓库: "}),e.jsx("a",{href:c.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:c.manifest.repository_url})]})]})]}),e.jsxs(rt,{children:[c.manifest.homepage_url&&e.jsxs(k,{onClick:()=>window.open(c.manifest.homepage_url,"_blank"),children:[e.jsx(vo,{className:"h-4 w-4 mr-2"}),"访问主页"]}),c.manifest.repository_url&&e.jsxs(k,{variant:"outline",onClick:()=>window.open(c.manifest.repository_url,"_blank"),children:[e.jsx(vo,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})})}),e.jsx(Is,{open:be,onOpenChange:me,children:e.jsxs(Rs,{children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"安装插件"}),e.jsxs(Zs,{children:["安装 ",pe?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",pe?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof pe?.manifest.author=="string"?pe.manifest.author:pe?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"advanced-options",checked:Ne,onCheckedChange:ae=>Se(ae)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),Ne&&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(da,{value:$,onValueChange:ae=>_e(ae),children:[e.jsxs(Zt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(Xe,{value:"custom",className:"text-xs",children:"自定义分支"})]}),$==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Le,{value:A,onValueChange:Y,children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:"选择分支"})}),e.jsxs(Re,{children:[e.jsx(le,{value:"main",children:"main (默认)"}),e.jsx(le,{value:"master",children:"master"}),e.jsx(le,{value:"dev",children:"dev (开发版)"}),e.jsx(le,{value:"develop",children:"develop"}),e.jsx(le,{value:"beta",children:"beta (测试版)"}),e.jsx(le,{value:"stable",children:"stable (稳定版)"})]})]})}),$==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"输入分支名称,例如: feature/new-feature",value:H,onChange:ae=>U(ae.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!Ne&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>me(!1),children:"取消"}),e.jsxs(k,{onClick:Fe,children:[e.jsx(Yt,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})}),e.jsx(On,{})]})})}function cC(){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(bj,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(Je,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(ze,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(ts,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(ca,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(ls,{className:"text-2xl",children:"功能开发中"}),e.jsx(Vs,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(Ye,{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 oC({field:l,value:n,onChange:i}){const[c,u]=m.useState(!1);switch(l.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:l.label}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]}),e.jsx(Pe,{checked:!!n,onCheckedChange:i,disabled:l.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsx(re,{type:"number",value:n??l.default,onChange:x=>i(parseFloat(x.target.value)||0),min:l.min,max:l.max,step:l.step??1,placeholder:l.placeholder,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{children:l.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:n??l.default})]}),e.jsx(Na,{value:[n??l.default],onValueChange:x=>i(x[0]),min:l.min??0,max:l.max??100,step:l.step??1,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsxs(Le,{value:String(n??l.default),onValueChange:i,disabled:l.disabled,children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:l.placeholder??"请选择"})}),e.jsx(Re,{children:l.choices?.map(x=>e.jsx(le,{value:String(x),children:String(x)},String(x)))})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsx(Ys,{value:n??l.default,onChange:x=>i(x.target.value),placeholder:l.placeholder,rows:l.rows??3,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{type:c?"text":"password",value:n??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,disabled:l.disabled,className:"pr-10"}),e.jsx(k,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>u(!c),children:c?e.jsx(Bi,{className:"h-4 w-4"}):e.jsx(Xt,{className:"h-4 w-4"})})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsx(i_,{value:Array.isArray(n)?n:[],onChange:x=>i(x),itemType:l.item_type??"string",itemFields:l.item_fields,minItems:l.min_items,maxItems:l.max_items,disabled:l.disabled,placeholder:l.placeholder}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsx(re,{type:"text",value:n??l.default??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,maxLength:l.max_length,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]})}}function gg({section:l,config:n,onChange:i}){const[c,u]=m.useState(!l.collapsed),x=Object.entries(l.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(Gi,{open:c,onOpenChange:u,children:e.jsxs(ze,{children:[e.jsx(qi,{asChild:!0,children:e.jsxs(ts,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c?e.jsx(Oa,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ba,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(ls,{className:"text-lg",children:l.title})]}),e.jsxs(Te,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),l.description&&e.jsx(Vs,{className:"ml-6",children:l.description})]})}),e.jsx(Fi,{children:e.jsx(Ye,{className:"space-y-4 pt-0",children:x.map(([h,f])=>e.jsx(oC,{field:f,value:n[l.name]?.[h],onChange:p=>i(l.name,h,p),sectionName:l.name},h))})})]})})}function dC({plugin:l,onBack:n}){const{toast:i}=et(),{triggerRestart:c,isRestarting:u}=sn(),[x,h]=m.useState("visual"),[f,p]=m.useState(null),[g,v]=m.useState({}),[N,y]=m.useState({}),[w,b]=m.useState(""),[L,D]=m.useState(""),[T,F]=m.useState(!0),[O,S]=m.useState(!1),[C,P]=m.useState(!1),[M,Z]=m.useState(!1),[G,ce]=m.useState(!1),de=m.useCallback(async()=>{F(!0);try{const[H,U,$]=await Promise.all([K4(l.id),Q4(l.id),Y4(l.id)]);p(H),v(U),y(JSON.parse(JSON.stringify(U))),b($),D($)}catch(H){i({title:"加载配置失败",description:H instanceof Error?H.message:"未知错误",variant:"destructive"})}finally{F(!1)}},[l.id,i]);m.useEffect(()=>{de()},[de]),m.useEffect(()=>{P(x==="visual"?JSON.stringify(g)!==JSON.stringify(N):w!==L)},[g,N,w,L,x]);const be=(H,U,$)=>{v(_e=>({..._e,[H]:{..._e[H]||{},[U]:$}}))},me=async()=>{S(!0);try{if(x==="source"){try{ov(w)}catch(H){Z(!0),i({title:"TOML 格式错误",description:H instanceof Error?H.message:"无法解析 TOML 配置,请检查语法",variant:"destructive"}),S(!1);return}await X4(l.id,w),D(w),Z(!1)}else await J4(l.id,g),y(JSON.parse(JSON.stringify(g)));i({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(H){i({title:"保存失败",description:H instanceof Error?H.message:"未知错误",variant:"destructive"})}finally{S(!1)}},pe=async()=>{try{await Z4(l.id),i({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),ce(!1),de()}catch(H){i({title:"重置失败",description:H instanceof Error?H.message:"未知错误",variant:"destructive"})}},je=async()=>{try{const H=await W4(l.id);i({title:H.message,description:H.note}),de()}catch(H){i({title:"切换状态失败",description:H instanceof Error?H.message:"未知错误",variant:"destructive"})}};if(T)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Js,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Dt,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(k,{onClick:n,variant:"outline",children:[e.jsx(en,{className:"h-4 w-4 mr-2"}),"返回"]})]});const A=Object.values(f.sections).sort((H,U)=>H.order-U.order),Y=g.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(k,{variant:"ghost",size:"icon",onClick:n,children:e.jsx(en,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:f.plugin_info.name||l.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Te,{variant:Y?"default":"secondary",children:Y?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",f.plugin_info.version||l.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>h(x==="visual"?"source":"visual"),children:x==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(pj,{className:"h-4 w-4 mr-2"}),"源代码"]}):e.jsxs(e.Fragment,{children:[e.jsx(fj,{className:"h-4 w-4 mr-2"}),"可视化"]})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>c(),disabled:u,children:[e.jsx(Nj,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:je,children:[e.jsx(Vi,{className:"h-4 w-4 mr-2"}),Y?"禁用":"启用"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>ce(!0),children:[e.jsx(Ui,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(k,{size:"sm",onClick:me,disabled:!C||O,children:[O?e.jsx(Js,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Ki,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),C&&e.jsx(ze,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(Ye,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),x==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(gt,{children:[e.jsx(Dt,{className:"h-4 w-4"}),e.jsxs(jt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。保存时会验证格式,只有格式正确才能保存。",M&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Xj,{value:w,onChange:H=>{b(H),M&&Z(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&e.jsx(e.Fragment,{children:f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(da,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(Zt,{children:f.layout.tabs.map(H=>e.jsxs(Xe,{value:H.id,children:[H.title,H.badge&&e.jsx(Te,{variant:"secondary",className:"ml-2 text-xs",children:H.badge})]},H.id))}),f.layout.tabs.map(H=>e.jsx(ys,{value:H.id,className:"space-y-4 mt-4",children:H.sections.map(U=>{const $=f.sections[U];return $?e.jsx(gg,{section:$,config:g,onChange:be},U):null})},H.id))]}):e.jsx("div",{className:"space-y-4",children:A.map(H=>e.jsx(gg,{section:H,config:g,onChange:be},H.name))})}),e.jsx(Is,{open:G,onOpenChange:ce,children:e.jsxs(Rs,{children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"确认重置配置"}),e.jsx(Zs,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>ce(!1),children:"取消"}),e.jsx(k,{variant:"destructive",onClick:pe,children:"确认重置"})]})]})})]})}function uC(){return e.jsx(Dn,{children:e.jsx(mC,{})})}function mC(){const{toast:l}=et(),[n,i]=m.useState([]),[c,u]=m.useState(!0),[x,h]=m.useState(""),[f,p]=m.useState(null),g=async()=>{u(!0);try{const b=await zi();i(b)}catch(b){l({title:"加载插件列表失败",description:b instanceof Error?b.message:"未知错误",variant:"destructive"})}finally{u(!1)}};m.useEffect(()=>{g()},[]);const N=n.filter(b=>{const L=x.toLowerCase();return b.id.toLowerCase().includes(L)||b.manifest.name.toLowerCase().includes(L)||b.manifest.description?.toLowerCase().includes(L)}).filter((b,L,D)=>L===D.findIndex(T=>T.id===b.id)),y=n.length,w=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(dC,{plugin:f,onBack:()=>p(null)})})}),e.jsx(On,{})]}):e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(zt,{className:`h-4 w-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(ze,{children:[e.jsxs(ts,{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(ca,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ye,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:c?"正在加载...":"个插件"})]})]}),e.jsxs(ze,{children:[e.jsxs(ts,{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(oa,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(Ye,{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(ze,{children:[e.jsxs(ts,{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(Dt,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(Ye,{children:[e.jsx("div",{className:"text-2xl font-bold",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索插件...",value:x,onChange:b=>h(b.target.value),className:"pl-9"})]}),e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"已安装的插件"}),e.jsx(Vs,{children:"点击插件查看和编辑配置"})]}),e.jsx(Ye,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Js,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(ca,{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:N.map(b=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>p(b),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(ca,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:b.manifest.name}),e.jsxs(Te,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",b.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:b.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(k,{variant:"ghost",size:"sm",children:e.jsx(zn,{className:"h-4 w-4"})}),e.jsx(ba,{className:"h-4 w-4 text-muted-foreground"})]})]},b.id))})})]})]})})}function xC(){const l=ua(),{toast:n}=et(),[i,c]=m.useState([]),[u,x]=m.useState(!0),[h,f]=m.useState(null),[p,g]=m.useState(null),[v,N]=m.useState(!1),[y,w]=m.useState(!1),[b,L]=m.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D=m.useCallback(async()=>{try{x(!0),f(null);const M=await we("/api/webui/plugins/mirrors");if(!M.ok)throw new Error("获取镜像源列表失败");const Z=await M.json();c(Z.mirrors||[])}catch(M){const Z=M instanceof Error?M.message:"加载镜像源失败";f(Z),n({title:"加载失败",description:Z,variant:"destructive"})}finally{x(!1)}},[n]);m.useEffect(()=>{D()},[D]);const T=async()=>{try{const M=await we("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(b)});if(!M.ok){const Z=await M.json();throw new Error(Z.detail||"添加镜像源失败")}n({title:"添加成功",description:"镜像源已添加"}),N(!1),L({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D()}catch(M){n({title:"添加失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},F=async()=>{if(p)try{if(!(await we(`/api/webui/plugins/mirrors/${p.id}`,{method:"PUT",body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");n({title:"更新成功",description:"镜像源已更新"}),w(!1),g(null),D()}catch(M){n({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},O=async M=>{if(confirm("确定要删除这个镜像源吗?"))try{if(!(await we(`/api/webui/plugins/mirrors/${M}`,{method:"DELETE"})).ok)throw new Error("删除镜像源失败");n({title:"删除成功",description:"镜像源已删除"}),D()}catch(Z){n({title:"删除失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}},S=async M=>{try{if(!(await we(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",body:JSON.stringify({enabled:!M.enabled})})).ok)throw new Error("更新状态失败");D()}catch(Z){n({title:"更新失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}},C=M=>{g(M),L({id:M.id,name:M.name,raw_prefix:M.raw_prefix,clone_prefix:M.clone_prefix,enabled:M.enabled,priority:M.priority}),w(!0)},P=async(M,Z)=>{const G=Z==="up"?M.priority-1:M.priority+1;if(!(G<1))try{if(!(await we(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",body:JSON.stringify({priority:G})})).ok)throw new Error("更新优先级失败");D()}catch(ce){n({title:"更新失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}};return e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(k,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(en,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),e.jsxs(k,{onClick:()=>N(!0),children:[e.jsx(lt,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),u?e.jsx(ze,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Js,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(ze,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Qt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:h}),e.jsx(k,{onClick:D,children:"重新加载"})]})}):e.jsxs(ze,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(wl,{children:[e.jsx(_l,{children:e.jsxs(nt,{children:[e.jsx(Qe,{children:"状态"}),e.jsx(Qe,{children:"名称"}),e.jsx(Qe,{children:"ID"}),e.jsx(Qe,{children:"优先级"}),e.jsx(Qe,{className:"text-right",children:"操作"})]})}),e.jsx(Sl,{children:i.map(M=>e.jsxs(nt,{children:[e.jsx(Ie,{children:e.jsx(Pe,{checked:M.enabled,onCheckedChange:()=>S(M)})}),e.jsx(Ie,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:M.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",M.raw_prefix]})]})}),e.jsx(Ie,{children:e.jsx(Te,{variant:"outline",children:M.id})}),e.jsx(Ie,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:M.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(k,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>P(M,"up"),disabled:M.priority===1,children:e.jsx(Tr,{className:"h-3 w-3"})}),e.jsx(k,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>P(M,"down"),children:e.jsx(Oa,{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(k,{variant:"ghost",size:"icon",onClick:()=>C(M),children:e.jsx(Cn,{className:"h-4 w-4"})}),e.jsx(k,{variant:"ghost",size:"icon",onClick:()=>O(M.id),children:e.jsx(ns,{className:"h-4 w-4 text-destructive"})})]})})]},M.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:i.map(M=>e.jsx(ze,{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:M.name}),M.enabled&&e.jsx(Te,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Te,{variant:"outline",className:"mt-1 text-xs",children:M.id})]}),e.jsx(Pe,{checked:M.enabled,onCheckedChange:()=>S(M)})]}),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:M.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:M.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(k,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>C(M),children:[e.jsx(Cn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>P(M,"up"),disabled:M.priority===1,children:e.jsx(Tr,{className:"h-4 w-4"})}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>P(M,"down"),children:e.jsx(Oa,{className:"h-4 w-4"})}),e.jsx(k,{variant:"destructive",size:"sm",onClick:()=>O(M.id),children:e.jsx(ns,{className:"h-4 w-4"})})]})]})},M.id))})]}),e.jsx(Is,{open:v,onOpenChange:N,children:e.jsxs(Rs,{className:"max-w-lg",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"添加镜像源"}),e.jsx(Zs,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(re,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:M=>L({...b,id:M.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-name",children:"名称 *"}),e.jsx(re,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:M=>L({...b,name:M.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(re,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:M=>L({...b,raw_prefix:M.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(re,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:M=>L({...b,clone_prefix:M.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-priority",children:"优先级"}),e.jsx(re,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:M=>L({...b,priority:parseInt(M.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(Pe,{id:"add-enabled",checked:b.enabled,onCheckedChange:M=>L({...b,enabled:M})}),e.jsx(E,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>N(!1),children:"取消"}),e.jsx(k,{onClick:T,children:"添加"})]})]})}),e.jsx(Is,{open:y,onOpenChange:w,children:e.jsxs(Rs,{className:"max-w-lg",children:[e.jsxs(Ls,{children:[e.jsx(Us,{children:"编辑镜像源"}),e.jsx(Zs,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"镜像源 ID"}),e.jsx(re,{value:b.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(re,{id:"edit-name",value:b.name,onChange:M=>L({...b,name:M.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(re,{id:"edit-raw",value:b.raw_prefix,onChange:M=>L({...b,raw_prefix:M.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(re,{id:"edit-clone",value:b.clone_prefix,onChange:M=>L({...b,clone_prefix:M.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(re,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:M=>L({...b,priority:parseInt(M.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(Pe,{id:"edit-enabled",checked:b.enabled,onCheckedChange:M=>L({...b,enabled:M})}),e.jsx(E,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(rt,{children:[e.jsx(k,{variant:"outline",onClick:()=>w(!1),children:"取消"}),e.jsx(k,{onClick:F,children:"保存"})]})]})})]})})}const Di=m.forwardRef(({className:l,...n},i)=>e.jsx(Ug,{ref:i,className:B("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",l),...n}));Di.displayName=Ug.displayName;const hC=m.forwardRef(({className:l,...n},i)=>e.jsx(Bg,{ref:i,className:B("aspect-square h-full w-full",l),...n}));hC.displayName=Bg.displayName;const Oi=m.forwardRef(({className:l,...n},i)=>e.jsx($g,{ref:i,className:B("flex h-full w-full items-center justify-center rounded-full bg-muted",l),...n}));Oi.displayName=$g.displayName;function fC(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function pC(){const l="maibot_webui_user_id";let n=localStorage.getItem(l);return n||(n=fC(),localStorage.setItem(l,n)),n}function gC(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function jC(l){localStorage.setItem("maibot_webui_user_name",l)}const pv="maibot_webui_virtual_tabs";function vC(){try{const l=localStorage.getItem(pv);if(l)return JSON.parse(l)}catch(l){console.error("[Chat] 加载虚拟标签页失败:",l)}return[]}function jg(l){try{localStorage.setItem(pv,JSON.stringify(l))}catch(n){console.error("[Chat] 保存虚拟标签页失败:",n)}}function NC({segment:l}){switch(l.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(l.data)});case"image":case"emoji":return e.jsx("img",{src:String(l.data),alt:l.type==="emoji"?"表情包":"图片",className:B("rounded-lg max-w-full",l.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:n=>{const i=n.target;i.style.display="none",i.parentElement?.insertAdjacentHTML("beforeend",`[${l.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(l.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(l.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(l.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(l.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[回复消息]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[转发消息]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",l.original_type||"未知消息","]"]})}}function bC({message:l,isBot:n}){return l.message_type==="rich"&&l.segments&&l.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:l.segments.map((i,c)=>e.jsx(NC,{segment:i},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:l.content})}function yC(){const l={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},n=()=>{const Ge=vC().map(He=>{const Ve=He.virtualConfig;return!Ve.groupId&&Ve.platform&&Ve.userId&&(Ve.groupId=`webui_virtual_group_${Ve.platform}_${Ve.userId}`),{id:He.id,type:"virtual",label:He.label,virtualConfig:Ve,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[l,...Ge]},[i,c]=m.useState(n),[u,x]=m.useState("webui-default"),h=i.find(Q=>Q.id===u)||i[0],[f,p]=m.useState(""),[g,v]=m.useState(!1),[N,y]=m.useState(!0),[w,b]=m.useState(gC()),[L,D]=m.useState(!1),[T,F]=m.useState(""),[O,S]=m.useState(!1),[C,P]=m.useState([]),[M,Z]=m.useState([]),[G,ce]=m.useState(!1),[de,be]=m.useState(!1),[me,pe]=m.useState(""),[je,A]=m.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),Y=m.useRef(pC()),H=m.useRef(new Map),U=m.useRef(null),$=m.useRef(new Map),_e=m.useRef(0),Ne=m.useRef(new Map),{toast:Se}=et(),V=Q=>(_e.current+=1,`${Q}-${Date.now()}-${_e.current}-${Math.random().toString(36).substr(2,9)}`),ye=m.useCallback((Q,Ge)=>{c(He=>He.map(Ve=>Ve.id===Q?{...Ve,...Ge}:Ve))},[]),W=m.useCallback((Q,Ge)=>{c(He=>He.map(Ve=>Ve.id===Q?{...Ve,messages:[...Ve.messages,Ge]}:Ve))},[]),ue=m.useCallback(()=>{U.current?.scrollIntoView({behavior:"smooth"})},[]);m.useEffect(()=>{ue()},[h?.messages,ue]);const ke=m.useCallback(async()=>{ce(!0);try{const Q=await we("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",Q.status,Q.headers.get("content-type")),Q.ok){const Ge=Q.headers.get("content-type");if(Ge&&Ge.includes("application/json")){const He=await Q.json();console.log("[Chat] 平台列表数据:",He),P(He.platforms||[])}else{const He=await Q.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",He.substring(0,200)),Se({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",Q.status),Se({title:"获取平台失败",description:`服务器返回错误: ${Q.status}`,variant:"destructive"})}catch(Q){console.error("[Chat] 获取平台列表失败:",Q),Se({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{ce(!1)}},[Se]),J=m.useCallback(async(Q,Ge)=>{be(!0);try{const He=new URLSearchParams;Q&&He.append("platform",Q),Ge&&He.append("search",Ge),He.append("limit","50");const Ve=await we(`/api/chat/persons?${He.toString()}`);if(Ve.ok){const Bs=Ve.headers.get("content-type");if(Bs&&Bs.includes("application/json")){const Ce=await Ve.json();Z(Ce.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(He){console.error("[Chat] 获取用户列表失败:",He)}finally{be(!1)}},[]);m.useEffect(()=>{je.platform&&J(je.platform,me)},[je.platform,me,J]);const ee=m.useCallback(async(Q,Ge)=>{y(!0);try{const He=new URLSearchParams;He.append("user_id",Y.current),He.append("limit","50"),Ge&&He.append("group_id",Ge);const Ve=`/api/chat/history?${He.toString()}`;console.log("[Chat] 正在加载历史消息:",Ve);const Bs=await we(Ve);if(Bs.ok){const Ce=await Bs.text();try{const cs=JSON.parse(Ce);if(cs.messages&&cs.messages.length>0){const Es=cs.messages.map(es=>({id:es.id,type:es.type,content:es.content,timestamp:es.timestamp,sender:{name:es.sender_name||(es.is_bot?"麦麦":"WebUI用户"),user_id:es.user_id,is_bot:es.is_bot}}));ye(Q,{messages:Es});const zs=Ne.current.get(Q)||new Set;Es.forEach(es=>{if(es.type==="bot"){const We=`bot-${es.content}-${Math.floor(es.timestamp*1e3)}`;zs.add(We)}}),Ne.current.set(Q,zs)}}catch(cs){console.error("[Chat] JSON 解析失败:",cs)}}}catch(He){console.error("[Chat] 加载历史消息失败:",He)}finally{y(!1)}},[ye]),De=m.useCallback(async(Q,Ge,He)=>{const Ve=H.current.get(Q);if(Ve?.readyState===WebSocket.OPEN||Ve?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${Q}] WebSocket 已存在,跳过连接`);return}v(!0);let Bs=null;try{const zs=await we("/api/webui/ws-token");if(zs.ok){const es=await zs.json();if(es.success&&es.token)Bs=es.token;else{console.warn(`[Tab ${Q}] 获取 WebSocket token 失败: ${es.message||"未登录"}`),v(!1);return}}}catch(zs){console.error(`[Tab ${Q}] 获取 WebSocket token 失败:`,zs),v(!1);return}if(!Bs){v(!1);return}const Ce=window.location.protocol==="https:"?"wss:":"ws:",cs=new URLSearchParams;cs.append("token",Bs),Ge==="virtual"&&He?(cs.append("user_id",He.userId),cs.append("user_name",He.userName),cs.append("platform",He.platform),cs.append("person_id",He.personId),cs.append("group_name",He.groupName||"WebUI虚拟群聊"),He.groupId&&cs.append("group_id",He.groupId)):(cs.append("user_id",Y.current),cs.append("user_name",w));const Es=`${Ce}//${window.location.host}/api/chat/ws?${cs.toString()}`;console.log(`[Tab ${Q}] 正在连接 WebSocket:`,Es);try{const zs=new WebSocket(Es);H.current.set(Q,zs),zs.onopen=()=>{ye(Q,{isConnected:!0}),v(!1),console.log(`[Tab ${Q}] WebSocket 已连接`)},zs.onmessage=es=>{try{const We=JSON.parse(es.data);switch(We.type){case"session_info":ye(Q,{sessionInfo:{session_id:We.session_id,user_id:We.user_id,user_name:We.user_name,bot_name:We.bot_name}});break;case"system":W(Q,{id:V("sys"),type:"system",content:We.content||"",timestamp:We.timestamp||Date.now()/1e3});break;case"user_message":{const vs=We.sender?.user_id,mt=Ge==="virtual"&&He?He.userId:Y.current;console.log(`[Tab ${Q}] 收到 user_message, sender: ${vs}, current: ${mt}`);const Rt=vs?vs.replace(/^webui_user_/,""):"",it=mt?mt.replace(/^webui_user_/,""):"";if(Rt&&it&&Rt===it){console.log(`[Tab ${Q}] 跳过自己的消息(user_id 匹配)`);break}const ss=Ne.current.get(Q)||new Set,St=`user-${We.content}-${Math.floor((We.timestamp||0)*1e3)}`;if(ss.has(St)){console.log(`[Tab ${Q}] 跳过自己的消息(内容去重)`);break}if(ss.add(St),Ne.current.set(Q,ss),ss.size>100){const $t=ss.values().next().value;$t&&ss.delete($t)}W(Q,{id:We.message_id||V("user"),type:"user",content:We.content||"",timestamp:We.timestamp||Date.now()/1e3,sender:We.sender});break}case"bot_message":{ye(Q,{isTyping:!1});const vs=Ne.current.get(Q)||new Set,mt=`bot-${We.content}-${Math.floor((We.timestamp||0)*1e3)}`;if(vs.has(mt))break;if(vs.add(mt),Ne.current.set(Q,vs),vs.size>100){const Rt=vs.values().next().value;Rt&&vs.delete(Rt)}c(Rt=>Rt.map(it=>{if(it.id!==Q)return it;const ss=it.messages.filter($t=>$t.type!=="thinking"),St={id:V("bot"),type:"bot",content:We.content||"",message_type:We.message_type==="rich"?"rich":"text",segments:We.segments,timestamp:We.timestamp||Date.now()/1e3,sender:We.sender};return{...it,messages:[...ss,St]}}));break}case"typing":ye(Q,{isTyping:We.is_typing||!1});break;case"error":c(vs=>vs.map(mt=>{if(mt.id!==Q)return mt;const Rt=mt.messages.filter(it=>it.type!=="thinking");return{...mt,messages:[...Rt,{id:V("error"),type:"error",content:We.content||"发生错误",timestamp:We.timestamp||Date.now()/1e3}]}})),Se({title:"错误",description:We.content,variant:"destructive"});break;case"pong":break;case"history":{const vs=We.messages||[];if(vs.length>0){const mt=Ne.current.get(Q)||new Set,Rt=vs.map(it=>{const ss=it.is_bot||!1,St=it.id||V(ss?"bot":"user"),$t=`${ss?"bot":"user"}-${it.content}-${Math.floor(it.timestamp*1e3)}`;return mt.add($t),{id:St,type:ss?"bot":"user",content:it.content,timestamp:it.timestamp,sender:{name:it.sender_name||(ss?"麦麦":"用户"),user_id:it.sender_id,is_bot:ss}}});Ne.current.set(Q,mt),ye(Q,{messages:Rt}),console.log(`[Tab ${Q}] 已加载 ${Rt.length} 条历史消息`)}break}default:console.log("未知消息类型:",We.type)}}catch(We){console.error("解析消息失败:",We)}},zs.onclose=()=>{ye(Q,{isConnected:!1}),v(!1),H.current.delete(Q),console.log(`[Tab ${Q}] WebSocket 已断开`);const es=$.current.get(Q);es&&clearTimeout(es);const We=window.setTimeout(()=>{if(!Fe.current){const vs=i.find(mt=>mt.id===Q);vs&&De(Q,vs.type,vs.virtualConfig)}},5e3);$.current.set(Q,We)},zs.onerror=es=>{console.error(`[Tab ${Q}] WebSocket 错误:`,es),v(!1)}}catch(zs){console.error(`[Tab ${Q}] 创建 WebSocket 失败:`,zs),v(!1)}},[w,ye,W,Se,i]),Fe=m.useRef(!1);m.useEffect(()=>{Fe.current=!1;const Q=H.current,Ge=$.current,He=Ne.current;ee("webui-default");const Ve=setTimeout(()=>{Fe.current||(De("webui-default","webui"),i.forEach(Ce=>{Ce.type==="virtual"&&Ce.virtualConfig&&(He.set(Ce.id,new Set),setTimeout(()=>{Fe.current||De(Ce.id,"virtual",Ce.virtualConfig)},200))}))},100),Bs=setInterval(()=>{Q.forEach(Ce=>{Ce.readyState===WebSocket.OPEN&&Ce.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{Fe.current=!0,clearTimeout(Ve),clearInterval(Bs),Ge.forEach(Ce=>{clearTimeout(Ce)}),Ge.clear(),Q.forEach(Ce=>{Ce.close()}),Q.clear()}},[]);const ge=m.useCallback(()=>{const Q=H.current.get(u);if(!f.trim()||!Q||Q.readyState!==WebSocket.OPEN)return;const Ge=h?.type==="virtual"&&h.virtualConfig?.userName||w,He=f.trim(),Ve=Date.now()/1e3;Q.send(JSON.stringify({type:"message",content:He,user_name:Ge}));const Bs=Ne.current.get(u)||new Set,Ce=`user-${He}-${Math.floor(Ve*1e3)}`;if(Bs.add(Ce),Ne.current.set(u,Bs),Bs.size>100){const zs=Bs.values().next().value;zs&&Bs.delete(zs)}const cs={id:V("user"),type:"user",content:He,timestamp:Ve,sender:{name:Ge,is_bot:!1}};W(u,cs);const Es={id:V("thinking"),type:"thinking",content:"",timestamp:Ve+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};W(u,Es),p("")},[f,w,u,h,W]),as=Q=>{Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),ge())},ae=()=>{F(w),D(!0)},Ee=()=>{const Q=T.trim()||"WebUI用户";b(Q),jC(Q),D(!1);const Ge=H.current.get(u);Ge?.readyState===WebSocket.OPEN&&Ge.send(JSON.stringify({type:"update_nickname",user_name:Q}))},ie=()=>{F(""),D(!1)},ve=Q=>new Date(Q*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),Me=()=>{const Q=H.current.get(u);Q&&(Q.close(),H.current.delete(u)),De(u,h?.type||"webui",h?.virtualConfig)},Ze=()=>{A({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),pe(""),ke(),S(!0)},js=()=>{if(!je.platform||!je.personId){Se({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const Q=`webui_virtual_group_${je.platform}_${je.userId}`,Ge=`virtual-${je.platform}-${je.userId}-${Date.now()}`,He=je.userName||je.userId,Ve={id:Ge,type:"virtual",label:He,virtualConfig:{...je,groupId:Q},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Bs=>{const Ce=[...Bs,Ve],cs=Ce.filter(Es=>Es.type==="virtual"&&Es.virtualConfig).map(Es=>({id:Es.id,label:Es.label,virtualConfig:Es.virtualConfig,createdAt:Date.now()}));return jg(cs),Ce}),x(Ge),S(!1),Ne.current.set(Ge,new Set),setTimeout(()=>{De(Ge,"virtual",je)},100),Se({title:"虚拟身份标签页",description:`已创建 ${He} 的对话`})},Ot=(Q,Ge)=>{if(Ge?.stopPropagation(),Q==="webui-default")return;const He=H.current.get(Q);He&&(He.close(),H.current.delete(Q));const Ve=$.current.get(Q);Ve&&(clearTimeout(Ve),$.current.delete(Q)),Ne.current.delete(Q),c(Bs=>{const Ce=Bs.filter(Es=>Es.id!==Q),cs=Ce.filter(Es=>Es.type==="virtual"&&Es.virtualConfig).map(Es=>({id:Es.id,label:Es.label,virtualConfig:Es.virtualConfig,createdAt:Date.now()}));return jg(cs),Ce}),u===Q&&x("webui-default")},rs=Q=>{x(Q)},Ps=Q=>{A(Ge=>({...Ge,personId:Q.person_id,userId:Q.user_id,userName:Q.nickname||Q.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Is,{open:O,onOpenChange:S,children:e.jsxs(Rs,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Ls,{children:[e.jsxs(Us,{className:"flex items-center gap-2",children:[e.jsx(im,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(Zs,{children:"选择一个麦麦已认识的用户,以该用户的身份与麦麦对话。麦麦将使用她对该用户的记忆和认知来回应。"})]}),e.jsxs("div",{className:"space-y-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{className:"flex items-center gap-2",children:[e.jsx(_m,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Le,{value:je.platform,onValueChange:Q=>{A(Ge=>({...Ge,platform:Q,personId:"",userId:"",userName:""})),Z([])},children:[e.jsx(Oe,{disabled:G,children:e.jsx(Ue,{placeholder:G?"加载中...":"选择平台"})}),e.jsx(Re,{children:C.map(Q=>e.jsxs(le,{value:Q.platform,children:[Q.platform," (",Q.count," 人)"]},Q.platform))})]})]}),je.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(E,{className:"flex items-center gap-2",children:[e.jsx(Sm,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索用户名...",value:me,onChange:Q=>pe(Q.target.value),className:"pl-9"})]}),e.jsx(Je,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:de?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Js,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):M.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(Sm,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:M.map(Q=>e.jsxs("button",{onClick:()=>Ps(Q),className:B("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",je.personId===Q.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(Di,{className:"h-8 w-8 shrink-0",children:e.jsx(Oi,{className:B("text-xs",je.personId===Q.person_id?"bg-primary-foreground/20":"bg-muted"),children:(Q.nickname||Q.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:Q.nickname||Q.person_name}),e.jsxs("div",{className:B("text-xs truncate",je.personId===Q.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",Q.user_id,Q.is_known&&" · 已认识"]})]})]},Q.person_id))})})})]}),je.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"虚拟群名(可选)"}),e.jsx(re,{placeholder:"WebUI虚拟群聊",value:je.groupName,onChange:Q=>A(Ge=>({...Ge,groupName:Q.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(rt,{className:"gap-2 sm:gap-0",children:[e.jsx(k,{variant:"outline",onClick:()=>S(!1),children:"取消"}),e.jsx(k,{onClick:js,disabled:!je.platform||!je.personId,children:"创建对话"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[i.map(Q=>e.jsxs("div",{className:B("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",u===Q.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>rs(Q.id),children:[Q.type==="webui"?e.jsx(Wl,{className:"h-3.5 w-3.5"}):e.jsx(im,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:Q.label}),e.jsx("span",{className:B("w-1.5 h-1.5 rounded-full",Q.isConnected?"bg-green-500":"bg-muted-foreground/50")}),Q.id!=="webui-default"&&e.jsx("span",{onClick:Ge=>Ot(Q.id,Ge),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:Ge=>{(Ge.key==="Enter"||Ge.key===" ")&&(Ge.preventDefault(),Ot(Q.id,Ge))},children:e.jsx(Da,{className:"h-3 w-3"})})]},Q.id)),e.jsx("button",{onClick:Ze,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(lt,{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(Di,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(Oi,{className:"bg-primary/10 text-primary",children:e.jsx(Mi,{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(Hw,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):g?e.jsxs(e.Fragment,{children:[e.jsx(Js,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Iw,{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(Js,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Me,disabled:g,title:"重新连接",children:e.jsx(zt,{className:B("h-4 w-4",g&&"animate-spin")})})]})]}),e.jsx("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:h?.type==="virtual"&&h.virtualConfig?e.jsxs(e.Fragment,{children:[e.jsx(im,{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(kr,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),L?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{value:T,onChange:Q=>F(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&Ee(),Q.key==="Escape"&&ie()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Ee,children:"保存"}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:ie,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:w}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ae,title:"修改昵称",children:e.jsx(Pw,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Je,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[h?.messages.length===0&&!N&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Mi,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(Q=>e.jsxs("div",{className:B("flex gap-2 sm:gap-3",Q.type==="user"&&"flex-row-reverse",Q.type==="system"&&"justify-center",Q.type==="error"&&"justify-center"),children:[Q.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:Q.content}),Q.type==="error"&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:Q.content}),Q.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(Di,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Oi,{className:"bg-primary/10 text-primary",children:e.jsx(Mi,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:"flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",children:[e.jsx("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:e.jsx("span",{className:"hidden sm:inline",children:Q.sender?.name||h?.sessionInfo.bot_name})}),e.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"思考中..."})]})})]})]}),(Q.type==="user"||Q.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(Di,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Oi,{className:B("text-xs",Q.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:Q.type==="bot"?e.jsx(Mi,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(kr,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:B("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",Q.type==="user"&&"items-end"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:Q.sender?.name||(Q.type==="bot"?h?.sessionInfo.bot_name:w)}),e.jsx("span",{children:ve(Q.timestamp)})]}),e.jsx("div",{className:B("rounded-2xl px-3 py-2 text-sm break-words",Q.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(bC,{message:Q,isBot:Q.type==="bot"})})]})]})]},Q.id)),e.jsx("div",{ref:U})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:f,onChange:Q=>p(Q.target.value),onKeyDown:as,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(k,{onClick:ge,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(Gw,{className:"h-4 w-4"})})]})})})]})}var Vm="Radio",[wC,gv]=Do(Vm),[_C,SC]=wC(Vm),jv=m.forwardRef((l,n)=>{const{__scopeRadio:i,name:c,checked:u=!1,required:x,disabled:h,value:f="on",onCheck:p,form:g,...v}=l,[N,y]=m.useState(null),w=Oo(n,D=>y(D)),b=m.useRef(!1),L=N?g||!!N.closest("form"):!0;return e.jsxs(_C,{scope:i,checked:u,disabled:h,children:[e.jsx(An.button,{type:"button",role:"radio","aria-checked":u,"data-state":yv(u),"data-disabled":h?"":void 0,disabled:h,value:f,...v,ref:w,onClick:Zl(l.onClick,D=>{u||p?.(),L&&(b.current=D.isPropagationStopped(),b.current||D.stopPropagation())})}),L&&e.jsx(bv,{control:N,bubbles:!b.current,name:c,value:f,checked:u,required:x,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});jv.displayName=Vm;var vv="RadioIndicator",Nv=m.forwardRef((l,n)=>{const{__scopeRadio:i,forceMount:c,...u}=l,x=SC(vv,i);return e.jsx(ow,{present:c||x.checked,children:e.jsx(An.span,{"data-state":yv(x.checked),"data-disabled":x.disabled?"":void 0,...u,ref:n})})});Nv.displayName=vv;var CC="RadioBubbleInput",bv=m.forwardRef(({__scopeRadio:l,control:n,checked:i,bubbles:c=!0,...u},x)=>{const h=m.useRef(null),f=Oo(h,x),p=dw(i),g=uw(n);return m.useEffect(()=>{const v=h.current;if(!v)return;const N=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(N,"checked").set;if(p!==i&&w){const b=new Event("click",{bubbles:c});w.call(v,i),v.dispatchEvent(b)}},[p,i,c]),e.jsx(An.input,{type:"radio","aria-hidden":!0,defaultChecked:i,...u,tabIndex:-1,ref:f,style:{...u.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});bv.displayName=CC;function yv(l){return l?"checked":"unchecked"}var kC=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],qo="RadioGroup",[TC]=Do(qo,[Hg,gv]),wv=Hg(),_v=gv(),[EC,MC]=TC(qo),Sv=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,name:c,defaultValue:u,value:x,required:h=!1,disabled:f=!1,orientation:p,dir:g,loop:v=!0,onValueChange:N,...y}=l,w=wv(i),b=tj(g),[L,D]=zo({prop:x,defaultProp:u??null,onChange:N,caller:qo});return e.jsx(EC,{scope:i,name:c,required:h,disabled:f,value:L,onValueChange:D,children:e.jsx(w0,{asChild:!0,...w,orientation:p,dir:b,loop:v,children:e.jsx(An.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:b,...y,ref:n})})})});Sv.displayName=qo;var Cv="RadioGroupItem",kv=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,disabled:c,...u}=l,x=MC(Cv,i),h=x.disabled||c,f=wv(i),p=_v(i),g=m.useRef(null),v=Oo(n,g),N=x.value===u.value,y=m.useRef(!1);return m.useEffect(()=>{const w=L=>{kC.includes(L.key)&&(y.current=!0)},b=()=>y.current=!1;return document.addEventListener("keydown",w),document.addEventListener("keyup",b),()=>{document.removeEventListener("keydown",w),document.removeEventListener("keyup",b)}},[]),e.jsx(_0,{asChild:!0,...f,focusable:!h,active:N,children:e.jsx(jv,{disabled:h,required:x.required,checked:N,...p,...u,name:x.name,ref:v,onCheck:()=>x.onValueChange(u.value),onKeyDown:Zl(w=>{w.key==="Enter"&&w.preventDefault()}),onFocus:Zl(u.onFocus,()=>{y.current&&g.current?.click()})})})});kv.displayName=Cv;var AC="RadioGroupIndicator",Tv=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,...c}=l,u=_v(i);return e.jsx(Nv,{...u,...c,ref:n})});Tv.displayName=AC;var Ev=Sv,Mv=kv,zC=Tv;const Km=m.forwardRef(({className:l,...n},i)=>e.jsx(Ev,{className:B("grid gap-2",l),...n,ref:i}));Km.displayName=Ev.displayName;const Mo=m.forwardRef(({className:l,...n},i)=>e.jsx(Mv,{ref:i,className:B("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",l),...n,children:e.jsx(zC,{className:"flex items-center justify-center",children:e.jsx(yj,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Mo.displayName=Mv.displayName;function DC({question:l,value:n,onChange:i,error:c,disabled:u=!1}){const[x,h]=m.useState(null),f=u||l.readOnly,p=()=>{switch(l.type){case"single":return e.jsx(Km,{value:n||"",onValueChange:i,disabled:f,className:"space-y-2",children:l.options?.map(g=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Mo,{value:g.value,id:`${l.id}-${g.id}`}),e.jsx(E,{htmlFor:`${l.id}-${g.id}`,className:"cursor-pointer font-normal",children:g.label})]},g.id))});case"multiple":{const g=n||[];return e.jsxs("div",{className:"space-y-2",children:[l.options?.map(v=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:`${l.id}-${v.id}`,checked:g.includes(v.value),disabled:f||l.maxSelections!==void 0&&g.length>=l.maxSelections&&!g.includes(v.value),onCheckedChange:N=>{i(N?[...g,v.value]:g.filter(y=>y!==v.value))}}),e.jsx(E,{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(re,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,className:B(l.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(Ys,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,rows:4,className:B(l.readOnly&&"bg-muted cursor-not-allowed")}),l.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(n||"").length," / ",l.maxLength]})]});case"rating":{const g=n||0,v=x!==null?x:g;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:B("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&&i(N),children:e.jsx(vl,{className:B("h-6 w-6 transition-colors",N<=v?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},N)),g>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[g," / 5"]})]})}case"scale":{const g=l.min??1,v=l.max??10,N=l.step??1,y=n??g;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Na,{value:[y],onValueChange:([w])=>i(w),min:g,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||g}),e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx("span",{children:l.maxLabel||v})]})]})}case"dropdown":return e.jsxs(Le,{value:n||"",onValueChange:i,disabled:f,children:[e.jsx(Oe,{children:e.jsx(Ue,{placeholder:l.placeholder||"请选择..."})}),e.jsx(Re,{children:l.options?.map(g=>e.jsx(le,{value:g.value,children:g.label},g.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"不支持的问题类型"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(E,{className:"text-base font-medium",children:[l.title,l.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),l.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:l.description})]}),p(),c&&e.jsx("p",{className:"text-sm text-destructive",children:c})]})}const Av="https://maibot-plugin-stats.maibot-webui.workers.dev";function zv(){const l="maibot_user_id";let n=localStorage.getItem(l);if(!n){const i=Math.random().toString(36).substring(2,10),c=Date.now().toString(36),u=Math.random().toString(36).substring(2,10);n=`fp_${i}_${c}_${u}`,localStorage.setItem(l,n)}return n}async function OC(l,n,i,c){try{const u=c?.userId||zv(),x={surveyId:l,surveyVersion:n,userId:u,answers:i,submittedAt:new Date().toISOString(),allowMultiple:c?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${Av}/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 RC(l,n){try{const i=n||zv(),c=new URLSearchParams({user_id:i,survey_id:l}),u=await fetch(`${Av}/survey/check?${c}`);return u.ok?{success:!0,hasSubmitted:(await u.json()).hasSubmitted}:{success:!1,error:(await u.json()).error||"检查失败"}}catch(i){return console.error("Error checking submission:",i),{success:!1,error:"网络错误"}}}function Dv({config:l,initialAnswers:n,onSubmitSuccess:i,onSubmitError:c,showProgress:u=!0,paginateQuestions:x=!1,className:h}){const f=m.useCallback(()=>!n||n.length===0?{}:n.reduce((H,U)=>(H[U.questionId]=U.value,H),{}),[n]),[p,g]=m.useState(()=>f()),[v,N]=m.useState({}),[y,w]=m.useState(0),[b,L]=m.useState(!1),[D,T]=m.useState(!1),[F,O]=m.useState(null),[S,C]=m.useState(null),[P,M]=m.useState(!1),[Z,G]=m.useState(!0);m.useEffect(()=>{n&&n.length>0&&g(H=>({...H,...f()}))},[n,f]),m.useEffect(()=>{(async()=>{if(!l.settings?.allowMultiple){const U=await RC(l.id);U.success&&U.hasSubmitted&&M(!0)}G(!1)})()},[l.id,l.settings?.allowMultiple]);const ce=m.useCallback(()=>{const H=new Date;return!(l.settings?.startTime&&new Date(l.settings.startTime)>H||l.settings?.endTime&&new Date(l.settings.endTime){const U=p[H.id];return U==null?!1:Array.isArray(U)?U.length>0:typeof U=="string"?U.trim()!=="":!0}).length,be=de/l.questions.length*100,me=m.useCallback((H,U)=>{g($=>({...$,[H]:U})),N($=>{const _e={...$};return delete _e[H],_e})},[]),pe=m.useCallback(()=>{const H={};for(const U of l.questions){if(U.required){const $=p[U.id];if($==null){H[U.id]="此题为必填项";continue}if(Array.isArray($)&&$.length===0){H[U.id]="请至少选择一项";continue}if(typeof $=="string"&&$.trim()===""){H[U.id]="此题为必填项";continue}}U.minLength&&typeof p[U.id]=="string"&&p[U.id].length{if(!pe()){if(x){const H=l.questions.findIndex(U=>v[U.id]);H>=0&&w(H)}return}L(!0),O(null);try{const H=l.questions.filter($=>p[$.id]!==void 0).map($=>({questionId:$.id,value:p[$.id]})),U=await OC(l.id,l.version,H,{allowMultiple:l.settings?.allowMultiple});if(U.success&&U.submissionId)T(!0),C(U.submissionId),i?.(U.submissionId);else{const $=U.error||"提交失败";O($),c?.($)}}catch(H){const U=H instanceof Error?H.message:"提交失败";O(U),c?.(U)}finally{L(!1)}},[pe,x,l,p,v,i,c]),A=m.useCallback(H=>{H>=0&&He.jsxs("div",{className:B("p-4 rounded-lg border bg-card",v[H.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:[U+1,"."]}),e.jsx(DC,{question:H,value:p[H.id],onChange:$=>me(H.id,$),error:v[H.id],disabled:b})]},H.id)),F&&e.jsxs(gt,{variant:"destructive",children:[e.jsx(Dt,{className:"h-4 w-4"}),e.jsx(jt,{children:F})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(k,{variant:"outline",onClick:()=>A(y-1),disabled:y===0||b,children:[e.jsx(Wa,{className:"h-4 w-4 mr-1"}),"上一题"]}),y===l.questions.length-1?e.jsxs(k,{onClick:je,disabled:b,children:[b&&e.jsx(Js,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(k,{onClick:()=>A(y+1),disabled:b,children:["下一题",e.jsx(ba,{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(k,{onClick:je,disabled:b,size:"lg",children:[b&&e.jsx(Js,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const LC={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:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},UC={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 BC(){const[l,n]=m.useState(!0),i=m.useMemo(()=>JSON.parse(JSON.stringify(LC)),[]);m.useEffect(()=>{n(!1)},[]);const c=m.useMemo(()=>[{questionId:"webui_version",value:`v${Uo}`}],[]),u=m.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),x=m.useCallback(h=>{console.error("WebUI Survey submission error:",h)},[]);return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Js,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(wj,{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(Dv,{config:i,initialAnswers:c,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:u,onSubmitError:x})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(gt,{variant:"destructive",className:"max-w-md",children:[e.jsx(Dt,{className:"h-4 w-4"}),e.jsx(jt,{children:"无法加载问卷配置"})]}),e.jsx(k,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function $C(){const[l,n]=m.useState(null),[i,c]=m.useState(!0),[u,x]=m.useState("未知版本");m.useEffect(()=>{(async()=>{try{const N=await D1();x(N.version||"未知版本")}catch(N){console.error("Failed to get MaiBot version:",N),x("获取失败")}const v=JSON.parse(JSON.stringify(UC));n(v),c(!1)})()},[]);const h=m.useMemo(()=>[{questionId:"maibot_version",value:u}],[u]),f=m.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=m.useCallback(g=>{console.error("MaiBot Survey submission error:",g)},[]);return i?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Js,{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(wj,{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(Dv,{config:l,initialAnswers:h,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:f,onSubmitError:p})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(gt,{variant:"destructive",className:"max-w-md",children:[e.jsx(Dt,{className:"h-4 w-4"}),e.jsx(jt,{children:"无法加载问卷配置"})]}),e.jsx(k,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}var Fo="DropdownMenu",[HC]=Do(Fo,[Ig]),Wt=Ig(),[IC,Ov]=HC(Fo),Rv=l=>{const{__scopeDropdownMenu:n,children:i,dir:c,open:u,defaultOpen:x,onOpenChange:h,modal:f=!0}=l,p=Wt(n),g=m.useRef(null),[v,N]=zo({prop:u,defaultProp:x??!1,onChange:h,caller:Fo});return e.jsx(IC,{scope:n,triggerId:wm(),triggerRef:g,contentId:wm(),open:v,onOpenChange:N,onOpenToggle:m.useCallback(()=>N(y=>!y),[N]),modal:f,children:e.jsx(R0,{...p,open:v,onOpenChange:N,dir:c,modal:f,children:i})})};Rv.displayName=Fo;var Lv="DropdownMenuTrigger",Uv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,disabled:c=!1,...u}=l,x=Ov(Lv,i),h=Wt(i);return e.jsx(L0,{asChild:!0,...h,children:e.jsx(An.button,{type:"button",id:x.triggerId,"aria-haspopup":"menu","aria-expanded":x.open,"aria-controls":x.open?x.contentId:void 0,"data-state":x.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...u,ref:mw(n,x.triggerRef),onPointerDown:Zl(l.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(x.onOpenToggle(),x.open||f.preventDefault())}),onKeyDown:Zl(l.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&x.onOpenToggle(),f.key==="ArrowDown"&&x.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});Uv.displayName=Lv;var PC="DropdownMenuPortal",Bv=l=>{const{__scopeDropdownMenu:n,...i}=l,c=Wt(n);return e.jsx(k0,{...c,...i})};Bv.displayName=PC;var $v="DropdownMenuContent",Hv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Ov($v,i),x=Wt(i),h=m.useRef(!1);return e.jsx(T0,{id:u.contentId,"aria-labelledby":u.triggerId,...x,...c,ref:n,onCloseAutoFocus:Zl(l.onCloseAutoFocus,f=>{h.current||u.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:Zl(l.onInteractOutside,f=>{const p=f.detail.originalEvent,g=p.button===0&&p.ctrlKey===!0,v=p.button===2||g;(!u.modal||v)&&(h.current=!0)}),style:{...l.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Hv.displayName=$v;var GC="DropdownMenuGroup",qC=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(U0,{...u,...c,ref:n})});qC.displayName=GC;var FC="DropdownMenuLabel",Iv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(D0,{...u,...c,ref:n})});Iv.displayName=FC;var VC="DropdownMenuItem",Pv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(E0,{...u,...c,ref:n})});Pv.displayName=VC;var KC="DropdownMenuCheckboxItem",Gv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(M0,{...u,...c,ref:n})});Gv.displayName=KC;var QC="DropdownMenuRadioGroup",YC=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(B0,{...u,...c,ref:n})});YC.displayName=QC;var JC="DropdownMenuRadioItem",qv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(z0,{...u,...c,ref:n})});qv.displayName=JC;var XC="DropdownMenuItemIndicator",Fv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(A0,{...u,...c,ref:n})});Fv.displayName=XC;var ZC="DropdownMenuSeparator",Vv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(O0,{...u,...c,ref:n})});Vv.displayName=ZC;var WC="DropdownMenuArrow",ek=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx($0,{...u,...c,ref:n})});ek.displayName=WC;var sk="DropdownMenuSubTrigger",Kv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(S0,{...u,...c,ref:n})});Kv.displayName=sk;var tk="DropdownMenuSubContent",Qv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Wt(i);return e.jsx(C0,{...u,...c,ref:n,style:{...l.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Qv.displayName=tk;var ak=Rv,lk=Uv,nk=Bv,Yv=Hv,Jv=Iv,Xv=Pv,Zv=Gv,Wv=qv,eN=Fv,sN=Vv,tN=Kv,aN=Qv;const rk=ak,ik=lk,ck=m.forwardRef(({className:l,inset:n,children:i,...c},u)=>e.jsxs(tN,{ref:u,className:B("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",n&&"pl-8",l),...c,children:[i,e.jsx(ba,{className:"ml-auto h-4 w-4"})]}));ck.displayName=tN.displayName;const ok=m.forwardRef(({className:l,...n},i)=>e.jsx(aN,{ref:i,className:B("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",l),...n}));ok.displayName=aN.displayName;const lN=m.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(nk,{children:e.jsx(Yv,{ref:c,sideOffset:n,className:B("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",l),...i})}));lN.displayName=Yv.displayName;const nN=m.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(Xv,{ref:c,className:B("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",l),...i}));nN.displayName=Xv.displayName;const dk=m.forwardRef(({className:l,children:n,checked:i,...c},u)=>e.jsxs(Zv,{ref:u,className:B("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),checked:i,...c,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(eN,{children:e.jsx(_t,{className:"h-4 w-4"})})}),n]}));dk.displayName=Zv.displayName;const uk=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(Wv,{ref:c,className:B("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),...i,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(eN,{children:e.jsx(yj,{className:"h-2 w-2 fill-current"})})}),n]}));uk.displayName=Wv.displayName;const mk=m.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(Jv,{ref:c,className:B("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",l),...i}));mk.displayName=Jv.displayName;const xk=m.forwardRef(({className:l,...n},i)=>e.jsx(sN,{ref:i,className:B("-mx-1 my-1 h-px bg-muted",l),...n}));xk.displayName=sN.displayName;const rN=({className:l,...n})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:B("mx-auto flex w-full justify-center",l),...n});rN.displayName="Pagination";const iN=m.forwardRef(({className:l,...n},i)=>e.jsx("ul",{ref:i,className:B("flex flex-row items-center gap-1",l),...n}));iN.displayName="PaginationContent";const wo=m.forwardRef(({className:l,...n},i)=>e.jsx("li",{ref:i,className:B("",l),...n}));wo.displayName="PaginationItem";const Vo=({className:l,isActive:n,size:i="icon",...c})=>e.jsx("a",{"aria-current":n?"page":void 0,className:B(Mr({variant:n?"outline":"ghost",size:i}),l),...c});Vo.displayName="PaginationLink";const cN=({className:l,...n})=>e.jsxs(Vo,{"aria-label":"Go to previous page",size:"default",className:B("gap-1 pl-2.5",l),...n,children:[e.jsx(Wa,{className:"h-4 w-4"}),e.jsx("span",{children:"上一页"})]});cN.displayName="PaginationPrevious";const oN=({className:l,...n})=>e.jsxs(Vo,{"aria-label":"Go to next page",size:"default",className:B("gap-1 pr-2.5",l),...n,children:[e.jsx("span",{children:"下一页"}),e.jsx(ba,{className:"h-4 w-4"})]});oN.displayName="PaginationNext";const ym=[{value:"created_at",label:"最新发布",icon:Nl},{value:"downloads",label:"下载最多",icon:Yt},{value:"likes",label:"最受欢迎",icon:So}];function hk(){const l=ua(),[n,i]=m.useState([]),[c,u]=m.useState(!0),[x,h]=m.useState(""),[f,p]=m.useState("downloads"),[g,v]=m.useState(1),[N,y]=m.useState(1),[w,b]=m.useState(0),[L,D]=m.useState(new Set),[T,F]=m.useState(new Set),O=rv(),S=m.useCallback(async()=>{u(!0);try{const G=await T_({status:"approved",page:g,page_size:12,search:x||void 0,sort_by:f,sort_order:"desc"});i(G.packs),y(G.total_pages),b(G.total);const ce=new Set;for(const de of G.packs)await nv(de.id,O)&&ce.add(de.id);D(ce)}catch(G){console.error("加载 Pack 列表失败:",G),Ft({title:"加载 Pack 列表失败",variant:"destructive"})}finally{u(!1)}},[g,x,f,O]);m.useEffect(()=>{S()},[S]);const C=G=>{G.preventDefault(),v(1),S()},P=async G=>{if(!T.has(G)){F(ce=>new Set(ce).add(G));try{const ce=await lv(G,O);D(de=>{const be=new Set(de);return ce.liked?be.add(G):be.delete(G),be}),i(de=>de.map(be=>be.id===G?{...be,likes:ce.likes}:be))}catch(ce){console.error("点赞失败:",ce),Ft({title:"点赞失败",variant:"destructive"})}finally{F(ce=>{const de=new Set(ce);return de.delete(G),de})}}},M=G=>{l({to:"/config/pack-market/$packId",params:{packId:G}})},Z=ym.find(G=>G.value===f)||ym[0];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(ca,{className:"h-8 w-8",strokeWidth:2}),"配置模板市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和应用社区分享的模型配置模板,快速配置你的 MaiBot"})]}),e.jsxs(k,{variant:"outline",onClick:S,disabled:c,className:"gap-2",children:[e.jsx(zt,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"刷新"]})]})}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 flex-wrap",children:[e.jsx("form",{onSubmit:C,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索模板名称、描述...",value:x,onChange:G=>h(G.target.value),className:"pl-10"})]})}),e.jsxs(rk,{children:[e.jsx(ik,{asChild:!0,children:e.jsxs(k,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(qw,{className:"w-4 h-4"}),Z.label,e.jsx(Oa,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(lN,{align:"end",children:ym.map(G=>e.jsxs(nN,{onClick:()=>{p(G.value),v(1)},children:[e.jsx(G.icon,{className:"w-4 h-4 mr-2"}),G.label]},G.value))})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共找到 ",e.jsx("span",{className:"font-medium text-foreground",children:w})," 个模板"]}),c?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((G,ce)=>e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(Qs,{className:"h-6 w-3/4"}),e.jsx(Qs,{className:"h-4 w-full mt-2"})]}),e.jsx(Ye,{children:e.jsx(Qs,{className:"h-20 w-full"})}),e.jsx(Lo,{children:e.jsx(Qs,{className:"h-9 w-full"})})]},ce))}):n.length===0?e.jsx(ze,{className:"py-12",children:e.jsxs(Ye,{className:"text-center text-muted-foreground",children:[e.jsx(ca,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg font-medium",children:"暂无模板"}),e.jsx("p",{className:"mt-1",children:"还没有人分享配置模板,快来分享第一个吧!"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.map(G=>e.jsx(fk,{pack:G,liked:L.has(G.id),liking:T.has(G.id),onLike:()=>P(G.id),onView:()=>M(G.id)},G.id))}),N>1&&e.jsx(rN,{children:e.jsxs(iN,{children:[e.jsx(wo,{children:e.jsx(cN,{onClick:()=>v(G=>Math.max(1,G-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:N},(G,ce)=>ce+1).filter(G=>G===1||G===N||Math.abs(G-g)<=1).map((G,ce,de)=>{const be=ce>0&&G-de[ce-1]>1;return e.jsxs(wo,{children:[be&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(Vo,{onClick:()=>v(G),isActive:G===g,className:"cursor-pointer",children:G})]},G)}),e.jsx(wo,{children:e.jsx(oN,{onClick:()=>v(G=>Math.min(N,G+1)),className:g===N?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function fk({pack:l,liked:n,liking:i,onLike:c,onView:u}){const x=h=>new Date(h).toLocaleDateString("zh-CN",{year:"numeric",month:"short",day:"numeric"});return e.jsxs(ze,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(ts,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(ls,{className:"text-lg line-clamp-1",children:l.name}),e.jsxs(Te,{variant:"secondary",className:"text-xs",children:["v",l.version]})]}),e.jsx(Vs,{className:"line-clamp-2 min-h-[40px]",children:l.description})]}),e.jsxs(Ye,{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(kr,{className:"w-3.5 h-3.5"}),l.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Nl,{className:"w-3.5 h-3.5"}),x(l.created_at)]})]}),e.jsxs("div",{className:"flex gap-4 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"提供商数量",children:[e.jsx(yl,{className:"w-3.5 h-3.5"}),l.provider_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"模型数量",children:[e.jsx(kn,{className:"w-3.5 h-3.5"}),l.model_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"任务配置数",children:[e.jsx(Tn,{className:"w-3.5 h-3.5"}),l.task_count]})]}),l.tags&&l.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[l.tags.slice(0,3).map(h=>e.jsxs(Te,{variant:"outline",className:"text-xs",children:[e.jsx(Rm,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),l.tags.length>3&&e.jsxs(Te,{variant:"outline",className:"text-xs",children:["+",l.tags.length-3]})]})]}),e.jsx(Lo,{className:"pt-3 border-t",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Yt,{className:"w-4 h-4"}),l.downloads]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c()},disabled:i,className:`flex items-center gap-1 transition-colors ${n?"text-red-500":"hover:text-red-500"} ${i?"opacity-50":""}`,children:[e.jsx(So,{className:`w-4 h-4 ${n?"fill-current":""}`}),l.likes]})]}),e.jsx(k,{size:"sm",onClick:u,children:"查看详情"})]})})]})}var Pa="Accordion",pk=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Qm,gk,jk]=xw(Pa),[Ko]=Do(Pa,[jk,Pg]),Ym=Pg(),dN=Ts.forwardRef((l,n)=>{const{type:i,...c}=l,u=c,x=c;return e.jsx(Qm.Provider,{scope:l.__scopeAccordion,children:i==="multiple"?e.jsx(yk,{...x,ref:n}):e.jsx(bk,{...u,ref:n})})});dN.displayName=Pa;var[uN,vk]=Ko(Pa),[mN,Nk]=Ko(Pa,{collapsible:!1}),bk=Ts.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},collapsible:x=!1,...h}=l,[f,p]=zo({prop:i,defaultProp:c??"",onChange:u,caller:Pa});return e.jsx(uN,{scope:l.__scopeAccordion,value:Ts.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:Ts.useCallback(()=>x&&p(""),[x,p]),children:e.jsx(mN,{scope:l.__scopeAccordion,collapsible:x,children:e.jsx(xN,{...h,ref:n})})})}),yk=Ts.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},...x}=l,[h,f]=zo({prop:i,defaultProp:c??[],onChange:u,caller:Pa}),p=Ts.useCallback(v=>f((N=[])=>[...N,v]),[f]),g=Ts.useCallback(v=>f((N=[])=>N.filter(y=>y!==v)),[f]);return e.jsx(uN,{scope:l.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(mN,{scope:l.__scopeAccordion,collapsible:!0,children:e.jsx(xN,{...x,ref:n})})})}),[wk,Qo]=Ko(Pa),xN=Ts.forwardRef((l,n)=>{const{__scopeAccordion:i,disabled:c,dir:u,orientation:x="vertical",...h}=l,f=Ts.useRef(null),p=Oo(f,n),g=gk(i),N=tj(u)==="ltr",y=Zl(l.onKeyDown,w=>{if(!pk.includes(w.key))return;const b=w.target,L=g().filter(Z=>!Z.ref.current?.disabled),D=L.findIndex(Z=>Z.ref.current===b),T=L.length;if(D===-1)return;w.preventDefault();let F=D;const O=0,S=T-1,C=()=>{F=D+1,F>S&&(F=O)},P=()=>{F=D-1,F{const{__scopeAccordion:i,value:c,...u}=l,x=Qo(Ao,i),h=vk(Ao,i),f=Ym(i),p=wm(),g=c&&h.value.includes(c)||!1,v=x.disabled||l.disabled;return e.jsx(_k,{scope:i,open:g,disabled:v,triggerId:p,children:e.jsx(Lg,{"data-orientation":x.orientation,"data-state":NN(g),...f,...u,ref:n,disabled:v,open:g,onOpenChange:N=>{N?h.onItemOpen(c):h.onItemClose(c)}})})});hN.displayName=Ao;var fN="AccordionHeader",pN=Ts.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=Qo(Pa,i),x=Jm(fN,i);return e.jsx(An.h3,{"data-orientation":u.orientation,"data-state":NN(x.open),"data-disabled":x.disabled?"":void 0,...c,ref:n})});pN.displayName=fN;var Mm="AccordionTrigger",gN=Ts.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=Qo(Pa,i),x=Jm(Mm,i),h=Nk(Mm,i),f=Ym(i);return e.jsx(Qm.ItemSlot,{scope:i,children:e.jsx(H0,{"aria-disabled":x.open&&!h.collapsible||void 0,"data-orientation":u.orientation,id:x.triggerId,...f,...c,ref:n})})});gN.displayName=Mm;var jN="AccordionContent",vN=Ts.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=Qo(Pa,i),x=Jm(jN,i),h=Ym(i);return e.jsx(I0,{role:"region","aria-labelledby":x.triggerId,"data-orientation":u.orientation,...h,...c,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...l.style}})});vN.displayName=jN;function NN(l){return l?"open":"closed"}var Sk=dN,Ck=hN,kk=pN,bN=gN,yN=vN;const Tk=Sk,wN=m.forwardRef(({className:l,...n},i)=>e.jsx(Ck,{ref:i,className:B("border-b",l),...n}));wN.displayName="AccordionItem";const _N=m.forwardRef(({className:l,children:n,...i},c)=>e.jsx(kk,{className:"flex",children:e.jsxs(bN,{ref:c,className:B("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",l),...i,children:[n,e.jsx(Oa,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));_N.displayName=bN.displayName;const SN=m.forwardRef(({className:l,children:n,...i},c)=>e.jsx(yN,{ref:c,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...i,children:e.jsx("div",{className:B("pb-4 pt-0",l),children:n})}));SN.displayName=yN.displayName;const Ek={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"};function Mk(){const{packId:l}=MN.useParams(),n=ua(),[i,c]=m.useState(null),[u,x]=m.useState(!0),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[v,N]=m.useState(!1),[y,w]=m.useState(1),[b,L]=m.useState(null),[D,T]=m.useState(!1),[F,O]=m.useState(!1),[S,C]=m.useState({apply_providers:!0,apply_models:!0,apply_task_config:!0,task_mode:"append",selected_providers:void 0,selected_models:void 0,selected_tasks:void 0}),[P,M]=m.useState({}),[Z,G]=m.useState({}),ce=rv(),de=m.useCallback(async()=>{if(l){x(!0);try{const A=await E_(l);c(A);const Y=await nv(l,ce);f(Y)}catch(A){console.error("加载 Pack 失败:",A),Ft({title:"加载模板失败",variant:"destructive"})}finally{x(!1)}}},[l,ce]);m.useEffect(()=>{de()},[de]);const be=async()=>{if(!(!l||p)){g(!0);try{const A=await lv(l,ce);f(A.liked),i&&c({...i,likes:A.likes})}catch(A){console.error("点赞失败:",A),Ft({title:"点赞失败",variant:"destructive"})}finally{g(!1)}}},me=async()=>{if(i){N(!0),w(1),T(!0);try{const A=await z_(i);L(A);const Y={};for(const U of A.existing_providers)Y[U.pack_provider.name]=U.local_providers[0].name;M(Y);const H={};for(const U of A.new_providers)H[U.name]="";G(H)}catch(A){console.error("检测冲突失败:",A),Ft({title:"检测配置冲突失败",variant:"destructive"}),N(!1)}finally{T(!1)}}},pe=async()=>{if(i){if(S.apply_providers&&b){for(const A of b.new_providers)if(!Z[A.name]){Ft({title:`请填写提供商 "${A.name}" 的 API Key`,variant:"destructive"});return}}O(!0);try{await D_(i,S,P,Z),await A_(i.id,ce),c({...i,downloads:i.downloads+1}),Ft({title:"配置模板应用成功!"}),N(!1)}catch(A){console.error("应用 Pack 失败:",A),Ft({title:A instanceof Error?A.message:"应用配置失败",variant:"destructive"})}finally{O(!1)}}},je=A=>new Date(A).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return u?e.jsx(zk,{}):i?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(k,{variant:"ghost",size:"sm",onClick:()=>n({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx(en,{className:"w-4 h-4"}),"返回市场"]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ca,{className:"w-10 h-10 text-primary mt-1"}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[i.name,e.jsxs(Te,{variant:"secondary",children:["v",i.version]})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:i.description})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(kr,{className:"w-4 h-4"}),i.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Nl,{className:"w-4 h-4"}),je(i.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Yt,{className:"w-4 h-4"}),i.downloads," 次下载"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(So,{className:`w-4 h-4 ${h?"fill-red-500 text-red-500":""}`}),i.likes," 赞"]})]}),i.tags&&i.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:i.tags.map(A=>e.jsxs(Te,{variant:"outline",children:[e.jsx(Rm,{className:"w-3 h-3 mr-1"}),A]},A))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(k,{size:"lg",onClick:me,children:[e.jsx(Yt,{className:"w-4 h-4 mr-2"}),"应用模板"]}),e.jsxs(k,{variant:"outline",onClick:be,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(So,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"已点赞":"点赞"]})]})]}),e.jsx(Or,{}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(ze,{children:e.jsxs(Ye,{className:"flex items-center gap-3 py-4",children:[e.jsx(yl,{className:"w-8 h-8 text-blue-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:i.providers.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"API 提供商"})]})]})}),e.jsx(ze,{children:e.jsxs(Ye,{className:"flex items-center gap-3 py-4",children:[e.jsx(kn,{className:"w-8 h-8 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:i.models.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"模型配置"})]})]})}),e.jsx(ze,{children:e.jsxs(Ye,{className:"flex items-center gap-3 py-4",children:[e.jsx(Tn,{className:"w-8 h-8 text-purple-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Object.keys(i.task_config).length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"任务配置"})]})]})})]}),e.jsxs(da,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(Zt,{children:[e.jsxs(Xe,{value:"providers",children:[e.jsx(yl,{className:"w-4 h-4 mr-2"}),"提供商 (",i.providers.length,")"]}),e.jsxs(Xe,{value:"models",children:[e.jsx(kn,{className:"w-4 h-4 mr-2"}),"模型 (",i.models.length,")"]}),e.jsxs(Xe,{value:"tasks",children:[e.jsx(Tn,{className:"w-4 h-4 mr-2"}),"任务配置 (",Object.keys(i.task_config).length,")"]})]}),e.jsx(ys,{value:"providers",children:e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"API 提供商"}),e.jsx(Vs,{children:"模板中包含的 API 提供商配置(不含 API Key)"})]}),e.jsx(Ye,{children:e.jsxs(wl,{children:[e.jsx(_l,{children:e.jsxs(nt,{children:[e.jsx(Qe,{children:"名称"}),e.jsx(Qe,{children:"Base URL"}),e.jsx(Qe,{children:"类型"})]})}),e.jsx(Sl,{children:i.providers.map(A=>e.jsxs(nt,{children:[e.jsx(Ie,{className:"font-medium",children:A.name}),e.jsx(Ie,{className:"text-muted-foreground font-mono text-sm",children:A.base_url}),e.jsx(Ie,{children:e.jsx(Te,{variant:"outline",children:A.client_type})})]},A.name))})]})})]})}),e.jsx(ys,{value:"models",children:e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"模型配置"}),e.jsx(Vs,{children:"模板中包含的模型配置"})]}),e.jsx(Ye,{children:e.jsxs(wl,{children:[e.jsx(_l,{children:e.jsxs(nt,{children:[e.jsx(Qe,{children:"模型名称"}),e.jsx(Qe,{children:"标识符"}),e.jsx(Qe,{children:"提供商"}),e.jsx(Qe,{className:"text-right",children:"价格 (入/出)"})]})}),e.jsx(Sl,{children:i.models.map(A=>e.jsxs(nt,{children:[e.jsx(Ie,{className:"font-medium",children:A.name}),e.jsx(Ie,{className:"text-muted-foreground font-mono text-sm",children:A.model_identifier}),e.jsx(Ie,{children:A.api_provider}),e.jsxs(Ie,{className:"text-right text-muted-foreground",children:["¥",A.price_in," / ¥",A.price_out]})]},A.name))})]})})]})}),e.jsx(ys,{value:"tasks",children:e.jsxs(ze,{children:[e.jsxs(ts,{children:[e.jsx(ls,{children:"任务配置"}),e.jsx(Vs,{children:"模板中各任务类型的模型分配"})]}),e.jsx(Ye,{children:e.jsx(Tk,{type:"multiple",className:"w-full",children:Object.entries(i.task_config).map(([A,Y])=>e.jsxs(wN,{value:A,children:[e.jsx(_N,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(zn,{className:"w-4 h-4"}),Ek[A]||A,e.jsxs(Te,{variant:"secondary",className:"ml-2",children:[Y.model_list.length," 个模型"]})]})}),e.jsx(SN,{children:e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"分配的模型:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Y.model_list.map(H=>e.jsx(Te,{variant:"outline",children:H},H))}),Y.temperature!==void 0&&e.jsxs("div",{className:"text-sm",children:["Temperature: ",e.jsx("span",{className:"font-mono",children:Y.temperature})]}),Y.max_tokens!==void 0&&e.jsxs("div",{className:"text-sm",children:["Max Tokens: ",e.jsx("span",{className:"font-mono",children:Y.max_tokens})]})]})})]},A))})})]})})]}),e.jsx(Ak,{open:v,onOpenChange:N,pack:i,step:y,setStep:w,conflicts:b,detectingConflicts:D,applying:F,options:S,setOptions:C,_providerMapping:P,_setProviderMapping:M,newProviderApiKeys:Z,setNewProviderApiKeys:G,onApply:pe})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(ca,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),e.jsx("h2",{className:"text-xl font-semibold",children:"模板不存在"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"该配置模板可能已被删除或尚未通过审核"}),e.jsxs(k,{className:"mt-4",onClick:()=>n({to:"/config/pack-market"}),children:[e.jsx(en,{className:"w-4 h-4 mr-2"}),"返回市场"]})]})}function Ak({open:l,onOpenChange:n,pack:i,step:c,setStep:u,conflicts:x,detectingConflicts:h,applying:f,options:p,setOptions:g,_providerMapping:v,_setProviderMapping:N,newProviderApiKeys:y,setNewProviderApiKeys:w,onApply:b}){return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ls,{children:[e.jsxs(Us,{className:"flex items-center gap-2",children:[e.jsx(ca,{className:"w-5 h-5"}),"应用配置模板"]}),e.jsxs(Zs,{children:["步骤 ",c," / ",3,":",c===1&&"选择要应用的内容",c===2&&"配置提供商映射",c===3&&"确认并应用"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Js,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在检测配置冲突..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"apply_providers",checked:p.apply_providers,onCheckedChange:D=>g({...p,apply_providers:D})}),e.jsxs(E,{htmlFor:"apply_providers",className:"flex items-center gap-2",children:[e.jsx(yl,{className:"w-4 h-4"}),"应用提供商配置 (",i.providers.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"apply_models",checked:p.apply_models,onCheckedChange:D=>g({...p,apply_models:D})}),e.jsxs(E,{htmlFor:"apply_models",className:"flex items-center gap-2",children:[e.jsx(kn,{className:"w-4 h-4"}),"应用模型配置 (",i.models.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"apply_task_config",checked:p.apply_task_config,onCheckedChange:D=>g({...p,apply_task_config:D})}),e.jsxs(E,{htmlFor:"apply_task_config",className:"flex items-center gap-2",children:[e.jsx(Tn,{className:"w-4 h-4"}),"应用任务配置 (",Object.keys(i.task_config).length," 个)"]})]})]}),p.apply_task_config&&e.jsxs("div",{className:"pl-6 space-y-2 border-l-2 border-muted",children:[e.jsx(E,{className:"text-sm font-medium",children:"任务配置应用模式"}),e.jsxs(Km,{value:p.task_mode,onValueChange:D=>g({...p,task_mode:D}),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Mo,{value:"append",id:"mode_append"}),e.jsx(E,{htmlFor:"mode_append",className:"font-normal",children:"追加模式 - 将模板中的模型添加到现有配置"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Mo,{value:"replace",id:"mode_replace"}),e.jsx(E,{htmlFor:"mode_replace",className:"font-normal",children:"替换模式 - 用模板配置完全替换现有配置"})]})]})]})]}),c===2&&x&&e.jsxs("div",{className:"space-y-4",children:[p.apply_providers&&x.existing_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(gt,{children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsx(_n,{children:"发现已有的提供商"}),e.jsx(jt,{children:"以下提供商的 URL 与您本地配置中的提供商匹配,将自动使用本地提供商:"})]}),e.jsx("div",{className:"space-y-2",children:x.existing_providers.map(({pack_provider:D,local_providers:T})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(_t,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),e.jsx("span",{className:"font-medium flex-shrink-0",children:D.name}),e.jsx(ba,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),T.length===1?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:T[0].name}),e.jsx(Te,{variant:"outline",className:"ml-auto",children:"URL 匹配"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Le,{value:v[D.name]||T[0].name,onValueChange:F=>N({...v,[D.name]:F}),children:[e.jsx(Oe,{className:"w-[200px]",children:e.jsx(Ue,{})}),e.jsx(Re,{children:T.map(F=>e.jsx(le,{value:F.name,children:F.name},F.name))})]}),e.jsxs(Te,{variant:"outline",className:"ml-auto",children:[T.length," 个匹配"]})]})]},D.name))})]}),p.apply_providers&&x.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(gt,{variant:"destructive",children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsx(_n,{children:"需要配置 API Key"}),e.jsx(jt,{children:"以下提供商在您的本地配置中不存在,需要填写 API Key:"})]}),e.jsx("div",{className:"space-y-4",children:x.new_providers.map(D=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Am,{className:"w-4 h-4 text-amber-500"}),e.jsx("span",{className:"font-medium",children:D.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",D.base_url,")"]})]}),e.jsx(re,{type:"password",placeholder:`输入 ${D.name} 的 API Key`,value:y[D.name]||"",onChange:T=>w({...y,[D.name]:T.target.value})})]},D.name))})]}),(!p.apply_providers||x.existing_providers.length===0&&x.new_providers.length===0)&&e.jsxs(gt,{children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(_n,{children:"无需配置"}),e.jsx(jt,{children:"模板中没有提供商配置,或您选择不应用提供商。"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(gt,{children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsx(_n,{children:"确认应用"}),e.jsx(jt,{children:"请确认以下将要应用的内容:"})]}),e.jsxs("div",{className:"space-y-2",children:[p.apply_providers&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(_t,{className:"w-4 h-4 text-green-500"}),e.jsx(yl,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",i.providers.length," 个提供商配置"]})]}),p.apply_models&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(_t,{className:"w-4 h-4 text-green-500"}),e.jsx(kn,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",i.models.length," 个模型配置"]})]}),p.apply_task_config&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(_t,{className:"w-4 h-4 text-green-500"}),e.jsx(Tn,{className:"w-4 h-4"}),e.jsxs("span",{children:[p.task_mode==="append"?"追加":"替换"," ",Object.keys(i.task_config).length," 个任务配置"]})]})]}),x&&x.new_providers.length>0&&e.jsxs(gt,{variant:"destructive",children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsxs(jt,{children:["将添加 ",x.new_providers.length," 个新提供商,请确保已填写正确的 API Key。"]})]})]})]}),e.jsxs(rt,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(k,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{variant:"outline",onClick:()=>n(!1),disabled:f,children:"取消"}),c<3?e.jsx(k,{onClick:()=>u(c+1),disabled:h,children:"下一步"}):e.jsxs(k,{onClick:b,disabled:f,children:[f&&e.jsx(Js,{className:"w-4 h-4 mr-2 animate-spin"}),"应用模板"]})]})]})]})})}function zk(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Qs,{className:"h-9 w-24"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Qs,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Qs,{className:"h-8 w-2/3"}),e.jsx(Qs,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(Qs,{className:"h-4 w-24"}),e.jsx(Qs,{className:"h-4 w-32"}),e.jsx(Qs,{className:"h-4 w-28"}),e.jsx(Qs,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Qs,{className:"h-6 w-20"}),e.jsx(Qs,{className:"h-6 w-24"}),e.jsx(Qs,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(Qs,{className:"h-10 w-full"}),e.jsx(Qs,{className:"h-10 w-full"})]})]}),e.jsx(Qs,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(Qs,{className:"h-24"}),e.jsx(Qs,{className:"h-24"}),e.jsx(Qs,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qs,{className:"h-10 w-32"}),e.jsx(Qs,{className:"h-10 w-32"}),e.jsx(Qs,{className:"h-10 w-32"})]}),e.jsx(Qs,{className:"h-96 w-full"})]})]})})})}function Dk(){const l=ua(),[n,i]=m.useState(!0);return m.useEffect(()=>{let c=!1;return(async()=>{try{const x=await Hi();!c&&!x&&l({to:"/auth"})}catch{c||l({to:"/auth"})}finally{c||i(!1)}})(),()=>{c=!0}},[l]),{checking:n}}async function Ok(){return await Hi()}const Rk=Ar("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"}}),CN=m.forwardRef(({className:l,size:n,abbrTitle:i,children:c,...u},x)=>e.jsx("kbd",{className:B(Rk({size:n,className:l})),ref:x,...u,children:i?e.jsx("abbr",{title:i,children:c}):c}));CN.displayName="Kbd";const Lk=[{icon:Ro,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Ha,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:yl,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:_j,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:zm,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wl,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:Sj,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Er,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:Fw,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:ca,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Dm,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:zn,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Uk({open:l,onOpenChange:n}){const[i,c]=m.useState(""),[u,x]=m.useState(0),h=ua(),f=Lk.filter(v=>v.title.toLowerCase().includes(i.toLowerCase())||v.description.toLowerCase().includes(i.toLowerCase())||v.category.toLowerCase().includes(i.toLowerCase())),p=m.useCallback(v=>{h({to:v}),n(!1),c(""),x(0)},[h,n]),g=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(),p(f[u].path))},[f,u,p]);return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Rs,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Ls,{className:"px-4 pt-4 pb-0",children:[e.jsx(Us,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(re,{value:i,onChange:v=>{c(v.target.value),x(0)},onKeyDown:g,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(Je,{className:"h-[400px]",children:f.length>0?e.jsx("div",{className:"p-2",children:f.map((v,N)=>{const y=v.icon;return e.jsxs("button",{onClick:()=>p(v.path),onMouseEnter:()=>x(N),className:B("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(Vt,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Bk(){const l=window.location.protocol==="http:",n=window.location.hostname.toLowerCase(),i=n==="localhost"||n==="127.0.0.1"||n==="::1",c=sessionStorage.getItem("http-warning-dismissed")==="true",[u,x]=m.useState(l&&!i&&!c),[h,f]=m.useState(!1),p=()=>{f(!0),x(!1),sessionStorage.setItem("http-warning-dismissed","true")};return!u||h?null:e.jsx("div",{className:"relative bg-amber-500/10 border-b border-amber-500/20 backdrop-blur-sm",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(Qt,{className:"h-5 w-5 text-amber-600 dark:text-amber-500 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-semibold",children:"安全警告:"}),"您正在使用 ",e.jsx("strong",{children:"HTTP"})," 访问 MaiBot WebUI"]}),e.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-200 mt-1",children:"如果这是公网服务器,您的数据(包括 Token、聊天记录等)可能在传输过程中被窃取。强烈建议使用 HTTPS 访问或仅在本地网络使用。"})]})]}),e.jsx(k,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 text-amber-700 hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-200 flex-shrink-0","aria-label":"关闭警告",children:e.jsx(Da,{className:"h-4 w-4"})})]})})})}function $k(){const[l,n]=m.useState(0),[i,c]=m.useState(!1),u=m.useRef(null);m.useEffect(()=>{const g=v=>{const N=v.target;if(N.scrollHeight>N.clientHeight+100){u.current=N;const y=N.scrollTop,w=N.scrollHeight-N.clientHeight,b=w>0?y/w*100:0;n(b),c(y>300)}};return window.addEventListener("scroll",g,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})},[]);const x=()=>{u.current?.scrollTo({top:0,behavior:"smooth"})},h=18,f=2*Math.PI*h,p=f-l/100*f;return e.jsx("div",{className:B("fixed bottom-24 right-8 z-50 transition-all duration-500 ease-in-out transform",i?"translate-x-0 opacity-100":"translate-x-32 opacity-0 pointer-events-none"),children:e.jsxs(k,{variant:"outline",size:"icon",className:B("relative h-12 w-12 rounded-full shadow-xl","bg-background/80 backdrop-blur-md border-border/50","hover:bg-accent hover:scale-110 hover:shadow-2xl hover:border-primary/50","transition-all duration-300","group"),onClick:x,"aria-label":"回到顶部",children:[e.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90 transform p-1",viewBox:"0 0 44 44",children:[e.jsx("circle",{className:"text-muted-foreground/10",strokeWidth:"3",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"}),e.jsx("circle",{className:"text-primary transition-all duration-100 ease-out",strokeWidth:"3",strokeDasharray:f,strokeDashoffset:p,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"})]}),e.jsx(Vw,{className:"h-5 w-5 text-primary transition-transform duration-300 group-hover:-translate-y-1 group-hover:scale-110",strokeWidth:2.5}),e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]})})}const Hk=fw,Ik=pw,Pk=gw,kN=m.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(hw,{children:e.jsx(aj,{ref:c,sideOffset:n,className:B("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",l),...i})}));kN.displayName=aj.displayName;function Gk({children:l}){const{checking:n}=Dk(),[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),{theme:p,setTheme:g}=Lm(),v=Yy();if(m.useEffect(()=>{const L=D=>{(D.metaKey||D.ctrlKey)&&D.key==="k"&&(D.preventDefault(),f(!0))};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[]),n)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const N=[{title:"概览",items:[{icon:Ro,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Ha,label:"麦麦主程序配置",path:"/config/bot"},{icon:yl,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:_j,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:Fp,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:zm,label:"表情包管理",path:"/resource/emoji"},{icon:Wl,label:"表达方式管理",path:"/resource/expression"},{icon:Er,label:"黑话管理",path:"/resource/jargon"},{icon:Sj,label:"人物信息管理",path:"/resource/person"},{icon:vj,label:"知识库图谱可视化",path:"/resource/knowledge-graph"},{icon:Cr,label:"麦麦知识库管理",path:"/resource/knowledge-base"}]},{title:"扩展与监控",items:[{icon:ca,label:"插件市场",path:"/plugins"},{icon:bj,label:"配置模板市场",path:"/config/pack-market"},{icon:Fp,label:"插件配置",path:"/plugin-config"},{icon:Dm,label:"日志查看器",path:"/logs"},{icon:Wl,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:zn,label:"系统设置",path:"/settings"}]}],w=p==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":p,b=async()=>{await k1()};return e.jsx(Hk,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:B("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",i?"lg:w-64":"lg:w-16",u?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:B("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!i&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:B("flex items-baseline gap-2",!i&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:X1()})]}),!i&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Je,{className:B("flex-1 overflow-x-hidden",!i&&"lg:w-16"),children:e.jsx("nav",{className:B("p-4",!i&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:B("space-y-6",!i&&"lg:space-y-3 lg:w-full"),children:N.map((L,D)=>e.jsxs("li",{children:[e.jsx("div",{className:B("px-3 h-[1.25rem]","mb-2",!i&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:L.title})}),!i&&D>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:L.items.map(T=>{const F=v({to:T.path}),O=T.icon,S=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:B("flex items-center transition-all duration-300",i?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(O,{className:B("h-5 w-5 flex-shrink-0",F&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:B("text-sm font-medium whitespace-nowrap transition-all duration-300",F&&"font-semibold",i?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:T.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(Ik,{children:[e.jsx(Pk,{asChild:!0,children:e.jsx(br,{to:T.path,"data-tour":T.tourId,className:B("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",i?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>x(!1),children:S})}),!i&&e.jsx(kN,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:T.label})})]})},T.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.jsx(Bk,{}),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(Kw,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>c(!i),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:i?"收起侧边栏":"展开侧边栏",children:e.jsx(Wa,{className:B("h-5 w-5 transition-transform",!i&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>f(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),e.jsxs(CN,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(Uk,{open:h,onOpenChange:f}),e.jsxs(k,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(Qw,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:L=>{P1(w==="dark"?"light":"dark",g,L)},className:"rounded-lg p-2 hover:bg-accent",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(uj,{className:"h-5 w-5"}):e.jsx(mj,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(k,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[e.jsx(Yw,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:l}),e.jsx($k,{})]})]})})}function qk(l){const n=l.split(` -`).slice(1),i=[];for(const c of n){const u=c.trim();if(!u.startsWith("at "))continue;const x=u.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);x?i.push({functionName:x[1]||"",fileName:x[2],lineNumber:x[3],columnNumber:x[4],raw:u}):i.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:u})}return i}function Fk({error:l,errorInfo:n}){const[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),p=l.stack?qk(l.stack):[],g=async()=>{const v=` -Error: ${l.name} -Message: ${l.message} - -Stack Trace: -${l.stack||"No stack trace available"} - -Component Stack: -${n?.componentStack||"No component stack available"} - -URL: ${window.location.href} -User Agent: ${navigator.userAgent} -Time: ${new Date().toISOString()} - `.trim();try{await navigator.clipboard.writeText(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(gt,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Qt,{className:"h-4 w-4"}),e.jsxs(jt,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[l.name,":"]})," ",l.message]})]}),p.length>0&&e.jsxs(Gi,{open:i,onOpenChange:c,children:[e.jsx(qi,{asChild:!0,children:e.jsxs(k,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Jw,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),i?e.jsx(Tr,{className:"h-4 w-4"}):e.jsx(Oa,{className:"h-4 w-4"})]})}),e.jsx(Fi,{children:e.jsx(Je,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((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))})})})]}),n?.componentStack&&e.jsxs(Gi,{open:u,onOpenChange:x,children:[e.jsx(qi,{asChild:!0,children:e.jsxs(k,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Qt,{className:"h-4 w-4"}),"Component Stack"]}),u?e.jsx(Tr,{className:"h-4 w-4"}):e.jsx(Oa,{className:"h-4 w-4"})]})}),e.jsx(Fi,{children:e.jsx(Je,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:n.componentStack})})})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(_t,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(_o,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function TN({error:l,errorInfo:n}){const i=()=>{window.location.href="/"},c=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(ze,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(ts,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(Qt,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(ls,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(Vs,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(Ye,{className:"space-y-4",children:[e.jsx(Fk,{error:l,errorInfo:n}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(k,{onClick:c,className:"flex-1",children:[e.jsx(zt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(k,{onClick:i,variant:"outline",className:"flex-1",children:[e.jsx(Ro,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class Vk extends m.Component{constructor(n){super(n),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,i){console.error("ErrorBoundary caught an error:",n,i),this.setState({errorInfo:i})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(TN,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function EN({error:l}){return e.jsx(TN,{error:l,errorInfo:null})}const Ji=Jy({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(vg,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!Ok())throw Zy({to:"/auth"})}}),Kk=Ws({getParentRoute:()=>Ji,path:"/auth",component:h2}),Qk=Ws({getParentRoute:()=>Ji,path:"/setup",component:M2}),ut=Ws({getParentRoute:()=>Ji,id:"protected",component:()=>e.jsx(Gk,{children:e.jsx(vg,{})}),errorComponent:({error:l})=>e.jsx(EN,{error:l})}),Yk=Ws({getParentRoute:()=>ut,path:"/",component:B1}),Jk=Ws({getParentRoute:()=>ut,path:"/config/bot",component:d_}),Xk=Ws({getParentRoute:()=>ut,path:"/config/modelProvider",component:y_}),Zk=Ws({getParentRoute:()=>ut,path:"/config/model",component:Q_}),Wk=Ws({getParentRoute:()=>ut,path:"/config/adapter",component:pS}),e3=Ws({getParentRoute:()=>ut,path:"/resource/emoji",component:$S}),s3=Ws({getParentRoute:()=>ut,path:"/resource/expression",component:XS}),t3=Ws({getParentRoute:()=>ut,path:"/resource/person",component:b4}),a3=Ws({getParentRoute:()=>ut,path:"/resource/jargon",component:u4}),l3=Ws({getParentRoute:()=>ut,path:"/resource/knowledge-graph",component:M4}),n3=Ws({getParentRoute:()=>ut,path:"/resource/knowledge-base",component:A4}),r3=Ws({getParentRoute:()=>ut,path:"/logs",component:D4}),i3=Ws({getParentRoute:()=>ut,path:"/chat",component:yC}),c3=Ws({getParentRoute:()=>ut,path:"/plugins",component:rC}),o3=Ws({getParentRoute:()=>ut,path:"/model-presets",component:cC}),d3=Ws({getParentRoute:()=>ut,path:"/plugin-config",component:uC}),u3=Ws({getParentRoute:()=>ut,path:"/plugin-mirrors",component:xC}),m3=Ws({getParentRoute:()=>ut,path:"/settings",component:i2}),x3=Ws({getParentRoute:()=>ut,path:"/config/pack-market",component:hk}),MN=Ws({getParentRoute:()=>ut,path:"/config/pack-market/$packId",component:Mk}),h3=Ws({getParentRoute:()=>ut,path:"/survey/webui-feedback",component:BC}),f3=Ws({getParentRoute:()=>ut,path:"/survey/maibot-feedback",component:$C}),p3=Ws({getParentRoute:()=>Ji,path:"*",component:Qj}),g3=Ji.addChildren([Kk,Qk,ut.addChildren([Yk,Jk,Xk,Zk,Wk,e3,s3,a3,t3,l3,n3,c3,o3,d3,u3,r3,i3,m3,x3,MN,h3,f3]),p3]),j3=Xy({routeTree:g3,defaultNotFoundComponent:Qj,defaultErrorComponent:({error:l})=>e.jsx(EN,{error:l})});function v3({children:l,defaultTheme:n="system",storageKey:i="ui-theme",...c}){const[u,x]=m.useState(()=>localStorage.getItem(i)||n);m.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),u==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(p);return}f.classList.add(u)},[u]),m.useEffect(()=>{const f=localStorage.getItem("accent-color");if(f){const p=document.documentElement,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&&(p.style.setProperty("--primary",v.hsl),v.gradient?(p.style.setProperty("--primary-gradient",v.gradient),p.classList.add("has-gradient")):(p.style.removeProperty("--primary-gradient"),p.classList.remove("has-gradient")))}},[]);const h={theme:u,setTheme:f=>{localStorage.setItem(i,f),x(f)}};return e.jsx(Pj.Provider,{...c,value:h,children:l})}function N3({children:l,defaultEnabled:n=!0,defaultWavesEnabled:i=!0,storageKey:c="enable-animations",wavesStorageKey:u="enable-waves-background"}){const[x,h]=m.useState(()=>{const v=localStorage.getItem(c);return v!==null?v==="true":n}),[f,p]=m.useState(()=>{const v=localStorage.getItem(u);return v!==null?v==="true":i});m.useEffect(()=>{const v=document.documentElement;x?v.classList.remove("no-animations"):v.classList.add("no-animations"),localStorage.setItem(c,String(x))},[x,c]),m.useEffect(()=>{localStorage.setItem(u,String(f))},[f,u]);const g={enableAnimations:x,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(Gj.Provider,{value:g,children:l})}const b3=jw,AN=m.forwardRef(({className:l,...n},i)=>e.jsx(lj,{ref:i,className:B("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",l),...n}));AN.displayName=lj.displayName;const y3=Ar("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"}}),zN=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(nj,{ref:c,className:B(y3({variant:n}),l),...i}));zN.displayName=nj.displayName;const w3=m.forwardRef(({className:l,...n},i)=>e.jsx(rj,{ref:i,className:B("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",l),...n}));w3.displayName=rj.displayName;const DN=m.forwardRef(({className:l,...n},i)=>e.jsx(ij,{ref:i,className:B("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",l),"toast-close":"",...n,children:e.jsx(Da,{className:"h-4 w-4"})}));DN.displayName=ij.displayName;const ON=m.forwardRef(({className:l,...n},i)=>e.jsx(cj,{ref:i,className:B("text-sm font-semibold [&+div]:text-xs",l),...n}));ON.displayName=cj.displayName;const RN=m.forwardRef(({className:l,...n},i)=>e.jsx(oj,{ref:i,className:B("text-sm opacity-90",l),...n}));RN.displayName=oj.displayName;function _3(){const{toasts:l}=et();return e.jsxs(b3,{children:[l.map(function({id:n,title:i,description:c,action:u,...x}){return e.jsxs(zN,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[i&&e.jsx(ON,{children:i}),c&&e.jsx(RN,{children:c})]}),u,e.jsx(DN,{})]},n)}),e.jsx(AN,{})]})}C1.createRoot(document.getElementById("root")).render(e.jsx(m.StrictMode,{children:e.jsx(Vk,{children:e.jsx(v3,{defaultTheme:"system",children:e.jsx(N3,{children:e.jsxs(p_,{children:[e.jsx(Wy,{router:j3}),e.jsx(v_,{}),e.jsx(_3,{})]})})})})})); diff --git a/webui/dist/assets/index-ClRLbZoU.js b/webui/dist/assets/index-ClRLbZoU.js new file mode 100644 index 00000000..3ca0bc65 --- /dev/null +++ b/webui/dist/assets/index-ClRLbZoU.js @@ -0,0 +1,90 @@ +import{r as m,j as e,L as Sr,e as sa,R as Ss,b as e0,f as s0,g as t0,h as a0,k as l0,l as Ys,m as n0,n as r0,O as vg,o as i0}from"./router-9vIXuQkh.js";import{a as c0,b as o0,g as d0}from"./react-vendor-BmxF9s7Q.js";import{N as u0,c as m0,O as Or,P as x0,g as rm}from"./utils-BqoaXoQ1.js";import{L as Ng,T as bg,C as yg,R as h0,a as wg,V as f0,b as p0,S as _g,c as g0,d as Sg,I as j0,e as Cg,f as v0,g as kg,h as N0,i as b0,j as y0,O as Tg,P as w0,k as Eg,l as Mg,D as Ag,A as zg,m as Dg,n as _0,o as S0,p as Og,q as C0,r as Rg,s as k0,t as T0,u as Lg,v as E0,w as M0,x as Ug,y as Bg,F as $g,z as Ig,B as A0,E as z0,G as Hg,H as D0,J as O0,K as R0,M as L0,N as U0,Q as B0,U as $0,W as I0,X as H0,Y as P0,Z as G0,_ as F0,$ as V0,a0 as q0,a1 as K0,a2 as Pg,a3 as Q0,a4 as Y0}from"./radix-extra-CTMrA3du.js";import{R as J0,T as X0,L as Z0,g as W0,C as xo,X as ho,Y as Ei,h as ew,B as im,j as fo,P as sw,k as tw,l as aw}from"./charts-simvewUa.js";import{S as lw,H as Gg,O as Fg,o as nw,C as Vg,p as rw,T as qg,D as Kg,R as iw,q as cw,I as Qg,J as ow,K as Yg,L as Jg,M as dw,N as Xg,V as uw,Q as Zg,U as Wg,X as mw,Y as xw,Z as ej,_ as hw,$ as fw,a0 as sj,a1 as pw,e as tj,f as Do,c as Oo,P as Rn,d as Ro,b as tn,h as gw,l as jw,m as vw,u as Sm,r as Nw,a as bw,a2 as yw,a3 as aj,a4 as ww,a5 as _w,a6 as Sw,a7 as lj,a8 as nj,a9 as rj,aa as ij,ab as cj,ac as oj,ad as Cw}from"./radix-core-BdJoVJLV.js";import{R as wt,a as $i,C as _t,b as Zt,L as Es,P as Qi,Z as Tn,F as Ia,c as kw,S as Ln,d as Tw,M as an,A as Ew,D as Mw,e as Mr,f as bl,T as Aw,X as Da,g as zw,h as dj,I as Gt,i as Jt,j as yt,k as _o,E as Ii,l as Wt,m as uj,H as Dw,n as as,o as qt,U as Hi,p as mj,q as xj,r as Gp,K as zm,s as hj,t as Ow,u as vo,v as Rw,B as Di,w as En,x as Dm,y as Lw,z as Uw,G as Ft,J as Lo,N as Ha,O as tt,Q as Oa,V as Ar,W as Om,Y as fj,_ as Yi,$ as pj,a0 as gj,a1 as Mn,a2 as Rr,a3 as el,a4 as ba,a5 as Lr,a6 as Rm,a7 as jj,a8 as Xt,a9 as wl,aa as An,ab as zn,ac as Uo,ad as Bw,ae as $w,af as Iw,ag as vj,ah as No,ai as Dn,aj as Hw,ak as zr,al as Pw,am as So,an as Cm,ao as Nj,ap as Gw,aq as Fw,ar as Fp,as as Vw,at as bj,au as qw,av as Zl,aw as yj,ax as cm,ay as Vp,az as Kw,aA as om,aB as Qw,aC as Yw,aD as Jw,aE as Xw,aF as wj,aG as _j,aH as Co,aI as Zw,aJ as Sj,aK as Cj,aL as Ww,aM as e1,aN as qp,aO as s1,aP as t1,aQ as a1,aR as l1}from"./icons-C3pAHJin.js";import{S as n1,p as r1,j as i1,a as c1,E as Kp,R as o1,o as d1}from"./codemirror-TZqPU532.js";import{u as kj,a as ko,s as Tj,K as Ej,P as Mj,b as Aj,D as zj,c as Dj,S as Oj,v as u1,d as Rj,C as Lj,h as m1}from"./dnd-BiPfFtVp.js";import{_ as ma,c as x1,g as Uj,D as h1,z as po}from"./misc-CDy9pI_Y.js";import{D as f1,U as p1}from"./uppy-x-2TBvZ1.js";import{M as g1,r as j1,a as v1,b as N1}from"./markdown-CKA5gBQ9.js";import{c as b1,H as To,P as Eo,u as y1,d as w1,R as _1,B as S1,e as C1,C as k1,M as T1,f as E1}from"./reactflow-DtsZHOR4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))c(u);new MutationObserver(u=>{for(const x of u)if(x.type==="childList")for(const h of x.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function i(u){const x={};return u.integrity&&(x.integrity=u.integrity),u.referrerPolicy&&(x.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?x.credentials="include":u.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function c(u){if(u.ep)return;u.ep=!0;const x=i(u);fetch(u.href,x)}})();var dm={exports:{}},Mi={},um={exports:{}},mm={};var Qp;function M1(){return Qp||(Qp=1,(function(l){function n(z,K){var B=z.length;z.push(K);e:for(;0>>1,H=z[U];if(0>>1;Uu(_e,B))Xu(be,_e)?(z[U]=be,z[X]=B,U=X):(z[U]=_e,z[je]=B,U=je);else if(Xu(be,B))z[U]=be,z[X]=B,U=X;else break e}}return K}function u(z,K){var B=z.sortIndex-K.sortIndex;return B!==0?B:z.id-K.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;l.unstable_now=function(){return x.now()}}else{var h=Date,f=h.now();l.unstable_now=function(){return h.now()-f}}var p=[],j=[],N=1,v=null,b=3,w=!1,y=!1,L=!1,D=!1,k=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function S(z){for(var K=i(j);K!==null;){if(K.callback===null)c(j);else if(K.startTime<=z)c(j),K.sortIndex=K.expirationTime,n(p,K);else break;K=i(j)}}function E(z){if(L=!1,S(z),!y)if(i(p)!==null)y=!0,I||(I=!0,ve());else{var K=i(j);K!==null&&ge(E,K.startTime-z)}}var I=!1,A=-1,J=5,G=-1;function ue(){return D?!0:!(l.unstable_now()-Gz&&ue());){var U=v.callback;if(typeof U=="function"){v.callback=null,b=v.priorityLevel;var H=U(v.expirationTime<=z);if(z=l.unstable_now(),typeof H=="function"){v.callback=H,S(z),K=!0;break s}v===i(p)&&c(p),S(z)}else c(p);v=i(p)}if(v!==null)K=!0;else{var we=i(j);we!==null&&ge(E,we.startTime-z),K=!1}}break e}finally{v=null,b=B,w=!1}K=void 0}}finally{K?ve():I=!1}}}var ve;if(typeof M=="function")ve=function(){M(de)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,fe=ne.port2;ne.port1.onmessage=de,ve=function(){fe.postMessage(null)}}else ve=function(){k(de,0)};function ge(z,K){A=k(function(){z(l.unstable_now())},K)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(z){z.callback=null},l.unstable_forceFrameRate=function(z){0>z||125U?(z.sortIndex=B,n(j,z),i(p)===null&&z===i(j)&&(L?(V(A),A=-1):L=!0,ge(E,B-U))):(z.sortIndex=H,n(p,z),y||w||(y=!0,I||(I=!0,ve()))),z},l.unstable_shouldYield=ue,l.unstable_wrapCallback=function(z){var K=b;return function(){var B=b;b=K;try{return z.apply(this,arguments)}finally{b=B}}}})(mm)),mm}var Yp;function A1(){return Yp||(Yp=1,um.exports=M1()),um.exports}var Jp;function z1(){if(Jp)return Mi;Jp=1;var l=A1(),n=c0(),i=o0();function c(s){var t="https://react.dev/errors/"+s;if(1H||(s.current=U[H],U[H]=null,H--)}function _e(s,t){H++,U[H]=s.current,s.current=t}var X=we(null),be=we(null),ee=we(null),xe=we(null);function Ce(s,t){switch(_e(ee,t),_e(be,s),_e(X,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?mp(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=mp(t),s=xp(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}je(X),_e(X,s)}function Z(){je(X),je(be),je(ee)}function se(s){s.memoizedState!==null&&_e(xe,s);var t=X.current,a=xp(t,s.type);t!==a&&(_e(be,s),_e(X,a))}function De(s){be.current===s&&(je(X),je(be)),xe.current===s&&(je(xe),Si._currentValue=B)}var q,te;function Ae(s){if(q===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);q=t&&t[1]||"",te=-1)":-1o||R[r]!==le[o]){var he=` +`+R[r].replace(" at new "," at ");return s.displayName&&he.includes("")&&(he=he.replace("",s.displayName)),he}while(1<=r&&0<=o);break}}}finally{Te=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?Ae(a):""}function ie(s,t){switch(s.tag){case 26:case 27:case 5:return Ae(s.type);case 16:return Ae("Lazy");case 13:return s.child!==t&&t!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return Ie(s.type,!1);case 11:return Ie(s.type.render,!1);case 1:return Ie(s.type,!0);case 31:return Ae("Activity");default:return""}}function Ee(s){try{var t="",a=null;do t+=ie(s,a),a=s,s=s.return;while(s);return t}catch(r){return` +Error generating stack: `+r.message+` +`+r.stack}}var Vs=Object.prototype.hasOwnProperty,Vt=l.unstable_scheduleCallback,Kt=l.unstable_cancelCallback,Qt=l.unstable_shouldYield,fs=l.unstable_requestPaint,Is=l.unstable_now,Y=l.unstable_getCurrentPriorityLevel,Fe=l.unstable_ImmediatePriority,He=l.unstable_UserBlockingPriority,qe=l.unstable_NormalPriority,Ds=l.unstable_LowPriority,Se=l.unstable_IdlePriority,ns=l.log,Cs=l.unstable_setDisableYieldValue,Ms=null,ss=null;function es(s){if(typeof ns=="function"&&Cs(s),ss&&typeof ss.setStrictMode=="function")try{ss.setStrictMode(Ms,s)}catch{}}var ps=Math.clz32?Math.clz32:nt,mt=Math.log,zt=Math.LN2;function nt(s){return s>>>=0,s===0?32:31-(mt(s)/zt|0)|0}var ts=256,St=262144,Lt=4194304;function Mt(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 Fa(s,t,a){var r=s.pendingLanes;if(r===0)return 0;var o=0,d=s.suspendedLanes,g=s.pingedLanes;s=s.warmLanes;var _=r&134217727;return _!==0?(r=_&~d,r!==0?o=Mt(r):(g&=_,g!==0?o=Mt(g):a||(a=_&~s,a!==0&&(o=Mt(a))))):(_=r&~d,_!==0?o=Mt(_):g!==0?o=Mt(g):a||(a=r&~s,a!==0&&(o=Mt(a)))),o===0?0:t!==0&&t!==o&&(t&d)===0&&(d=o&-o,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:o}function Va(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function $n(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function W(){var s=Lt;return Lt<<=1,(Lt&62914560)===0&&(Lt=4194304),s}function O(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function F(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Le(s,t,a,r,o,d){var g=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var _=s.entanglements,R=s.expirationTimes,le=s.hiddenUpdates;for(a=g&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var QN=/[\n"\\]/g;function wa(s){return s.replace(QN,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ed(s,t,a,r,o,d,g,_){s.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?s.type=g:s.removeAttribute("type"),t!=null?g==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+ya(t)):s.value!==""+ya(t)&&(s.value=""+ya(t)):g!=="submit"&&g!=="reset"||s.removeAttribute("value"),t!=null?sd(s,g,ya(t)):a!=null?sd(s,g,ya(a)):r!=null&&s.removeAttribute("value"),o==null&&d!=null&&(s.defaultChecked=!!d),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.name=""+ya(_):s.removeAttribute("name")}function nx(s,t,a,r,o,d,g,_){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)){Wo(s);return}a=a!=null?""+ya(a):"",t=t!=null?""+ya(t):a,_||t===s.value||(s.value=t),s.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,s.checked=_?s.checked:!!r,s.defaultChecked=!!r,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.name=g),Wo(s)}function sd(s,t,a){t==="number"&&tc(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function Vn(s,t,a,r){if(s=s.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rd=!1;if(al)try{var Gr={};Object.defineProperty(Gr,"passive",{get:function(){rd=!0}}),window.addEventListener("test",Gr,Gr),window.removeEventListener("test",Gr,Gr)}catch{rd=!1}var El=null,id=null,lc=null;function mx(){if(lc)return lc;var s,t=id,a=t.length,r,o="value"in El?El.value:El.textContent,d=o.length;for(s=0;s=qr),jx=" ",vx=!1;function Nx(s,t){switch(s){case"keyup":return yb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bx(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Yn=!1;function _b(s,t){switch(s){case"compositionend":return bx(t);case"keypress":return t.which!==32?null:(vx=!0,jx);case"textInput":return s=t.data,s===jx&&vx?null:s;default:return null}}function Sb(s,t){if(Yn)return s==="compositionend"||!md&&Nx(s,t)?(s=mx(),lc=id=El=null,Yn=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-s};s=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ex(a)}}function Ax(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Ax(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function zx(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=tc(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=tc(s.document)}return t}function fd(s){var t=s&&s.nodeName&&s.nodeName.toLowerCase();return t&&(t==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||t==="textarea"||s.contentEditable==="true")}var Db=al&&"documentMode"in document&&11>=document.documentMode,Jn=null,pd=null,Jr=null,gd=!1;function Dx(s,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;gd||Jn==null||Jn!==tc(r)||(r=Jn,"selectionStart"in r&&fd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Jr&&Yr(Jr,r)||(Jr=r,r=Xc(pd,"onSelect"),0>=g,o-=g,qa=1<<32-ps(t)+o|a<rs?(ws=$e,$e=null):ws=$e.sibling;var Ts=ce(Q,$e,ae[rs],pe);if(Ts===null){$e===null&&($e=ws);break}s&&$e&&Ts.alternate===null&&t(Q,$e),P=d(Ts,P,rs),ks===null?Ve=Ts:ks.sibling=Ts,ks=Ts,$e=ws}if(rs===ae.length)return a(Q,$e),_s&&nl(Q,rs),Ve;if($e===null){for(;rsrs?(ws=$e,$e=null):ws=$e.sibling;var Xl=ce(Q,$e,Ts.value,pe);if(Xl===null){$e===null&&($e=ws);break}s&&$e&&Xl.alternate===null&&t(Q,$e),P=d(Xl,P,rs),ks===null?Ve=Xl:ks.sibling=Xl,ks=Xl,$e=ws}if(Ts.done)return a(Q,$e),_s&&nl(Q,rs),Ve;if($e===null){for(;!Ts.done;rs++,Ts=ae.next())Ts=Ne(Q,Ts.value,pe),Ts!==null&&(P=d(Ts,P,rs),ks===null?Ve=Ts:ks.sibling=Ts,ks=Ts);return _s&&nl(Q,rs),Ve}for($e=r($e);!Ts.done;rs++,Ts=ae.next())Ts=me($e,Q,rs,Ts.value,pe),Ts!==null&&(s&&Ts.alternate!==null&&$e.delete(Ts.key===null?rs:Ts.key),P=d(Ts,P,rs),ks===null?Ve=Ts:ks.sibling=Ts,ks=Ts);return s&&$e.forEach(function(Wy){return t(Q,Wy)}),_s&&nl(Q,rs),Ve}function Gs(Q,P,ae,pe){if(typeof ae=="object"&&ae!==null&&ae.type===L&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case w:e:{for(var Ve=ae.key;P!==null;){if(P.key===Ve){if(Ve=ae.type,Ve===L){if(P.tag===7){a(Q,P.sibling),pe=o(P,ae.props.children),pe.return=Q,Q=pe;break e}}else if(P.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===J&&vn(Ve)===P.type){a(Q,P.sibling),pe=o(P,ae.props),ti(pe,ae),pe.return=Q,Q=pe;break e}a(Q,P);break}else t(Q,P);P=P.sibling}ae.type===L?(pe=hn(ae.props.children,Q.mode,pe,ae.key),pe.return=Q,Q=pe):(pe=hc(ae.type,ae.key,ae.props,null,Q.mode,pe),ti(pe,ae),pe.return=Q,Q=pe)}return g(Q);case y:e:{for(Ve=ae.key;P!==null;){if(P.key===Ve)if(P.tag===4&&P.stateNode.containerInfo===ae.containerInfo&&P.stateNode.implementation===ae.implementation){a(Q,P.sibling),pe=o(P,ae.children||[]),pe.return=Q,Q=pe;break e}else{a(Q,P);break}else t(Q,P);P=P.sibling}pe=_d(ae,Q.mode,pe),pe.return=Q,Q=pe}return g(Q);case J:return ae=vn(ae),Gs(Q,P,ae,pe)}if(ge(ae))return ze(Q,P,ae,pe);if(ve(ae)){if(Ve=ve(ae),typeof Ve!="function")throw Error(c(150));return ae=Ve.call(ae),Qe(Q,P,ae,pe)}if(typeof ae.then=="function")return Gs(Q,P,bc(ae),pe);if(ae.$$typeof===M)return Gs(Q,P,gc(Q,ae),pe);yc(Q,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,P!==null&&P.tag===6?(a(Q,P.sibling),pe=o(P,ae),pe.return=Q,Q=pe):(a(Q,P),pe=wd(ae,Q.mode,pe),pe.return=Q,Q=pe),g(Q)):a(Q,P)}return function(Q,P,ae,pe){try{si=0;var Ve=Gs(Q,P,ae,pe);return ir=null,Ve}catch($e){if($e===rr||$e===vc)throw $e;var ks=ha(29,$e,null,Q.mode);return ks.lanes=pe,ks.return=Q,ks}finally{}}}var bn=th(!0),ah=th(!1),Ol=!1;function Ld(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ud(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 Rl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Ll(s,t,a){var r=s.updateQueue;if(r===null)return null;if(r=r.shared,(As&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=xc(s),Ix(s,null,a),t}return mc(s,r,t,a),xc(s)}function ai(s,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,bs(s,a)}}function Bd(s,t){var a=s.updateQueue,r=s.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var o=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var g={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?o=d=g:d=d.next=g,a=a.next}while(a!==null);d===null?o=d=t:d=d.next=t}else o=d=t;a={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:d,shared:r.shared,callbacks:r.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=t:s.next=t,a.lastBaseUpdate=t}var $d=!1;function li(){if($d){var s=nr;if(s!==null)throw s}}function ni(s,t,a,r){$d=!1;var o=s.updateQueue;Ol=!1;var d=o.firstBaseUpdate,g=o.lastBaseUpdate,_=o.shared.pending;if(_!==null){o.shared.pending=null;var R=_,le=R.next;R.next=null,g===null?d=le:g.next=le,g=R;var he=s.alternate;he!==null&&(he=he.updateQueue,_=he.lastBaseUpdate,_!==g&&(_===null?he.firstBaseUpdate=le:_.next=le,he.lastBaseUpdate=R))}if(d!==null){var Ne=o.baseState;g=0,he=le=R=null,_=d;do{var ce=_.lane&-536870913,me=ce!==_.lane;if(me?(ys&ce)===ce:(r&ce)===ce){ce!==0&&ce===lr&&($d=!0),he!==null&&(he=he.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var ze=s,Qe=_;ce=t;var Gs=a;switch(Qe.tag){case 1:if(ze=Qe.payload,typeof ze=="function"){Ne=ze.call(Gs,Ne,ce);break e}Ne=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=Qe.payload,ce=typeof ze=="function"?ze.call(Gs,Ne,ce):ze,ce==null)break e;Ne=v({},Ne,ce);break e;case 2:Ol=!0}}ce=_.callback,ce!==null&&(s.flags|=64,me&&(s.flags|=8192),me=o.callbacks,me===null?o.callbacks=[ce]:me.push(ce))}else me={lane:ce,tag:_.tag,payload:_.payload,callback:_.callback,next:null},he===null?(le=he=me,R=Ne):he=he.next=me,g|=ce;if(_=_.next,_===null){if(_=o.shared.pending,_===null)break;me=_,_=me.next,me.next=null,o.lastBaseUpdate=me,o.shared.pending=null}}while(!0);he===null&&(R=Ne),o.baseState=R,o.firstBaseUpdate=le,o.lastBaseUpdate=he,d===null&&(o.shared.lanes=0),Hl|=g,s.lanes=g,s.memoizedState=Ne}}function lh(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function nh(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;sd?d:8;var g=z.T,_={};z.T=_,lu(s,!1,t,a);try{var R=o(),le=z.S;if(le!==null&&le(_,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var he=Pb(R,r);ci(s,t,he,va(s))}else ci(s,t,r,va(s))}catch(Ne){ci(s,t,{then:function(){},status:"rejected",reason:Ne},va())}finally{K.p=d,g!==null&&_.types!==null&&(g.types=_.types),z.T=g}}function Qb(){}function tu(s,t,a,r){if(s.tag!==5)throw Error(c(476));var o=Uh(s).queue;Lh(s,o,t,B,a===null?Qb:function(){return Bh(s),a(r)})}function Uh(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:B},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function Bh(s){var t=Uh(s);t.next===null&&(t=s.alternate.memoizedState),ci(s,t.next.queue,{},va())}function au(){return $t(Si)}function $h(){return bt().memoizedState}function Ih(){return bt().memoizedState}function Yb(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=va();s=Rl(a);var r=Ll(t,s,a);r!==null&&(oa(r,t,a),ai(r,t,a)),t={cache:zd()},s.payload=t;return}t=t.return}}function Jb(s,t,a){var r=va();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},zc(s)?Ph(t,a):(a=bd(s,t,a,r),a!==null&&(oa(a,s,r),Gh(a,t,r)))}function Hh(s,t,a){var r=va();ci(s,t,a,r)}function ci(s,t,a,r){var o={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(zc(s))Ph(t,o);else{var d=s.alternate;if(s.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var g=t.lastRenderedState,_=d(g,a);if(o.hasEagerState=!0,o.eagerState=_,xa(_,g))return mc(s,t,o,0),qs===null&&uc(),!1}catch{}finally{}if(a=bd(s,t,o,r),a!==null)return oa(a,s,r),Gh(a,t,r),!0}return!1}function lu(s,t,a,r){if(r={lane:2,revertLane:Lu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},zc(s)){if(t)throw Error(c(479))}else t=bd(s,a,r,2),t!==null&&oa(t,s,2)}function zc(s){var t=s.alternate;return s===ls||t!==null&&t===ls}function Ph(s,t){or=Sc=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function Gh(s,t,a){if((a&4194048)!==0){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,bs(s,a)}}var oi={readContext:$t,use:Tc,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useLayoutEffect:xt,useInsertionEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useSyncExternalStore:xt,useId:xt,useHostTransitionStatus:xt,useFormState:xt,useActionState:xt,useOptimistic:xt,useMemoCache:xt,useCacheRefresh:xt};oi.useEffectEvent=xt;var Fh={readContext:$t,use:Tc,useCallback:function(s,t){return Yt().memoizedState=[s,t===void 0?null:t],s},useContext:$t,useEffect:kh,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,Mc(4194308,4,Ah.bind(null,t,s),a)},useLayoutEffect:function(s,t){return Mc(4194308,4,s,t)},useInsertionEffect:function(s,t){Mc(4,2,s,t)},useMemo:function(s,t){var a=Yt();t=t===void 0?null:t;var r=s();if(yn){es(!0);try{s()}finally{es(!1)}}return a.memoizedState=[r,t],r},useReducer:function(s,t,a){var r=Yt();if(a!==void 0){var o=a(t);if(yn){es(!0);try{a(t)}finally{es(!1)}}}else o=t;return r.memoizedState=r.baseState=o,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},r.queue=s,s=s.dispatch=Jb.bind(null,ls,s),[r.memoizedState,s]},useRef:function(s){var t=Yt();return s={current:s},t.memoizedState=s},useState:function(s){s=Xd(s);var t=s.queue,a=Hh.bind(null,ls,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:eu,useDeferredValue:function(s,t){var a=Yt();return su(a,s,t)},useTransition:function(){var s=Xd(!1);return s=Lh.bind(null,ls,s.queue,!0,!1),Yt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var r=ls,o=Yt();if(_s){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),qs===null)throw Error(c(349));(ys&127)!==0||uh(r,t,a)}o.memoizedState=a;var d={value:a,getSnapshot:t};return o.queue=d,kh(xh.bind(null,r,d,s),[s]),r.flags|=2048,ur(9,{destroy:void 0},mh.bind(null,r,d,a,t),null),a},useId:function(){var s=Yt(),t=qs.identifierPrefix;if(_s){var a=Ka,r=qa;a=(r&~(1<<32-ps(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Cc++,0<\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof r.is=="string"?g.createElement("select",{is:r.is}):g.createElement("select"),r.multiple?d.multiple=!0:r.size&&(d.size=r.size);break;default:d=typeof r.is=="string"?g.createElement(o,{is:r.is}):g.createElement(o)}}d[Ut]=t,d[aa]=r;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)d.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=d;e:switch(Ht(d,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ul(t)}}return st(t),ju(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==r&&ul(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(c(166));if(s=ee.current,tr(t)){if(s=t.stateNode,a=t.memoizedProps,r=null,o=Bt,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}s[Ut]=t,s=!!(s.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||dp(s.nodeValue,a)),s||zl(t,!0)}else s=Zc(s).createTextNode(r),s[Ut]=t,t.stateNode=s}return st(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(r=tr(t),a!==null){if(s===null){if(!r)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(557));s[Ut]=t}else fn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;st(t),s=!1}else a=Td(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(pa(t),t):(pa(t),null);if((t.flags&128)!==0)throw Error(c(558))}return st(t),null;case 13:if(r=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=tr(t),r!==null&&r.dehydrated!==null){if(s===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[Ut]=t}else fn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;st(t),o=!1}else o=Td(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(pa(t),t):(pa(t),null)}return pa(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,s=s!==null&&s.memoizedState!==null,a&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==o&&(r.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),Uc(t,t.updateQueue),st(t),null);case 4:return Z(),s===null&&Iu(t.stateNode.containerInfo),st(t),null;case 10:return il(t.type),st(t),null;case 19:if(je(Nt),r=t.memoizedState,r===null)return st(t),null;if(o=(t.flags&128)!==0,d=r.rendering,d===null)if(o)ui(r,!1);else{if(ht!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(d=_c(s),d!==null){for(t.flags|=128,ui(r,!1),s=d.updateQueue,t.updateQueue=s,Uc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)Hx(a,s),a=a.sibling;return _e(Nt,Nt.current&1|2),_s&&nl(t,r.treeForkCount),t.child}s=s.sibling}r.tail!==null&&Is()>Pc&&(t.flags|=128,o=!0,ui(r,!1),t.lanes=4194304)}else{if(!o)if(s=_c(d),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,Uc(t,s),ui(r,!0),r.tail===null&&r.tailMode==="hidden"&&!d.alternate&&!_s)return st(t),null}else 2*Is()-r.renderingStartTime>Pc&&a!==536870912&&(t.flags|=128,o=!0,ui(r,!1),t.lanes=4194304);r.isBackwards?(d.sibling=t.child,t.child=d):(s=r.last,s!==null?s.sibling=d:t.child=d,r.last=d)}return r.tail!==null?(s=r.tail,r.rendering=s,r.tail=s.sibling,r.renderingStartTime=Is(),s.sibling=null,a=Nt.current,_e(Nt,o?a&1|2:a&1),_s&&nl(t,r.treeForkCount),s):(st(t),null);case 22:case 23:return pa(t),Hd(),r=t.memoizedState!==null,s!==null?s.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(st(t),t.subtreeFlags&6&&(t.flags|=8192)):st(t),a=t.updateQueue,a!==null&&Uc(t,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),s!==null&&je(jn),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),il(Ct),st(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function sy(s,t){switch(Cd(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return il(Ct),Z(),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(pa(t),t.alternate===null)throw Error(c(340));fn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(pa(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));fn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return je(Nt),null;case 4:return Z(),null;case 10:return il(t.type),null;case 22:case 23:return pa(t),Hd(),s!==null&&je(jn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return il(Ct),null;case 25:return null;default:return null}}function ff(s,t){switch(Cd(t),t.tag){case 3:il(Ct),Z();break;case 26:case 27:case 5:De(t);break;case 4:Z();break;case 31:t.memoizedState!==null&&pa(t);break;case 13:pa(t);break;case 19:je(Nt);break;case 10:il(t.type);break;case 22:case 23:pa(t),Hd(),s!==null&&je(jn);break;case 24:il(Ct)}}function mi(s,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var o=r.next;a=o;do{if((a.tag&s)===s){r=void 0;var d=a.create,g=a.inst;r=d(),g.destroy=r}a=a.next}while(a!==o)}}catch(_){Rs(t,t.return,_)}}function $l(s,t,a){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var d=o.next;r=d;do{if((r.tag&s)===s){var g=r.inst,_=g.destroy;if(_!==void 0){g.destroy=void 0,o=t;var R=a,le=_;try{le()}catch(he){Rs(o,R,he)}}}r=r.next}while(r!==d)}}catch(he){Rs(t,t.return,he)}}function pf(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{nh(t,a)}catch(r){Rs(s,s.return,r)}}}function gf(s,t,a){a.props=wn(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(r){Rs(s,t,r)}}function xi(s,t){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var r=s.stateNode;break;case 30:r=s.stateNode;break;default:r=s.stateNode}typeof a=="function"?s.refCleanup=a(r):a.current=r}}catch(o){Rs(s,t,o)}}function Qa(s,t){var a=s.ref,r=s.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(o){Rs(s,t,o)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){Rs(s,t,o)}else a.current=null}function jf(s){var t=s.type,a=s.memoizedProps,r=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(o){Rs(s,s.return,o)}}function vu(s,t,a){try{var r=s.stateNode;wy(r,s.type,a,t),r[aa]=t}catch(o){Rs(s,s.return,o)}}function vf(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&ql(s.type)||s.tag===4}function Nu(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||vf(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&&ql(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 bu(s,t,a){var r=s.tag;if(r===5||r===6)s=s.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(s),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=tl));else if(r!==4&&(r===27&&ql(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(bu(s,t,a),s=s.sibling;s!==null;)bu(s,t,a),s=s.sibling}function Bc(s,t,a){var r=s.tag;if(r===5||r===6)s=s.stateNode,t?a.insertBefore(s,t):a.appendChild(s);else if(r!==4&&(r===27&&ql(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(Bc(s,t,a),s=s.sibling;s!==null;)Bc(s,t,a),s=s.sibling}function Nf(s){var t=s.stateNode,a=s.memoizedProps;try{for(var r=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Ht(t,r,a),t[Ut]=s,t[aa]=a}catch(d){Rs(s,s.return,d)}}var ml=!1,Et=!1,yu=!1,bf=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function ty(s,t){if(s=s.containerInfo,Gu=no,s=zx(s),fd(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var o=r.anchorOffset,d=r.focusNode;r=r.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var g=0,_=-1,R=-1,le=0,he=0,Ne=s,ce=null;s:for(;;){for(var me;Ne!==a||o!==0&&Ne.nodeType!==3||(_=g+o),Ne!==d||r!==0&&Ne.nodeType!==3||(R=g+r),Ne.nodeType===3&&(g+=Ne.nodeValue.length),(me=Ne.firstChild)!==null;)ce=Ne,Ne=me;for(;;){if(Ne===s)break s;if(ce===a&&++le===o&&(_=g),ce===d&&++he===r&&(R=g),(me=Ne.nextSibling)!==null)break;Ne=ce,ce=Ne.parentNode}Ne=me}a=_===-1||R===-1?null:{start:_,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Fu={focusedElem:s,selectionRange:a},no=!1,Ot=t;Ot!==null;)if(t=Ot,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Ot=s;else for(;Ot!==null;){switch(t=Ot,d=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a title"))),Ht(d,r,a),d[Ut]=s,Dt(d),r=d;break e;case"link":var g=kp("link","href",o).get(r+(a.href||""));if(g){for(var _=0;_Gs&&(g=Gs,Gs=Qe,Qe=g);var Q=Mx(_,Qe),P=Mx(_,Gs);if(Q&&P&&(me.rangeCount!==1||me.anchorNode!==Q.node||me.anchorOffset!==Q.offset||me.focusNode!==P.node||me.focusOffset!==P.offset)){var ae=Ne.createRange();ae.setStart(Q.node,Q.offset),me.removeAllRanges(),Qe>Gs?(me.addRange(ae),me.extend(P.node,P.offset)):(ae.setEnd(P.node,P.offset),me.addRange(ae))}}}}for(Ne=[],me=_;me=me.parentNode;)me.nodeType===1&&Ne.push({element:me,left:me.scrollLeft,top:me.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_a?32:a,z.T=null,a=Eu,Eu=null;var d=Gl,g=gl;if(At=0,pr=Gl=null,gl=0,(As&6)!==0)throw Error(c(331));var _=As;if(As|=4,zf(d.current),Ef(d,d.current,g,a),As=_,vi(0,!1),ss&&typeof ss.onPostCommitFiberRoot=="function")try{ss.onPostCommitFiberRoot(Ms,d)}catch{}return!0}finally{K.p=o,z.T=r,Jf(s,t)}}function Zf(s,t,a){t=Sa(a,t),t=cu(s.stateNode,t,2),s=Ll(s,t,2),s!==null&&(F(s,2),Ya(s))}function Rs(s,t,a){if(s.tag===3)Zf(s,s,a);else for(;t!==null;){if(t.tag===3){Zf(t,s,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Pl===null||!Pl.has(r))){s=Sa(a,s),a=Zh(2),r=Ll(t,a,2),r!==null&&(Wh(a,r,t,s),F(r,2),Ya(r));break}}t=t.return}}function Du(s,t,a){var r=s.pingCache;if(r===null){r=s.pingCache=new ny;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(a)||(Su=!0,o.add(a),s=dy.bind(null,s,t,a),t.then(s,s))}function dy(s,t,a){var r=s.pingCache;r!==null&&r.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,qs===s&&(ys&a)===a&&(ht===4||ht===3&&(ys&62914560)===ys&&300>Is()-Hc?(As&2)===0&&gr(s,0):Cu|=a,fr===ys&&(fr=0)),Ya(s)}function Wf(s,t){t===0&&(t=W()),s=xn(s,t),s!==null&&(F(s,t),Ya(s))}function uy(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),Wf(s,a)}function my(s,t){var a=0;switch(s.tag){case 31:case 13:var r=s.stateNode,o=s.memoizedState;o!==null&&(a=o.retryLane);break;case 19:r=s.stateNode;break;case 22:r=s.stateNode._retryCache;break;default:throw Error(c(314))}r!==null&&r.delete(t),Wf(s,a)}function xy(s,t){return Vt(s,t)}var Qc=null,vr=null,Ou=!1,Yc=!1,Ru=!1,Vl=0;function Ya(s){s!==vr&&s.next===null&&(vr===null?Qc=vr=s:vr=vr.next=s),Yc=!0,Ou||(Ou=!0,fy())}function vi(s,t){if(!Ru&&Yc){Ru=!0;do for(var a=!1,r=Qc;r!==null;){if(s!==0){var o=r.pendingLanes;if(o===0)var d=0;else{var g=r.suspendedLanes,_=r.pingedLanes;d=(1<<31-ps(42|s)+1)-1,d&=o&~(g&~_),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,ap(r,d))}else d=ys,d=Fa(r,r===qs?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(d&3)===0||Va(r,d)||(a=!0,ap(r,d));r=r.next}while(a);Ru=!1}}function hy(){ep()}function ep(){Yc=Ou=!1;var s=0;Vl!==0&&Sy()&&(s=Vl);for(var t=Is(),a=null,r=Qc;r!==null;){var o=r.next,d=sp(r,t);d===0?(r.next=null,a===null?Qc=o:a.next=o,o===null&&(vr=a)):(a=r,(s!==0||(d&3)!==0)&&(Yc=!0)),r=o}At!==0&&At!==5||vi(s),Vl!==0&&(Vl=0)}function sp(s,t){for(var a=s.suspendedLanes,r=s.pingedLanes,o=s.expirationTimes,d=s.pendingLanes&-62914561;0_)break;var he=R.transferSize,Ne=R.initiatorType;he&&up(Ne)&&(R=R.responseEnd,g+=he*(R<_?1:(_-le)/(R-le)))}if(--r,t+=8*(d+g)/(o.duration/1e3),s++,10"u"?null:document;function wp(s,t,a){var r=Nr;if(r&&typeof t=="string"&&t){var o=wa(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),yp.has(o)||(yp.add(o),s={rel:s,crossOrigin:a,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),Ht(t,"link",s),Dt(t),r.head.appendChild(t)))}}function Oy(s){jl.D(s),wp("dns-prefetch",s,null)}function Ry(s,t){jl.C(s,t),wp("preconnect",s,t)}function Ly(s,t,a){jl.L(s,t,a);var r=Nr;if(r&&s&&t){var o='link[rel="preload"][as="'+wa(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+wa(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+wa(a.imageSizes)+'"]')):o+='[href="'+wa(s)+'"]';var d=o;switch(t){case"style":d=br(s);break;case"script":d=yr(s)}Aa.has(d)||(s=v({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),Aa.set(d,s),r.querySelector(o)!==null||t==="style"&&r.querySelector(wi(d))||t==="script"&&r.querySelector(_i(d))||(t=r.createElement("link"),Ht(t,"link",s),Dt(t),r.head.appendChild(t)))}}function Uy(s,t){jl.m(s,t);var a=Nr;if(a&&s){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+wa(r)+'"][href="'+wa(s)+'"]',d=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=yr(s)}if(!Aa.has(d)&&(s=v({rel:"modulepreload",href:s},t),Aa.set(d,s),a.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(_i(d)))return}r=a.createElement("link"),Ht(r,"link",s),Dt(r),a.head.appendChild(r)}}}function By(s,t,a){jl.S(s,t,a);var r=Nr;if(r&&s){var o=Gn(r).hoistableStyles,d=br(s);t=t||"default";var g=o.get(d);if(!g){var _={loading:0,preload:null};if(g=r.querySelector(wi(d)))_.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":t},a),(a=Aa.get(d))&&Xu(s,a);var R=g=r.createElement("link");Dt(R),Ht(R,"link",s),R._p=new Promise(function(le,he){R.onload=le,R.onerror=he}),R.addEventListener("load",function(){_.loading|=1}),R.addEventListener("error",function(){_.loading|=2}),_.loading|=4,eo(g,t,r)}g={type:"stylesheet",instance:g,count:1,state:_},o.set(d,g)}}}function $y(s,t){jl.X(s,t);var a=Nr;if(a&&s){var r=Gn(a).hoistableScripts,o=yr(s),d=r.get(o);d||(d=a.querySelector(_i(o)),d||(s=v({src:s,async:!0},t),(t=Aa.get(o))&&Zu(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},r.set(o,d))}}function Iy(s,t){jl.M(s,t);var a=Nr;if(a&&s){var r=Gn(a).hoistableScripts,o=yr(s),d=r.get(o);d||(d=a.querySelector(_i(o)),d||(s=v({src:s,async:!0,type:"module"},t),(t=Aa.get(o))&&Zu(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},r.set(o,d))}}function _p(s,t,a,r){var o=(o=ee.current)?Wc(o):null;if(!o)throw Error(c(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=br(a.href),a=Gn(o).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=br(a.href);var d=Gn(o).hoistableStyles,g=d.get(s);if(g||(o=o.ownerDocument||o,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(s,g),(d=o.querySelector(wi(s)))&&!d._p&&(g.instance=d,g.state.loading=5),Aa.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},Aa.set(s,a),d||Hy(o,s,a,g.state))),t&&r===null)throw Error(c(528,""));return g}if(t&&r!==null)throw Error(c(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=yr(a),a=Gn(o).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,s))}}function br(s){return'href="'+wa(s)+'"'}function wi(s){return'link[rel="stylesheet"]['+s+"]"}function Sp(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function Hy(s,t,a,r){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=s.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Ht(t,"link",a),Dt(t),s.head.appendChild(t))}function yr(s){return'[src="'+wa(s)+'"]'}function _i(s){return"script[async]"+s}function Cp(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=s.querySelector('style[data-href~="'+wa(a.href)+'"]');if(r)return t.instance=r,Dt(r),r;var o=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(s.ownerDocument||s).createElement("style"),Dt(r),Ht(r,"style",o),eo(r,a.precedence,s),t.instance=r;case"stylesheet":o=br(a.href);var d=s.querySelector(wi(o));if(d)return t.state.loading|=4,t.instance=d,Dt(d),d;r=Sp(a),(o=Aa.get(o))&&Xu(r,o),d=(s.ownerDocument||s).createElement("link"),Dt(d);var g=d;return g._p=new Promise(function(_,R){g.onload=_,g.onerror=R}),Ht(d,"link",r),t.state.loading|=4,eo(d,a.precedence,s),t.instance=d;case"script":return d=yr(a.src),(o=s.querySelector(_i(d)))?(t.instance=o,Dt(o),o):(r=a,(o=Aa.get(d))&&(r=v({},a),Zu(r,o)),s=s.ownerDocument||s,o=s.createElement("script"),Dt(o),Ht(o,"link",r),s.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,eo(r,a.precedence,s));return t.instance}function eo(s,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,d=o,g=0;g title"):null)}function Py(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 Ep(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Gy(s,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=br(r.href),d=t.querySelector(wi(o));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=to.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=d,Dt(d);return}d=t.ownerDocument||t,r=Sp(r),(o=Aa.get(o))&&Xu(r,o),d=d.createElement("link"),Dt(d);var g=d;g._p=new Promise(function(_,R){g.onload=_,g.onerror=R}),Ht(d,"link",r),a.instance=d}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=to.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var Wu=0;function Fy(s,t){return s.stylesheets&&s.count===0&&lo(s,s.stylesheets),0Wu?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function to(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)lo(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var ao=null;function lo(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,ao=new Map,t.forEach(Vy,s),ao=null,to.call(s))}function Vy(s,t){if(!(t.state.loading&4)){var a=ao.get(s);if(a)var r=a.get(null);else{a=new Map,ao.set(s,a);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(n){console.error(n)}}return l(),dm.exports=z1(),dm.exports}var O1=D1();function $(...l){return u0(m0(l))}const Me=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:$("rounded-xl border bg-card text-card-foreground shadow",l),...n}));Me.displayName="Card";const Je=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:$("flex flex-col space-y-1.5 p-6",l),...n}));Je.displayName="CardHeader";const Xe=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:$("font-semibold leading-none tracking-tight",l),...n}));Xe.displayName="CardTitle";const Ls=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:$("text-sm text-muted-foreground",l),...n}));Ls.displayName="CardDescription";const Ke=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:$("p-6 pt-0",l),...n}));Ke.displayName="CardContent";const Bo=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:$("flex items-center p-6 pt-0",l),...n}));Bo.displayName="CardFooter";const ua=h0,ea=m.forwardRef(({className:l,...n},i)=>e.jsx(Ng,{ref:i,className:$("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",l),...n}));ea.displayName=Ng.displayName;const We=m.forwardRef(({className:l,...n},i)=>e.jsx(bg,{ref:i,className:$("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",l),...n}));We.displayName=bg.displayName;const vs=m.forwardRef(({className:l,...n},i)=>e.jsx(yg,{ref:i,className:$("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",l),...n}));vs.displayName=yg.displayName;const Ze=m.forwardRef(({className:l,children:n,viewportRef:i,...c},u)=>e.jsxs(wg,{ref:u,className:$("relative overflow-hidden",l),...c,children:[e.jsx(f0,{ref:i,className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(km,{}),e.jsx(km,{orientation:"horizontal"}),e.jsx(p0,{})]}));Ze.displayName=wg.displayName;const km=m.forwardRef(({className:l,orientation:n="vertical",...i},c)=>e.jsx(_g,{ref:c,orientation:n,className:$("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",l),...i,children:e.jsx(g0,{className:"relative flex-1 rounded-full bg-border"})}));km.displayName=_g.displayName;function Ks({className:l,...n}){return e.jsx("div",{className:$("animate-pulse rounded-md bg-primary/10",l),...n})}const On=m.forwardRef(({className:l,value:n,...i},c)=>e.jsx(Sg,{ref:c,className:$("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",l),...i,children:e.jsx(j0,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));On.displayName=Sg.displayName;async function ye(l,n){const c=n?.body instanceof FormData?{...n?.headers}:{"Content-Type":"application/json",...n?.headers},u={...n,credentials:"include",headers:c},x=await fetch(l,u);if(x.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return x}function zs(){return{"Content-Type":"application/json"}}async function R1(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(l){console.error("登出请求失败:",l)}window.location.href="/auth"}async function Pi(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const L1={light:"",dark:".dark"},Bj=m.createContext(null);function $j(){const l=m.useContext(Bj);if(!l)throw new Error("useChart must be used within a ");return l}const Cr=m.forwardRef(({id:l,className:n,children:i,config:c,...u},x)=>{const h=m.useId(),f=`chart-${l||h.replace(/:/g,"")}`;return e.jsx(Bj.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:x,className:$("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",n),...u,children:[e.jsx(U1,{id:f,config:c}),e.jsx(J0,{children:i})]})})});Cr.displayName="Chart";const U1=({id:l,config:n})=>{const i=Object.entries(n).filter(([,c])=>c.theme||c.color);return i.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(L1).map(([c,u])=>` +${u} [data-chart=${l}] { +${i.map(([x,h])=>{const f=h.theme?.[c]||h.color;return f?` --color-${x}: ${f};`:null}).join(` +`)} +} +`).join(` +`)}}):null},Ai=X0,kr=m.forwardRef(({active:l,payload:n,className:i,indicator:c="dot",hideLabel:u=!1,hideIndicator:x=!1,label:h,labelFormatter:f,labelClassName:p,formatter:j,color:N,nameKey:v,labelKey:b},w)=>{const{config:y}=$j(),L=m.useMemo(()=>{if(u||!n?.length)return null;const[k]=n,V=`${b||k?.dataKey||k?.name||"value"}`,M=Tm(y,k,V),S=!b&&typeof h=="string"?y[h]?.label||h:M?.label;return f?e.jsx("div",{className:$("font-medium",p),children:f(S,n)}):S?e.jsx("div",{className:$("font-medium",p),children:S}):null},[h,f,n,u,p,y,b]);if(!l||!n?.length)return null;const D=n.length===1&&c!=="dot";return e.jsxs("div",{ref:w,className:$("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",i),children:[D?null:L,e.jsx("div",{className:"grid gap-1.5",children:n.filter(k=>k.type!=="none").map((k,V)=>{const M=`${v||k.name||k.dataKey||"value"}`,S=Tm(y,k,M),E=N||k.payload.fill||k.color;return e.jsx("div",{className:$("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",c==="dot"&&"items-center"),children:j&&k?.value!==void 0&&k.name?j(k.value,k.name,k,V,k.payload):e.jsxs(e.Fragment,{children:[S?.icon?e.jsx(S.icon,{}):!x&&e.jsx("div",{className:$("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":c==="dot","w-1":c==="line","w-0 border-[1.5px] border-dashed bg-transparent":c==="dashed","my-0.5":D&&c==="dashed"}),style:{"--color-bg":E,"--color-border":E}}),e.jsxs("div",{className:$("flex flex-1 justify-between leading-none",D?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[D?L:null,e.jsx("span",{className:"text-muted-foreground",children:S?.label||k.name})]}),k.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});kr.displayName="ChartTooltip";const B1=Z0,Ij=m.forwardRef(({className:l,hideIcon:n=!1,payload:i,verticalAlign:c="bottom",nameKey:u},x)=>{const{config:h}=$j();return i?.length?e.jsx("div",{ref:x,className:$("flex items-center justify-center gap-4",c==="top"?"pb-3":"pt-3",l),children:i.filter(f=>f.type!=="none").map(f=>{const p=`${u||f.dataKey||"value"}`,j=Tm(h,f,p);return e.jsxs("div",{className:$("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[j?.icon&&!n?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});Ij.displayName="ChartLegend";function Tm(l,n,i){if(typeof n!="object"||n===null)return;const c="payload"in n&&typeof n.payload=="object"&&n.payload!==null?n.payload:void 0;let u=i;return i in n&&typeof n[i]=="string"?u=n[i]:c&&i in c&&typeof c[i]=="string"&&(u=c[i]),u in l?l[u]:l[i]}const Dr=Or("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),C=m.forwardRef(({className:l,variant:n,size:i,asChild:c=!1,...u},x)=>{const h=c?lw:"button";return e.jsx(h,{className:$(Dr({variant:n,size:i,className:l})),ref:x,...u})});C.displayName="Button";const $1=Or("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ke({className:l,variant:n,...i}){return e.jsx("div",{className:$($1({variant:n}),l),...i})}async function I1(){const l=await ye("/api/webui/system/restart",{method:"POST",headers:zs()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"重启失败")}return await l.json()}async function H1(){const l=await ye("/api/webui/system/status",{method:"GET",headers:zs()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取状态失败")}return await l.json()}const _r={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},Hj=m.createContext(null);function Un({children:l,onRestartComplete:n,onRestartFailed:i,healthCheckUrl:c="/api/webui/system/status",maxAttempts:u=_r.MAX_ATTEMPTS}){const[x,h]=m.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),[f,p]=m.useState({}),j=m.useCallback(()=>{f.progress&&clearInterval(f.progress),f.elapsed&&clearInterval(f.elapsed),f.check&&clearTimeout(f.check),p({})},[f]),N=m.useCallback(()=>{j(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u})},[j,u]),v=m.useCallback(async()=>{try{const D=new AbortController,k=setTimeout(()=>D.abort(),_r.CHECK_TIMEOUT),V=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:D.signal});return clearTimeout(k),V.ok}catch{return!1}},[c]),b=m.useCallback(()=>{let D=0;const k=async()=>{if(D++,h(M=>({...M,status:"checking",checkAttempts:D})),await v())j(),h(M=>({...M,status:"success",progress:100})),setTimeout(()=>{n?.(),window.location.href="/auth"},_r.SUCCESS_REDIRECT_DELAY);else if(D>=u){j();const M=`健康检查超时 (${D}/${u})`;h(S=>({...S,status:"failed",error:M})),i?.(M)}else{const M=setTimeout(k,_r.CHECK_INTERVAL);p(S=>({...S,check:M}))}};k()},[v,j,u,n,i]),w=m.useCallback(()=>{h(D=>({...D,status:"checking",checkAttempts:0,error:void 0})),b()},[b]),y=m.useCallback(async D=>{const{delay:k=0,skipApiCall:V=!1}=D??{};if(x.status!=="idle"&&x.status!=="failed")return;if(j(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),k>0&&await new Promise(E=>setTimeout(E,k)),V)h(E=>({...E,status:"restarting"}));else try{h(E=>({...E,status:"restarting"})),await Promise.race([I1(),new Promise(E=>setTimeout(E,5e3))])}catch{}const M=setInterval(()=>{h(E=>({...E,progress:E.progress>=90?E.progress:E.progress+1}))},_r.PROGRESS_INTERVAL),S=setInterval(()=>{h(E=>({...E,elapsedTime:E.elapsedTime+1}))},1e3);p({progress:M,elapsed:S}),setTimeout(()=>{b()},_r.INITIAL_DELAY)},[x.status,j,u,b]),L={state:x,isRestarting:x.status!=="idle",triggerRestart:y,resetState:N,retryHealthCheck:w};return e.jsx(Hj.Provider,{value:L,children:l})}function ln(){const l=m.useContext(Hj);if(!l)throw new Error("useRestart must be used within a RestartProvider");return l}function P1(){try{return ln()}catch{return null}}const G1=(l,n,i,c,u)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Es,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"准备重启",description:u??"正在发送重启请求...",tip:"🔄 正在准备重启麦麦..."},restarting:{icon:e.jsx(Es,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"正在重启麦麦",description:u??"请稍候,麦麦正在重启中...",tip:"🔄 配置已保存,正在重启主程序..."},checking:{icon:e.jsx(Es,{className:"h-16 w-16 text-primary animate-spin"}),title:"检查服务状态",description:`等待服务恢复... (${n}/${i})`,tip:"⏳ 正在等待服务恢复,请勿关闭页面..."},success:{icon:e.jsx(Zt,{className:"h-16 w-16 text-green-500"}),title:"重启成功",description:"正在跳转到登录页面...",tip:"✅ 配置已生效,服务运行正常"},failed:{icon:e.jsx(_t,{className:"h-16 w-16 text-destructive"}),title:"重启超时",description:"服务未能在预期时间内恢复",tip:"⚠️ 如果长时间无响应,请尝试手动重启"}})[l];function Bn({visible:l,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x=!0,className:h}){const f=P1();return(f?f.isRestarting:l)?f?e.jsx(Pj,{state:f.state,onRetry:f.retryHealthCheck,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):e.jsx(F1,{onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):null}function Pj({state:l,onRetry:n,onComplete:i,onFailed:c,title:u,description:x,showAnimation:h,className:f}){const{status:p,progress:j,elapsedTime:N,checkAttempts:v,maxAttempts:b}=l;m.useEffect(()=>{p==="success"&&i?i():p==="failed"&&c&&c()},[p,i,c]);const w=G1(p,v,b,u,x),y=L=>{const D=Math.floor(L/60),k=L%60;return`${D}:${k.toString().padStart(2,"0")}`};return e.jsxs("div",{className:$("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(V1,{}),e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8 relative z-10",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsxs("div",{className:"relative",children:[w.icon,(p==="restarting"||p==="checking")&&e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/20 animate-ping"})]}),e.jsx("h2",{className:"text-2xl font-bold",children:w.title}),e.jsx("p",{className:"text-muted-foreground text-center",children:w.description})]}),p!=="failed"&&p!=="idle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(On,{value:j,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[j,"%"]}),e.jsxs("span",{children:["已用时: ",y(N)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:w.tip})}),p==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{onClick:()=>window.location.reload(),variant:"default",className:"flex-1",children:[e.jsx(wt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(C,{onClick:n,variant:"secondary",className:"flex-1",children:[e.jsx($i,{className:"mr-2 h-4 w-4"}),"重试检测"]})]})]})]})}function F1({onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x}){const[h,f]=m.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=m.useCallback(()=>{let j=0;const N=60,v=async()=>{j++,f(b=>({...b,status:"checking",checkAttempts:j}));try{if((await fetch("/api/webui/system/status",{method:"GET",signal:AbortSignal.timeout(3e3)})).ok){f(w=>({...w,status:"success",progress:100})),setTimeout(()=>{l?.(),window.location.href="/auth"},1500);return}}catch{}j>=N?(f(b=>({...b,status:"failed"})),n?.()):setTimeout(v,2e3)};v()},[l,n]);return m.useEffect(()=>{const j=setInterval(()=>{f(b=>({...b,progress:b.progress>=90?b.progress:b.progress+1}))},200),N=setInterval(()=>{f(b=>({...b,elapsedTime:b.elapsedTime+1}))},1e3),v=setTimeout(()=>{p()},3e3);return()=>{clearInterval(j),clearInterval(N),clearTimeout(v)}},[p]),e.jsx(Pj,{state:h,onRetry:p,onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x})}function V1(){return e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsxs("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px]",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite]"}),e.jsx("div",{className:"absolute inset-8 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_0.5s]"}),e.jsx("div",{className:"absolute inset-16 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_1s]"})]}),e.jsx("div",{className:"absolute top-1/4 left-1/4 w-2 h-2 bg-primary/20 rounded-full animate-bounce"}),e.jsx("div",{className:"absolute top-3/4 right-1/4 w-3 h-3 bg-primary/15 rounded-full animate-bounce delay-150"}),e.jsx("div",{className:"absolute top-1/2 right-1/3 w-2 h-2 bg-primary/20 rounded-full animate-bounce delay-300"})]})}function q1(){return e.jsx(Un,{children:e.jsx(Q1,{})})}const K1=l=>{const n=[];for(let i=0;i{try{w(!0);const U=await x0.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");v({hitokoto:U.data.hitokoto,from:U.data.from||U.data.from_who||"未知"})}catch(U){console.error("获取一言失败:",U),v({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{w(!1)}},[]),M=m.useCallback(async()=>{try{const U=await ye("/api/webui/system/status");if(U.ok){const H=await U.json();L(H)}else L(null)}catch(U){console.error("获取机器人状态失败:",U),L(null)}},[]),S=async()=>{await D()},E=m.useCallback(async()=>{try{const U=await ye(`/api/webui/statistics/dashboard?hours=${h}`);if(U.ok){const H=await U.json();n(H)}c(!1),x(100)}catch(U){console.error("Failed to fetch dashboard data:",U),c(!1),x(100)}},[h]);if(m.useEffect(()=>{if(!i)return;x(0);const U=setTimeout(()=>x(15),200),H=setTimeout(()=>x(30),800),we=setTimeout(()=>x(45),2e3),je=setTimeout(()=>x(60),4e3),_e=setTimeout(()=>x(75),6500),X=setTimeout(()=>x(85),9e3),be=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(U),clearTimeout(H),clearTimeout(we),clearTimeout(je),clearTimeout(_e),clearTimeout(X),clearTimeout(be)}},[i]),m.useEffect(()=>{E(),V(),M()},[E,V,M]),m.useEffect(()=>{if(!p)return;const U=setInterval(()=>{E(),M()},3e4);return()=>clearInterval(U)},[p,E,M]),i||!l)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(wt,{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(On,{value:u,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u,"%"]})]})]})});const{summary:I,model_stats:A=[],hourly_data:J=[],daily_data:G=[],recent_activity:ue=[]}=l,de=I??{total_requests:0,total_cost:0,total_tokens:0,online_time:0,total_messages:0,total_replies:0,avg_response_time:0,cost_per_hour:0,tokens_per_hour:0},ve=U=>{const H=Math.floor(U/3600),we=Math.floor(U%3600/60);return`${H}小时${we}分钟`},ne=U=>{const H=U.toLocaleString("zh-CN");return U>=1e9?{display:`${(U/1e9).toFixed(2)}B`,exact:H,needsExact:!0}:U>=1e6?{display:`${(U/1e6).toFixed(2)}M`,exact:H,needsExact:!0}:U>=1e4?{display:`${(U/1e3).toFixed(1)}K`,exact:H,needsExact:!0}:U>=1e3?{display:`${(U/1e3).toFixed(2)}K`,exact:H,needsExact:!0}:{display:H,exact:H,needsExact:!1}},fe=U=>{const H=`¥${U.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return U>=1e6?{display:`¥${(U/1e6).toFixed(2)}M`,exact:H,needsExact:!0}:U>=1e4?{display:`¥${(U/1e3).toFixed(1)}K`,exact:H,needsExact:!0}:U>=1e3?{display:`¥${(U/1e3).toFixed(2)}K`,exact:H,needsExact:!0}:{display:H,exact:H,needsExact:!1}},ge=U=>new Date(U).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),z=K1(A.length),K=A.map((U,H)=>({name:U.model_name,value:U.request_count,fill:z[H]})),B={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ua,{value:h.toString(),onValueChange:U=>f(Number(U)),children:e.jsxs(ea,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(We,{value:"24",children:"24小时"}),e.jsx(We,{value:"168",children:"7天"}),e.jsx(We,{value:"720",children:"30天"})]})}),e.jsxs(C,{variant:p?"default":"outline",size:"sm",onClick:()=>j(!p),className:"gap-2",children:[e.jsx(wt,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:E,children:e.jsx(wt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[b?e.jsx(Ks,{className:"h-5 flex-1"}):N?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',N.hitokoto,'" —— ',N.from]}):null,e.jsx(C,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:V,disabled:b,children:e.jsx(wt,{className:`h-3.5 w-3.5 ${b?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Me,{className:"lg:col-span-1",children:[e.jsx(Je,{className:"pb-3",children:e.jsxs(Xe,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Qi,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(Ke,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:y?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(ke,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(Zt,{className:"h-3 w-3 mr-1"}),"运行中"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),e.jsxs(ke,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(_t,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),y&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",y.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",ve(y.uptime)]})]})]})})]}),e.jsxs(Me,{children:[e.jsx(Je,{className:"pb-3",children:e.jsxs(Xe,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Tn,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(Ke,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:S,disabled:k,className:"gap-2",children:[e.jsx($i,{className:`h-4 w-4 ${k?"animate-spin":""}`}),k?"重启中...":"重启麦麦"]}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Sr,{to:"/logs",children:[e.jsx(Ia,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Sr,{to:"/plugins",children:[e.jsx(kw,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Sr,{to:"/settings",children:[e.jsx(Ln,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(Me,{children:[e.jsxs(Je,{className:"pb-3",children:[e.jsxs(Xe,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Tw,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(Ls,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(Ke,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Sr,{to:"/survey/webui-feedback",children:[e.jsx(Ia,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Sr,{to:"/survey/maibot-feedback",children:[e.jsx(an,{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(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(Ew,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ne(de.total_requests).display,ne(de.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ne(de.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"总花费"}),e.jsx(Mw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[fe(de.total_cost).display,fe(de.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",fe(de.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:de.cost_per_hour>0?`¥${de.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Mr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ne(de.total_tokens).display,ne(de.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ne(de.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:de.tokens_per_hour>0?`${ne(de.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(Tn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[de.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(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(bl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ke,{children:e.jsxs("div",{className:"text-xl font-bold",children:[ve(de.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",de.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(an,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[ne(de.total_messages).display,ne(de.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ne(de.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",ne(de.total_replies).display,ne(de.total_replies).needsExact&&e.jsxs("span",{children:["(",ne(de.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(Aw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsx("div",{className:"text-xl font-bold",children:de.total_messages>0?`¥${(de.total_cost/de.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ua,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(ea,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(We,{value:"trends",children:"趋势"}),e.jsx(We,{value:"models",children:"模型"}),e.jsx(We,{value:"activity",children:"活动"}),e.jsx(We,{value:"daily",children:"日统计"})]}),e.jsxs(vs,{value:"trends",className:"space-y-4",children:[e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"请求趋势"}),e.jsxs(Ls,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(Ke,{children:e.jsx(Cr,{config:B,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(W0,{data:J,children:[e.jsx(xo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(ho,{dataKey:"timestamp",tickFormatter:U=>ge(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ei,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ai,{content:e.jsx(kr,{labelFormatter:U=>ge(U)})}),e.jsx(ew,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"花费趋势"}),e.jsx(Ls,{children:"API调用成本变化"})]}),e.jsx(Ke,{children:e.jsx(Cr,{config:B,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(im,{data:J,children:[e.jsx(xo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(ho,{dataKey:"timestamp",tickFormatter:U=>ge(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ei,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ai,{content:e.jsx(kr,{labelFormatter:U=>ge(U)})}),e.jsx(fo,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"Token消耗"}),e.jsx(Ls,{children:"Token使用量变化"})]}),e.jsx(Ke,{children:e.jsx(Cr,{config:B,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(im,{data:J,children:[e.jsx(xo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(ho,{dataKey:"timestamp",tickFormatter:U=>ge(U),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ei,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ai,{content:e.jsx(kr,{labelFormatter:U=>ge(U)})}),e.jsx(fo,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(vs,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"模型请求分布"}),e.jsxs(Ls,{children:["各模型使用占比 (共 ",A.length," 个模型)"]})]}),e.jsx(Ke,{children:e.jsx(Cr,{config:Object.fromEntries(A.map((U,H)=>[U.model_name,{label:U.model_name,color:z[H]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(sw,{children:[e.jsx(Ai,{content:e.jsx(kr,{})}),e.jsx(tw,{data:K,cx:"50%",cy:"50%",labelLine:!1,label:({name:U,percent:H})=>H&&H<.05?"":`${U} ${H?(H*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:K.map((U,H)=>e.jsx(aw,{fill:U.fill},`cell-${H}`))})]})})})]}),e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"模型详细统计"}),e.jsx(Ls,{children:"请求数、花费和性能"})]}),e.jsx(Ke,{children:e.jsx(Ze,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:A.map((U,H)=>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:U.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${H%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:U.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",U.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:[(U.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:[U.avg_response_time.toFixed(2),"s"]})]})]})]},H))})})})]})]})}),e.jsx(vs,{value:"activity",children:e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"最近活动"}),e.jsx(Ls,{children:"最新的API调用记录"})]}),e.jsx(Ke,{children:e.jsx(Ze,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:ue.map((U,H)=>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:U.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:U.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:ge(U.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:U.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",U.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[U.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${U.status==="success"?"text-green-600":"text-red-600"}`,children:U.status})]})]})]},H))})})})]})}),e.jsx(vs,{value:"daily",children:e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"每日统计"}),e.jsx(Ls,{children:"最近7天的数据汇总"})]}),e.jsx(Ke,{children:e.jsx(Cr,{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(im,{data:G,children:[e.jsx(xo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(ho,{dataKey:"timestamp",tickFormatter:U=>{const H=new Date(U);return`${H.getMonth()+1}/${H.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ei,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ei,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ai,{content:e.jsx(kr,{labelFormatter:U=>new Date(U).toLocaleDateString("zh-CN")})}),e.jsx(B1,{content:e.jsx(Ij,{})}),e.jsx(fo,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(fo,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(Bn,{})]})})}const Y1={theme:"system",setTheme:()=>null},Gj=m.createContext(Y1),Lm=()=>{const l=m.useContext(Gj);if(l===void 0)throw new Error("useTheme must be used within a ThemeProvider");return l},J1=(l,n,i)=>{const c=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||c){n(l);return}const u=i.clientX,x=i.clientY,h=Math.hypot(Math.max(u,innerWidth-u),Math.max(x,innerHeight-x));document.startViewTransition(()=>{n(l)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${u}px ${x}px)`,`circle(${h}px at ${u}px ${x}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Fj=m.createContext(void 0),Vj=()=>{const l=m.useContext(Fj);if(l===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return l},Ge=m.forwardRef(({className:l,...n},i)=>e.jsx(Cg,{className:$("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",l),...n,ref:i,children:e.jsx(v0,{className:$("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ge.displayName=Cg.displayName;const X1=Or("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=m.forwardRef(({className:l,...n},i)=>e.jsx(Gg,{ref:i,className:$(X1(),l),...n}));T.displayName=Gg.displayName;const oe=m.forwardRef(({className:l,type:n,...i},c)=>e.jsx("input",{type:n,className:$("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l),ref:c,...i}));oe.displayName="Input";const Z1=5,W1=5e3;let xm=0;function e2(){return xm=(xm+1)%Number.MAX_SAFE_INTEGER,xm.toString()}const hm=new Map,Zp=l=>{if(hm.has(l))return;const n=setTimeout(()=>{hm.delete(l),Ui({type:"REMOVE_TOAST",toastId:l})},W1);hm.set(l,n)},s2=(l,n)=>{switch(n.type){case"ADD_TOAST":return{...l,toasts:[n.toast,...l.toasts].slice(0,Z1)};case"UPDATE_TOAST":return{...l,toasts:l.toasts.map(i=>i.id===n.toast.id?{...i,...n.toast}:i)};case"DISMISS_TOAST":{const{toastId:i}=n;return i?Zp(i):l.toasts.forEach(c=>{Zp(c.id)}),{...l,toasts:l.toasts.map(c=>c.id===i||i===void 0?{...c,open:!1}:c)}}case"REMOVE_TOAST":return n.toastId===void 0?{...l,toasts:[]}:{...l,toasts:l.toasts.filter(i=>i.id!==n.toastId)}}},bo=[];let yo={toasts:[]};function Ui(l){yo=s2(yo,l),bo.forEach(n=>{n(yo)})}function Pt({...l}){const n=e2(),i=u=>Ui({type:"UPDATE_TOAST",toast:{...u,id:n}}),c=()=>Ui({type:"DISMISS_TOAST",toastId:n});return Ui({type:"ADD_TOAST",toast:{...l,id:n,open:!0,onOpenChange:u=>{u||c()}}}),{id:n,dismiss:c,update:i}}function Js(){const[l,n]=m.useState(yo);return m.useEffect(()=>(bo.push(n),()=>{const i=bo.indexOf(n);i>-1&&bo.splice(i,1)}),[l]),{...l,toast:Pt,dismiss:i=>Ui({type:"DISMISS_TOAST",toastId:i})}}const t2=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:l=>l.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:l=>/[A-Z]/.test(l)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:l=>/[a-z]/.test(l)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:l=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(l)}];function a2(l){const n=t2.map(c=>({id:c.id,label:c.label,description:c.description,passed:c.validate(l)}));return{isValid:n.every(c=>c.passed),rules:n}}const $o="0.12.0",Um="MaiBot Dashboard",l2=`${Um} v${$o}`,n2=(l="v")=>`${l}${$o}`,da={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"},Xa={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function pt(l){const n=qj(l),i=localStorage.getItem(n);if(i===null)return Xa[l];const c=Xa[l];if(typeof c=="boolean")return i==="true";if(typeof c=="number"){const u=parseFloat(i);return isNaN(u)?c:u}return i}function Tr(l,n){const i=qj(l);localStorage.setItem(i,String(n)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:l,value:n}}))}function r2(){return{theme:pt("theme"),accentColor:pt("accentColor"),enableAnimations:pt("enableAnimations"),enableWavesBackground:pt("enableWavesBackground"),logCacheSize:pt("logCacheSize"),logAutoScroll:pt("logAutoScroll"),logFontSize:pt("logFontSize"),logLineSpacing:pt("logLineSpacing"),dataSyncInterval:pt("dataSyncInterval"),wsReconnectInterval:pt("wsReconnectInterval"),wsMaxReconnectAttempts:pt("wsMaxReconnectAttempts")}}function i2(){const l=r2(),n=localStorage.getItem(da.COMPLETED_TOURS),i=n?JSON.parse(n):[];return{...l,completedTours:i}}function c2(l){const n=[],i=[];for(const[c,u]of Object.entries(l)){if(c==="completedTours"){Array.isArray(u)?(localStorage.setItem(da.COMPLETED_TOURS,JSON.stringify(u)),n.push("completedTours")):i.push("completedTours");continue}if(c in Xa){const x=c,h=Xa[x];if(typeof u==typeof h){if(x==="theme"&&!["light","dark","system"].includes(u)){i.push(c);continue}if(x==="logFontSize"&&!["xs","sm","base"].includes(u)){i.push(c);continue}Tr(x,u),n.push(c)}else i.push(c)}else i.push(c)}return{success:n.length>0,imported:n,skipped:i}}function o2(){for(const l of Object.keys(Xa))Tr(l,Xa[l]);localStorage.removeItem(da.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function d2(){const l=[],n=[],i=[];for(let c=0;cc.size-i.size),{used:l,items:localStorage.length,details:n}}function u2(l){if(l===0)return"0 B";const n=1024,i=["B","KB","MB"],c=Math.floor(Math.log(l)/Math.log(n));return parseFloat((l/Math.pow(n,c)).toFixed(2))+" "+i[c]}function qj(l){return{theme:da.THEME,accentColor:da.ACCENT_COLOR,enableAnimations:da.ENABLE_ANIMATIONS,enableWavesBackground:da.ENABLE_WAVES_BACKGROUND,logCacheSize:da.LOG_CACHE_SIZE,logAutoScroll:da.LOG_AUTO_SCROLL,logFontSize:da.LOG_FONT_SIZE,logLineSpacing:da.LOG_LINE_SPACING,dataSyncInterval:da.DATA_SYNC_INTERVAL,wsReconnectInterval:da.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:da.WS_MAX_RECONNECT_ATTEMPTS}[l]}const Na=m.forwardRef(({className:l,...n},i)=>e.jsxs(kg,{ref:i,className:$("relative flex w-full touch-none select-none items-center",l),...n,children:[e.jsx(N0,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(b0,{className:"absolute h-full bg-primary"})}),e.jsx(y0,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));Na.displayName=kg.displayName;class m2{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return pt("logCacheSize")}getMaxReconnectAttempts(){return pt("wsMaxReconnectAttempts")}getReconnectInterval(){return pt("wsReconnectInterval")}getWebSocketUrl(n){let i;{const c=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host;i=`${c}//${u}/ws/logs`}return n?`${i}?token=${encodeURIComponent(n)}`:i}async getWsToken(){try{const n=await ye("/api/webui/ws-token",{method:"GET",credentials:"include"});if(!n.ok)return console.error("获取 WebSocket token 失败:",n.status),null;const i=await n.json();return i.success&&i.token?i.token:null}catch(n){return console.error("获取 WebSocket token 失败:",n),null}}async connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;if(window.location.pathname==="/auth"){console.log("📡 在登录页面,跳过 WebSocket 连接");return}if(!await Pi()){console.log("📡 未登录,跳过 WebSocket 连接");return}const i=await this.getWsToken();if(!i){console.log("📡 无法获取 WebSocket token,跳过连接");return}const c=this.getWebSocketUrl(i);try{this.ws=new WebSocket(c),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=u=>{try{if(u.data==="pong")return;const x=JSON.parse(u.data);this.notifyLog(x)}catch(x){console.error("解析日志消息失败:",x)}},this.ws.onerror=u=>{console.error("❌ WebSocket 错误:",u),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(u){console.error("创建 WebSocket 连接失败:",u),this.attemptReconnect()}}attemptReconnect(){const n=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=n)return;this.reconnectAttempts+=1;const i=this.getReconnectInterval(),c=Math.min(i*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(n){return this.logCallbacks.add(n),()=>this.logCallbacks.delete(n)}onConnectionChange(n){return this.connectionCallbacks.add(n),n(this.isConnected),()=>this.connectionCallbacks.delete(n)}notifyLog(n){if(!this.logCache.some(c=>c.id===n.id)){this.logCache.push(n);const c=this.getMaxCacheSize();this.logCache.length>c&&(this.logCache=this.logCache.slice(-c)),this.logCallbacks.forEach(u=>{try{u(n)}catch(x){console.error("日志回调执行失败:",x)}})}}notifyConnection(n){this.connectionCallbacks.forEach(i=>{try{i(n)}catch(c){console.error("连接状态回调执行失败:",c)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Cn=new m2;typeof window<"u"&&setTimeout(()=>{Cn.connect()},100);const Fs=iw,Io=cw,x2=nw,Kj=m.forwardRef(({className:l,...n},i)=>e.jsx(Fg,{ref:i,className:$("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",l),...n}));Kj.displayName=Fg.displayName;const Us=m.forwardRef(({className:l,children:n,preventOutsideClose:i=!1,...c},u)=>e.jsxs(x2,{children:[e.jsx(Kj,{}),e.jsxs(Vg,{ref:u,className:$("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",l),onPointerDownOutside:i?x=>x.preventDefault():void 0,onInteractOutside:i?x=>x.preventDefault():void 0,...c,children:[n,e.jsxs(rw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Da,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Us.displayName=Vg.displayName;const Bs=({className:l,...n})=>e.jsx("div",{className:$("flex flex-col space-y-1.5 text-center sm:text-left",l),...n});Bs.displayName="DialogHeader";const it=({className:l,...n})=>e.jsx("div",{className:$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});it.displayName="DialogFooter";const $s=m.forwardRef(({className:l,...n},i)=>e.jsx(qg,{ref:i,className:$("text-lg font-semibold leading-none tracking-tight",l),...n}));$s.displayName=qg.displayName;const lt=m.forwardRef(({className:l,...n},i)=>e.jsx(Kg,{ref:i,className:$("text-sm text-muted-foreground",l),...n}));lt.displayName=Kg.displayName;const hs=_0,gt=S0,h2=w0,Qj=m.forwardRef(({className:l,...n},i)=>e.jsx(Tg,{className:$("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",l),...n,ref:i}));Qj.displayName=Tg.displayName;const is=m.forwardRef(({className:l,...n},i)=>e.jsxs(h2,{children:[e.jsx(Qj,{}),e.jsx(Eg,{ref:i,className:$("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",l),...n})]}));is.displayName=Eg.displayName;const cs=({className:l,...n})=>e.jsx("div",{className:$("flex flex-col space-y-2 text-center sm:text-left",l),...n});cs.displayName="AlertDialogHeader";const os=({className:l,...n})=>e.jsx("div",{className:$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});os.displayName="AlertDialogFooter";const ds=m.forwardRef(({className:l,...n},i)=>e.jsx(Mg,{ref:i,className:$("text-lg font-semibold",l),...n}));ds.displayName=Mg.displayName;const us=m.forwardRef(({className:l,...n},i)=>e.jsx(Ag,{ref:i,className:$("text-sm text-muted-foreground",l),...n}));us.displayName=Ag.displayName;const ms=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(zg,{ref:c,className:$(Dr({variant:n}),l),...i}));ms.displayName=zg.displayName;const xs=m.forwardRef(({className:l,...n},i)=>e.jsx(Dg,{ref:i,className:$(Dr({variant:"outline"}),"mt-2 sm:mt-0",l),...n}));xs.displayName=Dg.displayName;function f2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),e.jsxs(ua,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(ea,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(We,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(zw,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(We,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(dj,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(We,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Ln,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(We,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Gt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Ze,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(vs,{value:"appearance",className:"mt-0",children:e.jsx(p2,{})}),e.jsx(vs,{value:"security",className:"mt-0",children:e.jsx(g2,{})}),e.jsx(vs,{value:"other",className:"mt-0",children:e.jsx(j2,{})}),e.jsx(vs,{value:"about",className:"mt-0",children:e.jsx(v2,{})})]})]})]})}function eg(l){const n=document.documentElement,c={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[l];if(c)n.style.setProperty("--primary",c.hsl),c.gradient?(n.style.setProperty("--primary-gradient",c.gradient),n.classList.add("has-gradient")):(n.style.removeProperty("--primary-gradient"),n.classList.remove("has-gradient"));else if(l.startsWith("#")){const u=x=>{x=x.replace("#","");const h=parseInt(x.substring(0,2),16)/255,f=parseInt(x.substring(2,4),16)/255,p=parseInt(x.substring(4,6),16)/255,j=Math.max(h,f,p),N=Math.min(h,f,p);let v=0,b=0;const w=(j+N)/2;if(j!==N){const y=j-N;switch(b=w>.5?y/(2-j-N):y/(j+N),j){case h:v=((f-p)/y+(flocalStorage.getItem("accent-color")||"blue");m.useEffect(()=>{const j=localStorage.getItem("accent-color")||"blue";eg(j)},[]);const p=j=>{f(j),localStorage.setItem("accent-color",j),eg(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(fm,{value:"light",current:l,onChange:n,label:"浅色",description:"始终使用浅色主题"}),e.jsx(fm,{value:"dark",current:l,onChange:n,label:"深色",description:"始终使用深色主题"}),e.jsx(fm,{value:"system",current:l,onChange:n,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(za,{value:"blue",current:h,onChange:p,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(za,{value:"purple",current:h,onChange:p,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(za,{value:"green",current:h,onChange:p,label:"绿色",colorClass:"bg-green-500"}),e.jsx(za,{value:"orange",current:h,onChange:p,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(za,{value:"pink",current:h,onChange:p,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(za,{value:"red",current:h,onChange:p,label:"红色",colorClass:"bg-red-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(za,{value:"gradient-sunset",current:h,onChange:p,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(za,{value:"gradient-ocean",current:h,onChange:p,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(za,{value:"gradient-forest",current:h,onChange:p,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(za,{value:"gradient-aurora",current:h,onChange:p,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(za,{value:"gradient-fire",current:h,onChange:p,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(za,{value:"gradient-twilight",current:h,onChange:p,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:h.startsWith("#")?h:"#3b82f6",onChange:j=>p(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(oe,{type:"text",value:h,onChange:j=>p(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(T,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Ge,{id:"animations",checked:i,onCheckedChange:c})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Ge,{id:"waves-background",checked:u,onCheckedChange:x})]})})]})]})]})}function g2(){const l=sa(),[n,i]=m.useState(""),[c,u]=m.useState(""),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[j,N]=m.useState(!1),[v,b]=m.useState(!1),[w,y]=m.useState(!1),[L,D]=m.useState(!1),[k,V]=m.useState(""),[M,S]=m.useState(!1),{toast:E}=Js(),I=m.useMemo(()=>a2(c),[c]),A=async ne=>{if(!n){E({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(ne),y(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},J=async()=>{if(!c.trim()){E({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!I.isValid){const ne=I.rules.filter(fe=>!fe.passed).map(fe=>fe.label).join(", ");E({title:"格式错误",description:`Token 不符合要求: ${ne}`,variant:"destructive"});return}N(!0);try{const ne=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),fe=await ne.json();ne.ok&&fe.success?(u(""),i(c.trim()),E({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{l({to:"/auth"})},1500)):E({title:"更新失败",description:fe.message||"无法更新 Token",variant:"destructive"})}catch(ne){console.error("更新 Token 错误:",ne),E({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{N(!1)}},G=async()=>{b(!0);try{const ne=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),fe=await ne.json();ne.ok&&fe.success?(i(fe.token),V(fe.token),D(!0),S(!1),E({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):E({title:"生成失败",description:fe.message||"无法生成新 Token",variant:"destructive"})}catch(ne){console.error("生成 Token 错误:",ne),E({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{b(!1)}},ue=async()=>{try{await navigator.clipboard.writeText(k),S(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},de=()=>{D(!1),setTimeout(()=>{V(""),S(!1)},300),setTimeout(()=>{l({to:"/auth"})},500)},ve=ne=>{ne||de()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Fs,{open:L,onOpenChange:ve,children:e.jsxs(Us,{className:"sm:max-w-md",children:[e.jsxs(Bs,{children:[e.jsxs($s,{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(lt,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Jt,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"重要提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),e.jsx("li",{children:"请立即复制并保存到安全的位置"}),e.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),e.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),e.jsxs(it,{className:"gap-2 sm:gap-0",children:[e.jsx(C,{variant:"outline",onClick:ue,className:"gap-2",children:M?e.jsxs(e.Fragment,{children:[e.jsx(yt,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(_o,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(C,{onClick:de,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(oe,{id:"current-token",type:x?"text":"password",value:n||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{n?h(!x):E({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(Ii,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Wt,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(C,{variant:"outline",size:"icon",onClick:()=>A(n),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!n,children:w?e.jsx(yt,{className:"h-4 w-4 text-green-500"}):e.jsx(_o,{className:"h-4 w-4"})}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsxs(C,{variant:"outline",disabled:v,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(wt,{className:$("h-4 w-4",v&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认重新生成 Token"}),e.jsx(us,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:G,children:"确认生成"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(oe,{id:"new-token",type:f?"text":"password",value:c,onChange:ne=>u(ne.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:f?"隐藏":"显示",children:f?e.jsx(Ii,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Wt,{className:"h-4 w-4 text-muted-foreground"})})]}),c&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),e.jsx("div",{className:"space-y-1.5",children:I.rules.map(ne=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[ne.passed?e.jsx(Zt,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(uj,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:$(ne.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:ne.label})]},ne.id))}),I.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(yt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(C,{onClick:J,disabled:j||!I.isValid||!c,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 j2(){const l=sa(),{toast:n}=Js(),[i,c]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(()=>pt("logCacheSize")),[p,j]=m.useState(()=>pt("wsReconnectInterval")),[N,v]=m.useState(()=>pt("wsMaxReconnectAttempts")),[b,w]=m.useState(()=>pt("dataSyncInterval")),[y,L]=m.useState(()=>Wp()),[D,k]=m.useState(!1),[V,M]=m.useState(!1),S=m.useRef(null);if(u)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const E=()=>{L(Wp())},I=z=>{const K=z[0];f(K),Tr("logCacheSize",K)},A=z=>{const K=z[0];j(K),Tr("wsReconnectInterval",K)},J=z=>{const K=z[0];v(K),Tr("wsMaxReconnectAttempts",K)},G=z=>{const K=z[0];w(K),Tr("dataSyncInterval",K)},ue=()=>{Cn.clearLogs(),n({title:"日志已清除",description:"日志缓存已清空"})},de=()=>{const z=d2();E(),n({title:"缓存已清除",description:`已清除 ${z.clearedKeys.length} 项缓存数据`})},ve=()=>{k(!0);try{const z=i2(),K=JSON.stringify(z,null,2),B=new Blob([K],{type:"application/json"}),U=URL.createObjectURL(B),H=document.createElement("a");H.href=U,H.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(H),H.click(),document.body.removeChild(H),URL.revokeObjectURL(U),n({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(z){console.error("导出设置失败:",z),n({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{k(!1)}},ne=z=>{const K=z.target.files?.[0];if(!K)return;M(!0);const B=new FileReader;B.onload=U=>{try{const H=U.target?.result,we=JSON.parse(H),je=c2(we);je.success?(f(pt("logCacheSize")),j(pt("wsReconnectInterval")),v(pt("wsMaxReconnectAttempts")),w(pt("dataSyncInterval")),E(),n({title:"导入成功",description:`成功导入 ${je.imported.length} 项设置${je.skipped.length>0?`,跳过 ${je.skipped.length} 项`:""}`}),(je.imported.includes("theme")||je.imported.includes("accentColor"))&&n({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):n({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(H){console.error("导入设置失败:",H),n({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{M(!1),S.current&&(S.current.value="")}},B.readAsText(K)},fe=()=>{o2(),f(Xa.logCacheSize),j(Xa.wsReconnectInterval),v(Xa.wsMaxReconnectAttempts),w(Xa.dataSyncInterval),E(),n({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},ge=async()=>{c(!0);try{const z=await ye("/api/webui/setup/reset",{method:"POST"}),K=await z.json();z.ok&&K.success?(n({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{l({to:"/setup"})},1e3)):n({title:"重置失败",description:K.message||"无法重置配置状态",variant:"destructive"})}catch(z){console.error("重置配置状态错误:",z),n({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{c(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Mr,{className:"h-5 w-5"}),"性能与存储"]}),e.jsxs("div",{className:"space-y-4 sm:space-y-5",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Dw,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(C,{variant:"ghost",size:"sm",onClick:E,className:"h-7 px-2",children:e.jsx(wt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:u2(y.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[y.items," 个存储项"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(Na,{value:[h],onValueChange:I,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制日志查看器最多缓存的日志条数,较大的值会占用更多内存"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[b," 秒"]})]}),e.jsx(Na,{value:[b],onValueChange:G,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制首页统计数据的自动刷新间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[p/1e3," 秒"]})]}),e.jsx(Na,{value:[p],onValueChange:A,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"日志 WebSocket 连接断开后的重连基础间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," 次"]})]}),e.jsx(Na,{value:[N],onValueChange:J,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"连接失败后的最大重连尝试次数"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:ue,className:"gap-2",children:[e.jsx(as,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(as,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认清除本地缓存"}),e.jsx(us,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:de,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(qt,{className:"h-5 w-5"}),"导入/导出设置"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"导出当前的界面设置以便备份,或从之前导出的文件中恢复设置。"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(C,{variant:"outline",onClick:ve,disabled:D,className:"gap-2",children:[e.jsx(qt,{className:"h-4 w-4"}),D?"导出中...":"导出设置"]}),e.jsx("input",{ref:S,type:"file",accept:".json",onChange:ne,className:"hidden"}),e.jsxs(C,{variant:"outline",onClick:()=>S.current?.click(),disabled:V,className:"gap-2",children:[e.jsx(Hi,{className:"h-4 w-4"}),V?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx($i,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认重置所有设置"}),e.jsx(us,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:fe,children:"确认重置"})]})]})]})})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsxs(C,{variant:"outline",disabled:i,className:"gap-2",children:[e.jsx($i,{className:$("h-4 w-4",i&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认重新配置"}),e.jsx(us,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:ge,children:"确认重置"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Jt,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsxs(C,{variant:"destructive",className:"gap-2",children:[e.jsx(Jt,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认触发错误"}),e.jsx(us,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function v2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:$("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:["关于 ",Um]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",$o]}),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(ot,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(ot,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(ot,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(ot,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(ot,{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(ot,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(ot,{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(ot,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(ot,{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(ot,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(ot,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(ot,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(ot,{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(ot,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(ot,{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(ot,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(ot,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(ot,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(ot,{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(ot,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(ot,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(ot,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(ot,{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 ot({name:l,description:n,license:i}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:l}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:n})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:i})]})}function fm({value:l,current:n,onChange:i,label:c,description:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:$("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:c}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:u})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[l==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),l==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),l==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function za({value:l,current:n,onChange:i,label:c,colorClass:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:$("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-8 w-8 sm:h-10 sm:w-10 rounded-full",u)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:c})]})]})}const N2=Date.now()%1e6;class b2{grad3;p;perm;constructor(n=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let i=0;i<256;i++)this.p[i]=Math.floor(Math.random()*256);this.perm=[];for(let i=0;i<512;i++)this.perm[i]=this.p[i&255]}dot(n,i,c){return n[0]*i+n[1]*c}mix(n,i,c){return(1-c)*n+c*i}fade(n){return n*n*n*(n*(n*6-15)+10)}perlin2(n,i){const c=Math.floor(n)&255,u=Math.floor(i)&255;n-=Math.floor(n),i-=Math.floor(i);const x=this.fade(n),h=this.fade(i),f=this.perm[c]+u,p=this.perm[f],j=this.perm[f+1],N=this.perm[c+1]+u,v=this.perm[N],b=this.perm[N+1];return this.mix(this.mix(this.dot(this.grad3[p%12],n,i),this.dot(this.grad3[v%12],n-1,i),x),this.mix(this.dot(this.grad3[j%12],n,i-1),this.dot(this.grad3[b%12],n-1,i-1),x),h)}}function sg(){const l=m.useRef(null),n=m.useRef(null),i=m.useRef(void 0),[c]=m.useState(()=>new b2(N2)),u=m.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:c,bounding:null});return m.useEffect(()=>{const x=n.current,h=l.current;if(!x||!h)return;const f=u.current;f.noise=c;const p=()=>{const D=x.getBoundingClientRect();f.bounding=D,h.style.width=`${D.width}px`,h.style.height=`${D.height}px`},j=()=>{if(!f.bounding)return;const{width:D,height:k}=f.bounding;f.lines=[],f.paths.forEach(ue=>ue.remove()),f.paths=[];const V=10,M=32,S=D+200,E=k+30,I=Math.ceil(S/V),A=Math.ceil(E/M),J=(D-V*I)/2,G=(k-M*A)/2;for(let ue=0;ue<=I;ue++){const de=[];for(let ne=0;ne<=A;ne++){const fe={x:J+V*ue,y:G+M*ne,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};de.push(fe)}const ve=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(ve),f.paths.push(ve),f.lines.push(de)}},N=D=>{const{lines:k,mouse:V,noise:M}=f;k.forEach(S=>{S.forEach(E=>{const I=M.perlin2((E.x+D*.0125)*.002,(E.y+D*.005)*.0015)*12;E.wave.x=Math.cos(I)*32,E.wave.y=Math.sin(I)*16;const A=E.x-V.sx,J=E.y-V.sy,G=Math.hypot(A,J),ue=Math.max(175,V.vs);if(G{const V={x:D.x+D.wave.x+(k?D.cursor.x:0),y:D.y+D.wave.y+(k?D.cursor.y:0)};return V.x=Math.round(V.x*10)/10,V.y=Math.round(V.y*10)/10,V},b=()=>{const{lines:D,paths:k}=f;D.forEach((V,M)=>{let S=v(V[0],!1),E=`M ${S.x} ${S.y}`;V.forEach((I,A)=>{const J=A===V.length-1;S=v(I,!J),E+=`L ${S.x} ${S.y}`}),k[M].setAttribute("d",E)})},w=D=>{const{mouse:k}=f;k.sx+=(k.x-k.sx)*.1,k.sy+=(k.y-k.sy)*.1;const V=k.x-k.lx,M=k.y-k.ly,S=Math.hypot(V,M);k.v=S,k.vs+=(S-k.vs)*.1,k.vs=Math.min(100,k.vs),k.lx=k.x,k.ly=k.y,k.a=Math.atan2(M,V),x&&(x.style.setProperty("--x",`${k.sx}px`),x.style.setProperty("--y",`${k.sy}px`)),N(D),b(),i.current=requestAnimationFrame(w)},y=D=>{if(!f.bounding)return;const{mouse:k}=f;k.x=D.pageX-f.bounding.left,k.y=D.pageY-f.bounding.top+window.scrollY,k.set||(k.sx=k.x,k.sy=k.y,k.lx=k.x,k.ly=k.y,k.set=!0)},L=()=>{p(),j()};return p(),j(),window.addEventListener("resize",L),window.addEventListener("mousemove",y),i.current=requestAnimationFrame(w),()=>{window.removeEventListener("resize",L),window.removeEventListener("mousemove",y),i.current&&cancelAnimationFrame(i.current)}},[c]),e.jsxs("div",{ref:n,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:l,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` + path { + fill: none; + stroke: hsl(var(--primary) / 0.20); + stroke-width: 1px; + } + `})})]})}function y2(){const[l,n]=m.useState(""),[i,c]=m.useState(!1),[u,x]=m.useState(""),[h,f]=m.useState(!0),p=sa(),{enableWavesBackground:j,setEnableWavesBackground:N}=Vj(),{theme:v,setTheme:b}=Lm();m.useEffect(()=>{(async()=>{try{await Pi()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const y=v==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":v,L=()=>{b(y==="dark"?"light":"dark")},D=async k=>{if(k.preventDefault(),x(""),!l.trim()){x("请输入 Access Token");return}c(!0),console.log("开始验证 token...");try{const V=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:l.trim()})});console.log("Token 验证响应状态:",V.status);const M=await V.json();if(console.log("Token 验证响应数据:",M),V.ok&&M.valid){console.log("Token 验证成功,准备跳转..."),console.log("is_first_setup:",M.is_first_setup),await new Promise(E=>setTimeout(E,100));const S=await Pi();console.log("跳转前认证状态检查:",S),M.is_first_setup?(console.log("跳转到首次配置页面"),p({to:"/setup"})):(console.log("跳转到首页"),p({to:"/"}))}else console.error("Token 验证失败:",M.message),x(M.message||"Token 验证失败,请检查后重试")}catch(V){console.error("Token 验证错误:",V),x("连接服务器失败,请检查网络连接")}finally{c(!1)}};return h?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[j&&e.jsx(sg,{}),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(sg,{}),e.jsxs(Me,{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:y==="dark"?"切换到浅色模式":"切换到深色模式",children:y==="dark"?e.jsx(mj,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(xj,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(Je,{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(Gp,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Xe,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(Ls,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(Ke,{children:e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(zm,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(oe,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:l,onChange:k=>n(k.target.value),className:$("pl-10",u&&"border-red-500 focus-visible:ring-red-500"),disabled:i,autoFocus:!0,autoComplete:"off"})]})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(_t,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:u})]}),e.jsx(C,{type:"submit",className:"w-full",disabled:i,children:i?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),e.jsxs(Fs,{children:[e.jsx(Io,{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(hj,{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($s,{className:"flex items-center gap-2",children:[e.jsx(Gp,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(lt,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ow,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),e.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),e.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ia,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),e.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:e.jsx("code",{className:"text-primary",children:"data/webui.json"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",e.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_t,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"安全提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),e.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),e.jsxs(hs,{children:[e.jsx(gt,{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(Tn,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsxs(ds,{className:"flex items-center gap-2",children:[e.jsx(Tn,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(us,{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(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>N(!1),children:"关闭动画"})]})]})]})]})})]}),e.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:e.jsx("p",{children:l2})})]})}const Zs=m.forwardRef(({className:l,...n},i)=>e.jsx("textarea",{className:$("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l),ref:i,...n}));Zs.displayName="Textarea";const Ur=m.forwardRef(({className:l,orientation:n="horizontal",decorative:i=!0,...c},u)=>e.jsx(Og,{ref:u,decorative:i,orientation:n,className:$("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",l),...c}));Ur.displayName=Og.displayName;function w2({config:l,onChange:n}){const i=u=>{u.trim()&&!l.alias_names.includes(u.trim())&&n({...l,alias_names:[...l.alias_names,u.trim()]})},c=u=>{n({...l,alias_names:l.alias_names.filter((x,h)=>h!==u)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(oe,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:l.qq_account||"",onChange:u=>n({...l,qq_account:Number(u.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(oe,{id:"nickname",placeholder:"请输入机器人的昵称",value:l.nickname,onChange:u=>n({...l,nickname:u.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:l.alias_names.map((u,x)=>e.jsxs(ke,{variant:"secondary",className:"gap-1",children:[u,e.jsx("button",{type:"button",onClick:()=>c(x),className:"ml-1 hover:text-destructive",children:e.jsx(Da,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:u=>{u.key==="Enter"&&(i(u.target.value),u.target.value="")}}),e.jsx(C,{type:"button",variant:"outline",onClick:()=>{const u=document.getElementById("alias_input");u&&(i(u.value),u.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function _2({config:l,onChange:n}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(Zs,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:l.personality,onChange:i=>n({...l,personality:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(Zs,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:l.reply_style,onChange:i=>n({...l,reply_style:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(Zs,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:l.interest,onChange:i=>n({...l,interest:i.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(Ur,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(Zs,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:l.plan_style,onChange:i=>n({...l,plan_style:i.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(Zs,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:l.private_plan_style,onChange:i=>n({...l,private_plan_style:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function S2({config:l,onChange:n}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(l.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(oe,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:l.emoji_chance,onChange:i=>n({...l,emoji_chance:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(oe,{id:"max_reg_num",type:"number",min:"1",max:"200",value:l.max_reg_num,onChange:i=>n({...l,max_reg_num:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Ge,{id:"do_replace",checked:l.do_replace,onCheckedChange:i=>n({...l,do_replace:i})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(oe,{id:"check_interval",type:"number",min:"1",max:"120",value:l.check_interval,onChange:i=>n({...l,check_interval:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(Ur,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Ge,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:i=>n({...l,steal_emoji:i})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Ge,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:i=>n({...l,content_filtration:i})})]}),l.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(oe,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:l.filtration_prompt,onChange:i=>n({...l,filtration_prompt:i.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function C2({config:l,onChange:n}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Ge,{id:"enable_tool",checked:l.enable_tool,onCheckedChange:i=>n({...l,enable_tool:i})})]}),e.jsx(Ur,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Ge,{id:"all_global",checked:l.all_global,onCheckedChange:i=>n({...l,all_global:i})})]})]})}function k2({config:l,onChange:n}){const[i,c]=m.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(vo,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(oe,{id:"siliconflow_api_key",type:i?"text":"password",placeholder:"sk-...",value:l.api_key,onChange:u=>n({api_key:u.target.value}),className:"font-mono pr-10"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>c(!i),children:i?e.jsx(Ii,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Wt,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[e.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),e.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),e.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),e.jsx("li",{children:"SenseVoice - 语音识别"}),e.jsx("li",{children:"BGE-M3 - 文本嵌入"}),e.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),e.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:e.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function T2(){const l=await ye("/api/webui/config/bot",{method:"GET",headers:zs()});if(!l.ok)throw new Error("读取Bot配置失败");const i=(await l.json()).config.bot||{};return{qq_account:i.qq_account||0,nickname:i.nickname||"",alias_names:i.alias_names||[]}}async function E2(){const l=await ye("/api/webui/config/bot",{method:"GET",headers:zs()});if(!l.ok)throw new Error("读取人格配置失败");const i=(await l.json()).config.personality||{};return{personality:i.personality||"",reply_style:i.reply_style||"",interest:i.interest||"",plan_style:i.plan_style||"",private_plan_style:i.private_plan_style||""}}async function M2(){const l=await ye("/api/webui/config/bot",{method:"GET",headers:zs()});if(!l.ok)throw new Error("读取表情包配置失败");const i=(await l.json()).config.emoji||{};return{emoji_chance:i.emoji_chance??.4,max_reg_num:i.max_reg_num??40,do_replace:i.do_replace??!0,check_interval:i.check_interval??10,steal_emoji:i.steal_emoji??!0,content_filtration:i.content_filtration??!1,filtration_prompt:i.filtration_prompt||""}}async function A2(){const l=await ye("/api/webui/config/bot",{method:"GET",headers:zs()});if(!l.ok)throw new Error("读取其他配置失败");const i=(await l.json()).config,c=i.tool||{},u=i.expression||{};return{enable_tool:c.enable_tool??!0,all_global:u.all_global_jargon??!0}}async function z2(){const l=await ye("/api/webui/config/model",{method:"GET",headers:zs()});if(!l.ok)throw new Error("读取模型配置失败");return{api_key:((await l.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function D2(l){const n=await ye("/api/webui/config/bot/section/bot",{method:"POST",headers:zs(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存Bot基础配置失败")}return await n.json()}async function O2(l){const n=await ye("/api/webui/config/bot/section/personality",{method:"POST",headers:zs(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存人格配置失败")}return await n.json()}async function R2(l){const n=await ye("/api/webui/config/bot/section/emoji",{method:"POST",headers:zs(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存表情包配置失败")}return await n.json()}async function L2(l){const n=[];n.push(ye("/api/webui/config/bot/section/tool",{method:"POST",headers:zs(),body:JSON.stringify({enable_tool:l.enable_tool})})),n.push(ye("/api/webui/config/bot/section/expression",{method:"POST",headers:zs(),body:JSON.stringify({all_global_jargon:l.all_global})}));const i=await Promise.all(n);for(const c of i)if(!c.ok){const u=await c.json();throw new Error(u.detail||"保存其他配置失败")}return{success:!0}}async function U2(l){const n=await ye("/api/webui/config/model",{method:"GET",headers:zs()});if(!n.ok)throw new Error("读取模型配置失败");const c=(await n.json()).config,u=c.api_providers||[],x=u.findIndex(p=>p.name==="SiliconFlow");x>=0?u[x]={...u[x],api_key:l.api_key}:u.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:l.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...c,api_providers:u},f=await ye("/api/webui/config/model",{method:"POST",headers:zs(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"保存模型配置失败")}return await f.json()}async function tg(){const l=await ye("/api/webui/setup/complete",{method:"POST"});if(!l.ok){const n=await l.json();throw new Error(n.message||"标记配置完成失败")}return await l.json()}function B2(){return e.jsx(Un,{children:e.jsx($2,{})})}function $2(){const l=sa(),{toast:n}=Js(),{triggerRestart:i}=ln(),[c,u]=m.useState(0),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[j,N]=m.useState(!0),[v,b]=m.useState({qq_account:0,nickname:"",alias_names:[]}),[w,y]=m.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.请控制你的发言频率,不要太过频繁的发言 +4.如果有人对你感到厌烦,请减少回复 +5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.某句话如果已经被回复过,不要重复回复`}),[L,D]=m.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[k,V]=m.useState({enable_tool:!0,all_global:!0}),[M,S]=m.useState({api_key:""}),E=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Di},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:En},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Dm},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Ln},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:zm}],I=(c+1)/E.length*100;m.useEffect(()=>{(async()=>{try{N(!0);const[fe,ge,z,K,B]=await Promise.all([T2(),E2(),M2(),A2(),z2()]);b(fe),y(ge),D(z),V(K),S(B)}catch(fe){n({title:"加载配置失败",description:fe instanceof Error?fe.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{N(!1)}})()},[n]);const A=async()=>{p(!0);try{switch(c){case 0:await D2(v);break;case 1:await O2(w);break;case 2:await R2(L);break;case 3:await L2(k);break;case 4:await U2(M);break}return n({title:"保存成功",description:`${E[c].title}配置已保存`}),!0}catch(ne){return n({title:"保存失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},J=async()=>{await A()&&c{c>0&&u(c-1)},ue=async()=>{h(!0);try{if(!await A()){h(!1);return}await tg(),n({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),await i()}catch(ne){n({title:"配置失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}finally{h(!1)}},de=async()=>{try{await tg(),l({to:"/"})}catch(ne){n({title:"跳过失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},ve=()=>{switch(c){case 0:return e.jsx(w2,{config:v,onChange:b});case 1:return e.jsx(_2,{config:w,onChange:y});case 2:return e.jsx(S2,{config:L,onChange:D});case 3:return e.jsx(C2,{config:k,onChange:V});case 4:return e.jsx(k2,{config:M,onChange:S});default:return null}};return e.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[e.jsx(Bn,{}),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"})]}),j?e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:e.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),e.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[e.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(Rw,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),e.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",Um," 的初始配置"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",c+1," / ",E.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(I),"%"]})]}),e.jsx(On,{value:I,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:E.map((ne,fe)=>{const ge=ne.icon;return e.jsxs("div",{className:$("flex flex-1 flex-col items-center gap-1 md:gap-2",fel({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Lo,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(C,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Ha,{className:"h-4 w-4"}),"返回上一页"]})]}),e.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}const I2=Ss.memo(function({config:n,onChange:i}){const c=n.platforms||[],u=n.alias_names||[],x=()=>{i({...n,platforms:[...c,""]})},h=v=>{i({...n,platforms:c.filter((b,w)=>w!==v)})},f=(v,b)=>{const w=[...c];w[v]=b,i({...n,platforms:w})},p=()=>{i({...n,alias_names:[...u,""]})},j=v=>{i({...n,alias_names:u.filter((b,w)=>w!==v)})},N=(v,b)=>{const w=[...u];w[v]=b,i({...n,alias_names:w})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"platform",children:"平台"}),e.jsx(oe,{id:"platform",value:n.platform,onChange:v=>i({...n,platform:v.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(oe,{id:"qq_account",value:n.qq_account,onChange:v=>i({...n,qq_account:v.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(oe,{id:"nickname",value:n.nickname,onChange:v=>i({...n,nickname:v.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"其他平台账号"}),e.jsxs(C,{onClick:x,size:"sm",variant:"outline",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map((v,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{value:v,onChange:w=>f(b,w.target.value),placeholder:"wx:114514"}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:['确定要删除平台账号 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>h(b),children:"删除"})]})]})]})]},b)),c.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"别名"}),e.jsxs(C,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[u.map((v,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{value:v,onChange:w=>N(b,w.target.value),placeholder:"小麦"}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:['确定要删除别名 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>j(b),children:"删除"})]})]})]})]},b)),u.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}),H2=Ss.memo(function({config:n,onChange:i}){const c=()=>{i({...n,states:[...n.states,""]})},u=h=>{i({...n,states:n.states.filter((f,p)=>p!==h)})},x=(h,f)=>{const p=[...n.states];p[h]=f,i({...n,states:p})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"personality",children:"人格特质"}),e.jsx(Zs,{id:"personality",value:n.personality,onChange:h=>i({...n,personality:h.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(Zs,{id:"reply_style",value:n.reply_style,onChange:h=>i({...n,reply_style:h.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"interest",children:"兴趣"}),e.jsx(Zs,{id:"interest",value:n.interest,onChange:h=>i({...n,interest:h.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(Zs,{id:"plan_style",value:n.plan_style,onChange:h=>i({...n,plan_style:h.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(Zs,{id:"visual_style",value:n.visual_style,onChange:h=>i({...n,visual_style:h.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(Zs,{id:"private_plan_style",value:n.private_plan_style,onChange:h=>i({...n,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"状态列表(人格多样性)"}),e.jsxs(C,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),e.jsx("div",{className:"space-y-2",children:n.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Zs,{value:h,onChange:p=>x(f,p.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsx(us,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>u(f),children:"删除"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"state_probability",children:"状态替换概率"}),e.jsx(oe,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:n.state_probability,onChange:h=>i({...n,state_probability:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}),Ue=hw,Be=fw,Oe=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(Qg,{ref:c,className:$("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",l),...i,children:[n,e.jsx(ow,{asChild:!0,children:e.jsx(Oa,{className:"h-4 w-4 opacity-50"})})]}));Oe.displayName=Qg.displayName;const Jj=m.forwardRef(({className:l,...n},i)=>e.jsx(Yg,{ref:i,className:$("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Ar,{className:"h-4 w-4"})}));Jj.displayName=Yg.displayName;const Xj=m.forwardRef(({className:l,...n},i)=>e.jsx(Jg,{ref:i,className:$("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Oa,{className:"h-4 w-4"})}));Xj.displayName=Jg.displayName;const Re=m.forwardRef(({className:l,children:n,position:i="popper",...c},u)=>e.jsx(dw,{children:e.jsxs(Xg,{ref:u,className:$("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",i==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",l),position:i,...c,children:[e.jsx(Jj,{}),e.jsx(uw,{className:$("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(Xj,{})]})}));Re.displayName=Xg.displayName;const P2=m.forwardRef(({className:l,...n},i)=>e.jsx(Zg,{ref:i,className:$("px-2 py-1.5 text-sm font-semibold",l),...n}));P2.displayName=Zg.displayName;const re=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(Wg,{ref:c,className:$("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),...i,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(mw,{children:e.jsx(yt,{className:"h-4 w-4"})})}),e.jsx(xw,{children:n})]}));re.displayName=Wg.displayName;const G2=m.forwardRef(({className:l,...n},i)=>e.jsx(ej,{ref:i,className:$("-mx-1 my-1 h-px bg-muted",l),...n}));G2.displayName=ej.displayName;const Za=k0,Wa=T0,Pa=m.forwardRef(({className:l,align:n="center",sideOffset:i=4,...c},u)=>e.jsx(C0,{children:e.jsx(Rg,{ref:u,align:n,sideOffset:i,className:$("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",l),...c})}));Pa.displayName=Rg.displayName;const F2=Ss.memo(function({value:n,onChange:i}){const c=m.useMemo(()=>{const w=n.split("-");if(w.length===2){const[y,L]=w,[D,k]=y.split(":"),[V,M]=L.split(":");return{startHour:D?D.padStart(2,"0"):"00",startMinute:k?k.padStart(2,"0"):"00",endHour:V?V.padStart(2,"0"):"23",endMinute:M?M.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[n]),[u,x]=m.useState(c.startHour),[h,f]=m.useState(c.startMinute),[p,j]=m.useState(c.endHour),[N,v]=m.useState(c.endMinute);m.useEffect(()=>{x(c.startHour),f(c.startMinute),j(c.endHour),v(c.endMinute)},[c]);const b=(w,y,L,D)=>{const k=`${w}:${y}-${L}:${D}`;i(k)};return e.jsxs(Za,{children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(bl,{className:"h-4 w-4 mr-2"}),n||"选择时间段"]})}),e.jsx(Pa,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"小时"}),e.jsxs(Ue,{value:u,onValueChange:w=>{x(w),b(w,h,p,N)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:24},(w,y)=>y).map(w=>e.jsx(re,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Ue,{value:h,onValueChange:w=>{f(w),b(u,w,p,N)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:60},(w,y)=>y).map(w=>e.jsx(re,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"小时"}),e.jsxs(Ue,{value:p,onValueChange:w=>{j(w),b(u,h,w,N)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:24},(w,y)=>y).map(w=>e.jsx(re,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Ue,{value:N,onValueChange:w=>{v(w),b(u,h,p,w)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:Array.from({length:60},(w,y)=>y).map(w=>e.jsx(re,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]})]})})]})}),V2=Ss.memo(function({rule:n}){const i=`{ target = "${n.target}", time = "${n.time}", value = ${n.value.toFixed(1)} }`;return e.jsxs(Za,{children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Wt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Pa,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:i}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),q2=Ss.memo(function({config:n,onChange:i}){const c=()=>{i({...n,talk_value_rules:[...n.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},u=h=>{i({...n,talk_value_rules:n.talk_value_rules.filter((f,p)=>p!==h)})},x=(h,f,p)=>{const j=[...n.talk_value_rules];j[h]={...j[h],[f]:p},i({...n,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(T,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(oe,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:n.talk_value,onChange:h=>i({...n,talk_value:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"mentioned_bot_reply",checked:n.mentioned_bot_reply,onCheckedChange:h=>i({...n,mentioned_bot_reply:h})}),e.jsx(T,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(oe,{id:"max_context_size",type:"number",min:"1",value:n.max_context_size,onChange:h=>i({...n,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(oe,{id:"planner_smooth",type:"number",step:"1",min:"0",value:n.planner_smooth,onChange:h=>i({...n,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_talk_value_rules",checked:n.enable_talk_value_rules,onCheckedChange:h=>i({...n,enable_talk_value_rules:h})}),e.jsx(T,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"include_planner_reasoning",checked:n.include_planner_reasoning,onCheckedChange:h=>i({...n,include_planner_reasoning:h})}),e.jsx(T,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),n.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),e.jsxs(C,{onClick:c,size:"sm",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),n.talk_value_rules&&n.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:n.talk_value_rules.map((h,f)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",f+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V2,{rule:h}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"sm",children:e.jsx(as,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:["确定要删除规则 #",f+1," 吗?此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>u(f),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Ue,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?x(f,"target",""):x(f,"target","qq::group")},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"global",children:"全局配置"}),e.jsx(re,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),j=p[0]||"qq",N=p[1]||"",v=p[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ue,{value:j,onValueChange:b=>{x(f,"target",`${b}:${N}:${v}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"qq",children:"QQ"}),e.jsx(re,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(oe,{value:N,onChange:b=>{x(f,"target",`${j}:${b.target.value}:${v}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ue,{value:v,onValueChange:b=>{x(f,"target",`${j}:${N}:${b}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"group",children:"群组(group)"}),e.jsx(re,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",h.target||"(未设置)"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(F2,{value:h.time,onChange:p=>x(f,"time",p)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:`rule-value-${f}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(oe,{id:`rule-value-${f}`,type:"number",step:"0.01",min:"0.01",max:"1",value:h.value,onChange:p=>{const j=parseFloat(p.target.value);isNaN(j)||x(f,"value",Math.max(.01,Math.min(1,j)))},className:"w-20 h-8 text-xs"})]}),e.jsx(Na,{value:[h.value],onValueChange:p=>x(f,"value",p[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (极少发言)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (正常)"})]})]})]})]},f))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}),K2=Ss.memo(function({config:n,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:n.enable_asr,onCheckedChange:c=>i({...n,enable_asr:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}),Q2=Ss.memo(function({config:n,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:n.enable,onCheckedChange:c=>i({...n,enable:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),n.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"LPMM 模式"}),e.jsxs(Ue,{value:n.lpmm_mode,onValueChange:c=>i({...n,lpmm_mode:c}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"classic",children:"经典模式"}),e.jsx(re,{value:"agent",children:"Agent 模式"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词搜索 TopK"}),e.jsx(oe,{type:"number",min:"1",value:n.rag_synonym_search_top_k,onChange:c=>i({...n,rag_synonym_search_top_k:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词阈值"}),e.jsx(oe,{type:"number",step:"0.1",min:"0",max:"1",value:n.rag_synonym_threshold,onChange:c=>i({...n,rag_synonym_threshold:parseFloat(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"实体提取线程数"}),e.jsx(oe,{type:"number",min:"1",value:n.info_extraction_workers,onChange:c=>i({...n,info_extraction_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入向量维度"}),e.jsx(oe,{type:"number",min:"1",value:n.embedding_dimension,onChange:c=>i({...n,embedding_dimension:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入并发线程数"}),e.jsx(oe,{type:"number",min:"1",value:n.max_embedding_workers,onChange:c=>i({...n,max_embedding_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"每批嵌入条数"}),e.jsx(oe,{type:"number",min:"1",value:n.embedding_chunk_size,onChange:c=>i({...n,embedding_chunk_size:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义实体数上限"}),e.jsx(oe,{type:"number",min:"1",value:n.max_synonym_entities,onChange:c=>i({...n,max_synonym_entities:parseInt(c.target.value)})})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:n.enable_ppr,onCheckedChange:c=>i({...n,enable_ppr:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 PPR (低配机器可关闭)"})]})]})]})]})}),Y2=Ss.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.useState("WARNING"),f=()=>{c&&!n.suppress_libraries.includes(c)&&(i({...n,suppress_libraries:[...n.suppress_libraries,c]}),u(""))},p=y=>{i({...n,suppress_libraries:n.suppress_libraries.filter(L=>L!==y)})},j=()=>{c&&!n.library_log_levels[c]&&(i({...n,library_log_levels:{...n.library_log_levels,[c]:x}}),u(""),h("WARNING"))},N=y=>{const L={...n.library_log_levels};delete L[y],i({...n,library_log_levels:L})},v=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],b=["FULL","compact","lite"],w=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日期格式"}),e.jsx(oe,{value:n.date_style,onChange:y=>i({...n,date_style:y.target.value}),placeholder:"例如: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志级别样式"}),e.jsxs(Ue,{value:n.log_level_style,onValueChange:y=>i({...n,log_level_style:y}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:b.map(y=>e.jsx(re,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志文本颜色"}),e.jsxs(Ue,{value:n.color_text,onValueChange:y=>i({...n,color_text:y}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:w.map(y=>e.jsx(re,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"全局日志级别"}),e.jsxs(Ue,{value:n.log_level,onValueChange:y=>i({...n,log_level:y}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:v.map(y=>e.jsx(re,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"控制台日志级别"}),e.jsxs(Ue,{value:n.console_log_level,onValueChange:y=>i({...n,console_log_level:y}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:v.map(y=>e.jsx(re,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"文件日志级别"}),e.jsxs(Ue,{value:n.file_log_level,onValueChange:y=>i({...n,file_log_level:y}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsx(Re,{children:v.map(y=>e.jsx(re,{value:y,children:y},y))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(oe,{value:c,onChange:y=>u(y.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),f())}}),e.jsx(C,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(tt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:n.suppress_libraries.map(y=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:y}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>p(y),children:e.jsx(as,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},y))})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(oe,{value:c,onChange:y=>u(y.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Ue,{value:x,onValueChange:h,children:[e.jsx(Oe,{className:"w-32",children:e.jsx(Be,{})}),e.jsx(Re,{children:v.map(y=>e.jsx(re,{value:y,children:y},y))})]}),e.jsx(C,{onClick:j,size:"sm",children:e.jsx(tt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(n.library_log_levels).map(([y,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:y}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:L}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(y),children:e.jsx(as,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},y))})]})]})}),J2=Ss.memo(function({config:n,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Ge,{checked:n.show_prompt,onCheckedChange:c=>i({...n,show_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Ge,{checked:n.show_replyer_prompt,onCheckedChange:c=>i({...n,show_replyer_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Ge,{checked:n.show_replyer_reasoning,onCheckedChange:c=>i({...n,show_replyer_reasoning:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Ge,{checked:n.show_jargon_prompt,onCheckedChange:c=>i({...n,show_jargon_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Ge,{checked:n.show_memory_prompt,onCheckedChange:c=>i({...n,show_memory_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Ge,{checked:n.show_planner_prompt,onCheckedChange:c=>i({...n,show_planner_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Ge,{checked:n.show_lpmm_paragraph,onCheckedChange:c=>i({...n,show_lpmm_paragraph:c})})]})]})]})}),X2=Ss.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.useState(""),f=()=>{c&&!n.auth_token.includes(c)&&(i({...n,auth_token:[...n.auth_token,c]}),u(""))},p=v=>{i({...n,auth_token:n.auth_token.filter((b,w)=>w!==v)})},j=()=>{x&&!n.api_server_allowed_api_keys.includes(x)&&(i({...n,api_server_allowed_api_keys:[...n.api_server_allowed_api_keys,x]}),h(""))},N=v=>{i({...n,api_server_allowed_api_keys:n.api_server_allowed_api_keys.filter((b,w)=>w!==v)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"旧版 API 认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"用于旧版 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(oe,{value:c,onChange:v=>u(v.target.value),placeholder:"输入认证令牌",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),f())}}),e.jsx(C,{onClick:f,size:"sm",children:e.jsx(tt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:n.auth_token.map((v,b)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:v}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>p(b),children:e.jsx(as,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"新版 API Server 配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"启用新版 API Server"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否启用额外的新版 API Server(额外监听端口)"})]}),e.jsx(Ge,{checked:n.enable_api_server,onCheckedChange:v=>i({...n,enable_api_server:v})})]}),n.enable_api_server&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"主机地址"}),e.jsx(oe,{value:n.api_server_host,onChange:v=>i({...n,api_server_host:v.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"端口号"}),e.jsx(oe,{type:"number",value:n.api_server_port,onChange:v=>i({...n,api_server_port:parseInt(v.target.value)}),placeholder:"8090"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:n.api_server_use_wss,onCheckedChange:v=>i({...n,api_server_use_wss:v})}),e.jsx(T,{children:"启用 WSS 安全连接"})]}),n.api_server_use_wss&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL 证书文件路径"}),e.jsx(oe,{value:n.api_server_cert_file,onChange:v=>i({...n,api_server_cert_file:v.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL 密钥文件路径"}),e.jsx(oe,{value:n.api_server_key_file,onChange:v=>i({...n,api_server_key_file:v.target.value}),placeholder:"key.pem"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"允许的 API Key 列表"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"为空则允许所有连接"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(oe,{value:x,onChange:v=>h(v.target.value),placeholder:"输入 API Key",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),j())}}),e.jsx(C,{onClick:j,size:"sm",children:e.jsx(tt,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:n.api_server_allowed_api_keys.map((v,b)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:v}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(b),children:e.jsx(as,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]})]})]})]})]})}),Z2=Ss.memo(function({config:n,onChange:i}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Ge,{checked:n.enable,onCheckedChange:c=>i({...n,enable:c})})]})]})}),W2=Ss.memo(function({emojiConfig:n,memoryConfig:i,toolConfig:c,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(Ge,{id:"enable_tool",checked:c.enable_tool,onCheckedChange:f=>h({...c,enable_tool:f})}),e.jsx(T,{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(T,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(oe,{id:"max_agent_iterations",type:"number",min:"1",value:i.max_agent_iterations,onChange:f=>x({...i,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(T,{htmlFor:"agent_timeout_seconds",children:"最长回忆时间(秒)"}),e.jsx(oe,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:i.agent_timeout_seconds??120,onChange:f=>x({...i,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(Ge,{id:"enable_jargon_detection",checked:i.enable_jargon_detection??!0,onCheckedChange:f=>x({...i,enable_jargon_detection:f})}),e.jsx(T,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"启用黑话识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"记忆检索过程中是否启用黑话识别"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"global_memory",checked:i.global_memory??!1,onCheckedChange:f=>x({...i,global_memory:f})}),e.jsx(T,{htmlFor:"global_memory",className:"cursor-pointer",children:"全局记忆查询"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许记忆检索在所有聊天记录中进行全局查询(忽略当前聊天流)"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(oe,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:n.emoji_chance,onChange:f=>u({...n,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(T,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(oe,{id:"max_reg_num",type:"number",min:"1",value:n.max_reg_num,onChange:f=>u({...n,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(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(oe,{id:"check_interval",type:"number",min:"1",value:n.check_interval,onChange:f=>u({...n,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(Ge,{id:"do_replace",checked:n.do_replace,onCheckedChange:f=>u({...n,do_replace:f})}),e.jsx(T,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"steal_emoji",checked:n.steal_emoji,onCheckedChange:f=>u({...n,steal_emoji:f})}),e.jsx(T,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"content_filtration",checked:n.content_filtration,onCheckedChange:f=>u({...n,content_filtration:f})}),e.jsx(T,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),n.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(oe,{id:"filtration_prompt",value:n.filtration_prompt,onChange:f=>u({...n,filtration_prompt:f.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),e_=Ss.memo(function({member:n,groupIndex:i,memberIndex:c,availableChatIds:u,onUpdate:x,onRemove:h}){const f=u.includes(n)||n==="*",[p,j]=m.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(oe,{value:n,onChange:N=>x(i,c,N.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),u.length>0&&e.jsx(C,{size:"sm",variant:"outline",onClick:()=>j(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ue,{value:n,onValueChange:N=>x(i,c,N),children:[e.jsx(Oe,{className:"flex-1",children:e.jsx(Be,{placeholder:"选择聊天流"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"*",children:"* (全局共享)"}),u.map((N,v)=>e.jsx(re,{value:N,children:N},v))]})]}),e.jsx(C,{size:"sm",variant:"outline",onClick:()=>j(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:['确定要删除组成员 "',n||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>h(i,c),children:"删除"})]})]})]})]})}),s_=Ss.memo(function({config:n,onChange:i}){const c=()=>{i({...n,learning_list:[...n.learning_list,["","enable","enable","1.0"]]})},u=b=>{i({...n,learning_list:n.learning_list.filter((w,y)=>y!==b)})},x=(b,w,y)=>{const L=[...n.learning_list];L[b][w]=y,i({...n,learning_list:L})},h=({rule:b})=>{const w=`["${b[0]}", "${b[1]}", "${b[2]}", "${b[3]}"]`;return e.jsxs(Za,{children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Wt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Pa,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},f=()=>{i({...n,expression_groups:[...n.expression_groups,[]]})},p=b=>{i({...n,expression_groups:n.expression_groups.filter((w,y)=>y!==b)})},j=b=>{const w=[...n.expression_groups];w[b]=[...w[b],""],i({...n,expression_groups:w})},N=(b,w)=>{const y=[...n.expression_groups];y[b]=y[b].filter((L,D)=>D!==w),i({...n,expression_groups:y})},v=(b,w,y)=>{const L=[...n.expression_groups];L[b][w]=y,i({...n,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(C,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[n.learning_list.map((b,w)=>{const y=n.learning_list.some((S,E)=>E!==w&&S[0]===""),L=b[0]==="",D=b[0].split(":"),k=D[0]||"qq",V=D[1]||"",M=D[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["规则 ",w+1," ",L&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:b}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:["确定要删除学习规则 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>u(w),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Ue,{value:L?"global":"specific",onValueChange:S=>{S==="global"?x(w,0,""):x(w,0,"qq::group")},disabled:y&&!L,children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"global",children:"全局配置"}),e.jsx(re,{value:"specific",disabled:y&&!L,children:"详细配置"})]})]}),y&&!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(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ue,{value:k,onValueChange:S=>{x(w,0,`${S}:${V}:${M}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"qq",children:"QQ"}),e.jsx(re,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(oe,{value:V,onChange:S=>{x(w,0,`${k}:${S.target.value}:${M}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ue,{value:M,onValueChange:S=>{x(w,0,`${k}:${V}:${S}`)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"group",children:"群组(group)"}),e.jsx(re,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",b[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Ge,{checked:b[1]==="enable",onCheckedChange:S=>x(w,1,S?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Ge,{checked:b[2]==="enable",onCheckedChange:S=>x(w,2,S?"enable":"disable")})]})}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs font-medium",children:"学习强度"}),e.jsx(oe,{type:"number",step:"0.1",min:"0",max:"5",value:b[3],onChange:S=>{const E=parseFloat(S.target.value);isNaN(E)||x(w,3,Math.max(0,Math.min(5,E)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),e.jsx(Na,{value:[parseFloat(b[3])||1],onValueChange:S=>x(w,3,S[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0 (不学习)"}),e.jsx("span",{children:"2.5"}),e.jsx("span",{children:"5.0 (快速学习)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},w)}),n.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达反思配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦主动向管理员询问表达方式是否合适的功能"})]}),e.jsx(Ge,{checked:n.reflect,onCheckedChange:b=>i({...n,reflect:b})})]}),n.reflect&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const w=(n.reflect_operator_id||"").split(":"),y=w[0]||"qq",L=w[1]||"",D=w[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ue,{value:y,onValueChange:k=>{i({...n,reflect_operator_id:`${k}:${L}:${D}`})},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"qq",children:"QQ"}),e.jsx(re,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(oe,{value:L,onChange:k=>{i({...n,reflect_operator_id:`${y}:${k.target.value}:${D}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ue,{value:D,onValueChange:k=>{i({...n,reflect_operator_id:`${y}:${L}:${k}`})},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"private",children:"私聊(private)"}),e.jsx(re,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",n.reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会向此操作员询问表达方式是否合适"})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思"})]}),e.jsxs(C,{onClick:()=>{i({...n,allow_reflect:[...n.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(n.allow_reflect||[]).map((b,w)=>{const y=b.split(":"),L=y[0]||"qq",D=y[1]||"",k=y[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Ue,{value:L,onValueChange:V=>{const M=[...n.allow_reflect];M[w]=`${V}:${D}:${k}`,i({...n,allow_reflect:M})},children:[e.jsx(Oe,{className:"w-24",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"qq",children:"QQ"}),e.jsx(re,{value:"wx",children:"微信"})]})]}),e.jsx(oe,{value:D,onChange:V=>{const M=[...n.allow_reflect];M[w]=`${L}:${V.target.value}:${k}`,i({...n,allow_reflect:M})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Ue,{value:k,onValueChange:V=>{const M=[...n.allow_reflect];M[w]=`${L}:${D}:${V}`,i({...n,allow_reflect:M})},children:[e.jsx(Oe,{className:"w-32",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"group",children:"群组"}),e.jsx(re,{value:"private",children:"私聊"})]})]}),e.jsx(C,{onClick:()=>{i({...n,allow_reflect:n.allow_reflect.filter((V,M)=>M!==w)})},size:"sm",variant:"ghost",children:e.jsx(as,{className:"h-4 w-4"})})]},w)}),(!n.allow_reflect||n.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"列表为空,所有聊天流都可以进行表达反思"})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),e.jsxs(C,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[n.expression_groups.map((b,w)=>{const y=n.learning_list.map(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:["共享组 ",w+1,b.length===1&&b[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(C,{onClick:()=>j(w),size:"sm",variant:"outline",children:e.jsx(tt,{className:"h-4 w-4"})}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:["确定要删除共享组 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>p(w),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:b.map((L,D)=>e.jsx(e_,{member:L,groupIndex:w,memberIndex:D,availableChatIds:y,onUpdate:v,onRemove:N},`${w}-${D}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},w)}),n.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"黑话设置"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"all_global_jargon",checked:n.all_global_jargon??!1,onCheckedChange:b=>i({...n,all_global_jargon:b})}),e.jsx(T,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"全局黑话模式"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"开启后,新增的黑话将默认设为全局(所有聊天流共享)。关闭后,已记录的全局黑话不会改变,需要手动删除。"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_jargon_explanation",checked:n.enable_jargon_explanation??!0,onCheckedChange:b=>i({...n,enable_jargon_explanation:b})}),e.jsx(T,{htmlFor:"enable_jargon_explanation",className:"cursor-pointer",children:"启用黑话解释"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"在回复前尝试对上下文中的黑话进行解释。关闭可减少一次LLM调用,仅影响回复前的黑话匹配与解释,不影响黑话学习。"})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"jargon_mode",children:"黑话解释来源模式"}),e.jsxs(Ue,{value:n.jargon_mode??"context",onValueChange:b=>i({...n,jargon_mode:b}),children:[e.jsx(Oe,{id:"jargon_mode",className:"mt-2",children:e.jsx(Be,{placeholder:"选择黑话解释来源"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"context",children:"上下文模式(自动匹配黑话)"}),e.jsx(re,{value:"planner",children:"Planner模式(使用unknown_words列表)"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["上下文模式:使用上下文自动匹配黑话并解释",e.jsx("br",{}),"Planner模式:仅使用Planner在reply动作中给出的unknown_words列表进行黑话检索"]})]})]})]})});function t_({regex:l,reaction:n,onRegexChange:i,onReactionChange:c}){const[u,x]=m.useState(!1),[h,f]=m.useState(""),[p,j]=m.useState(null),[N,v]=m.useState(""),[b,w]=m.useState({}),[y,L]=m.useState(""),D=m.useRef(null),[k,V]=m.useState("build"),M=A=>A.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),S=(A,J=0)=>{const G=D.current;if(!G)return;const ue=G.selectionStart||0,de=G.selectionEnd||0,ve=l.substring(0,ue)+A+l.substring(de);i(ve),setTimeout(()=>{const ne=ue+A.length+J;G.setSelectionRange(ne,ne),G.focus()},0)};m.useEffect(()=>{if(!l||!h){p!==null&&j(null),Object.keys(b).length>0&&w({}),y!==n&&L(n),N!==""&&v("");return}try{const A=M(l),J=new RegExp(A,"g"),G=h.match(J);j(G),v("");const de=new RegExp(A).exec(h);if(de&&de.groups){w(de.groups);let ve=n;Object.entries(de.groups).forEach(([ne,fe])=>{ve=ve.replace(new RegExp(`\\[${ne}\\]`,"g"),fe||"")}),L(ve)}else w({}),L(n)}catch(A){v(A.message),j(null),w({}),L(n)}},[l,h,n,p,b,y,N]);const E=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const A=M(l),J=new RegExp(A,"g");let G=0;const ue=[];let de;for(;(de=J.exec(h))!==null;)de.index>G&&ue.push(e.jsx("span",{children:h.substring(G,de.index)},`text-${G}`)),ue.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:de[0]},`match-${de.index}`)),G=de.index+de[0].length;return G)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return e.jsxs(Fs,{open:u,onOpenChange:x,children:[e.jsx(Io,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Om,{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($s,{children:"正则表达式编辑器"}),e.jsx(lt,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Ze,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ua,{value:k,onValueChange:A=>V(A),className:"w-full",children:[e.jsxs(ea,{className:"grid w-full grid-cols-2",children:[e.jsx(We,{value:"build",children:"🔧 构建器"}),e.jsx(We,{value:"test",children:"🧪 测试器"})]}),e.jsxs(vs,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(oe,{ref:D,value:l,onChange:A=>i(A.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(Zs,{value:n,onChange:A=>c(A.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[I.map(A=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:A.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:A.items.map(J=>e.jsx(C,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>S(J.pattern,J.moveCursor||0),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("span",{className:"text-xs font-medium",children:J.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:J.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:J.desc})]})},J.label))})]},A.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>i("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(C,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>i("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(C,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>i("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(vs,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:l||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(Zs,{id:"test-text",value:h,onChange:A=>f(A.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),N&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:N})]}),!N&&h&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:p&&p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",p.length," 处)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(Ze,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:E()})})]}),Object.keys(b).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Ze,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(b).map(([A,J])=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",A,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:J})]},A))})})]}),Object.keys(b).length>0&&n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(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:y})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const a_=Ss.memo(function({keywordReactionConfig:n,responsePostProcessConfig:i,chineseTypoConfig:c,responseSplitterConfig:u,onKeywordReactionChange:x,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:p}){const j=()=>{x({...n,regex_rules:[...n.regex_rules,{regex:[""],reaction:""}]})},N=S=>{x({...n,regex_rules:n.regex_rules.filter((E,I)=>I!==S)})},v=(S,E,I)=>{const A=[...n.regex_rules];E==="regex"&&typeof I=="string"?A[S]={...A[S],regex:[I]}:E==="reaction"&&typeof I=="string"&&(A[S]={...A[S],reaction:I}),x({...n,regex_rules:A})},b=()=>{x({...n,keyword_rules:[...n.keyword_rules,{keywords:[],reaction:""}]})},w=S=>{x({...n,keyword_rules:n.keyword_rules.filter((E,I)=>I!==S)})},y=(S,E,I)=>{const A=[...n.keyword_rules];typeof I=="string"&&(A[S]={...A[S],reaction:I}),x({...n,keyword_rules:A})},L=S=>{const E=[...n.keyword_rules];E[S]={...E[S],keywords:[...E[S].keywords||[],""]},x({...n,keyword_rules:E})},D=(S,E)=>{const I=[...n.keyword_rules];I[S]={...I[S],keywords:(I[S].keywords||[]).filter((A,J)=>J!==E)},x({...n,keyword_rules:I})},k=(S,E,I)=>{const A=[...n.keyword_rules],J=[...A[S].keywords||[]];J[E]=I,A[S]={...A[S],keywords:J},x({...n,keyword_rules:A})},V=({rule:S})=>{const E=`{ regex = [${(S.regex||[]).map(I=>`"${I}"`).join(", ")}], reaction = "${S.reaction}" }`;return e.jsxs(Za,{children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Wt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Pa,{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})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},M=({rule:S})=>{const E=`[[keyword_reaction.keyword_rules]] +keywords = [${(S.keywords||[]).map(I=>`"${I}"`).join(", ")}] +reaction = "${S.reaction}"`;return e.jsxs(Za,{children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Wt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Pa,{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})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),e.jsxs(C,{onClick:j,size:"sm",variant:"outline",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.regex_rules.map((S,E)=>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:["正则规则 ",E+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t_,{regex:S.regex&&S.regex[0]||"",reaction:S.reaction,onRegexChange:I=>v(E,"regex",I),onReactionChange:I=>v(E,"reaction",I)}),e.jsx(V,{rule:S}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:["确定要删除正则规则 ",E+1," 吗?此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>N(E),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(oe,{value:S.regex&&S.regex[0]||"",onChange:I=>v(E,"regex",I.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Zs,{value:S.reaction,onChange:I=>v(E,"reaction",I.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},E)),n.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(C,{onClick:b,size:"sm",variant:"outline",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.keyword_rules.map((S,E)=>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:["关键词规则 ",E+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{rule:S}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:["确定要删除关键词规则 ",E+1," 吗?此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>w(E),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(C,{onClick:()=>L(E),size:"sm",variant:"ghost",children:[e.jsx(tt,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(S.keywords||[]).map((I,A)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{value:I,onChange:J=>k(E,A,J.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(C,{onClick:()=>D(E,A),size:"sm",variant:"ghost",children:e.jsx(as,{className:"h-4 w-4"})})]},A)),(!S.keywords||S.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Zs,{value:S.reaction,onChange:I=>y(E,"reaction",I.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},E)),n.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_response_post_process",checked:i.enable_response_post_process,onCheckedChange:S=>h({...i,enable_response_post_process:S})}),e.jsx(T,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),i.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_chinese_typo",checked:c.enable,onCheckedChange:S=>f({...c,enable:S})}),e.jsx(T,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),c.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(oe,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.error_rate,onChange:S=>f({...c,error_rate:parseFloat(S.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(oe,{id:"min_freq",type:"number",min:"0",value:c.min_freq,onChange:S=>f({...c,min_freq:parseInt(S.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(oe,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:c.tone_error_rate,onChange:S=>f({...c,tone_error_rate:parseFloat(S.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(oe,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.word_replace_rate,onChange:S=>f({...c,word_replace_rate:parseFloat(S.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_response_splitter",checked:u.enable,onCheckedChange:S=>p({...u,enable:S})}),e.jsx(T,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),u.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(oe,{id:"max_length",type:"number",min:"1",value:u.max_length,onChange:S=>p({...u,max_length:parseInt(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(oe,{id:"max_sentence_num",type:"number",min:"1",value:u.max_sentence_num,onChange:S=>p({...u,max_sentence_num:parseInt(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_kaomoji_protection",checked:u.enable_kaomoji_protection,onCheckedChange:S=>p({...u,enable_kaomoji_protection:S})}),e.jsx(T,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_overflow_return_all",checked:u.enable_overflow_return_all,onCheckedChange:S=>p({...u,enable_overflow_return_all:S})}),e.jsx(T,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),l_=Ss.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.useState(""),[f,p]=m.useState(!1),j=n.allowed_ips?n.allowed_ips.split(",").map(k=>k.trim()).filter(k=>k):[],N=n.trusted_proxies?n.trusted_proxies.split(",").map(k=>k.trim()).filter(k=>k):[],v=()=>{if(!c.trim())return;const k=[...j,c.trim()];i({...n,allowed_ips:k.join(",")}),u("")},b=k=>{const V=j.filter((M,S)=>S!==k);i({...n,allowed_ips:V.join(",")})},w=()=>{if(!x.trim())return;const k=[...N,x.trim()];i({...n,trusted_proxies:k.join(",")}),h("")},y=k=>{const V=N.filter((M,S)=>S!==k);i({...n,trusted_proxies:V.join(",")})},L=k=>{!k&&n.enabled?p(!0):i({...n,enabled:k})},D=()=>{i({...n,enabled:!1}),p(!1)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"WebUI 服务配置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:n.enabled,onCheckedChange:L}),e.jsx(T,{className:"cursor-pointer",children:"启用 WebUI"})]}),n.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"运行模式"}),e.jsxs(Ue,{value:n.mode,onValueChange:k=>i({...n,mode:k}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择运行模式"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"development",children:"开发模式"}),e.jsx(re,{value:"production",children:"生产模式"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"监听地址"}),e.jsx(oe,{value:n.host,onChange:k=>i({...n,host:k.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"端口号"}),e.jsx(oe,{type:"number",value:n.port,onChange:k=>i({...n,port:parseInt(k.target.value)}),placeholder:"8001"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"防爬虫模式"}),e.jsxs(Ue,{value:n.anti_crawler_mode,onValueChange:k=>i({...n,anti_crawler_mode:k}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择防爬虫模式"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"false",children:"禁用"}),e.jsx(re,{value:"basic",children:"基础(只记录不阻止)"}),e.jsx(re,{value:"loose",children:"宽松"}),e.jsx(re,{value:"strict",children:"严格"})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"IP 白名单"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{value:c,onChange:k=>u(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),v())},placeholder:"输入IP地址后按回车或点击添加"}),e.jsx(C,{type:"button",size:"sm",onClick:v,disabled:!c.trim(),children:e.jsx(tt,{className:"h-4 w-4"})})]}),j.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:j.map((k,V)=>e.jsxs(ke,{variant:"secondary",className:"flex items-center gap-1",children:[k,e.jsx("button",{type:"button",onClick:()=>b(V),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Da,{className:"h-3 w-3"})})]},V))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持精确IP、CIDR格式和通配符(如:127.0.0.1、192.168.1.0/24)"})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"信任的代理 IP"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{value:x,onChange:k=>h(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),w())},placeholder:"输入代理IP后按回车或点击添加"}),e.jsx(C,{type:"button",size:"sm",onClick:w,disabled:!x.trim(),children:e.jsx(tt,{className:"h-4 w-4"})})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.map((k,V)=>e.jsxs(ke,{variant:"secondary",className:"flex items-center gap-1",children:[k,e.jsx("button",{type:"button",onClick:()=>y(V),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Da,{className:"h-3 w-3"})})]},V))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有来自这些IP的X-Forwarded-For头才被信任"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:n.trust_xff,onCheckedChange:k=>i({...n,trust_xff:k})}),e.jsx(T,{className:"cursor-pointer",children:"启用 X-Forwarded-For 代理解析"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:n.secure_cookie,onCheckedChange:k=>i({...n,secure_cookie:k})}),e.jsx(T,{className:"cursor-pointer",children:"启用安全 Cookie(仅 HTTPS)"})]})]})]}),e.jsx(hs,{open:f,onOpenChange:p,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"警告:即将关闭 WebUI"}),e.jsxs(us,{children:["关闭 WebUI 后,在您下次重启麦麦之前,WebUI 界面将无法访问。",e.jsx("br",{}),e.jsx("br",{}),"您需要通过修改配置文件或命令行重新启用 WebUI 才能再次访问此界面。",e.jsx("br",{}),e.jsx("br",{}),"确定要关闭 WebUI 吗?"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{variant:"destructive",onClick:D,children:"确认关闭"})]})]})})]})}),nn="/api/webui/config";async function ag(){const n=await(await ye(`${nn}/bot`)).json();if(!n.success)throw new Error("获取配置数据失败");return n.config}async function Wl(){const n=await(await ye(`${nn}/model`)).json();if(!n.success)throw new Error("获取模型配置数据失败");return n.config}async function lg(l){const i=await(await ye(`${nn}/bot`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function n_(){const n=await(await ye(`${nn}/bot/raw`)).json();if(!n.success)throw new Error("获取配置源代码失败");return n.content}async function r_(l){const i=await(await ye(`${nn}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:l})})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function Bi(l){const i=await(await ye(`${nn}/model`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function i_(l,n){const c=await(await ye(`${nn}/bot/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function Em(l,n){const c=await(await ye(`${nn}/model/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function c_(l,n="openai",i="/models"){const c=new URLSearchParams({provider_name:l,parser:n,endpoint:i}),u=await ye(`/api/webui/models/list?${c}`);if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.detail||`获取模型列表失败 (${u.status})`)}const x=await u.json();if(!x.success)throw new Error("获取模型列表失败");return x.models}async function o_(l){const n=new URLSearchParams({provider_name:l}),i=await ye(`/api/webui/models/test-connection-by-name?${n}`,{method:"POST"});if(!i.ok){const c=await i.json().catch(()=>({}));throw new Error(c.detail||`测试连接失败 (${i.status})`)}return await i.json()}const d_=Or("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"}}),dt=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx("div",{ref:c,role:"alert",className:$(d_({variant:n}),l),...i}));dt.displayName="Alert";const kn=m.forwardRef(({className:l,...n},i)=>e.jsx("h5",{ref:i,className:$("mb-1 font-medium leading-none tracking-tight",l),...n}));kn.displayName="AlertTitle";const ut=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:$("text-sm [&_p]:leading-relaxed",l),...n}));ut.displayName="AlertDescription";const u_={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(l,n){let i;if(!n.inString&&(i=l.match(/^('''|"""|'|")/))&&(n.stringType=i[0],n.inString=!0),l.sol()&&!n.inString&&n.inArray===0&&(n.lhs=!0),n.inString){for(;n.inString;)if(l.match(n.stringType))n.inString=!1;else if(l.peek()==="\\")l.next(),l.next();else{if(l.eol())break;l.match(/^.[^\\\"\']*/)}return n.lhs?"property":"string"}else{if(n.inArray&&l.peek()==="]")return l.next(),n.inArray--,"bracket";if(n.lhs&&l.peek()==="["&&l.skipTo("]"))return l.next(),l.peek()==="]"&&l.next(),"atom";if(l.peek()==="#")return l.skipToEnd(),"comment";if(l.eatSpace())return null;if(n.lhs&&l.eatWhile(function(c){return c!="="&&c!=" "}))return"property";if(n.lhs&&l.peek()==="=")return l.next(),n.lhs=!1,null;if(!n.lhs&&l.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!n.lhs&&(l.match("true")||l.match("false")))return"atom";if(!n.lhs&&l.peek()==="[")return n.inArray++,l.next(),"bracket";if(!n.lhs&&l.match(/^\-?\d+(?:\.\d+)?/))return"number";l.eatSpace()||l.next()}return null},languageData:{commentTokens:{line:"#"}}},m_={python:[r1()],json:[i1(),c1()],toml:[n1.define(u_)],text:[]};function Zj({value:l,onChange:n,language:i="text",readOnly:c=!1,height:u="400px",minHeight:x,maxHeight:h,placeholder:f,theme:p="dark",className:j=""}){const[N,v]=m.useState(!1);if(m.useEffect(()=>{v(!0)},[]),!N)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${j}`,style:{height:u,minHeight:x,maxHeight:h}});const b=[...m_[i]||[],Kp.lineWrapping];return c&&b.push(Kp.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${j}`,children:e.jsx(o1,{value:l,height:u,minHeight:x,maxHeight:h,theme:p==="dark"?d1:void 0,extensions:b,onChange:n,placeholder:f,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function x_({id:l,index:n,itemType:i,itemFields:c,value:u,onChange:x,onRemove:h,disabled:f,canRemove:p,placeholder:j}){const{attributes:N,listeners:v,setNodeRef:b,transform:w,transition:y,isDragging:L}=Rj({id:l,disabled:f}),D={transform:Lj.Transform.toString(w),transition:y};return e.jsxs("div",{ref:b,style:D,className:$("flex items-start gap-2 group",L&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:$("flex-shrink-0 p-2 cursor-grab active:cursor-grabbing","text-muted-foreground hover:text-foreground transition-colors","opacity-0 group-hover:opacity-100 focus:opacity-100",f&&"cursor-not-allowed opacity-30"),...N,...v,children:e.jsx(fj,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:i==="object"&&c?e.jsx(h_,{value:u,onChange:x,fields:c,disabled:f}):i==="number"?e.jsx(oe,{type:"number",value:u??"",onChange:k=>x(parseFloat(k.target.value)||0),placeholder:j??`第 ${n+1} 项`,disabled:f,className:"font-mono"}):e.jsx(oe,{type:"text",value:u??"",onChange:k=>x(k.target.value),placeholder:j??`第 ${n+1} 项`,disabled:f})}),e.jsx(C,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:$("flex-shrink-0 text-muted-foreground hover:text-destructive","opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity"),children:e.jsx(as,{className:"h-4 w-4"})})]})}function h_({value:l,onChange:n,fields:i,disabled:c}){const u=m.useCallback((h,f)=>{n({...l,[h]:f})},[l,n]),x=(h,f)=>{const p=l?.[h];if(f.type==="boolean"||f.type==="switch")return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(Ge,{checked:!!(p??f.default),onCheckedChange:j=>u(h,j),disabled:c})]});if(f.type==="slider"||f.type==="number"&&f.min!=null&&f.max!=null){const j=p??f.default??f.min??0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx("span",{className:"text-xs text-muted-foreground",children:j})]}),e.jsx(Na,{value:[j],onValueChange:N=>u(h,N[0]),min:f.min??0,max:f.max??100,step:f.step??1,disabled:c,className:"py-1"})]})}return f.type==="select"&&f.choices?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsxs(Ue,{value:String(p??f.default??""),onValueChange:j=>u(h,j),disabled:c,children:[e.jsx(Oe,{className:"h-8 text-sm",children:e.jsx(Be,{placeholder:f.placeholder??"请选择"})}),e.jsx(Re,{children:f.choices.map(j=>e.jsx(re,{value:String(j),children:String(j)},String(j)))})]})]}):f.type==="number"?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(oe,{type:"number",value:p??f.default??"",onChange:j=>u(h,parseFloat(j.target.value)||0),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(oe,{type:"text",value:p??f.default??"",onChange:j=>u(h,j.target.value),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]})};return e.jsx(Me,{className:"p-3 space-y-2 bg-muted/30",children:Object.entries(i).map(([h,f])=>e.jsx("div",{children:x(h,f)},h))})}function f_({value:l,onChange:n,itemType:i="string",itemFields:c,minItems:u,maxItems:x,disabled:h,placeholder:f}){const p=m.useMemo(()=>Array.isArray(l)?l:typeof l=="string"&&l.trim()?l.split(",").map(M=>M.trim()):[],[l]),[j]=m.useState(()=>new Map),N=m.useCallback(M=>(j.has(M)||j.set(M,`item-${Date.now()}-${M}-${Math.random().toString(36).slice(2)}`),j.get(M)),[j]),v=m.useMemo(()=>{const M=[];for(let S=0;S{const{active:S,over:E}=M;if(E&&S.id!==E.id){const I=v.indexOf(S.id),A=v.indexOf(E.id),J=Aj(p,I,A);n(J)}},[p,v,n]),y=m.useCallback(()=>{if(x!=null&&p.length>=x)return;let M;i==="object"&&c?M=Object.fromEntries(Object.entries(c).map(([S,E])=>[S,E.default??""])):i==="number"?M=0:M="",n([...p,M])},[p,x,i,c,n]),L=m.useCallback((M,S)=>{const E=[...p];E[M]=S,n(E)},[p,n]),D=m.useCallback(M=>{if(u!=null&&p.length<=u)return;const S=p.filter((E,I)=>I!==M);j.delete(M),n(S)},[p,u,j,n]),k=x==null||p.lengthu;return e.jsxs("div",{className:"space-y-2",children:[p.length===0?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-4 justify-center border border-dashed rounded-md",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(zj,{sensors:b,collisionDetection:Dj,onDragEnd:w,children:e.jsx(Oj,{items:v,strategy:u1,children:e.jsx("div",{className:"space-y-2",children:p.map((M,S)=>e.jsx(x_,{id:v[S],index:S,itemType:i,itemFields:c,value:M,onChange:E=>L(S,E),onRemove:()=>D(S),disabled:h,canRemove:V,placeholder:f},v[S]))})})}),e.jsxs(C,{type:"button",variant:"outline",size:"sm",onClick:y,disabled:h||!k,className:"w-full",children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加项目",x!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",p.length,"/",x,")"]})]}),(u!=null||x!=null)&&(u!==null||x!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:u!=null&&x!=null?`允许 ${u} - ${x} 项`:u!=null?`至少 ${u} 项`:`最多 ${x} 项`})]})}function Bm({content:l,className:n=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${n}`,children:e.jsx(g1,{remarkPlugins:[v1,N1],rehypePlugins:[j1],components:{code({inline:i,className:c,children:u,...x}){return i?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...x,children:u}):e.jsx("code",{className:`${c} block bg-muted p-4 rounded-lg overflow-x-auto`,...x,children:u})},table({children:i,...c}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...c,children:i})})},th({children:i,...c}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...c,children:i})},td({children:i,...c}){return e.jsx("td",{className:"border border-border px-4 py-2",...c,children:i})},a({children:i,...c}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...c,children:i})},blockquote({children:i,...c}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...c,children:i})},h1({children:i,...c}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...c,children:i})},h2({children:i,...c}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...c,children:i})},h3({children:i,...c}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...c,children:i})},h4({children:i,...c}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...c,children:i})},ul({children:i,...c}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...c,children:i})},ol({children:i,...c}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...c,children:i})},p({children:i,...c}){return e.jsx("p",{className:"my-2 leading-relaxed",...c,children:i})},hr({...i}){return e.jsx("hr",{className:"my-4 border-border",...i})}},children:l})})}function p_(l,n,i,c={}){const{debounceMs:u=2e3,onSaveSuccess:x,onSaveError:h}=c,f=m.useRef(null),p=m.useCallback(async(b,w)=>{try{n(!0),await i_(b,w),i(!1),x?.()}catch(y){console.error(`自动保存 ${b} 失败:`,y),i(!0),h?.(y instanceof Error?y:new Error(String(y)))}finally{n(!1)}},[n,i,x,h]),j=m.useCallback((b,w)=>{l||(i(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(b,w)},u))},[l,i,p,u]),N=m.useCallback(async(b,w)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(b,w)},[p]),v=m.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return m.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:j,saveNow:N,cancelPendingAutoSave:v}}function Rt(l,n,i,c){m.useEffect(()=>{l&&!i&&c(n,l)},[l])}const g_=500;function j_(){return e.jsx(Un,{children:e.jsx(v_,{})})}function v_(){const[l,n]=m.useState(!0),[i,c]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[p,j]=m.useState("visual"),[N,v]=m.useState(""),[b,w]=m.useState(!1),{toast:y}=Js(),{triggerRestart:L,isRestarting:D}=ln(),[k,V]=m.useState(null),[M,S]=m.useState(null),[E,I]=m.useState(null),[A,J]=m.useState(null),[G,ue]=m.useState(null),[de,ve]=m.useState(null),[ne,fe]=m.useState(null),[ge,z]=m.useState(null),[K,B]=m.useState(null),[U,H]=m.useState(null),[we,je]=m.useState(null),[_e,X]=m.useState(null),[be,ee]=m.useState(null),[xe,Ce]=m.useState(null),[Z,se]=m.useState(null),[De,q]=m.useState(null),[te,Ae]=m.useState(null),[Te,Ie]=m.useState(null),ie=m.useRef(!0),Ee=m.useRef({}),Vs=m.useCallback(Se=>{Ee.current=Se,V(Se.bot),S(Se.personality);const ns=Se.chat;ns.talk_value_rules||(ns.talk_value_rules=[]),I(ns),J(Se.expression),ue(Se.emoji),ve(Se.memory),fe(Se.tool),z(Se.voice),B(Se.lpmm_knowledge),H(Se.keyword_reaction),je(Se.response_post_process),X(Se.chinese_typo),ee(Se.response_splitter),Ce(Se.log),se(Se.debug),q(Se.maim_message),Ae(Se.telemetry),Ie(Se.webui)},[]),Vt=m.useCallback(()=>({...Ee.current,bot:k,personality:M,chat:E,expression:A,emoji:G,memory:de,tool:ne,voice:ge,lpmm_knowledge:K,keyword_reaction:U,response_post_process:we,chinese_typo:_e,response_splitter:be,log:xe,debug:Z,maim_message:De,telemetry:te,webui:Te}),[k,M,E,A,G,de,ne,ge,K,U,we,_e,be,xe,Z,De,te,Te]),Kt=m.useCallback(async()=>{try{const ns=(await n_()).replace(/"([^"]*)"/g,(Cs,Ms)=>`"${Ms.replace(/\\n/g,` +`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);v(ns),w(!1)}catch(Se){y({variant:"destructive",title:"加载失败",description:Se instanceof Error?Se.message:"加载源代码失败"})}},[y]),Qt=m.useCallback(async()=>{try{n(!0);const Se=await ag();Vs(Se),f(!1),ie.current=!1,await Kt()}catch(Se){console.error("加载配置失败:",Se),y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{n(!1)}},[y,Kt,Vs]);m.useEffect(()=>{Qt()},[Qt]);const{triggerAutoSave:fs,cancelPendingAutoSave:Is}=p_(ie.current,x,f);Rt(k,"bot",ie.current,fs),Rt(M,"personality",ie.current,fs),Rt(E,"chat",ie.current,fs),Rt(A,"expression",ie.current,fs),Rt(G,"emoji",ie.current,fs),Rt(de,"memory",ie.current,fs),Rt(ne,"tool",ie.current,fs),Rt(ge,"voice",ie.current,fs),Rt(K,"lpmm_knowledge",ie.current,fs),Rt(U,"keyword_reaction",ie.current,fs),Rt(we,"response_post_process",ie.current,fs),Rt(_e,"chinese_typo",ie.current,fs),Rt(be,"response_splitter",ie.current,fs),Rt(xe,"log",ie.current,fs),Rt(Z,"debug",ie.current,fs),Rt(De,"maim_message",ie.current,fs),Rt(te,"telemetry",ie.current,fs),Rt(Te,"webui",ie.current,fs);const Y=async()=>{try{c(!0);const Se=N.replace(/"([^"]*)"/g,(ns,Cs)=>`"${Cs.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await r_(Se),f(!1),w(!1),y({title:"保存成功",description:"配置已保存"}),await Qt()}catch(Se){w(!0),y({variant:"destructive",title:"保存失败",description:Se instanceof Error?Se.message:"保存配置失败"})}finally{c(!1)}},Fe=async Se=>{if(h){y({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(j(Se),Se==="source")await Kt();else try{const ns=await ag();Vs(ns),f(!1)}catch(ns){console.error("加载配置失败:",ns),y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},He=async()=>{try{c(!0),Is(),await lg(Vt()),f(!1),y({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Se){console.error("保存配置失败:",Se),y({title:"保存失败",description:Se.message,variant:"destructive"})}finally{c(!1)}},qe=async()=>{await L()},Ds=async()=>{try{c(!0),Is(),await lg(Vt()),f(!1),y({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Se=>setTimeout(Se,g_)),await qe()}catch(Se){console.error("保存失败:",Se),y({title:"保存失败",description:Se.message,variant:"destructive"})}finally{c(!1)}};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(C,{onClick:p==="visual"?He:Y,disabled:i||u||!h||D,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(Yi,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:i?"保存中":u?"自动":h?"保存":"已保存"})]}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsxs(C,{disabled:i||u||D,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(Qi,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:D?"重启中":h?"保存重启":"重启"})]})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认重启麦麦?"}),e.jsx(us,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:h?Ds:qe,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ua,{value:p,onValueChange:Se=>Fe(Se),className:"w-full",children:e.jsxs(ea,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(We,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(pj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(We,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(gj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsxs(ut,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsxs(ut,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",b&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Zj,{value:N,onChange:Se=>{v(Se),f(!0),b&&w(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),p==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(ua,{defaultValue:"bot",className:"w-full",children:[e.jsxs(ea,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(We,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(We,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(We,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(We,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(We,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(We,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(We,{value:"voice",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"语音"}),e.jsx(We,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(We,{value:"webui",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"WebUI"}),e.jsx(We,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(vs,{value:"bot",className:"space-y-4",children:k&&e.jsx(I2,{config:k,onChange:V})}),e.jsx(vs,{value:"personality",className:"space-y-4",children:M&&e.jsx(H2,{config:M,onChange:S})}),e.jsx(vs,{value:"chat",className:"space-y-4",children:E&&e.jsx(q2,{config:E,onChange:I})}),e.jsx(vs,{value:"expression",className:"space-y-4",children:A&&e.jsx(s_,{config:A,onChange:J})}),e.jsx(vs,{value:"features",className:"space-y-4",children:G&&de&&ne&&e.jsx(W2,{emojiConfig:G,memoryConfig:de,toolConfig:ne,onEmojiChange:ue,onMemoryChange:ve,onToolChange:fe})}),e.jsx(vs,{value:"processing",className:"space-y-4",children:U&&we&&_e&&be&&e.jsx(a_,{keywordReactionConfig:U,responsePostProcessConfig:we,chineseTypoConfig:_e,responseSplitterConfig:be,onKeywordReactionChange:H,onResponsePostProcessChange:je,onChineseTypoChange:X,onResponseSplitterChange:ee})}),e.jsx(vs,{value:"voice",className:"space-y-4",children:ge&&e.jsx(K2,{config:ge,onChange:z})}),e.jsx(vs,{value:"lpmm",className:"space-y-4",children:K&&e.jsx(Q2,{config:K,onChange:B})}),e.jsx(vs,{value:"webui",className:"space-y-4",children:Te&&e.jsx(l_,{config:Te,onChange:Ie})}),e.jsxs(vs,{value:"other",className:"space-y-4",children:[xe&&e.jsx(Y2,{config:xe,onChange:Ce}),Z&&e.jsx(J2,{config:Z,onChange:se}),De&&e.jsx(X2,{config:De,onChange:q}),te&&e.jsx(Z2,{config:te,onChange:Ae})]})]})}),e.jsx(Bn,{})]})})}const _l=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:i,className:$("w-full caption-bottom text-sm",l),...n})}));_l.displayName="Table";const Sl=m.forwardRef(({className:l,...n},i)=>e.jsx("thead",{ref:i,className:$("[&_tr]:border-b",l),...n}));Sl.displayName="TableHeader";const Cl=m.forwardRef(({className:l,...n},i)=>e.jsx("tbody",{ref:i,className:$("[&_tr:last-child]:border-0",l),...n}));Cl.displayName="TableBody";const N_=m.forwardRef(({className:l,...n},i)=>e.jsx("tfoot",{ref:i,className:$("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",l),...n}));N_.displayName="TableFooter";const at=m.forwardRef(({className:l,...n},i)=>e.jsx("tr",{ref:i,className:$("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",l),...n}));at.displayName="TableRow";const Ye=m.forwardRef(({className:l,...n},i)=>e.jsx("th",{ref:i,className:$("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));Ye.displayName="TableHead";const Pe=m.forwardRef(({className:l,...n},i)=>e.jsx("td",{ref:i,className:$("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));Pe.displayName="TableCell";const b_=m.forwardRef(({className:l,...n},i)=>e.jsx("caption",{ref:i,className:$("mt-4 text-sm text-muted-foreground",l),...n}));b_.displayName="TableCaption";const Ho=m.forwardRef(({className:l,...n},i)=>e.jsx(ma,{ref:i,className:$("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",l),...n}));Ho.displayName=ma.displayName;const Po=m.forwardRef(({className:l,...n},i)=>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(ma.Input,{ref:i,className:$("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",l),...n})]}));Po.displayName=ma.Input.displayName;const Go=m.forwardRef(({className:l,...n},i)=>e.jsx(ma.List,{ref:i,className:$("max-h-[300px] overflow-y-auto overflow-x-hidden",l),...n}));Go.displayName=ma.List.displayName;const Fo=m.forwardRef((l,n)=>e.jsx(ma.Empty,{ref:n,className:"py-6 text-center text-sm",...l}));Fo.displayName=ma.Empty.displayName;const Gi=m.forwardRef(({className:l,...n},i)=>e.jsx(ma.Group,{ref:i,className:$("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",l),...n}));Gi.displayName=ma.Group.displayName;const y_=m.forwardRef(({className:l,...n},i)=>e.jsx(ma.Separator,{ref:i,className:$("-mx-1 h-px bg-border",l),...n}));y_.displayName=ma.Separator.displayName;const Fi=m.forwardRef(({className:l,...n},i)=>e.jsx(ma.Item,{ref:i,className:$("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",l),...n}));Fi.displayName=ma.Item.displayName;const Qs=m.forwardRef(({className:l,...n},i)=>e.jsx(sj,{ref:i,className:$("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",l),...n,children:e.jsx(pw,{className:$("grid place-content-center text-current"),children:e.jsx(yt,{className:"h-4 w-4"})})}));Qs.displayName=sj.displayName;const Wj=m.createContext(null),ev="maibot-completed-tours";function w_(){try{const l=localStorage.getItem(ev);return l?new Set(JSON.parse(l)):new Set}catch{return new Set}}function ng(l){localStorage.setItem(ev,JSON.stringify([...l]))}function __({children:l}){const[n,i]=m.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=m.useState(()=>new Map),[u,x]=m.useState(w_),[,h]=m.useState(0),f=m.useCallback((M,S)=>{c.set(M,S),h(E=>E+1)},[c]),p=m.useCallback(M=>{c.delete(M),i(S=>S.activeTourId===M?{...S,activeTourId:null,isRunning:!1,stepIndex:0}:S)},[c]),j=m.useCallback((M,S=0)=>{c.has(M)&&i({activeTourId:M,stepIndex:S,isRunning:!0})},[c]),N=m.useCallback(()=>{i(M=>({...M,isRunning:!1}))},[]),v=m.useCallback(M=>{i(S=>({...S,stepIndex:M}))},[]),b=m.useCallback(()=>{i(M=>({...M,stepIndex:M.stepIndex+1}))},[]),w=m.useCallback(()=>{i(M=>({...M,stepIndex:Math.max(0,M.stepIndex-1)}))},[]),y=m.useCallback(()=>n.activeTourId?c.get(n.activeTourId)||[]:[],[n.activeTourId,c]),L=m.useCallback(M=>{x(S=>{const E=new Set(S);return E.add(M),ng(E),E})},[]),D=m.useCallback(M=>{const{action:S,index:E,status:I,type:A}=M,J=["finished","skipped"];if(S==="close"){i(G=>({...G,isRunning:!1,stepIndex:0}));return}J.includes(I)?i(G=>(I==="finished"&&G.activeTourId&&setTimeout(()=>L(G.activeTourId),0),{...G,isRunning:!1,stepIndex:0})):A==="step:after"&&(S==="next"?i(G=>({...G,stepIndex:E+1})):S==="prev"&&i(G=>({...G,stepIndex:E-1})))},[L]),k=m.useCallback(M=>u.has(M),[u]),V=m.useCallback(M=>{x(S=>{const E=new Set(S);return E.delete(M),ng(E),E})},[]);return e.jsx(Wj.Provider,{value:{state:n,tours:c,registerTour:f,unregisterTour:p,startTour:j,stopTour:N,goToStep:v,nextStep:b,prevStep:w,getCurrentSteps:y,handleJoyrideCallback:D,isTourCompleted:k,markTourCompleted:L,resetTourCompleted:V},children:l})}function $m(){const l=m.useContext(Wj);if(!l)throw new Error("useTour must be used within a TourProvider");return l}const S_={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},C_={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function k_(){const{state:l,getCurrentSteps:n,handleJoyrideCallback:i}=$m(),c=n(),[u,x]=m.useState(!1),h=m.useRef(l.stepIndex),f=m.useRef(null);m.useEffect(()=>{h.current!==l.stepIndex&&(x(!1),h.current=l.stepIndex)},[l.stepIndex]),m.useEffect(()=>{if(!l.isRunning||c.length===0){x(!1);return}const v=c[l.stepIndex];if(!v){x(!1);return}const b=v.target;if(b==="body"){x(!0);return}x(!1);const w=setTimeout(()=>{const y=()=>{const V=document.querySelector(b);if(V){const M=V.getBoundingClientRect();if(M.width>0&&M.height>0)return!0}return!1};if(y()){setTimeout(()=>x(!0),100);return}const L=setInterval(()=>{y()&&(clearInterval(L),setTimeout(()=>x(!0),100))},100),D=setTimeout(()=>{clearInterval(L),x(!0)},5e3),k=()=>{clearInterval(L),clearTimeout(D)};f.current=k},150);return()=>{clearTimeout(w),f.current&&(f.current(),f.current=null)}},[l.isRunning,l.stepIndex,c]);const[p,j]=m.useState(null);if(m.useEffect(()=>{let v=document.getElementById("tour-portal-container");return v||(v=document.createElement("div"),v.id="tour-portal-container",v.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(v)),j(v),()=>{}},[]),!l.isRunning||c.length===0||!u)return null;const N=e.jsx(x1,{steps:c,stepIndex:l.stepIndex,run:l.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:i,styles:S_,locale:C_,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${l.stepIndex}`);return p?e0.createPortal(N,p):N}const Ja="model-assignment-tour",sv=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek),还是模型平台(如 Siliconflow),都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址,确保填写正确以便系统能够连接到模型服务。对于不同的提供商,API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],tv={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"},Oi=[{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 rg(l){return l?l.replace(/\/+$/,"").toLowerCase():""}function T_(l){if(!l)return null;const n=rg(l);return Oi.find(i=>i.id!=="custom"&&rg(i.base_url)===n)||null}const go=l=>({...l,max_retry:l.max_retry??2,timeout:l.timeout??30,retry_interval:l.retry_interval??10}),E_=l=>{const n={};return l?(l.name?.trim()||(n.name="请输入提供商名称"),l.base_url?.trim()||(n.base_url="请输入基础 URL"),l.api_key?.trim()||(n.api_key="请输入 API Key"),{isValid:Object.keys(n).length===0,errors:n}):{isValid:!1,errors:{name:"提供商数据为空"}}};function M_(){return e.jsx(Un,{children:e.jsx(A_,{})})}function A_(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[p,j]=m.useState(!1),[N,v]=m.useState(!1),[b,w]=m.useState(null),[y,L]=m.useState(null),[D,k]=m.useState("custom"),[V,M]=m.useState(!1),[S,E]=m.useState(!1),[I,A]=m.useState(null),[J,G]=m.useState(!1),[ue,de]=m.useState(""),[ve,ne]=m.useState(new Set),[fe,ge]=m.useState(!1),[z,K]=m.useState(1),[B,U]=m.useState(20),[H,we]=m.useState(""),[je,_e]=m.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[X,be]=m.useState({}),[ee,xe]=m.useState(new Set),[Ce,Z]=m.useState(new Map),{toast:se}=Js(),De=sa(),{state:q,goToStep:te,registerTour:Ae}=$m(),{triggerRestart:Te,isRestarting:Ie}=ln(),ie=m.useRef(null),Ee=m.useRef(!0);m.useEffect(()=>{Ae(Ja,sv)},[Ae]),m.useEffect(()=>{if(q.activeTourId===Ja&&q.isRunning){const W=tv[q.stepIndex];W&&!window.location.pathname.endsWith(W.replace("/config/",""))&&De({to:W})}},[q.stepIndex,q.activeTourId,q.isRunning,De]);const Vs=m.useRef(q.stepIndex);m.useEffect(()=>{if(q.activeTourId===Ja&&q.isRunning){const W=Vs.current,O=q.stepIndex;W>=3&&W<=9&&O<3&&v(!1),W>=10&&O>=3&&O<=9&&(be({}),k("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),L(null),G(!1),v(!0)),Vs.current=O}},[q.stepIndex,q.activeTourId,q.isRunning]),m.useEffect(()=>{if(q.activeTourId!==Ja||!q.isRunning)return;const W=O=>{const F=O.target,Le=q.stepIndex;Le===2&&F.closest('[data-tour="add-provider-button"]')?setTimeout(()=>te(3),300):Le===9&&F.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>te(10),300)};return document.addEventListener("click",W,!0),()=>document.removeEventListener("click",W,!0)},[q,te]),m.useEffect(()=>{Vt()},[]);const Vt=async()=>{try{c(!0);const W=await Wl();n(W.api_providers||[]),j(!1),Ee.current=!1}catch(W){console.error("加载配置失败:",W)}finally{c(!1)}},Kt=async()=>{await Te()},Qt=async()=>{try{x(!0),ie.current&&clearTimeout(ie.current);const W=l.map(Ws=>({...Ws,max_retry:Ws.max_retry??2,timeout:Ws.timeout??30,retry_interval:Ws.retry_interval??10})),{shouldProceed:O}=await fs(W,"restart");if(!O){x(!1);return}const F=await Wl(),Le=new Set(W.map(Ws=>Ws.name)),bs=(F.models||[]).filter(Ws=>Le.has(Ws.api_provider));F.api_providers=W,F.models=bs,await Bi(F),j(!1),se({title:"保存成功",description:"正在重启麦麦..."}),await Kt()}catch(W){console.error("保存配置失败:",W),se({title:"保存失败",description:W.message,variant:"destructive"}),x(!1)}},fs=m.useCallback(async(W,O="auto")=>{try{const F=await Wl(),Le=new Set(l.map(vt=>vt.name)),Xs=new Set(W.map(vt=>vt.name)),bs=Array.from(Le).filter(vt=>!Xs.has(vt));if(bs.length===0)return{shouldProceed:!0,providers:W};const jt=(F.models||[]).filter(vt=>bs.includes(vt.api_provider));return jt.length===0?{shouldProceed:!0,providers:W}:(_e({isOpen:!0,providersToDelete:bs,affectedModels:jt,pendingProviders:W,context:O,oldProviders:[...l]}),{shouldProceed:!1,providers:W})}catch(F){return console.error("检查删除影响失败:",F),{shouldProceed:!0,providers:W}}},[l]),Is=async()=>{try{(je.context==="auto"?f:x)(!0),_e(vt=>({...vt,isOpen:!1}));const O=await Wl(),F=je.pendingProviders.map(go),Le=new Set(F.map(vt=>vt.name)),bs=(O.models||[]).filter(vt=>Le.has(vt.api_provider)),Ws=new Set(je.affectedModels.map(vt=>vt.name)),jt=O.model_task_config;jt&&Object.keys(jt).forEach(vt=>{const cn=jt[vt];cn&&Array.isArray(cn.model_list)&&(cn.model_list=cn.model_list.filter(Wi=>!Ws.has(Wi)))}),O.api_providers=F,O.models=bs,O.model_task_config=jt,await Bi(O),n(je.pendingProviders),j(!1),se({title:"删除成功",description:`已删除 ${je.providersToDelete.length} 个提供商和 ${je.affectedModels.length} 个关联模型`}),_e({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),ne(new Set),je.context==="restart"&&await Kt()}catch(W){console.error("删除失败:",W),se({title:"删除失败",description:W.message,variant:"destructive"})}finally{je.context==="auto"?f(!1):x(!1)}},Y=()=>{je.oldProviders.length>0&&n(je.oldProviders),_e({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),j(!1)},Fe=m.useCallback(async W=>{if(Ee.current)return;const{shouldProceed:O}=await fs(W,"auto");if(!O){j(!0);return}try{f(!0);const F=W.map(go);await Em("api_providers",F),j(!1)}catch(F){console.error("自动保存失败:",F),se({title:"自动保存失败",description:F.message,variant:"destructive"}),j(!0)}finally{f(!1)}},[l,fs]);m.useEffect(()=>{if(!Ee.current)return j(!0),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{Fe(l)},2e3),()=>{ie.current&&clearTimeout(ie.current)}},[l,Fe]);const He=async()=>{try{x(!0),ie.current&&clearTimeout(ie.current);const W=l.map(go),{shouldProceed:O}=await fs(W,"manual");if(!O){x(!1);return}const F=await Wl(),Le=new Set(W.map(Ws=>Ws.name)),Xs=F.models||[],bs=Xs.filter(Ws=>{const jt=Le.has(Ws.api_provider);return jt||console.warn(`模型 "${Ws.name}" 引用了已删除的提供商 "${Ws.api_provider}",将被移除`),jt});if(Xs.length!==bs.length){const Ws=Xs.length-bs.length;se({title:"注意",description:`已自动移除 ${Ws} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",W),F.api_providers=W,F.models=bs,console.log("完整配置数据:",F),await Bi(F),j(!1),se({title:"保存成功",description:"模型提供商配置已保存"})}catch(W){console.error("保存配置失败:",W),se({title:"保存失败",description:W.message,variant:"destructive"})}finally{x(!1)}},qe=(W,O)=>{if(be({}),W){const F=Oi.find(Le=>Le.base_url===W.base_url&&Le.client_type===W.client_type);k(F?.id||"custom"),w(W)}else k("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});L(O),G(!1),v(!0)},Ds=m.useCallback(W=>{k(W),M(!1);const O=Oi.find(F=>F.id===W);O&&O.id!=="custom"?w(F=>({...F,name:O.name,base_url:O.base_url,client_type:O.client_type})):O?.id==="custom"&&w(F=>({...F,name:"",base_url:"",client_type:"openai"}))},[]),Se=m.useMemo(()=>D!=="custom",[D]),ns=m.useCallback(async()=>{if(b?.api_key)try{await navigator.clipboard.writeText(b.api_key),se({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{se({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[b?.api_key,se]),Cs=()=>{if(!b)return;const{isValid:W,errors:O}=E_(b);if(!W){be(O);return}be({});const F=go(b);if(y!==null){const Le=[...l];Le[y]=F,n(Le)}else n([...l,F]);v(!1),w(null),L(null)},Ms=W=>{if(!W&&b){const O={...b,max_retry:b.max_retry??2,timeout:b.timeout??30,retry_interval:b.retry_interval??10};w(O)}v(W)},ss=W=>{A(W),E(!0)},es=async()=>{if(I!==null){const W=l.filter((F,Le)=>Le!==I),{shouldProceed:O}=await fs(W,"manual");O&&(n(W),se({title:"删除成功",description:"提供商已从列表中移除"}))}E(!1),A(null)},ps=W=>{const O=new Set(ve);O.has(W)?O.delete(W):O.add(W),ne(O)},mt=()=>{if(ve.size===ts.length)ne(new Set);else{const W=ts.map((O,F)=>l.findIndex(Le=>Le===ts[F]));ne(new Set(W))}},zt=()=>{if(ve.size===0){se({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}ge(!0)},nt=async()=>{const W=l.filter((F,Le)=>!ve.has(Le)),{shouldProceed:O}=await fs(W,"manual");O&&(n(W),ne(new Set),se({title:"批量删除成功",description:`已删除 ${ve.size} 个提供商`})),ge(!1)},ts=m.useMemo(()=>{if(!ue)return l;const W=ue.toLowerCase();return l.filter(O=>O.name.toLowerCase().includes(W)||O.base_url.toLowerCase().includes(W)||O.client_type.toLowerCase().includes(W))},[l,ue]),{totalPages:St,paginatedProviders:Lt}=m.useMemo(()=>{const W=Math.ceil(ts.length/B),O=ts.slice((z-1)*B,z*B);return{totalPages:W,paginatedProviders:O}},[ts,z,B]),Mt=m.useCallback(()=>{const W=parseInt(H);W>=1&&W<=St&&(K(W),we(""))},[H,St]),Fa=async W=>{xe(O=>new Set(O).add(W));try{const O=await o_(W);Z(F=>new Map(F).set(W,O)),O.network_ok?O.api_key_valid===!0?se({title:"连接正常",description:`${W} 网络连接正常,API Key 有效 (${O.latency_ms}ms)`}):O.api_key_valid===!1?se({title:"连接正常但 Key 无效",description:`${W} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):se({title:"网络连接正常",description:`${W} 可以访问 (${O.latency_ms}ms)`}):se({title:"连接失败",description:O.error||"无法连接到提供商",variant:"destructive"})}catch(O){se({title:"测试失败",description:O.message,variant:"destructive"})}finally{xe(O=>{const F=new Set(O);return F.delete(W),F})}},Va=async()=>{for(const W of l)await Fa(W.name)},$n=W=>{const O=ee.has(W),F=Ce.get(W);return O?e.jsxs(ke,{variant:"secondary",className:"gap-1",children:[e.jsx(Es,{className:"h-3 w-3 animate-spin"}),"测试中"]}):F?F.network_ok?F.api_key_valid===!0?e.jsxs(ke,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(Zt,{className:"h-3 w-3"}),"正常"]}):F.api_key_valid===!1?e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(_t,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(ke,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(Zt,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(uj,{className:"h-3 w-3"}),"离线"]}):null};return i?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[ve.size>0&&e.jsxs(C,{onClick:zt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(as,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",ve.size,")"]}),e.jsxs(C,{onClick:Va,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:l.length===0||ee.size>0,children:[e.jsx(Tn,{className:"mr-2 h-4 w-4"}),ee.size>0?`测试中 (${ee.size})`:"测试全部"]}),e.jsxs(C,{onClick:()=>qe(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(tt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(C,{onClick:He,disabled:u||h||!p||Ie,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(Yi,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),u?"保存中...":h?"自动保存中...":p?"保存配置":"已保存"]}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsxs(C,{disabled:u||h||Ie,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(Qi,{className:"mr-2 h-4 w-4"}),Ie?"重启中...":p?"保存并重启":"重启麦麦"]})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认重启麦麦?"}),e.jsx(us,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:p?Qt:Kt,children:p?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsxs(ut,{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(oe,{placeholder:"搜索提供商名称、URL 或类型...",value:ue,onChange:W=>de(W.target.value),className:"pl-9"})]}),ue&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",ts.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:ts.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:ue?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Lt.map((W,O)=>{const F=l.findIndex(Le=>Le===W);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:W.name}),$n(W.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:W.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Fa(W.name),disabled:ee.has(W.name),title:"测试连接",children:ee.has(W.name)?e.jsx(Es,{className:"h-4 w-4 animate-spin"}):e.jsx(Tn,{className:"h-4 w-4"})}),e.jsx(C,{variant:"default",size:"sm",onClick:()=>qe(W,F),children:e.jsx(Mn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(C,{size:"sm",onClick:()=>ss(F),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(as,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),e.jsx("p",{className:"font-medium",children:W.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:W.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:W.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:W.retry_interval})]})]})]},O)})}),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(_l,{children:[e.jsx(Sl,{children:e.jsxs(at,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Qs,{checked:ve.size===ts.length&&ts.length>0,onCheckedChange:mt})}),e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"基础URL"}),e.jsx(Ye,{children:"客户端类型"}),e.jsx(Ye,{className:"text-right",children:"最大重试"}),e.jsx(Ye,{className:"text-right",children:"超时(秒)"}),e.jsx(Ye,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Cl,{children:Lt.length===0?e.jsx(at,{children:e.jsx(Pe,{colSpan:9,className:"text-center text-muted-foreground py-8",children:ue?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Lt.map((W,O)=>{const F=l.findIndex(Le=>Le===W);return e.jsxs(at,{children:[e.jsx(Pe,{children:e.jsx(Qs,{checked:ve.has(F),onCheckedChange:()=>ps(F)})}),e.jsx(Pe,{children:$n(W.name)||e.jsx(ke,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Pe,{className:"font-medium",children:W.name}),e.jsx(Pe,{className:"max-w-xs truncate",title:W.base_url,children:W.base_url}),e.jsx(Pe,{children:W.client_type}),e.jsx(Pe,{className:"text-right",children:W.max_retry}),e.jsx(Pe,{className:"text-right",children:W.timeout}),e.jsx(Pe,{className:"text-right",children:W.retry_interval}),e.jsx(Pe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Fa(W.name),disabled:ee.has(W.name),title:"测试连接",children:ee.has(W.name)?e.jsx(Es,{className:"h-4 w-4 animate-spin"}):e.jsx(Tn,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"default",size:"sm",onClick:()=>qe(W,F),children:[e.jsx(Mn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>ss(F),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(as,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},O)})})]})})}),ts.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:B.toString(),onValueChange:W=>{U(parseInt(W)),K(1),ne(new Set)},children:[e.jsx(Oe,{id:"page-size-provider",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"10",children:"10"}),e.jsx(re,{value:"20",children:"20"}),e.jsx(re,{value:"50",children:"50"}),e.jsx(re,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(z-1)*B+1," 到"," ",Math.min(z*B,ts.length)," 条,共 ",ts.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>K(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(Rr,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>K(W=>Math.max(1,W-1)),disabled:z===1,children:[e.jsx(el,{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(oe,{type:"number",value:H,onChange:W=>we(W.target.value),onKeyDown:W=>W.key==="Enter"&&Mt(),placeholder:z.toString(),className:"w-16 h-8 text-center",min:1,max:St}),e.jsx(C,{variant:"outline",size:"sm",onClick:Mt,disabled:!H,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>K(W=>W+1),disabled:z>=St,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>K(St),disabled:z>=St,className:"hidden sm:flex",children:e.jsx(Lr,{className:"h-4 w-4"})})]})]})]}),e.jsx(Fs,{open:N,onOpenChange:Ms,children:e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:q.isRunning,children:[e.jsxs(Bs,{children:[e.jsx($s,{children:y!==null?"编辑提供商":"添加提供商"}),e.jsx(lt,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:W=>{W.preventDefault(),Cs()},autoComplete:"off",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[e.jsx(T,{htmlFor:"template",children:"提供商模板"}),e.jsxs(Za,{open:V,onOpenChange:M,children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",role:"combobox","aria-expanded":V,className:"w-full justify-between",children:[D?Oi.find(W=>W.id===D)?.display_name:"选择提供商模板...",e.jsx(Rm,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Pa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(Ho,{children:[e.jsx(Po,{placeholder:"搜索提供商模板..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(Go,{className:"max-h-none overflow-visible",children:[e.jsx(Fo,{children:"未找到匹配的模板"}),e.jsx(Gi,{children:Oi.map(W=>e.jsxs(Fi,{value:W.display_name,onSelect:()=>Ds(W.id),children:[e.jsx(yt,{className:`mr-2 h-4 w-4 ${D===W.id?"opacity-100":"opacity-0"}`}),W.display_name]},W.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(T,{htmlFor:"name",className:X.name?"text-destructive":"",children:"名称 *"}),e.jsx(oe,{id:"name",value:b?.name||"",onChange:W=>{w(O=>O?{...O,name:W.target.value}:null),X.name&&be(O=>({...O,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:X.name?"border-destructive focus-visible:ring-destructive":""}),X.name&&e.jsx("p",{className:"text-xs text-destructive",children:X.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(T,{htmlFor:"base_url",className:X.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(oe,{id:"base_url",value:b?.base_url||"",onChange:W=>{w(O=>O?{...O,base_url:W.target.value}:null),X.base_url&&be(O=>({...O,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:Se,className:`${Se?"bg-muted cursor-not-allowed":""} ${X.base_url?"border-destructive focus-visible:ring-destructive":""}`}),X.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:X.base_url}),Se&&!X.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(T,{htmlFor:"api_key",className:X.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{id:"api_key",type:J?"text":"password",value:b?.api_key||"",onChange:W=>{w(O=>O?{...O,api_key:W.target.value}:null),X.api_key&&be(O=>({...O,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${X.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(C,{type:"button",variant:"outline",size:"icon",onClick:()=>G(!J),title:J?"隐藏密钥":"显示密钥",children:J?e.jsx(Ii,{className:"h-4 w-4"}):e.jsx(Wt,{className:"h-4 w-4"})}),e.jsx(C,{type:"button",variant:"outline",size:"icon",onClick:ns,title:"复制密钥",children:e.jsx(_o,{className:"h-4 w-4"})})]}),X.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:X.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Ue,{value:b?.client_type||"openai",onValueChange:W=>w(O=>O?{...O,client_type:W}:null),disabled:Se,children:[e.jsx(Oe,{id:"client_type",className:Se?"bg-muted cursor-not-allowed":"",children:e.jsx(Be,{placeholder:"选择客户端类型"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"openai",children:"OpenAI"}),e.jsx(re,{value:"gemini",children:"Gemini"})]})]}),Se&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(oe,{id:"max_retry",type:"number",min:"0",value:b?.max_retry??"",onChange:W=>{const O=W.target.value===""?null:parseInt(W.target.value);w(F=>F?{...F,max_retry:O}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(oe,{id:"timeout",type:"number",min:"1",value:b?.timeout??"",onChange:W=>{const O=W.target.value===""?null:parseInt(W.target.value);w(F=>F?{...F,timeout:O}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(oe,{id:"retry_interval",type:"number",min:"1",value:b?.retry_interval??"",onChange:W=>{const O=W.target.value===""?null:parseInt(W.target.value);w(F=>F?{...F,retry_interval:O}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(it,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>v(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(C,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(hs,{open:S,onOpenChange:E,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:['确定要删除提供商 "',I!==null?l[I]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:es,children:"删除"})]})]})}),e.jsx(hs,{open:fe,onOpenChange:ge,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认批量删除"}),e.jsxs(us,{children:["确定要删除选中的 ",ve.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:nt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(hs,{open:je.isOpen,onOpenChange:W=>_e(O=>({...O,isOpen:W})),children:e.jsxs(is,{className:"max-w-2xl",children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除提供商"}),e.jsx(us,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:je.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",je.affectedModels.length," 个关联的模型:"]}),e.jsx(Ze,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:je.affectedModels.map((W,O)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-mono text-muted-foreground",children:"•"}),e.jsx("span",{className:"ml-2 font-medium",children:W.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",W.model_identifier,")"]})]},O))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(os,{children:[e.jsx(xs,{onClick:Y,children:"取消"}),e.jsx(ms,{onClick:Is,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),e.jsx(Bn,{})]})}function av(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function lv(l){return typeof l=="boolean"?"boolean":typeof l=="number"?"number":"string"}function z_(l,n){switch(n){case"boolean":return l==="true";case"number":{const i=parseFloat(l);return isNaN(i)?0:i}default:return l}}function ig(l){return Object.entries(l).map(([n,i])=>({id:av(),key:n,value:i,type:lv(i)}))}function pm(l){const n={};for(const i of l)i.key.trim()&&(n[i.key.trim()]=i.value);return n}function gm(l){if(!l.trim())return{valid:!0,parsed:{}};try{const n=JSON.parse(l);if(typeof n!="object"||n===null||Array.isArray(n))return{valid:!1,error:"必须是一个 JSON 对象 {}"};for(const[i,c]of Object.entries(n))if(c!==null&&!["string","number","boolean"].includes(typeof c))return{valid:!1,error:`键 "${i}" 的值类型不支持(仅支持 string/number/boolean)`};return{valid:!0,parsed:n}}catch{return{valid:!1,error:"JSON 格式错误"}}}function D_(l){switch(l){case"boolean":return"布尔";case"number":return"数字";default:return"字符串"}}function O_(l){switch(l){case"boolean":return"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400";case"number":return"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"}}function R_({value:l,onChange:n,className:i,placeholder:c="添加额外参数..."}){const[u,x]=m.useState("list"),h=m.useMemo(()=>ig(l||{}),[l]),f=m.useMemo(()=>Object.keys(l||{}).length>0?JSON.stringify(l,null,2):"",[l]),[p,j]=m.useState(h),[N,v]=m.useState(f),[b,w]=m.useState(null);m.useEffect(()=>{j(h),v(f)},[h,f]);const y=m.useMemo(()=>{const S=gm(N);return S.valid&&S.parsed?{success:!0,data:S.parsed}:{success:!1,data:{}}},[N]),L=m.useCallback(S=>{const E=S;if(E==="json"&&u==="list"){const I=pm(p);v(Object.keys(I).length>0?JSON.stringify(I,null,2):""),w(null)}else if(E==="list"&&u==="json"){const I=gm(N);I.valid&&I.parsed&&(j(ig(I.parsed)),w(null))}x(E)},[u,p,N]),D=m.useCallback(()=>{const S={id:av(),key:"",value:"",type:"string"},E=[...p,S];j(E)},[p]),k=m.useCallback(S=>{const E=p.filter(I=>I.id!==S);j(E),n(pm(E))},[p,n]),V=m.useCallback((S,E,I)=>{const A=p.map(J=>{if(J.id!==S)return J;if(E==="type"){const G=I;let ue;return G==="boolean"?ue=J.value==="true"||J.value===!0:G==="number"?ue=typeof J.value=="number"?J.value:parseFloat(String(J.value))||0:ue=String(J.value),{...J,type:G,value:ue}}else return E==="value"?{...J,value:z_(I,J.type)}:{...J,[E]:I}});j(A),n(pm(A))},[p,n]),M=m.useCallback(S=>{v(S);const E=gm(S);E.valid&&E.parsed?(w(null),n(E.parsed)):w(E.error||"JSON 格式错误")},[n]);return e.jsxs("div",{className:$("space-y-3",i),children:[e.jsx(T,{className:"text-sm font-medium",children:"额外参数"}),e.jsxs(ua,{value:u,onValueChange:L,className:"w-full",children:[e.jsxs(ea,{className:"h-8 p-0.5 bg-muted/60",children:[e.jsx(We,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"键值对"}),e.jsx(We,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON"})]}),e.jsxs(vs,{value:"list",className:"mt-3 space-y-2",children:[p.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:c}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 text-xs text-muted-foreground px-1",children:[e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),p.map(S=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 items-center",children:[e.jsx(oe,{value:S.key,onChange:E=>V(S.id,"key",E.target.value),placeholder:"key",className:"h-8 text-sm"}),S.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Ge,{checked:S.value===!0,onCheckedChange:E=>V(S.id,"value",String(E))}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:S.value?"true":"false"})]}):e.jsx(oe,{type:S.type==="number"?"number":"text",value:S.value,onChange:E=>V(S.id,"value",E.target.value),placeholder:"value",className:"h-8 text-sm",step:S.type==="number"?"any":void 0}),e.jsxs(Ue,{value:S.type,onValueChange:E=>V(S.id,"type",E),children:[e.jsx(Oe,{className:"h-8 text-xs",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"string",children:"字符串"}),e.jsx(re,{value:"number",children:"数字"}),e.jsx(re,{value:"boolean",children:"布尔"})]})]}),e.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>k(S.id),children:e.jsx(as,{className:"h-4 w-4"})})]},S.id))]}),e.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-8",onClick:D,children:[e.jsx(tt,{className:"h-4 w-4 mr-1"}),"添加参数"]})]}),e.jsx(vs,{value:"json",className:"mt-3",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),b?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(_t,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:b})]}):N.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(yt,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(Zs,{value:N,onChange:S=>M(S.target.value),placeholder:`{ + "key": "value" +}`,className:$("font-mono text-sm min-h-[140px] h-[140px] resize-y flex-1",b&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持 string、number、boolean 类型"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"min-h-[140px] h-[140px] flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:y.success&&Object.keys(y.data).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(y.data).map(([S,E])=>{const I=lv(E);return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("code",{className:"px-1.5 py-0.5 bg-background rounded text-xs font-medium",children:S}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:$("font-mono",I==="boolean"&&(E?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),I==="number"&&"text-blue-600 dark:text-blue-400",I==="string"&&"text-amber-600 dark:text-amber-400"),children:I==="string"?`"${E}"`:String(E)}),e.jsx(ke,{variant:"secondary",className:$("h-5 text-[10px] px-1.5",O_(I)),children:D_(I)})]},S)})}):y.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})]})}const Br="https://maibot-plugin-stats.maibot-webui.workers.dev";async function L_(l){const n=new URLSearchParams;l?.status&&n.set("status",l.status),l?.page&&n.set("page",l.page.toString()),l?.page_size&&n.set("page_size",l.page_size.toString()),l?.search&&n.set("search",l.search),l?.sort_by&&n.set("sort_by",l.sort_by),l?.sort_order&&n.set("sort_order",l.sort_order);const i=await fetch(`${Br}/pack?${n.toString()}`);if(!i.ok)throw new Error(`获取 Pack 列表失败: ${i.status}`);return i.json()}async function U_(l){const n=await fetch(`${Br}/pack/${l}`);if(!n.ok)throw new Error(`获取 Pack 失败: ${n.status}`);const i=await n.json();if(!i.success)throw new Error(i.error||"获取 Pack 失败");return i.pack}async function B_(l){const i=await(await fetch(`${Br}/pack`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.error||"创建 Pack 失败");return i}async function $_(l,n){await fetch(`${Br}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})}async function nv(l,n){const c=await(await fetch(`${Br}/pack/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})).json();if(!c.success)throw new Error(c.error||"点赞失败");return{likes:c.likes,liked:c.liked}}async function rv(l,n){return(await(await fetch(`${Br}/pack/like/check?pack_id=${l}&user_id=${n}`)).json()).liked||!1}async function I_(l){const n=await ye("/api/webui/config/model");if(!n.ok)throw new Error("获取当前模型配置失败");const i=await n.json(),c=i.config||i;console.log("=== Pack Conflict Detection ==="),console.log("Pack providers:",l.providers),console.log("Local providers:",c.api_providers);const u={existing_providers:[],new_providers:[],conflicting_models:[]},x=c.api_providers||[];for(const f of l.providers){console.log(` +Checking pack provider: ${f.name}`),console.log(` Pack URL: ${f.base_url}`),console.log(` Normalized: ${jm(f.base_url)}`);const p=x.filter(j=>{const N=jm(j.base_url),v=jm(f.base_url);return console.log(` Comparing with local "${j.name}": ${j.base_url}`),console.log(` Local normalized: ${N}`),console.log(` Match: ${N===v}`),N===v});p.length>0?(console.log(` ✓ Matched with ${p.length} local provider(s):`,p.map(j=>j.name).join(", ")),u.existing_providers.push({pack_provider:f,local_providers:p.map(j=>({name:j.name,base_url:j.base_url}))})):(console.log(" ✗ No match found - will need API key"),u.new_providers.push(f))}const h=c.models||[];console.log(` +=== Model Conflict Detection ===`);for(const f of l.models){const p=h.find(j=>j.name===f.name);p&&(console.log(`Model conflict: ${f.name}`),u.conflicting_models.push({pack_model:f.name,local_model:p.name}))}return console.log(` +=== Detection Summary ===`),console.log(`Existing providers: ${u.existing_providers.length}`),console.log(`New providers: ${u.new_providers.length}`),console.log(`Conflicting models: ${u.conflicting_models.length}`),console.log(`=========================== +`),u}async function H_(l,n,i,c){const u=await ye("/api/webui/config/model");if(!u.ok)throw new Error("获取当前模型配置失败");const x=await u.json(),h=x.config||x;if(n.apply_providers){const p=n.selected_providers?l.providers.filter(j=>n.selected_providers.includes(j.name)):l.providers;for(const j of p){if(i[j.name])continue;const N=c[j.name];if(!N)throw new Error(`提供商 "${j.name}" 缺少 API Key`);const v={...j,api_key:N},b=h.api_providers.findIndex(w=>w.name===j.name);b>=0?h.api_providers[b]=v:h.api_providers.push(v)}}if(n.apply_models){const p=n.selected_models?l.models.filter(j=>n.selected_models.includes(j.name)):l.models;for(const j of p){const N=i[j.api_provider]||j.api_provider,v={...j,api_provider:N},b=h.models.findIndex(w=>w.name===j.name);b>=0?h.models[b]=v:h.models.push(v)}}if(n.apply_task_config){const p=n.selected_tasks||Object.keys(l.task_config);for(const j of p){const N=l.task_config[j];if(!N)continue;const v=new Set(n.selected_models||l.models.map(y=>y.name)),b=N.model_list.filter(y=>v.has(y));if(b.length===0)continue;const w={...N,model_list:b};if(n.task_mode==="replace")h.model_task_config[j]=w;else{const y=h.model_task_config[j];if(y){const L=[...new Set([...y.model_list,...b])];h.model_task_config[j]={...y,model_list:L}}else h.model_task_config[j]=w}}}if(!(await ye("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("保存配置失败")}async function P_(l){const n=await ye("/api/webui/config/model");if(!n.ok)throw new Error("获取当前模型配置失败");const i=await n.json();if(!i.success||!i.config)throw new Error("获取配置失败");const c=i.config;let u=(c.api_providers||[]).map(j=>({name:j.name,base_url:j.base_url,client_type:j.client_type,max_retry:j.max_retry,timeout:j.timeout,retry_interval:j.retry_interval}));l.selectedProviders&&(u=u.filter(j=>l.selectedProviders.includes(j.name)));let x=c.models||[];l.selectedModels&&(x=x.filter(j=>l.selectedModels.includes(j.name)));const h={},f=c.model_task_config||{},p=l.selectedTasks||Object.keys(f);for(const j of p)f[j]&&(h[j]=f[j]);return{providers:u,models:x,task_config:h}}function jm(l){try{const n=new URL(l);return`${n.protocol}//${n.host}${n.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return l.toLowerCase().replace(/\/$/,"")}}function iv(){const l="maibot_pack_user_id";let n=localStorage.getItem(l);return n||(n="pack_user_"+Math.random().toString(36).substring(2,15),localStorage.setItem(l,n)),n}const G_={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"},F_=["官方推荐","性价比","高性能","免费模型","国内可用","海外模型","OpenAI","Claude","Gemini","国产模型","多模态","轻量级"];function V_({trigger:l}){const[n,i]=m.useState(!1),[c,u]=m.useState(1),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[j,N]=m.useState([]),[v,b]=m.useState([]),[w,y]=m.useState({}),[L,D]=m.useState(new Set),[k,V]=m.useState(new Set),[M,S]=m.useState(new Set),[E,I]=m.useState(""),[A,J]=m.useState(""),[G,ue]=m.useState(""),[de,ve]=m.useState([]);m.useEffect(()=>{n&&c===1&&ne()},[n,c]);const ne=async()=>{h(!0);try{const X=await P_({name:"",description:"",author:""});N(X.providers),b(X.models),y(X.task_config),D(new Set(X.providers.map(be=>be.name))),V(new Set(X.models.map(be=>be.name))),S(new Set(Object.keys(X.task_config)))}catch(X){console.error("加载配置失败:",X),Pt({title:"加载当前配置失败",variant:"destructive"})}finally{h(!1)}},fe=X=>{const be=new Set(L),ee=new Set(k),xe=new Set(M);be.has(X)?(be.delete(X),v.filter(Z=>Z.api_provider===X).forEach(Z=>ee.delete(Z.name)),Object.entries(w).forEach(([Z,se])=>{se.model_list&&(se.model_list.some(q=>ee.has(q))||xe.delete(Z))})):(be.add(X),v.filter(Z=>Z.api_provider===X).forEach(Z=>ee.add(Z.name)),Object.entries(w).forEach(([Z,se])=>{se.model_list&&se.model_list.some(q=>{const te=v.find(Ae=>Ae.name===q);return te&&te.api_provider===X})&&xe.add(Z)})),D(be),V(ee),S(xe)},ge=X=>{const be=new Set(k),ee=new Set(M);be.has(X)?(be.delete(X),Object.entries(w).forEach(([xe,Ce])=>{Ce.model_list&&(Ce.model_list.some(se=>be.has(se))||ee.delete(xe))})):(be.add(X),Object.entries(w).forEach(([xe,Ce])=>{Ce.model_list&&Ce.model_list.includes(X)&&ee.add(xe)})),V(be),S(ee)},z=X=>{const be=new Set(M);be.has(X)?be.delete(X):be.add(X),S(be)},K=X=>{de.includes(X)?ve(de.filter(be=>be!==X)):de.length<5?ve([...de,X]):Pt({title:"最多选择 5 个标签",variant:"destructive"})},B=()=>{L.size===j.length?D(new Set):D(new Set(j.map(X=>X.name)))},U=()=>{k.size===v.length?V(new Set):V(new Set(v.map(X=>X.name)))},H=()=>{const X=Object.keys(w);M.size===X.length?S(new Set):S(new Set(X))},we=async()=>{if(!E.trim()){Pt({title:"请输入模板名称",variant:"destructive"});return}if(!A.trim()){Pt({title:"请输入模板描述",variant:"destructive"});return}if(!G.trim()){Pt({title:"请输入作者名称",variant:"destructive"});return}if(L.size===0&&k.size===0&&M.size===0){Pt({title:"请至少选择一项配置",variant:"destructive"});return}p(!0);try{const X=j.filter(xe=>L.has(xe.name)),be=v.filter(xe=>k.has(xe.name)),ee={};for(const[xe,Ce]of Object.entries(w))M.has(xe)&&(ee[xe]=Ce);await B_({name:E.trim(),description:A.trim(),author:G.trim(),tags:de,providers:X,models:be,task_config:ee}),Pt({title:"模板已提交审核,审核通过后将显示在市场中"}),i(!1),je()}catch(X){console.error("提交失败:",X),Pt({title:X instanceof Error?X.message:"提交失败",variant:"destructive"})}finally{p(!1)}},je=()=>{u(1),I(""),J(""),ue(""),ve([]),D(new Set),V(new Set),S(new Set)},_e=2;return e.jsxs(Fs,{open:n,onOpenChange:i,children:[e.jsx(Io,{asChild:!0,children:l||e.jsxs(C,{variant:"outline",children:[e.jsx(jj,{className:"w-4 h-4 mr-2"}),"分享配置"]})}),e.jsxs(Us,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs(Bs,{children:[e.jsxs($s,{className:"flex items-center gap-2",children:[e.jsx(Xt,{className:"w-5 h-5"}),"分享配置模板"]}),e.jsxs(lt,{children:["步骤 ",c," / ",_e,":",c===1&&"选择要分享的配置",c===2&&"填写模板信息"]})]}),e.jsx(Ze,{className:"h-[calc(85vh-220px)] pr-4",children:x?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Es,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在加载当前配置..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(kn,{children:"安全提示"}),e.jsxs(ut,{children:["分享的配置将",e.jsx("strong",{children:"不包含"})," API Key,其他用户需要自行配置。"]})]}),e.jsxs(ua,{defaultValue:"providers",className:"w-full",children:[e.jsxs(ea,{className:"grid w-full grid-cols-3",children:[e.jsxs(We,{value:"providers",children:[e.jsx(wl,{className:"w-4 h-4 mr-2"}),"API 提供商",e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[L.size,"/",j.length]})]}),e.jsxs(We,{value:"models",children:[e.jsx(An,{className:"w-4 h-4 mr-2"}),"模型配置",e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[k.size,"/",v.length]})]}),e.jsxs(We,{value:"tasks",children:[e.jsx(zn,{className:"w-4 h-4 mr-2"}),"任务配置",e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[M.size,"/",Object.keys(w).length]})]})]}),e.jsx(vs,{value:"providers",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(C,{variant:"ghost",size:"sm",onClick:B,children:L.size===j.length?"取消全选":"全选"})}),j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无提供商配置"}):j.map(X=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Qs,{id:`provider-${X.name}`,checked:L.has(X.name),onCheckedChange:()=>fe(X.name)}),e.jsxs(T,{htmlFor:`provider-${X.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:X.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:X.base_url})]}),e.jsx(ke,{variant:"outline",className:"text-xs",children:X.client_type})]},X.name))]})}),e.jsx(vs,{value:"models",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(C,{variant:"ghost",size:"sm",onClick:U,children:k.size===v.length?"取消全选":"全选"})}),v.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无模型配置"}):v.map(X=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Qs,{id:`model-${X.name}`,checked:k.has(X.name),onCheckedChange:()=>ge(X.name)}),e.jsxs(T,{htmlFor:`model-${X.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:X.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:X.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:X.api_provider})]},X.name))]})}),e.jsx(vs,{value:"tasks",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(C,{variant:"ghost",size:"sm",onClick:H,children:M.size===Object.keys(w).length?"取消全选":"全选"})}),Object.keys(w).length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无任务配置"}):Object.entries(w).map(([X,be])=>e.jsxs("div",{className:"space-y-2 p-2 rounded hover:bg-muted",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:`task-${X}`,checked:M.has(X),onCheckedChange:()=>z(X)}),e.jsx(T,{htmlFor:`task-${X}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:G_[X]||X})}),e.jsxs(ke,{variant:"outline",className:"text-xs",children:[be.model_list.length," 个模型"]})]}),be.model_list&&be.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:be.model_list.map(ee=>{const xe=v.find(Z=>Z.name===ee),Ce=k.has(ee);return e.jsxs(ke,{variant:Ce?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>ge(ee),children:[ee,xe&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",xe.api_provider,")"]})]},ee)})})]},X))]})})]})]}),c===2&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 text-sm p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(wl,{className:"w-4 h-4"}),L.size," 个提供商"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(An,{className:"w-4 h-4"}),k.size," 个模型"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(zn,{className:"w-4 h-4"}),M.size," 个任务"]})]}),e.jsx(Ur,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-name",children:"模板名称 *"}),e.jsx(oe,{id:"pack-name",placeholder:"例如:高性价比国产模型配置",value:E,onChange:X=>I(X.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[E.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-description",children:"模板描述 *"}),e.jsx(Zs,{id:"pack-description",placeholder:"详细描述这个配置模板的特点、适用场景等...",value:A,onChange:X=>J(X.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[A.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-author",children:"作者名称 *"}),e.jsx(oe,{id:"pack-author",placeholder:"你的昵称或 ID",value:G,onChange:X=>ue(X.target.value),maxLength:30})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"标签(可选,最多 5 个)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:F_.map(X=>e.jsxs(ke,{variant:de.includes(X)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>K(X),children:[de.includes(X)&&e.jsx(yt,{className:"w-3 h-3 mr-1"}),e.jsx(Uo,{className:"w-3 h-3 mr-1"}),X]},X))})]})]}),e.jsxs(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(kn,{children:"审核说明"}),e.jsx(ut,{children:"提交后需要经过审核才能在市场中展示。审核通常在 1-3 个工作日内完成。"})]})]})]})}),e.jsxs(it,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(C,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(C,{variant:"outline",onClick:()=>{i(!1),je()},disabled:f,children:"取消"}),c<_e?e.jsx(C,{onClick:()=>u(c+1),disabled:x||L.size===0&&k.size===0&&M.size===0,children:"下一步"}):e.jsxs(C,{onClick:we,disabled:f,children:[f&&e.jsx(Es,{className:"w-4 h-4 mr-2 animate-spin"}),"提交审核"]})]})]})]})]})}function q_({value:l,label:n,onRemove:i}){const{attributes:c,listeners:u,setNodeRef:x,transform:h,transition:f,isDragging:p}=Rj({id:l}),j={transform:Lj.Transform.toString(h),transition:f,opacity:p?.5:1},N=b=>{b.preventDefault(),b.stopPropagation(),i(l)},v=b=>{b.stopPropagation()};return e.jsx("div",{ref:x,style:j,className:$("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(ke,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...c,...u,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(fj,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:n}),e.jsx("button",{type:"button",className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive",onClick:N,onPointerDown:v,onMouseDown:b=>b.stopPropagation(),children:e.jsx(Da,{className:"h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function K_({options:l,selected:n,onChange:i,placeholder:c="选择选项...",emptyText:u="未找到选项",className:x}){const[h,f]=m.useState(!1),p=kj(ko(Mj,{activationConstraint:{distance:8}}),ko(Ej,{coordinateGetter:Tj})),j=b=>{n.includes(b)?i(n.filter(w=>w!==b)):i([...n,b])},N=b=>{i(n.filter(w=>w!==b))},v=b=>{const{active:w,over:y}=b;if(y&&w.id!==y.id){const L=n.indexOf(w.id),D=n.indexOf(y.id);i(Aj(n,L,D))}};return e.jsxs(Za,{open:h,onOpenChange:f,children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",role:"combobox","aria-expanded":h,className:$("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(zj,{sensors:p,collisionDetection:Dj,onDragEnd:v,children:e.jsx(Oj,{items:n,strategy:m1,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:n.length===0?e.jsx("span",{className:"text-muted-foreground",children:c}):n.map(b=>{const w=l.find(y=>y.value===b);return e.jsx(q_,{value:b,label:w?.label||b,onRemove:N},b)})})})}),e.jsx(Rm,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Pa,{className:"w-full p-0",align:"start",children:e.jsxs(Ho,{children:[e.jsx(Po,{placeholder:"搜索...",className:"h-9"}),e.jsxs(Go,{children:[e.jsx(Fo,{children:u}),e.jsx(Gi,{children:l.map(b=>{const w=n.includes(b.value);return e.jsxs(Fi,{value:b.value,onSelect:()=>j(b.value),children:[e.jsx("div",{className:$("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",w?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(yt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:b.label})]},b.value)})})]})]})})]})}const $a=Ss.memo(function({title:n,description:i,taskConfig:c,modelNames:u,onChange:x,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:p}){const j=N=>{x("model_list",N)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:n}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:i})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":p,children:[e.jsx(T,{children:"模型列表"}),e.jsx(K_,{options:u.map(N=>({label:N,value:N})),selected:c.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(T,{children:"温度"}),e.jsx(oe,{type:"number",step:"0.1",min:"0",max:"1",value:c.temperature??.3,onChange:N=>{const v=parseFloat(N.target.value);!isNaN(v)&&v>=0&&v<=1&&x("temperature",v)},className:"w-20 h-8 text-sm"})]}),e.jsx(Na,{value:[c.temperature??.3],onValueChange:N=>x("temperature",N[0]),min:0,max:1,step:.1,className:"w-full"})]}),!f&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"最大 Token"}),e.jsx(oe,{type:"number",step:"1",min:"1",value:c.max_tokens??1024,onChange:N=>x("max_tokens",parseInt(N.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(oe,{type:"number",step:"1",min:"1",value:c.slow_threshold??15,onChange:N=>{const v=parseInt(N.target.value);!isNaN(v)&&v>=1&&x("slow_threshold",v)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]})]})]})}),Q_=Ss.memo(function({paginatedModels:n,allModels:i,onEdit:c,onDelete:u,isModelUsed:x,searchQuery:h}){return n.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:h?"未找到匹配的模型":"暂无模型配置"}):e.jsx("div",{className:"md:hidden space-y-3",children:n.map((f,p)=>{const j=i.findIndex(v=>v===f),N=x(f.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:f.name}),e.jsx(ke,{variant:N?"default":"secondary",className:N?"bg-green-600 hover:bg-green-700":"",children:N?"已使用":"未使用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:f.model_identifier,children:f.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>c(f,j),children:[e.jsx(Mn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>u(j),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(as,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),e.jsx("p",{className:"font-medium",children:f.api_provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"模型温度"}),e.jsx("p",{className:"font-medium",children:f.temperature!=null?f.temperature:e.jsx("span",{className:"text-muted-foreground",children:"默认"})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_in,"/M"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_out,"/M"]})]})]})]},p)})})}),Y_=Ss.memo(function({paginatedModels:n,allModels:i,filteredModels:c,selectedModels:u,onEdit:x,onDelete:h,onToggleSelection:f,onToggleSelectAll:p,isModelUsed:j,searchQuery:N}){return e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(_l,{children:[e.jsx(Sl,{children:e.jsxs(at,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Qs,{checked:u.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(Ye,{className:"w-24",children:"使用状态"}),e.jsx(Ye,{children:"模型名称"}),e.jsx(Ye,{children:"模型标识符"}),e.jsx(Ye,{children:"提供商"}),e.jsx(Ye,{className:"text-center",children:"温度"}),e.jsx(Ye,{className:"text-right",children:"输入价格"}),e.jsx(Ye,{className:"text-right",children:"输出价格"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Cl,{children:n.length===0?e.jsx(at,{children:e.jsx(Pe,{colSpan:9,className:"text-center text-muted-foreground py-8",children:N?"未找到匹配的模型":"暂无模型配置"})}):n.map((v,b)=>{const w=i.findIndex(L=>L===v),y=j(v.name);return e.jsxs(at,{children:[e.jsx(Pe,{children:e.jsx(Qs,{checked:u.has(w),onCheckedChange:()=>f(w)})}),e.jsx(Pe,{children:e.jsx(ke,{variant:y?"default":"secondary",className:y?"bg-green-600 hover:bg-green-700":"",children:y?"已使用":"未使用"})}),e.jsx(Pe,{className:"font-medium",children:v.name}),e.jsx(Pe,{className:"max-w-xs truncate",title:v.model_identifier,children:v.model_identifier}),e.jsx(Pe,{children:v.api_provider}),e.jsx(Pe,{className:"text-center",children:v.temperature!=null?v.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Pe,{className:"text-right",children:["¥",v.price_in,"/M"]}),e.jsxs(Pe,{className:"text-right",children:["¥",v.price_out,"/M"]}),e.jsx(Pe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>x(v,w),children:[e.jsx(Mn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>h(w),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(as,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},b)})})]})})})}),J_=300*1e3,cg=new Map,X_=[10,20,50,100],Z_=Ss.memo(function({page:n,pageSize:i,totalItems:c,jumpToPage:u,onPageChange:x,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:p,onSelectionClear:j}){const N=Math.ceil(c/i),v=w=>{h(parseInt(w)),x(1),j?.()},b=w=>{w.key==="Enter"&&p()};return c===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:i.toString(),onValueChange:v,children:[e.jsx(Oe,{id:"page-size-model",className:"w-20",children:e.jsx(Be,{})}),e.jsx(Re,{children:X_.map(w=>e.jsx(re,{value:w.toString(),children:w},w))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(n-1)*i+1," 到"," ",Math.min(n*i,c)," 条,共 ",c," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:n===1,className:"hidden sm:flex",children:e.jsx(Rr,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,n-1)),disabled:n===1,children:[e.jsx(el,{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(oe,{type:"number",value:u,onChange:w=>f(w.target.value),onKeyDown:b,placeholder:n.toString(),className:"w-16 h-8 text-center",min:1,max:N}),e.jsx(C,{variant:"outline",size:"sm",onClick:p,disabled:!u,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>x(n+1),disabled:n>=N,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>x(N),disabled:n>=N,className:"hidden sm:flex",children:e.jsx(Lr,{className:"h-4 w-4"})})]})]})});function W_(l){const{models:n,taskConfig:i,debounceMs:c=2e3,onSavingChange:u,onUnsavedChange:x}=l,h=m.useRef(null),f=m.useRef(null),p=m.useRef(!0),j=m.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),N=m.useCallback(w=>{const y={model_identifier:w.model_identifier,name:w.name,api_provider:w.api_provider,price_in:w.price_in??0,price_out:w.price_out??0,force_stream_mode:w.force_stream_mode??!1,extra_params:w.extra_params??{}};return w.temperature!=null&&(y.temperature=w.temperature),w.max_tokens!=null&&(y.max_tokens=w.max_tokens),y},[]),v=m.useCallback(async w=>{try{u?.(!0);const y=w.map(N);await Em("models",y),x?.(!1)}catch(y){console.error("自动保存模型列表失败:",y),x?.(!0)}finally{u?.(!1)}},[u,x,N]),b=m.useCallback(async w=>{try{u?.(!0),await Em("model_task_config",w),x?.(!1)}catch(y){console.error("自动保存任务配置失败:",y),x?.(!0)}finally{u?.(!1)}},[u,x]);return m.useEffect(()=>{if(!p.current)return x?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{v(n)},c),()=>{h.current&&clearTimeout(h.current)}},[n,v,c,x]),m.useEffect(()=>{if(!(p.current||!i))return x?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{b(i)},c),()=>{f.current&&clearTimeout(f.current)}},[i,b,c,x]),m.useEffect(()=>()=>{j()},[j]),{clearTimers:j,initialLoadRef:p}}function eS(l={}){const{onCloseEditDialog:n}=l,i=sa(),{registerTour:c,startTour:u,state:x,goToStep:h}=$m(),f=m.useRef(x.stepIndex);return m.useEffect(()=>{c(Ja,sv)},[c]),m.useEffect(()=>{if(x.activeTourId===Ja&&x.isRunning){const j=tv[x.stepIndex];j&&!window.location.pathname.endsWith(j.replace("/config/",""))&&i({to:j})}},[x.stepIndex,x.activeTourId,x.isRunning,i]),m.useEffect(()=>{if(x.activeTourId===Ja&&x.isRunning){const j=f.current,N=x.stepIndex;j>=12&&j<=17&&N<12&&n?.(),f.current=N}},[x.stepIndex,x.activeTourId,x.isRunning,n]),m.useEffect(()=>{if(x.activeTourId!==Ja||!x.isRunning)return;const j=N=>{const v=N.target,b=x.stepIndex;b===2&&v.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):b===9&&v.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):b===11&&v.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):b===17&&v.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):b===18&&v.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",j,!0),()=>document.removeEventListener("click",j,!0)},[x,h]),{startTour:m.useCallback(()=>{u(Ja)},[u]),isRunning:x.isRunning&&x.activeTourId===Ja,stepIndex:x.stepIndex}}function sS(l){const{getProviderConfig:n}=l,[i,c]=m.useState([]),[u,x]=m.useState(!1),[h,f]=m.useState(null),[p,j]=m.useState(null),N=m.useCallback(()=>{c([]),f(null),j(null)},[]),v=m.useCallback(async(b,w=!1)=>{const y=n(b);if(!y?.base_url){c([]),j(null),f('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!y.api_key){c([]),j(null),f('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const L=T_(y.base_url);if(j(L),!L?.modelFetcher){c([]),f(null);return}const D=`${b}:${y.base_url}`,k=cg.get(D);if(!w&&k&&Date.now()-k.timestampM(!1)}),{clearTimers:ie,initialLoadRef:Ee}=W_({models:l,taskConfig:p,onSavingChange:L,onUnsavedChange:k}),Vs=m.useCallback(async()=>{try{v(!0);const O=await Wl(),F=O.models||[];n(F),f(F.map(bs=>bs.name));const Le=O.api_providers||[];c(Le.map(bs=>bs.name)),x(Le),j(O.model_task_config||null);const Xs=O.model_task_config?.embedding?.model_list||[];Ce.current=[...Xs],k(!1),Ee.current=!1}catch(O){console.error("加载配置失败:",O)}finally{v(!1)}},[Ee]);m.useEffect(()=>{Vs()},[Vs]);const Vt=m.useCallback(O=>u.find(F=>F.name===O),[u]),{availableModels:Kt,fetchingModels:Qt,modelFetchError:fs,matchedTemplate:Is,fetchModelsForProvider:Y,clearModels:Fe}=sS({getProviderConfig:Vt});m.useEffect(()=>{V&&S?.api_provider&&Y(S.api_provider)},[V,S?.api_provider,Y]);const He=async()=>{await te()},qe=O=>{const F={model_identifier:O.model_identifier,name:O.name,api_provider:O.api_provider,price_in:O.price_in??0,price_out:O.price_out??0,force_stream_mode:O.force_stream_mode??!1,extra_params:O.extra_params??{}};return O.temperature!=null&&(F.temperature=O.temperature),O.max_tokens!=null&&(F.max_tokens=O.max_tokens),F},Ds=async()=>{try{w(!0),ie();const O=await Wl();O.models=l.map(qe),O.model_task_config=p,await Bi(O),k(!1),q({title:"保存成功",description:"正在重启麦麦..."}),await He()}catch(O){console.error("保存配置失败:",O),q({title:"保存失败",description:O.message,variant:"destructive"}),w(!1)}},Se=async()=>{try{w(!0),ie();const O=await Wl();O.models=l.map(qe),O.model_task_config=p,await Bi(O),k(!1),q({title:"保存成功",description:"模型配置已保存"}),await Vs()}catch(O){console.error("保存配置失败:",O),q({title:"保存失败",description:O.message,variant:"destructive"})}finally{w(!1)}},ns=(O,F)=>{De({}),E(O||{model_identifier:"",name:"",api_provider:i[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),A(F),M(!0)},Cs=()=>{if(!S)return;const O={};if(S.name?.trim()||(O.name="请输入模型名称"),S.api_provider?.trim()||(O.api_provider="请选择 API 提供商"),S.model_identifier?.trim()||(O.model_identifier="请输入模型标识符"),Object.keys(O).length>0){De(O);return}De({});const F={model_identifier:S.model_identifier,name:S.name,api_provider:S.api_provider,price_in:S.price_in??0,price_out:S.price_out??0,force_stream_mode:S.force_stream_mode??!1,extra_params:S.extra_params??{}};S.temperature!=null&&(F.temperature=S.temperature),S.max_tokens!=null&&(F.max_tokens=S.max_tokens);let Le,Xs=null;if(I!==null?(Xs=l[I].name,Le=[...l],Le[I]=F):Le=[...l,F],n(Le),f(Le.map(bs=>bs.name)),Xs&&Xs!==F.name&&p){const bs=Ws=>Ws.map(jt=>jt===Xs?F.name:jt);j({...p,utils:{...p.utils,model_list:bs(p.utils?.model_list||[])},utils_small:{...p.utils_small,model_list:bs(p.utils_small?.model_list||[])},tool_use:{...p.tool_use,model_list:bs(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:bs(p.replyer?.model_list||[])},planner:{...p.planner,model_list:bs(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:bs(p.vlm?.model_list||[])},voice:{...p.voice,model_list:bs(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:bs(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:bs(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:bs(p.lpmm_rdf_build?.model_list||[])},lpmm_qa:{...p.lpmm_qa,model_list:bs(p.lpmm_qa?.model_list||[])}})}M(!1),E(null),A(null),q({title:I!==null?"模型已更新":"模型已添加",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})},Ms=O=>{if(!O&&S){const F={...S,price_in:S.price_in??0,price_out:S.price_out??0};E(F)}M(O)},ss=O=>{de(O),G(!0)},es=()=>{if(ue!==null){const O=l.filter((F,Le)=>Le!==ue);n(O),f(O.map(F=>F.name)),q({title:"删除成功",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})}G(!1),de(null)},ps=O=>{const F=new Set(fe);F.has(O)?F.delete(O):F.add(O),ge(F)},mt=()=>{if(fe.size===Mt.length)ge(new Set);else{const O=Mt.map((F,Le)=>l.findIndex(Xs=>Xs===Mt[Le]));ge(new Set(O))}},zt=()=>{if(fe.size===0){q({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}K(!0)},nt=()=>{const O=fe.size,F=l.filter((Le,Xs)=>!fe.has(Xs));n(F),f(F.map(Le=>Le.name)),ge(new Set),K(!1),q({title:"批量删除成功",description:`已删除 ${O} 个模型,配置将在 2 秒后自动保存`})},ts=(O,F,Le)=>{if(p){if(O==="embedding"&&F==="model_list"&&Array.isArray(Le)){const Xs=Ce.current,bs=Le;if((Xs.length!==bs.length||Xs.some(jt=>!bs.includes(jt))||bs.some(jt=>!Xs.includes(jt)))&&Xs.length>0){Z.current={field:F,value:Le},xe(!0);return}}j({...p,[O]:{...p[O],[F]:Le}}),O==="embedding"&&F==="model_list"&&Array.isArray(Le)&&(Ce.current=[...Le])}},St=()=>{if(!p||!Z.current)return;const{field:O,value:F}=Z.current;j({...p,embedding:{...p.embedding,[O]:F}}),O==="model_list"&&Array.isArray(F)&&(Ce.current=[...F]),Z.current=null,xe(!1),q({title:"嵌入模型已更新",description:"建议重新生成知识库向量以确保最佳匹配精度"})},Lt=()=>{Z.current=null,xe(!1)},Mt=l.filter(O=>{if(!ve)return!0;const F=ve.toLowerCase();return O.name.toLowerCase().includes(F)||O.model_identifier.toLowerCase().includes(F)||O.api_provider.toLowerCase().includes(F)}),Fa=Math.ceil(Mt.length/H),Va=Mt.slice((B-1)*H,B*H),$n=()=>{const O=parseInt(je);O>=1&&O<=Fa&&(U(O),_e(""))},W=O=>p?[p.utils?.model_list||[],p.utils_small?.model_list||[],p.tool_use?.model_list||[],p.replyer?.model_list||[],p.planner?.model_list||[],p.vlm?.model_list||[],p.voice?.model_list||[],p.embedding?.model_list||[],p.lpmm_entity_extract?.model_list||[],p.lpmm_rdf_build?.model_list||[],p.lpmm_qa?.model_list||[]].some(Le=>Le.includes(O)):!1;return N?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(V_,{trigger:e.jsxs(C,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(jj,{className:"mr-2 h-4 w-4"}),"分享配置"]})}),e.jsxs(C,{onClick:Se,disabled:b||y||!D||Ae,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(Yi,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),b?"保存中...":y?"自动保存中...":D?"保存配置":"已保存"]}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsxs(C,{disabled:b||y||Ae,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(Qi,{className:"mr-2 h-4 w-4"}),Ae?"重启中...":D?"保存并重启":"重启麦麦"]})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认重启麦麦?"}),e.jsx(us,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:D?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:D?Ds:He,children:D?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsxs(ut,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(dt,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:Te,children:[e.jsx(Bw,{className:"h-4 w-4 text-primary"}),e.jsxs(ut,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(C,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(ua,{defaultValue:"models",className:"w-full",children:[e.jsxs(ea,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(We,{value:"models",children:"添加模型"}),e.jsx(We,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(vs,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[fe.size>0&&e.jsxs(C,{onClick:zt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(as,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",fe.size,")"]}),e.jsxs(C,{onClick:()=>ns(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(tt,{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(oe,{placeholder:"搜索模型名称、标识符或提供商...",value:ve,onChange:O=>ne(O.target.value),className:"pl-9"})]}),ve&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Mt.length," 个结果"]})]}),e.jsx(Q_,{paginatedModels:Va,allModels:l,onEdit:ns,onDelete:ss,isModelUsed:W,searchQuery:ve}),e.jsx(Y_,{paginatedModels:Va,allModels:l,filteredModels:Mt,selectedModels:fe,onEdit:ns,onDelete:ss,onToggleSelection:ps,onToggleSelectAll:mt,isModelUsed:W,searchQuery:ve}),e.jsx(Z_,{page:B,pageSize:H,totalItems:Mt.length,jumpToPage:je,onPageChange:U,onPageSizeChange:we,onJumpToPageChange:_e,onJumpToPage:$n,onSelectionClear:()=>ge(new Set)})]}),e.jsxs(vs,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),p&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx($a,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:p.utils,modelNames:h,onChange:(O,F)=>ts("utils",O,F),dataTour:"task-model-select"}),e.jsx($a,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:p.utils_small,modelNames:h,onChange:(O,F)=>ts("utils_small",O,F)}),e.jsx($a,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:p.tool_use,modelNames:h,onChange:(O,F)=>ts("tool_use",O,F)}),e.jsx($a,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:p.replyer,modelNames:h,onChange:(O,F)=>ts("replyer",O,F)}),e.jsx($a,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:p.planner,modelNames:h,onChange:(O,F)=>ts("planner",O,F)}),e.jsx($a,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:p.vlm,modelNames:h,onChange:(O,F)=>ts("vlm",O,F),hideTemperature:!0}),e.jsx($a,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:p.voice,modelNames:h,onChange:(O,F)=>ts("voice",O,F),hideTemperature:!0,hideMaxTokens:!0}),e.jsx($a,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:p.embedding,modelNames:h,onChange:(O,F)=>ts("embedding",O,F),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx($a,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(O,F)=>ts("lpmm_entity_extract",O,F)}),e.jsx($a,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(O,F)=>ts("lpmm_rdf_build",O,F)}),e.jsx($a,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:p.lpmm_qa,modelNames:h,onChange:(O,F)=>ts("lpmm_qa",O,F)})]})]})]})]}),e.jsx(Fs,{open:V,onOpenChange:Ms,children:e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Ie,children:[e.jsxs(Bs,{children:[e.jsx($s,{children:I!==null?"编辑模型":"添加模型"}),e.jsx(lt,{children:"配置模型的基本信息和参数"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[e.jsx(T,{htmlFor:"model_name",className:se.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(oe,{id:"model_name",value:S?.name||"",onChange:O=>{E(F=>F?{...F,name:O.target.value}:null),se.name&&De(F=>({...F,name:void 0}))},placeholder:"例如: qwen3-30b",className:se.name?"border-destructive focus-visible:ring-destructive":""}),se.name?e.jsx("p",{className:"text-xs text-destructive",children:se.name}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[e.jsx(T,{htmlFor:"api_provider",className:se.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Ue,{value:S?.api_provider||"",onValueChange:O=>{E(F=>F?{...F,api_provider:O}:null),Fe(),se.api_provider&&De(F=>({...F,api_provider:void 0}))},children:[e.jsx(Oe,{id:"api_provider",className:se.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Be,{placeholder:"选择提供商"})}),e.jsx(Re,{children:i.map(O=>e.jsx(re,{value:O,children:O},O))})]}),se.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:se.api_provider})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"model_identifier",className:se.model_identifier?"text-destructive":"",children:"模型标识符 *"}),Is?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{variant:"secondary",className:"text-xs",children:Is.display_name}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>S?.api_provider&&Y(S.api_provider,!0),disabled:Qt,children:Qt?e.jsx(Es,{className:"h-3 w-3 animate-spin"}):e.jsx(wt,{className:"h-3 w-3"})})]})]}),Is?.modelFetcher?e.jsxs(Za,{open:X,onOpenChange:be,children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",role:"combobox","aria-expanded":X,className:"w-full justify-between font-normal",disabled:Qt||!!fs,children:[Qt?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Es,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):fs?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):S?.model_identifier?e.jsx("span",{className:"truncate",children:S.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(Rm,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Pa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(Ho,{children:[e.jsx(Po,{placeholder:"搜索模型..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(Go,{className:"max-h-none overflow-visible",children:[e.jsx(Fo,{children:fs?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:fs}),!fs.includes("API Key")&&e.jsx(C,{variant:"link",size:"sm",onClick:()=>S?.api_provider&&Y(S.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(Gi,{heading:"可用模型",children:Kt.map(O=>e.jsxs(Fi,{value:O.id,onSelect:()=>{E(F=>F?{...F,model_identifier:O.id}:null),be(!1)},children:[e.jsx(yt,{className:`mr-2 h-4 w-4 ${S?.model_identifier===O.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:O.id}),O.name!==O.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:O.name})]})]},O.id))}),e.jsx(Gi,{heading:"手动输入",children:e.jsxs(Fi,{value:"__manual_input__",onSelect:()=>{be(!1)},children:[e.jsx(Mn,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(oe,{id:"model_identifier",value:S?.model_identifier||"",onChange:O=>{E(F=>F?{...F,model_identifier:O.target.value}:null),se.model_identifier&&De(F=>({...F,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:se.model_identifier?"border-destructive focus-visible:ring-destructive":""}),se.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:se.model_identifier}),fs&&Is?.modelFetcher&&!se.model_identifier&&e.jsxs(dt,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(ut,{className:"text-xs",children:fs})]}),Is?.modelFetcher&&e.jsx(oe,{value:S?.model_identifier||"",onChange:O=>{E(F=>F?{...F,model_identifier:O.target.value}:null),se.model_identifier&&De(F=>({...F,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${se.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!se.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:fs?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':Is?.modelFetcher?`已识别为 ${Is.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(oe,{id:"price_in",type:"number",step:"0.1",min:"0",value:S?.price_in??"",onChange:O=>{const F=O.target.value===""?null:parseFloat(O.target.value);E(Le=>Le?{...Le,price_in:F}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(oe,{id:"price_out",type:"number",step:"0.1",min:"0",value:S?.price_out??"",onChange:O=>{const F=O.target.value===""?null:parseFloat(O.target.value);E(Le=>Le?{...Le,price_out:F}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Ge,{id:"enable_model_temperature",checked:S?.temperature!=null,onCheckedChange:O=>{E(O?F=>F?{...F,temperature:.5}:null:F=>F?{...F,temperature:null}:null)}})]}),S?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:S.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(Na,{value:[S.temperature],onValueChange:O=>E(F=>F?{...F,temperature:O[0]}:null),min:0,max:1,step:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Ge,{id:"enable_model_max_tokens",checked:S?.max_tokens!=null,onCheckedChange:O=>{E(O?F=>F?{...F,max_tokens:2048}:null:F=>F?{...F,max_tokens:null}:null)}})]}),S?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"最大 Token 数"}),e.jsx(oe,{type:"number",min:"1",max:"128000",value:S.max_tokens,onChange:O=>{const F=parseInt(O.target.value);!isNaN(F)&&F>=1&&E(Le=>Le?{...Le,max_tokens:F}:null)},className:"w-28 h-8 text-sm"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"限制模型单次输出的最大 token 数量,不同模型支持的上限不同"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"force_stream_mode",checked:S?.force_stream_mode||!1,onCheckedChange:O=>E(F=>F?{...F,force_stream_mode:O}:null)}),e.jsx(T,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsx(R_,{value:S?.extra_params||{},onChange:O=>E(F=>F?{...F,extra_params:O}:null),placeholder:"添加额外参数(如 enable_thinking、top_p 等)..."})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>M(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(C,{onClick:Cs,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(hs,{open:J,onOpenChange:G,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:['确定要删除模型 "',ue!==null?l[ue]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:es,children:"删除"})]})]})}),e.jsx(hs,{open:z,onOpenChange:K,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认批量删除"}),e.jsxs(us,{children:["确定要删除选中的 ",fe.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:nt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(hs,{open:ee,onOpenChange:xe,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsxs(ds,{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-5 w-5 text-amber-500"}),"更换嵌入模型警告"]}),e.jsx(us,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"注意:"}),"更换嵌入模型可能会影响知识库的匹配精度!"]}),e.jsxs("ul",{className:"space-y-2 ml-4 list-disc text-muted-foreground",children:[e.jsx("li",{children:"不同的嵌入模型会产生不同的向量表示"}),e.jsx("li",{children:"这可能导致现有知识库的检索结果不准确"}),e.jsx("li",{children:"建议更换嵌入模型后重新生成所有知识库的向量"})]}),e.jsx("p",{className:"text-foreground font-medium",children:"确定要更换嵌入模型吗?"})]})})]}),e.jsxs(os,{children:[e.jsx(xs,{onClick:Lt,children:"取消"}),e.jsx(ms,{onClick:St,className:"bg-amber-600 hover:bg-amber-700",children:"确认更换"})]})]})}),e.jsx(Bn,{})]})})}const Vi=Lg,qi=E0,Ki=M0,Vo="/api/webui/config";async function lS(){const n=await(await ye(`${Vo}/adapter-config/path`)).json();return!n.success||!n.path?null:{path:n.path,lastModified:n.lastModified}}async function og(l){const i=await(await ye(`${Vo}/adapter-config/path`,{method:"POST",headers:zs(),body:JSON.stringify({path:l})})).json();if(!i.success)throw new Error(i.message||"保存路径失败")}async function dg(l){const i=await(await ye(`${Vo}/adapter-config?path=${encodeURIComponent(l)}`)).json();if(!i.success)throw new Error("读取配置文件失败");return i.content}async function ug(l,n){const c=await(await ye(`${Vo}/adapter-config`,{method:"POST",headers:zs(),body:JSON.stringify({path:l,content:n})})).json();if(!c.success)throw new Error(c.message||"保存配置失败")}const ft={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"}},vm={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:Xt},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:$w}};function nS(l,n){let i=l.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function rS(l,n,i){let c=l.split(/\r\n|\n|\r/g),u="",x=(Math.log10(n+1)|0)+1;for(let h=n-1;h<=n+1;h++){let f=c[h-1];f&&(u+=h.toString().padEnd(x," "),u+=": ",u+=f,u+=` +`,h===n&&(u+=" ".repeat(x+i+2),u+=`^ +`))}return u}class Ns extends Error{line;column;codeblock;constructor(n,i){const[c,u]=nS(i.toml,i.ptr),x=rS(i.toml,c,u);super(`Invalid TOML document: ${n} + +${x}`,i),this.line=c,this.column=u,this.codeblock=x}}function iS(l,n){let i=0;for(;l[n-++i]==="\\";);return--i&&i%2}function Mo(l,n=0,i=l.length){let c=l.indexOf(` +`,n);return l[c-1]==="\r"&&c--,c<=i?c:-1}function Im(l,n){for(let i=n;i-1&&i!=="'"&&iS(l,n));return n>-1&&(n+=c.length,c.length>1&&(l[n]===i&&n++,l[n]===i&&n++)),n}let cS=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Er extends Date{#s=!1;#t=!1;#e=null;constructor(n){let i=!0,c=!0,u="Z";if(typeof n=="string"){let x=n.match(cS);x?(x[1]||(i=!1,n=`0000-01-01T${n}`),c=!!x[2],c&&n[10]===" "&&(n=n.replace(" ","T")),x[2]&&+x[2]>23?n="":(u=x[3]||null,n=n.toUpperCase(),!u&&c&&(n+="Z"))):n=""}super(n),isNaN(this.getTime())||(this.#s=i,this.#t=c,this.#e=u)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let n=super.toISOString();if(this.isDate())return n.slice(0,10);if(this.isTime())return n.slice(11,23);if(this.#e===null)return n.slice(0,-1);if(this.#e==="Z")return n;let i=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return i=this.#e[0]==="-"?i:-i,new Date(this.getTime()-i*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(n,i="Z"){let c=new Er(n);return c.#e=i,c}static wrapAsLocalDateTime(n){let i=new Er(n);return i.#e=null,i}static wrapAsLocalDate(n){let i=new Er(n);return i.#t=!1,i.#e=null,i}static wrapAsLocalTime(n){let i=new Er(n);return i.#s=!1,i.#e=null,i}}let oS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,dS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,uS=/^[+-]?0[0-9_]/,mS=/^[0-9a-f]{4,8}$/i,xg={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function ov(l,n=0,i=l.length){let c=l[n]==="'",u=l[n++]===l[n]&&l[n]===l[n+1];u&&(i-=2,l[n+=2]==="\r"&&n++,l[n]===` +`&&n++);let x=0,h,f="",p=n;for(;n-1&&(Im(l,x),u=u.slice(0,x));let h=u.trimEnd();if(!c){let f=u.indexOf(` +`,h.length);if(f>-1)throw new Ns("newlines are not allowed in inline tables",{toml:l,ptr:n+f})}return[h,x]}function Hm(l,n,i,c,u){if(c===0)throw new Ns("document contains excessively nested structures. aborting.",{toml:l,ptr:n});let x=l[n];if(x==="["||x==="{"){let[p,j]=x==="["?gS(l,n,c,u):pS(l,n,c,u),N=i?mg(l,j,",",i):j;if(j-N&&i==="}"){let v=Mo(l,j,N);if(v>-1)throw new Ns("newlines are not allowed in inline tables",{toml:l,ptr:v})}return[p,N]}let h;if(x==='"'||x==="'"){h=cv(l,n);let p=ov(l,n,h);if(i){if(h=yl(l,h,i!=="]"),l[h]&&l[h]!==","&&l[h]!==i&&l[h]!==` +`&&l[h]!=="\r")throw new Ns("unexpected character encountered",{toml:l,ptr:h});h+=+(l[h]===",")}return[p,h]}h=mg(l,n,",",i);let f=hS(l,n,h-+(l[h-1]===","),i==="]");if(!f[0])throw new Ns("incomplete key-value declaration: no value specified",{toml:l,ptr:n});return i&&f[1]>-1&&(h=yl(l,n+f[1]),h+=+(l[h]===",")),[xS(f[0],l,n,u),h]}let fS=/^[a-zA-Z0-9-_]+[ \t]*$/;function Mm(l,n,i="="){let c=n-1,u=[],x=l.indexOf(i,n);if(x<0)throw new Ns("incomplete key-value: cannot find end of key",{toml:l,ptr:n});do{let h=l[n=++c];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===l[n+1]&&h===l[n+2])throw new Ns("multiline strings are not allowed in keys",{toml:l,ptr:n});let f=cv(l,n);if(f<0)throw new Ns("unfinished string encountered",{toml:l,ptr:n});c=l.indexOf(".",f);let p=l.slice(f,c<0||c>x?x:c),j=Mo(p);if(j>-1)throw new Ns("newlines are not allowed in keys",{toml:l,ptr:n+c+j});if(p.trimStart())throw new Ns("found extra tokens after the string part",{toml:l,ptr:f});if(xx?x:c);if(!fS.test(f))throw new Ns("only letter, numbers, dashes and underscores are allowed in keys",{toml:l,ptr:n});u.push(f.trimEnd())}}while(c+1&&cu===""||u===null||u===void 0?x:u,i={inner:{version:n(l.inner.version,ft.inner.version)},nickname:{nickname:n(l.nickname.nickname,ft.nickname.nickname)},napcat_server:{host:n(l.napcat_server.host,ft.napcat_server.host),port:n(l.napcat_server.port||0,ft.napcat_server.port),token:n(l.napcat_server.token,ft.napcat_server.token),heartbeat_interval:n(l.napcat_server.heartbeat_interval||0,ft.napcat_server.heartbeat_interval)},maibot_server:{host:n(l.maibot_server.host,ft.maibot_server.host),port:n(l.maibot_server.port||0,ft.maibot_server.port)},chat:{group_list_type:n(l.chat.group_list_type,ft.chat.group_list_type),group_list:l.chat.group_list||[],private_list_type:n(l.chat.private_list_type,ft.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??ft.chat.ban_qq_bot,enable_poke:l.chat.enable_poke??ft.chat.enable_poke},voice:{use_tts:l.voice.use_tts??ft.voice.use_tts},debug:{level:n(l.debug.level,ft.debug.level)}};let c=yS(i);return c=wS(c),c}catch(n){throw console.error("TOML 生成失败:",n),new Error(`无法生成 TOML 文件: ${n instanceof Error?n.message:"未知错误"}`)}}function wS(l){const n=l.split(` +`),i=[];for(let c=0;c"|?*\x00-\x1F]/.test(l)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function _S(){const[l,n]=m.useState("upload"),[i,c]=m.useState(null),[u,x]=m.useState(""),[h,f]=m.useState(""),[p,j]=m.useState("oneclick"),[N,v]=m.useState(""),[b,w]=m.useState(!1),[y,L]=m.useState(!1),[D,k]=m.useState(!1),[V,M]=m.useState(!1),[S,E]=m.useState(null),[I,A]=m.useState(!1),J=m.useRef(null),{toast:G}=Js(),ue=m.useRef(null),de=ee=>{if(f(ee),ee.trim()){const xe=ym(ee);v(xe.error)}else v("")},ve=m.useCallback(async ee=>{const xe=vm[ee];L(!0);try{const Ce=await dg(xe.path),Z=Nm(Ce);c(Z),j(ee),f(xe.path),await og(xe.path),G({title:"加载成功",description:`已从${xe.name}预设加载配置`})}catch(Ce){console.error("加载预设配置失败:",Ce),G({title:"加载失败",description:Ce instanceof Error?Ce.message:"无法读取预设配置文件",variant:"destructive"})}finally{L(!1)}},[G]),ne=m.useCallback(async ee=>{const xe=ym(ee);if(!xe.valid){v(xe.error),G({title:"路径无效",description:xe.error,variant:"destructive"});return}v(""),L(!0);try{const Ce=await dg(ee),Z=Nm(Ce);c(Z),f(ee),await og(ee),G({title:"加载成功",description:"已从配置文件加载"})}catch(Ce){console.error("加载配置失败:",Ce),G({title:"加载失败",description:Ce instanceof Error?Ce.message:"无法读取配置文件",variant:"destructive"})}finally{L(!1)}},[G]);m.useEffect(()=>{(async()=>{try{const xe=await lS();if(xe&&xe.path){f(xe.path);const Ce=Object.entries(vm).find(([,Z])=>Z.path===xe.path);Ce?(n("preset"),j(Ce[0]),await ve(Ce[0])):(n("path"),await ne(xe.path))}}catch(xe){console.error("加载保存的路径失败:",xe)}})()},[ne,ve]);const fe=m.useCallback(ee=>{l!=="path"&&l!=="preset"||!h||(ue.current&&clearTimeout(ue.current),ue.current=setTimeout(async()=>{w(!0);try{const xe=bm(ee);await ug(h,xe),G({title:"自动保存成功",description:"配置已保存到文件"})}catch(xe){console.error("自动保存失败:",xe),G({title:"自动保存失败",description:xe instanceof Error?xe.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},1e3))},[l,h,G]),ge=async()=>{if(!i||!h)return;const ee=ym(h);if(!ee.valid){G({title:"保存失败",description:ee.error,variant:"destructive"});return}w(!0);try{const xe=bm(i);await ug(h,xe),G({title:"保存成功",description:"配置已保存到文件"})}catch(xe){console.error("保存失败:",xe),G({title:"保存失败",description:xe instanceof Error?xe.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},z=async()=>{h&&await ne(h)},K=ee=>{if(ee!==l){if(i){E(ee),k(!0);return}B(ee)}},B=ee=>{c(null),x(""),v(""),n(ee),ee==="preset"&&ve("oneclick"),G({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[ee]})},U=()=>{S&&(B(S),E(null)),k(!1)},H=()=>{if(i){M(!0);return}we()},we=()=>{f(""),c(null),v(""),G({title:"已清空",description:"路径和配置已清空"})},je=()=>{we(),M(!1)},_e=ee=>{const xe=ee.target.files?.[0];if(!xe)return;const Ce=new FileReader;Ce.onload=Z=>{try{const se=Z.target?.result,De=Nm(se);c(De),x(xe.name),G({title:"上传成功",description:`已加载配置文件:${xe.name}`})}catch(se){console.error("解析配置文件失败:",se),G({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},Ce.readAsText(xe)},X=()=>{if(!i)return;const ee=bm(i),xe=new Blob([ee],{type:"text/plain;charset=utf-8"}),Ce=URL.createObjectURL(xe),Z=document.createElement("a");Z.href=Ce,Z.download=u||"config.toml",document.body.appendChild(Z),Z.click(),document.body.removeChild(Z),URL.revokeObjectURL(Ce),G({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},be=()=>{c(JSON.parse(JSON.stringify(ft))),x("config.toml"),G({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(_t,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(Vi,{open:I,onOpenChange:A,children:e.jsxs(Me,{children:[e.jsx(Je,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Xe,{children:"工作模式"}),e.jsx(Ls,{children:"选择配置文件的管理方式"})]}),e.jsx(qi,{asChild:!0,children:e.jsxs(C,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(Oa,{className:`h-4 w-4 transition-transform duration-200 ${I?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(Ki,{children:e.jsxs(Ke,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${l==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>K("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(Xt,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${l==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>K("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(Hi,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${l==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>K("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(Iw,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),l==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(T,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(vm).map(([ee,xe])=>{const Ce=xe.icon,Z=p===ee;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${Z?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{j(ee),ve(ee)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ce,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:xe.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:xe.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:xe.path})]})]})},ee)})})]}),l==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(oe,{id:"config-path",value:h,onChange:ee=>de(ee.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${N?"border-destructive":""}`}),N&&e.jsx("p",{className:"text-xs text-destructive",children:N})]}),e.jsx(C,{onClick:()=>ne(h),disabled:y||!h||!!N,className:"w-full sm:w-auto",children:y?e.jsxs(e.Fragment,{children:[e.jsx(wt,{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(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(ut,{children:l==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",b&&" (正在保存...)"]}):l==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",b&&" (正在保存...)"]})})]}),l==="upload"&&!i&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:J,type:"file",accept:".toml",className:"hidden",onChange:_e}),e.jsxs(C,{onClick:()=>J.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Hi,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(C,{onClick:be,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ia,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),l==="upload"&&i&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(C,{onClick:X,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(qt,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(l==="preset"||l==="path")&&i&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(C,{onClick:ge,size:"sm",disabled:b||!!N,className:"w-full sm:w-auto",children:[e.jsx(Yi,{className:"mr-2 h-4 w-4"}),b?"保存中...":"立即保存"]}),e.jsxs(C,{onClick:z,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[e.jsx(wt,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),l==="path"&&e.jsxs(C,{onClick:H,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(as,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),i?e.jsxs(ua,{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(ea,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(We,{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(We,{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(We,{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(We,{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(We,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(vs,{value:"napcat",className:"space-y-4",children:e.jsx(SS,{config:i,onChange:ee=>{c(ee),fe(ee)}})}),e.jsx(vs,{value:"maibot",className:"space-y-4",children:e.jsx(CS,{config:i,onChange:ee=>{c(ee),fe(ee)}})}),e.jsx(vs,{value:"chat",className:"space-y-4",children:e.jsx(kS,{config:i,onChange:ee=>{c(ee),fe(ee)}})}),e.jsx(vs,{value:"voice",className:"space-y-4",children:e.jsx(TS,{config:i,onChange:ee=>{c(ee),fe(ee)}})}),e.jsx(vs,{value:"debug",className:"space-y-4",children:e.jsx(ES,{config:i,onChange:ee=>{c(ee),fe(ee)}})})]}):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(Ia,{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(hs,{open:D,onOpenChange:k,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认切换模式"}),e.jsxs(us,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(os,{children:[e.jsx(xs,{onClick:()=>{k(!1),E(null)},children:"取消"}),e.jsx(ms,{onClick:U,children:"确认切换"})]})]})}),e.jsx(hs,{open:V,onOpenChange:M,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认清空路径"}),e.jsxs(us,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(os,{children:[e.jsx(xs,{onClick:()=>M(!1),children:"取消"}),e.jsx(ms,{onClick:je,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function SS({config:l,onChange:n}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(oe,{id:"napcat-host",value:l.napcat_server.host,onChange:i=>n({...l,napcat_server:{...l.napcat_server,host:i.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(oe,{id:"napcat-port",type:"number",value:l.napcat_server.port||"",onChange:i=>n({...l,napcat_server:{...l.napcat_server,port:i.target.value?parseInt(i.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(oe,{id:"napcat-token",type:"password",value:l.napcat_server.token,onChange:i=>n({...l,napcat_server:{...l.napcat_server,token:i.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(oe,{id:"napcat-heartbeat",type:"number",value:l.napcat_server.heartbeat_interval||"",onChange:i=>n({...l,napcat_server:{...l.napcat_server,heartbeat_interval:i.target.value?parseInt(i.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function CS({config:l,onChange:n}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(oe,{id:"maibot-host",value:l.maibot_server.host,onChange:i=>n({...l,maibot_server:{...l.maibot_server,host:i.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(oe,{id:"maibot-port",type:"number",value:l.maibot_server.port||"",onChange:i=>n({...l,maibot_server:{...l.maibot_server,port:i.target.value?parseInt(i.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function kS({config:l,onChange:n}){const i=x=>{const h={...l};x==="group"?h.chat.group_list=[...h.chat.group_list,0]:x==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],n(h)},c=(x,h)=>{const f={...l};x==="group"?f.chat.group_list=f.chat.group_list.filter((p,j)=>j!==h):x==="private"?f.chat.private_list=f.chat.private_list.filter((p,j)=>j!==h):f.chat.ban_user_id=f.chat.ban_user_id.filter((p,j)=>j!==h),n(f)},u=(x,h,f)=>{const p={...l};x==="group"?p.chat.group_list[h]=f:x==="private"?p.chat.private_list[h]=f:p.chat.ban_user_id[h]=f,n(p)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Ue,{value:l.chat.group_list_type,onValueChange:x=>n({...l,chat:{...l.chat,group_list_type:x}}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(re,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(C,{onClick:()=>i("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ia,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),l.chat.group_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{type:"number",value:x,onChange:f=>u("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>c("group",h),children:"删除"})]})]})]})]},h)),l.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Ue,{value:l.chat.private_list_type,onValueChange:x=>n({...l,chat:{...l.chat,private_list_type:x}}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(re,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(C,{onClick:()=>i("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ia,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.private_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{type:"number",value:x,onChange:f=>u("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>c("private",h),children:"删除"})]})]})]})]},h)),l.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"全局禁止名单"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),e.jsxs(C,{onClick:()=>i("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ia,{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(oe,{type:"number",value:x,onChange:f=>u("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(hs,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(as,{className:"h-4 w-4"})})}),e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>c("ban",h),children:"删除"})]})]})]})]},h)),l.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Ge,{checked:l.chat.ban_qq_bot,onCheckedChange:x=>n({...l,chat:{...l.chat,ban_qq_bot:x}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Ge,{checked:l.chat.enable_poke,onCheckedChange:x=>n({...l,chat:{...l.chat,enable_poke:x}})})]})]})]})})}function TS({config:l,onChange:n}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Ge,{checked:l.voice.use_tts,onCheckedChange:i=>n({...l,voice:{use_tts:i}})})]})]})})}function ES({config:l,onChange:n}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Ue,{value:l.debug.level,onValueChange:i=>n({...l,debug:{level:i}}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(re,{value:"INFO",children:"INFO(信息)"}),e.jsx(re,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(re,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(re,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const MS=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],AS=/^(aria-|data-)/,mv=l=>Object.fromEntries(Object.entries(l).filter(([n])=>AS.test(n)||MS.includes(n)));function zS(l,n){const i=mv(l);return Object.keys(l).some(c=>!Object.hasOwn(i,c)&&l[c]!==n[c])}class DS extends m.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(n){if(n.uppy!==this.props.uppy)this.uninstallPlugin(n),this.installPlugin();else if(zS(this.props,n)){const{uppy:i,...c}={...this.props,target:this.container};this.plugin.setOptions(c)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:n,...i}={id:"Dashboard",...this.props,inline:!0,target:this.container};n.use(f1,i),this.plugin=n.getPlugin(i.id)}uninstallPlugin(n=this.props){const{uppy:i}=n;i.removePlugin(this.plugin)}render(){return m.createElement("div",{className:"uppy-Container",ref:n=>{this.container=n},...mv(this.props)})}}function OS({src:l,alt:n="表情包",className:i,maxRetries:c=5,retryInterval:u=1500}){const[x,h]=m.useState("loading"),[f,p]=m.useState(0),[j,N]=m.useState(null),[v,b]=m.useState(l);l!==v&&(h("loading"),p(0),N(null),b(l));const w=m.useCallback(async()=>{try{const y=await fetch(l,{credentials:"include"});if(y.status===202){h("generating"),f{p(k=>k+1)},u):h("error");return}if(!y.ok){h("error");return}const L=await y.blob(),D=URL.createObjectURL(L);N(D),h("loaded")}catch(y){console.error("加载缩略图失败:",y),h("error")}},[l,f,c,u]);return m.useEffect(()=>{w()},[w]),m.useEffect(()=>()=>{j&&URL.revokeObjectURL(j)},[j]),x==="loading"||x==="generating"?e.jsx(Ks,{className:$("w-full h-full",i)}):x==="error"||!j?e.jsx("div",{className:$("w-full h-full flex items-center justify-center bg-muted",i),children:e.jsx(vj,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:j,alt:n,className:$("w-full h-full object-contain",i)})}function RS({children:l,className:n}){return e.jsx(Bm,{content:l,className:n})}const Ra="/api/webui/emoji";async function LS(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.is_registered!==void 0&&n.append("is_registered",l.is_registered.toString()),l.is_banned!==void 0&&n.append("is_banned",l.is_banned.toString()),l.format&&n.append("format",l.format),l.sort_by&&n.append("sort_by",l.sort_by),l.sort_order&&n.append("sort_order",l.sort_order);const i=await ye(`${Ra}/list?${n}`,{});if(!i.ok)throw new Error(`获取表情包列表失败: ${i.statusText}`);return i.json()}async function US(l){const n=await ye(`${Ra}/${l}`,{});if(!n.ok)throw new Error(`获取表情包详情失败: ${n.statusText}`);return n.json()}async function BS(l,n){const i=await ye(`${Ra}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok)throw new Error(`更新表情包失败: ${i.statusText}`);return i.json()}async function $S(l){const n=await ye(`${Ra}/${l}`,{method:"DELETE"});if(!n.ok)throw new Error(`删除表情包失败: ${n.statusText}`);return n.json()}async function IS(){const l=await ye(`${Ra}/stats/summary`,{});if(!l.ok)throw new Error(`获取统计数据失败: ${l.statusText}`);return l.json()}async function HS(l){const n=await ye(`${Ra}/${l}/register`,{method:"POST"});if(!n.ok)throw new Error(`注册表情包失败: ${n.statusText}`);return n.json()}async function PS(l){const n=await ye(`${Ra}/${l}/ban`,{method:"POST"});if(!n.ok)throw new Error(`封禁表情包失败: ${n.statusText}`);return n.json()}function GS(l,n=!1){return n?`${Ra}/${l}/thumbnail?original=true`:`${Ra}/${l}/thumbnail`}function FS(l){return`${Ra}/${l}/thumbnail?original=true`}async function VS(l){const n=await ye(`${Ra}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function qS(){return`${Ra}/upload`}function KS(){const[l,n]=m.useState([]),[i,c]=m.useState(null),[u,x]=m.useState(!1),[h,f]=m.useState(1),[p,j]=m.useState(0),[N,v]=m.useState(20),[b,w]=m.useState("all"),[y,L]=m.useState("all"),[D,k]=m.useState("all"),[V,M]=m.useState("usage_count"),[S,E]=m.useState("desc"),[I,A]=m.useState(null),[J,G]=m.useState(!1),[ue,de]=m.useState(!1),[ve,ne]=m.useState(!1),[fe,ge]=m.useState(new Set),[z,K]=m.useState(!1),[B,U]=m.useState(""),[H,we]=m.useState("medium"),[je,_e]=m.useState(!1),{toast:X}=Js(),be=m.useCallback(async()=>{try{x(!0);const ie=await LS({page:h,page_size:N,is_registered:b==="all"?void 0:b==="registered",is_banned:y==="all"?void 0:y==="banned",format:D==="all"?void 0:D,sort_by:V,sort_order:S});n(ie.data),j(ie.total)}catch(ie){const Ee=ie instanceof Error?ie.message:"加载表情包列表失败";X({title:"错误",description:Ee,variant:"destructive"})}finally{x(!1)}},[h,N,b,y,D,V,S,X]),ee=async()=>{try{const ie=await IS();c(ie.data)}catch(ie){console.error("加载统计数据失败:",ie)}};m.useEffect(()=>{be()},[be]),m.useEffect(()=>{ee()},[]);const xe=async ie=>{try{const Ee=await US(ie.id);A(Ee.data),G(!0)}catch(Ee){const Vs=Ee instanceof Error?Ee.message:"加载详情失败";X({title:"错误",description:Vs,variant:"destructive"})}},Ce=ie=>{A(ie),de(!0)},Z=ie=>{A(ie),ne(!0)},se=async()=>{if(I)try{await $S(I.id),X({title:"成功",description:"表情包已删除"}),ne(!1),A(null),be(),ee()}catch(ie){const Ee=ie instanceof Error?ie.message:"删除失败";X({title:"错误",description:Ee,variant:"destructive"})}},De=async ie=>{try{await HS(ie.id),X({title:"成功",description:"表情包已注册"}),be(),ee()}catch(Ee){const Vs=Ee instanceof Error?Ee.message:"注册失败";X({title:"错误",description:Vs,variant:"destructive"})}},q=async ie=>{try{await PS(ie.id),X({title:"成功",description:"表情包已封禁"}),be(),ee()}catch(Ee){const Vs=Ee instanceof Error?Ee.message:"封禁失败";X({title:"错误",description:Vs,variant:"destructive"})}},te=ie=>{const Ee=new Set(fe);Ee.has(ie)?Ee.delete(ie):Ee.add(ie),ge(Ee)},Ae=async()=>{try{const ie=await VS(Array.from(fe));X({title:"批量删除完成",description:ie.message}),ge(new Set),K(!1),be(),ee()}catch(ie){X({title:"批量删除失败",description:ie instanceof Error?ie.message:"批量删除失败",variant:"destructive"})}},Te=()=>{const ie=parseInt(B),Ee=Math.ceil(p/N);ie>=1&&ie<=Ee?(f(ie),U("")):X({title:"无效的页码",description:`请输入1-${Ee}之间的页码`,variant:"destructive"})},Ie=i?.formats?Object.keys(i.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),e.jsxs(C,{onClick:()=>_e(!0),className:"gap-2",children:[e.jsx(Hi,{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:[i&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Me,{children:e.jsxs(Je,{className:"pb-2",children:[e.jsx(Ls,{children:"总数"}),e.jsx(Xe,{className:"text-2xl",children:i.total})]})}),e.jsx(Me,{children:e.jsxs(Je,{className:"pb-2",children:[e.jsx(Ls,{children:"已注册"}),e.jsx(Xe,{className:"text-2xl text-green-600",children:i.registered})]})}),e.jsx(Me,{children:e.jsxs(Je,{className:"pb-2",children:[e.jsx(Ls,{children:"已封禁"}),e.jsx(Xe,{className:"text-2xl text-red-600",children:i.banned})]})}),e.jsx(Me,{children:e.jsxs(Je,{className:"pb-2",children:[e.jsx(Ls,{children:"未注册"}),e.jsx(Xe,{className:"text-2xl text-gray-600",children:i.unregistered})]})})]}),e.jsxs(Me,{children:[e.jsx(Je,{children:e.jsxs(Xe,{className:"flex items-center gap-2",children:[e.jsx(No,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(Ke,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"排序方式"}),e.jsxs(Ue,{value:`${V}-${S}`,onValueChange:ie=>{const[Ee,Vs]=ie.split("-");M(Ee),E(Vs),f(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(re,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(re,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(re,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(re,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(re,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(re,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(re,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"注册状态"}),e.jsxs(Ue,{value:b,onValueChange:ie=>{w(ie),f(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部"}),e.jsx(re,{value:"registered",children:"已注册"}),e.jsx(re,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"封禁状态"}),e.jsxs(Ue,{value:y,onValueChange:ie=>{L(ie),f(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部"}),e.jsx(re,{value:"banned",children:"已封禁"}),e.jsx(re,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"格式"}),e.jsxs(Ue,{value:D,onValueChange:ie=>{k(ie),f(1)},children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部"}),Ie.map(ie=>e.jsxs(re,{value:ie,children:[ie.toUpperCase()," (",i?.formats[ie],")"]},ie))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[fe.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",fe.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Ue,{value:H,onValueChange:ie=>we(ie),children:[e.jsx(Oe,{className:"w-24",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"small",children:"小"}),e.jsx(re,{value:"medium",children:"中"}),e.jsx(re,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:N.toString(),onValueChange:ie=>{v(parseInt(ie)),f(1),ge(new Set)},children:[e.jsx(Oe,{id:"emoji-page-size",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"20",children:"20"}),e.jsx(re,{value:"40",children:"40"}),e.jsx(re,{value:"60",children:"60"}),e.jsx(re,{value:"100",children:"100"})]})]}),fe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>ge(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:()=>K(!0),children:[e.jsx(as,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(C,{variant:"outline",size:"sm",onClick:be,disabled:u,children:[e.jsx(wt,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"表情包列表"}),e.jsxs(Ls,{children:["共 ",p," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(Ke,{children:[l.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${H==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":H==="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(ie=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${fe.has(ie.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>te(ie.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${fe.has(ie.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${fe.has(ie.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:fe.has(ie.id)&&e.jsx(Zt,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[ie.is_registered&&e.jsx(ke,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),ie.is_banned&&e.jsx(ke,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${H==="small"?"p-1":H==="medium"?"p-2":"p-3"}`,children:e.jsx(OS,{src:GS(ie.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${H==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(ke,{variant:"outline",className:"text-[10px] px-1 py-0",children:ie.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[ie.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${H==="small"?"flex-wrap":""}`,children:[e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ee=>{Ee.stopPropagation(),Ce(ie)},title:"编辑",children:e.jsx(Dn,{className:"h-3 w-3"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ee=>{Ee.stopPropagation(),xe(ie)},title:"详情",children:e.jsx(Gt,{className:"h-3 w-3"})}),!ie.is_registered&&e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Ee=>{Ee.stopPropagation(),De(ie)},title:"注册",children:e.jsx(Zt,{className:"h-3 w-3"})}),!ie.is_banned&&e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Ee=>{Ee.stopPropagation(),q(ie)},title:"封禁",children:e.jsx(Hw,{className:"h-3 w-3"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Ee=>{Ee.stopPropagation(),Z(ie)},title:"删除",children:e.jsx(as,{className:"h-3 w-3"})})]})]})]},ie.id))}),p>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(h-1)*N+1," 到"," ",Math.min(h*N,p)," 条,共 ",p," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Rr,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(ie=>Math.max(1,ie-1)),disabled:h===1,children:[e.jsx(el,{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(oe,{type:"number",value:B,onChange:ie=>U(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&Te(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/N)}),e.jsx(C,{variant:"outline",size:"sm",onClick:Te,disabled:!B,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(ie=>ie+1),disabled:h>=Math.ceil(p/N),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(p/N)),disabled:h>=Math.ceil(p/N),className:"hidden sm:flex",children:e.jsx(Lr,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(QS,{emoji:I,open:J,onOpenChange:G}),e.jsx(YS,{emoji:I,open:ue,onOpenChange:de,onSuccess:()=>{be(),ee()}}),e.jsx(JS,{open:je,onOpenChange:_e,onSuccess:()=>{be(),ee()}})]})}),e.jsx(hs,{open:z,onOpenChange:K,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认批量删除"}),e.jsxs(us,{children:["你确定要删除选中的 ",fe.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:Ae,children:"确认删除"})]})]})}),e.jsx(Fs,{open:ve,onOpenChange:ne,children:e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"确认删除"}),e.jsx(lt,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>ne(!1),children:"取消"}),e.jsx(C,{variant:"destructive",onClick:se,children:"删除"})]})]})})]})}function QS({emoji:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Bs,{children:e.jsx($s,{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:FS(l.id),alt:l.description||"表情包",className:"w-full h-full object-cover",onError:u=>{const x=u.target;x.style.display="none";const h=x.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:l.id})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(ke,{variant:"outline",children:l.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.full_path})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"描述"}),l.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(RS,{className:"prose-sm",children:l.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:l.emotion?e.jsx("span",{className:"text-sm",children:l.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[l.is_registered&&e.jsx(ke,{variant:"default",className:"bg-green-600",children:"已注册"}),l.is_banned&&e.jsx(ke,{variant:"destructive",children:"已封禁"}),!l.is_registered&&!l.is_banned&&e.jsx(ke,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:l.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.record_time)})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.last_used_time)})]})]})})]})})}function YS({emoji:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=m.useState(""),[h,f]=m.useState(!1),[p,j]=m.useState(!1),[N,v]=m.useState(!1),{toast:b}=Js();m.useEffect(()=>{l&&(x(l.emotion||""),f(l.is_registered),j(l.is_banned))},[l]);const w=async()=>{if(l)try{v(!0);const y=u.split(/[,,]/).map(L=>L.trim()).filter(Boolean).join(",");await BS(l.id,{emotion:y||void 0,is_registered:h,is_banned:p}),b({title:"成功",description:"表情包信息已更新"}),i(!1),c()}catch(y){const L=y instanceof Error?y.message:"保存失败";b({title:"错误",description:L,variant:"destructive"})}finally{v(!1)}};return l?e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"编辑表情包"}),e.jsx(lt,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"情绪"}),e.jsx(Zs,{value:u,onChange:y=>x(y.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:"is_registered",checked:h,onCheckedChange:y=>{y===!0?(f(!0),j(!1)):f(!1)}}),e.jsx(T,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:"is_banned",checked:p,onCheckedChange:y=>{y===!0?(j(!0),f(!1)):j(!1)}}),e.jsx(T,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:w,disabled:N,children:N?"保存中...":"保存"})]})]})}):null}function JS({open:l,onOpenChange:n,onSuccess:i}){const[c,u]=m.useState("select"),[x,h]=m.useState([]),[f,p]=m.useState(null),[j,N]=m.useState(!1),{toast:v}=Js(),b=m.useMemo(()=>new p1({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);m.useEffect(()=>{const I=()=>{const A=b.getFiles();if(A.length===0)return;const J=A.map(G=>({id:G.id,name:G.name,previewUrl:G.preview||URL.createObjectURL(G.data),emotion:"",description:"",isRegistered:!0,file:G.data}));h(J),A.length===1?(p(J[0].id),u("edit-single")):u("edit-multiple")};return b.on("upload",I),()=>{b.off("upload",I)}},[b]),m.useEffect(()=>{l||(b.cancelAll(),u("select"),h([]),p(null),N(!1))},[l,b]);const w=m.useCallback((I,A)=>{h(J=>J.map(G=>G.id===I?{...G,...A}:G))},[]),y=m.useCallback(I=>I.emotion.trim().length>0,[]),L=m.useMemo(()=>x.length>0&&x.every(y),[x,y]),D=m.useMemo(()=>x.find(I=>I.id===f)||null,[x,f]),k=m.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(u("select"),h([]),p(null))},[c]),V=m.useCallback(async()=>{if(!L){v({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}N(!0);let I=0,A=0;try{for(const J of x){const G=new FormData;G.append("file",J.file),G.append("emotion",J.emotion),G.append("description",J.description),G.append("is_registered",J.isRegistered.toString());try{(await ye(qS(),{method:"POST",body:G})).ok?I++:A++}catch{A++}}A===0?(v({title:"上传成功",description:`成功上传 ${I} 个表情包`}),n(!1),i()):(v({title:"部分上传失败",description:`成功 ${I} 个,失败 ${A} 个`,variant:"destructive"}),i())}finally{N(!1)}},[L,x,v,n,i]),M=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(DS,{uppy:b,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),S=()=>{const I=x[0];return I?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(C,{variant:"ghost",size:"sm",onClick:k,children:[e.jsx(Ha,{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:I.previewUrl,alt:I.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:I.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(oe,{id:"single-emotion",value:I.emotion,onChange:A=>w(I.id,{emotion:A.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:I.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"single-description",children:"描述"}),e.jsx(oe,{id:"single-description",value:I.description,onChange:A=>w(I.id,{description:A.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:"single-is-registered",checked:I.isRegistered,onCheckedChange:A=>w(I.id,{isRegistered:A===!0})}),e.jsx(T,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(it,{children:e.jsx(C,{onClick:V,disabled:!L||j,children:j?"上传中...":"上传"})})]}):null},E=()=>{const I=x.filter(y).length,A=x.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(C,{variant:"ghost",size:"sm",onClick:k,children:[e.jsx(Ha,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",I,"/",A," 已完成)"]})]}),e.jsx(ke,{variant:L?"default":"secondary",children:L?e.jsxs(e.Fragment,{children:[e.jsx(yt,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(Da,{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(J=>{const G=y(J),ue=f===J.id;return e.jsxs("div",{onClick:()=>p(J.id),className:` + flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all + ${ue?"ring-2 ring-primary":""} + ${G?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-border hover:border-muted-foreground/50"} + `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:J.previewUrl,alt:J.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:J.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:J.emotion||"未填写情感标签"})]}),G?e.jsx(Zt,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex-shrink-0"})]},J.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:D?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:D.previewUrl,alt:D.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:D.name}),y(D)&&e.jsxs(ke,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(yt,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(oe,{id:"multi-emotion",value:D.emotion,onChange:J=>w(D.id,{emotion:J.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:D.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"multi-description",children:"描述"}),e.jsx(oe,{id:"multi-description",value:D.description,onChange:J=>w(D.id,{description:J.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:"multi-is-registered",checked:D.isRegistered,onCheckedChange:J=>w(D.id,{isRegistered:J===!0})}),e.jsx(T,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"上传后立即注册"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(vj,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(it,{children:e.jsx(C,{onClick:V,disabled:!L||j,children:j?"上传中...":`上传全部 (${A})`})})]})};return e.jsx(Fs,{open:l,onOpenChange:n,children:e.jsxs(Us,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Bs,{children:[e.jsxs($s,{className:"flex items-center gap-2",children:[e.jsx(Hi,{className:"h-5 w-5"}),c==="select"&&"上传表情包 - 选择文件",c==="edit-single"&&"上传表情包 - 填写信息",c==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(lt,{children:[c==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",c==="edit-single"&&"请填写表情包的情感标签(必填)和描述",c==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[c==="select"&&M(),c==="edit-single"&&S(),c==="edit-multiple"&&E()]})]})})}const rn="/api/webui/expression";async function XS(){const l=await ye(`${rn}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function ZS(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id);const i=await ye(`${rn}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取表达方式列表失败")}return i.json()}async function WS(l){const n=await ye(`${rn}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取表达方式详情失败")}return n.json()}async function e4(l){const n=await ye(`${rn}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建表达方式失败")}return n.json()}async function s4(l,n){const i=await ye(`${rn}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新表达方式失败")}return i.json()}async function t4(l){const n=await ye(`${rn}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除表达方式失败")}return n.json()}async function a4(l){const n=await ye(`${rn}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除表达方式失败")}return n.json()}async function l4(){const l=await ye(`${rn}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}function n4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,j]=m.useState(20),[N,v]=m.useState(""),[b,w]=m.useState(null),[y,L]=m.useState(!1),[D,k]=m.useState(!1),[V,M]=m.useState(!1),[S,E]=m.useState(null),[I,A]=m.useState(new Set),[J,G]=m.useState(!1),[ue,de]=m.useState(""),[ve,ne]=m.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[fe,ge]=m.useState([]),[z,K]=m.useState(new Map),{toast:B}=Js(),U=async()=>{try{c(!0);const se=await ZS({page:h,page_size:p,search:N||void 0});n(se.data),x(se.total)}catch(se){B({title:"加载失败",description:se instanceof Error?se.message:"无法加载表达方式",variant:"destructive"})}finally{c(!1)}},H=async()=>{try{const se=await l4();se?.data&&ne(se.data)}catch(se){console.error("加载统计数据失败:",se)}},we=async()=>{try{const se=await XS();if(se?.data){ge(se.data);const De=new Map;se.data.forEach(q=>{De.set(q.chat_id,q.chat_name)}),K(De)}}catch(se){console.error("加载聊天列表失败:",se)}},je=se=>z.get(se)||se;m.useEffect(()=>{U(),H(),we()},[h,p,N]);const _e=async se=>{try{const De=await WS(se.id);w(De.data),L(!0)}catch(De){B({title:"加载详情失败",description:De instanceof Error?De.message:"无法加载表达方式详情",variant:"destructive"})}},X=se=>{w(se),k(!0)},be=async se=>{try{await t4(se.id),B({title:"删除成功",description:`已删除表达方式: ${se.situation}`}),E(null),U(),H()}catch(De){B({title:"删除失败",description:De instanceof Error?De.message:"无法删除表达方式",variant:"destructive"})}},ee=se=>{const De=new Set(I);De.has(se)?De.delete(se):De.add(se),A(De)},xe=()=>{I.size===l.length&&l.length>0?A(new Set):A(new Set(l.map(se=>se.id)))},Ce=async()=>{try{await a4(Array.from(I)),B({title:"批量删除成功",description:`已删除 ${I.size} 个表达方式`}),A(new Set),G(!1),U(),H()}catch(se){B({title:"批量删除失败",description:se instanceof Error?se.message:"无法批量删除表达方式",variant:"destructive"})}},Z=()=>{const se=parseInt(ue),De=Math.ceil(u/p);se>=1&&se<=De?(f(se),de("")):B({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(an,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs(C,{onClick:()=>M(!0),className:"gap-2",children:[e.jsx(tt,{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:ve.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:ve.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:ve.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Ft,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{id:"search",placeholder:"搜索情境、风格或上下文...",value:N,onChange:se=>v(se.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:I.size>0&&e.jsxs("span",{children:["已选择 ",I.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:p.toString(),onValueChange:se=>{j(parseInt(se)),f(1),A(new Set)},children:[e.jsx(Oe,{id:"page-size",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"10",children:"10"}),e.jsx(re,{value:"20",children:"20"}),e.jsx(re,{value:"50",children:"50"}),e.jsx(re,{value:"100",children:"100"})]})]}),I.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>A(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:()=>G(!0),children:[e.jsx(as,{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(_l,{children:[e.jsx(Sl,{children:e.jsxs(at,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Qs,{checked:I.size===l.length&&l.length>0,onCheckedChange:xe})}),e.jsx(Ye,{children:"情境"}),e.jsx(Ye,{children:"风格"}),e.jsx(Ye,{children:"聊天"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Cl,{children:i?e.jsx(at,{children:e.jsx(Pe,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(at,{children:e.jsx(Pe,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(se=>e.jsxs(at,{children:[e.jsx(Pe,{children:e.jsx(Qs,{checked:I.has(se.id),onCheckedChange:()=>ee(se.id)})}),e.jsx(Pe,{className:"font-medium max-w-xs truncate",children:se.situation}),e.jsx(Pe,{className:"max-w-xs truncate",children:se.style}),e.jsx(Pe,{className:"max-w-[200px] truncate",title:je(se.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:je(se.chat_id)})}),e.jsx(Pe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>X(se),children:[e.jsx(Dn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>_e(se),title:"查看详情",children:e.jsx(Wt,{className:"h-4 w-4"})}),e.jsxs(C,{size:"sm",onClick:()=>E(se),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(as,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},se.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(se=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Qs,{checked:I.has(se.id),onCheckedChange:()=>ee(se.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:se.situation,children:se.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:se.style,children:se.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:je(se.chat_id),style:{wordBreak:"keep-all"},children:je(se.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>X(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Dn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>_e(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(Wt,{className:"h-3 w-3"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>E(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(as,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},se.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Rr,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(el,{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(oe,{type:"number",value:ue,onChange:se=>de(se.target.value),onKeyDown:se=>se.key==="Enter"&&Z(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(C,{variant:"outline",size:"sm",onClick:Z,disabled:!ue,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Lr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(r4,{expression:b,open:y,onOpenChange:L,chatNameMap:z}),e.jsx(i4,{open:V,onOpenChange:M,chatList:fe,onSuccess:()=>{U(),H(),M(!1)}}),e.jsx(c4,{expression:b,open:D,onOpenChange:k,chatList:fe,onSuccess:()=>{U(),H(),k(!1)}}),e.jsx(hs,{open:!!S,onOpenChange:()=>E(null),children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:['确定要删除表达方式 "',S?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>S&&be(S),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(o4,{open:J,onOpenChange:G,onConfirm:Ce,count:I.size})]})}function r4({expression:l,open:n,onOpenChange:i,chatNameMap:c}){if(!l)return null;const u=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",x=h=>c.get(h)||h;return e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"表达方式详情"}),e.jsx(lt,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(zi,{label:"情境",value:l.situation}),e.jsx(zi,{label:"风格",value:l.style}),e.jsx(zi,{label:"聊天",value:x(l.chat_id)}),e.jsx(zi,{icon:zr,label:"记录ID",value:l.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(zi,{icon:bl,label:"创建时间",value:u(l.create_date)})})]}),e.jsx(it,{children:e.jsx(C,{onClick:()=>i(!1),children:"关闭"})})]})})}function zi({icon:l,label:n,value:i,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:$("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function i4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=m.useState({situation:"",style:"",chat_id:""}),[h,f]=m.useState(!1),{toast:p}=Js(),j=async()=>{if(!u.situation||!u.style||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{f(!0),await e4(u),p({title:"创建成功",description:"表达方式已创建"}),x({situation:"",style:"",chat_id:""}),c()}catch(N){p({title:"创建失败",description:N instanceof Error?N.message:"无法创建表达方式",variant:"destructive"})}finally{f(!1)}};return e.jsx(Fs,{open:l,onOpenChange:n,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"新增表达方式"}),e.jsx(lt,{children:"创建新的表达方式记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(oe,{id:"situation",value:u.situation,onChange:N=>x({...u,situation:N.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(oe,{id:"style",value:u.style,onChange:N=>x({...u,style:N.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Ue,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:i.map(N=>e.jsx(re,{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(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(C,{onClick:j,disabled:h,children:h?"创建中...":"创建"})]})]})})}function c4({expression:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=m.useState({}),[f,p]=m.useState(!1),{toast:j}=Js();m.useEffect(()=>{l&&h({situation:l.situation,style:l.style,chat_id:l.chat_id})},[l]);const N=async()=>{if(l)try{p(!0),await s4(l.id,x),j({title:"保存成功",description:"表达方式已更新"}),u()}catch(v){j({title:"保存失败",description:v instanceof Error?v.message:"无法更新表达方式",variant:"destructive"})}finally{p(!1)}};return l?e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"编辑表达方式"}),e.jsx(lt,{children:"修改表达方式的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_situation",children:"情境"}),e.jsx(oe,{id:"edit_situation",value:x.situation||"",onChange:v=>h({...x,situation:v.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_style",children:"风格"}),e.jsx(oe,{id:"edit_style",value:x.style||"",onChange:v=>h({...x,style:v.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ue,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:c.map(v=>e.jsx(re,{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(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function o4({open:l,onOpenChange:n,onConfirm:i,count:c}){return e.jsx(hs,{open:l,onOpenChange:n,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认批量删除"}),e.jsxs(us,{children:["您即将删除 ",c," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const kl="/api/webui/jargon";async function d4(){const l=await ye(`${kl}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function u4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id),l.is_jargon!==void 0&&l.is_jargon!==null&&n.append("is_jargon",l.is_jargon.toString()),l.is_global!==void 0&&n.append("is_global",l.is_global.toString());const i=await ye(`${kl}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取黑话列表失败")}return i.json()}async function m4(l){const n=await ye(`${kl}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取黑话详情失败")}return n.json()}async function x4(l){const n=await ye(`${kl}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建黑话失败")}return n.json()}async function h4(l,n){const i=await ye(`${kl}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新黑话失败")}return i.json()}async function f4(l){const n=await ye(`${kl}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除黑话失败")}return n.json()}async function p4(l){const n=await ye(`${kl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除黑话失败")}return n.json()}async function g4(){const l=await ye(`${kl}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取黑话统计失败")}return l.json()}async function j4(l,n){const i=new URLSearchParams;l.forEach(u=>i.append("ids",u.toString())),i.append("is_jargon",n.toString());const c=await ye(`${kl}/batch/set-jargon?${i}`,{method:"POST"});if(!c.ok){const u=await c.json();throw new Error(u.detail||"批量设置黑话状态失败")}return c.json()}function v4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,j]=m.useState(20),[N,v]=m.useState(""),[b,w]=m.useState("all"),[y,L]=m.useState("all"),[D,k]=m.useState(null),[V,M]=m.useState(!1),[S,E]=m.useState(!1),[I,A]=m.useState(!1),[J,G]=m.useState(null),[ue,de]=m.useState(new Set),[ve,ne]=m.useState(!1),[fe,ge]=m.useState(""),[z,K]=m.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[B,U]=m.useState([]),{toast:H}=Js(),we=async()=>{try{c(!0);const te=await u4({page:h,page_size:p,search:N||void 0,chat_id:b==="all"?void 0:b,is_jargon:y==="all"?void 0:y==="true"?!0:y==="false"?!1:void 0});n(te.data),x(te.total)}catch(te){H({title:"加载失败",description:te instanceof Error?te.message:"无法加载黑话列表",variant:"destructive"})}finally{c(!1)}},je=async()=>{try{const te=await g4();te?.data&&K(te.data)}catch(te){console.error("加载统计数据失败:",te)}},_e=async()=>{try{const te=await d4();te?.data&&U(te.data)}catch(te){console.error("加载聊天列表失败:",te)}};m.useEffect(()=>{we(),je(),_e()},[h,p,N,b,y]);const X=async te=>{try{const Ae=await m4(te.id);k(Ae.data),M(!0)}catch(Ae){H({title:"加载详情失败",description:Ae instanceof Error?Ae.message:"无法加载黑话详情",variant:"destructive"})}},be=te=>{k(te),E(!0)},ee=async te=>{try{await f4(te.id),H({title:"删除成功",description:`已删除黑话: ${te.content}`}),G(null),we(),je()}catch(Ae){H({title:"删除失败",description:Ae instanceof Error?Ae.message:"无法删除黑话",variant:"destructive"})}},xe=te=>{const Ae=new Set(ue);Ae.has(te)?Ae.delete(te):Ae.add(te),de(Ae)},Ce=()=>{ue.size===l.length&&l.length>0?de(new Set):de(new Set(l.map(te=>te.id)))},Z=async()=>{try{await p4(Array.from(ue)),H({title:"批量删除成功",description:`已删除 ${ue.size} 个黑话`}),de(new Set),ne(!1),we(),je()}catch(te){H({title:"批量删除失败",description:te instanceof Error?te.message:"无法批量删除黑话",variant:"destructive"})}},se=async te=>{try{await j4(Array.from(ue),te),H({title:"操作成功",description:`已将 ${ue.size} 个词条设为${te?"黑话":"非黑话"}`}),de(new Set),we(),je()}catch(Ae){H({title:"操作失败",description:Ae instanceof Error?Ae.message:"批量设置失败",variant:"destructive"})}},De=()=>{const te=parseInt(fe),Ae=Math.ceil(u/p);te>=1&&te<=Ae?(f(te),ge("")):H({title:"无效的页码",description:`请输入1-${Ae}之间的页码`,variant:"destructive"})},q=te=>te===!0?e.jsxs(ke,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(yt,{className:"h-3 w-3 mr-1"}),"是黑话"]}):te===!1?e.jsxs(ke,{variant:"secondary",children:[e.jsx(Da,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(ke,{variant:"outline",children:[e.jsx(hj,{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(Pw,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(C,{onClick:()=>A(!0),className:"gap-2",children:[e.jsx(tt,{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:z.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"已确认黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:z.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"确认非黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:z.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"待判定"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:z.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"全局黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:z.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"推断完成"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:z.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:z.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ft,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{id:"search",placeholder:"搜索内容、含义...",value:N,onChange:te=>v(te.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"聊天筛选"}),e.jsxs(Ue,{value:b,onValueChange:w,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"全部聊天"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部聊天"}),B.map(te=>e.jsx(re,{value:te.chat_id,children:te.chat_name},te.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"状态筛选"}),e.jsxs(Ue,{value:y,onValueChange:L,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"全部状态"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部状态"}),e.jsx(re,{value:"true",children:"是黑话"}),e.jsx(re,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Ue,{value:p.toString(),onValueChange:te=>{j(parseInt(te)),f(1),de(new Set)},children:[e.jsx(Oe,{id:"page-size",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"10",children:"10"}),e.jsx(re,{value:"20",children:"20"}),e.jsx(re,{value:"50",children:"50"}),e.jsx(re,{value:"100",children:"100"})]})]})]})]}),ue.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",ue.size," 个"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>se(!0),children:[e.jsx(yt,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>se(!1),children:[e.jsx(Da,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>de(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:()=>ne(!0),children:[e.jsx(as,{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(_l,{children:[e.jsx(Sl,{children:e.jsxs(at,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Qs,{checked:ue.size===l.length&&l.length>0,onCheckedChange:Ce})}),e.jsx(Ye,{children:"内容"}),e.jsx(Ye,{children:"含义"}),e.jsx(Ye,{children:"聊天"}),e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{className:"text-center",children:"次数"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Cl,{children:i?e.jsx(at,{children:e.jsx(Pe,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(at,{children:e.jsx(Pe,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(te=>e.jsxs(at,{children:[e.jsx(Pe,{children:e.jsx(Qs,{checked:ue.has(te.id),onCheckedChange:()=>xe(te.id)})}),e.jsx(Pe,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[te.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(So,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:te.content,children:te.content})]})}),e.jsx(Pe,{className:"max-w-[200px] truncate",title:te.meaning||"",children:te.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Pe,{className:"max-w-[150px] truncate",title:te.chat_name||te.chat_id,children:te.chat_name||te.chat_id}),e.jsx(Pe,{children:q(te.is_jargon)}),e.jsx(Pe,{className:"text-center",children:te.count}),e.jsx(Pe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>be(te),children:[e.jsx(Dn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>X(te),title:"查看详情",children:e.jsx(Wt,{className:"h-4 w-4"})}),e.jsxs(C,{size:"sm",onClick:()=>G(te),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(as,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},te.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(te=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Qs,{checked:ue.has(te.id),onCheckedChange:()=>xe(te.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:[te.is_global&&e.jsx(So,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:te.content})]}),te.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:te.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[q(te.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",te.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",te.chat_name||te.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>be(te),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(Dn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>X(te),className:"text-xs px-2 py-1 h-auto",children:e.jsx(Wt,{className:"h-3 w-3"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>G(te),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(as,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},te.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Rr,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(el,{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(oe,{type:"number",value:fe,onChange:te=>ge(te.target.value),onKeyDown:te=>te.key==="Enter"&&De(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(C,{variant:"outline",size:"sm",onClick:De,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Lr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(N4,{jargon:D,open:V,onOpenChange:M}),e.jsx(b4,{open:I,onOpenChange:A,chatList:B,onSuccess:()=>{we(),je(),A(!1)}}),e.jsx(y4,{jargon:D,open:S,onOpenChange:E,chatList:B,onSuccess:()=>{we(),je(),E(!1)}}),e.jsx(hs,{open:!!J,onOpenChange:()=>G(null),children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:['确定要删除黑话 "',J?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>J&&ee(J),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(hs,{open:ve,onOpenChange:ne,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认批量删除"}),e.jsxs(us,{children:["您即将删除 ",ue.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function N4({jargon:l,open:n,onOpenChange:i}){return l?e.jsx(Fs,{open:n,onOpenChange:i,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($s,{children:"黑话详情"}),e.jsx(lt,{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(wm,{icon:zr,label:"记录ID",value:l.id.toString(),mono:!0}),e.jsx(wm,{label:"使用次数",value:l.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:l.content})]}),l.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const c=JSON.parse(l.raw_content);return Array.isArray(c)?c.map((u,x)=>e.jsxs("div",{children:[x>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:u})]},x)):e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:l.meaning?e.jsx(Bm,{content:l.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(wm,{label:"聊天",value:l.chat_name||l.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[l.is_jargon===!0&&e.jsx(ke,{variant:"default",className:"bg-green-600",children:"是黑话"}),l.is_jargon===!1&&e.jsx(ke,{variant:"secondary",children:"非黑话"}),l.is_jargon===null&&e.jsx(ke,{variant:"outline",children:"未判定"}),l.is_global&&e.jsx(ke,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),l.is_complete&&e.jsx(ke,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),l.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:l.inference_with_context})]}),l.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:l.inference_content_only})]})]})}),e.jsx(it,{className:"flex-shrink-0",children:e.jsx(C,{onClick:()=>i(!1),children:"关闭"})})]})}):null}function wm({icon:l,label:n,value:i,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:$("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function b4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=m.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=m.useState(!1),{toast:p}=Js(),j=async()=>{if(!u.content||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await x4(u),p({title:"创建成功",description:"黑话已创建"}),x({content:"",meaning:"",chat_id:"",is_global:!1}),c()}catch(N){p({title:"创建失败",description:N instanceof Error?N.message:"无法创建黑话",variant:"destructive"})}finally{f(!1)}};return e.jsx(Fs,{open:l,onOpenChange:n,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"新增黑话"}),e.jsx(lt,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(oe,{id:"content",value:u.content,onChange:N=>x({...u,content:N.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"meaning",children:"含义"}),e.jsx(Zs,{id:"meaning",value:u.meaning||"",onChange:N=>x({...u,meaning:N.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Ue,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:i.map(N=>e.jsx(re,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"is_global",checked:u.is_global,onCheckedChange:N=>x({...u,is_global:N})}),e.jsx(T,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(C,{onClick:j,disabled:h,children:h?"创建中...":"创建"})]})]})})}function y4({jargon:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=m.useState({}),[f,p]=m.useState(!1),{toast:j}=Js();m.useEffect(()=>{l&&h({content:l.content,meaning:l.meaning||"",chat_id:l.stream_id||l.chat_id,is_global:l.is_global,is_jargon:l.is_jargon})},[l]);const N=async()=>{if(l)try{p(!0),await h4(l.id,x),j({title:"保存成功",description:"黑话已更新"}),u()}catch(v){j({title:"保存失败",description:v instanceof Error?v.message:"无法更新黑话",variant:"destructive"})}finally{p(!1)}};return l?e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"编辑黑话"}),e.jsx(lt,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_content",children:"内容"}),e.jsx(oe,{id:"edit_content",value:x.content||"",onChange:v=>h({...x,content:v.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(Zs,{id:"edit_meaning",value:x.meaning||"",onChange:v=>h({...x,meaning:v.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ue,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择关联的聊天"})}),e.jsx(Re,{children:c.map(v=>e.jsx(re,{value:v.chat_id,children:v.chat_name},v.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"黑话状态"}),e.jsxs(Ue,{value:x.is_jargon===null?"null":x.is_jargon?.toString()||"null",onValueChange:v=>h({...x,is_jargon:v==="null"?null:v==="true"}),children:[e.jsx(Oe,{children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"null",children:"未判定"}),e.jsx(re,{value:"true",children:"是黑话"}),e.jsx(re,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit_is_global",checked:x.is_global,onCheckedChange:v=>h({...x,is_global:v})}),e.jsx(T,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const $r="/api/webui/person";async function w4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.is_known!==void 0&&n.append("is_known",l.is_known.toString()),l.platform&&n.append("platform",l.platform);const i=await ye(`${$r}/list?${n}`,{headers:zs()});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取人物列表失败")}return i.json()}async function _4(l){const n=await ye(`${$r}/${l}`,{headers:zs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取人物详情失败")}return n.json()}async function S4(l,n){const i=await ye(`${$r}/${l}`,{method:"PATCH",headers:zs(),body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新人物信息失败")}return i.json()}async function C4(l){const n=await ye(`${$r}/${l}`,{method:"DELETE",headers:zs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除人物信息失败")}return n.json()}async function k4(){const l=await ye(`${$r}/stats/summary`,{headers:zs()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}async function T4(l){const n=await ye(`${$r}/batch/delete`,{method:"POST",headers:zs(),body:JSON.stringify({person_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function E4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,j]=m.useState(20),[N,v]=m.useState(""),[b,w]=m.useState(void 0),[y,L]=m.useState(void 0),[D,k]=m.useState(null),[V,M]=m.useState(!1),[S,E]=m.useState(!1),[I,A]=m.useState(null),[J,G]=m.useState({total:0,known:0,unknown:0,platforms:{}}),[ue,de]=m.useState(new Set),[ve,ne]=m.useState(!1),[fe,ge]=m.useState(""),{toast:z}=Js(),K=async()=>{try{c(!0);const Z=await w4({page:h,page_size:p,search:N||void 0,is_known:b,platform:y});n(Z.data),x(Z.total)}catch(Z){z({title:"加载失败",description:Z instanceof Error?Z.message:"无法加载人物信息",variant:"destructive"})}finally{c(!1)}},B=async()=>{try{const Z=await k4();Z?.data&&G(Z.data)}catch(Z){console.error("加载统计数据失败:",Z)}};m.useEffect(()=>{K(),B()},[h,p,N,b,y]);const U=async Z=>{try{const se=await _4(Z.person_id);k(se.data),M(!0)}catch(se){z({title:"加载详情失败",description:se instanceof Error?se.message:"无法加载人物详情",variant:"destructive"})}},H=Z=>{k(Z),E(!0)},we=async Z=>{try{await C4(Z.person_id),z({title:"删除成功",description:`已删除人物信息: ${Z.person_name||Z.nickname||Z.user_id}`}),A(null),K(),B()}catch(se){z({title:"删除失败",description:se instanceof Error?se.message:"无法删除人物信息",variant:"destructive"})}},je=m.useMemo(()=>Object.keys(J.platforms),[J.platforms]),_e=Z=>{const se=new Set(ue);se.has(Z)?se.delete(Z):se.add(Z),de(se)},X=()=>{ue.size===l.length&&l.length>0?de(new Set):de(new Set(l.map(Z=>Z.person_id)))},be=()=>{if(ue.size===0){z({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ne(!0)},ee=async()=>{try{const Z=await T4(Array.from(ue));z({title:"批量删除完成",description:Z.message}),de(new Set),ne(!1),K(),B()}catch(Z){z({title:"批量删除失败",description:Z instanceof Error?Z.message:"批量删除失败",variant:"destructive"})}},xe=()=>{const Z=parseInt(fe),se=Math.ceil(u/p);Z>=1&&Z<=se?(f(Z),ge("")):z({title:"无效的页码",description:`请输入1-${se}之间的页码`,variant:"destructive"})},Ce=Z=>Z?new Date(Z*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Cm,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:J.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:J.known})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:J.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(Ft,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:N,onChange:Z=>v(Z.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Ue,{value:b===void 0?"all":b.toString(),onValueChange:Z=>{w(Z==="all"?void 0:Z==="true"),f(1)},children:[e.jsx(Oe,{id:"filter-known",className:"mt-1.5",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部"}),e.jsx(re,{value:"true",children:"已认识"}),e.jsx(re,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Ue,{value:y||"all",onValueChange:Z=>{L(Z==="all"?void 0:Z),f(1)},children:[e.jsx(Oe,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部平台"}),je.map(Z=>e.jsxs(re,{value:Z,children:[Z," (",J.platforms[Z],")"]},Z))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:ue.size>0&&e.jsxs("span",{children:["已选择 ",ue.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ue,{value:p.toString(),onValueChange:Z=>{j(parseInt(Z)),f(1),de(new Set)},children:[e.jsx(Oe,{id:"page-size",className:"w-20",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"10",children:"10"}),e.jsx(re,{value:"20",children:"20"}),e.jsx(re,{value:"50",children:"50"}),e.jsx(re,{value:"100",children:"100"})]})]}),ue.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>de(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:be,children:[e.jsx(as,{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(_l,{children:[e.jsx(Sl,{children:e.jsxs(at,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Qs,{checked:l.length>0&&ue.size===l.length,onCheckedChange:X,"aria-label":"全选"})}),e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"昵称"}),e.jsx(Ye,{children:"平台"}),e.jsx(Ye,{children:"用户ID"}),e.jsx(Ye,{children:"最后更新"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Cl,{children:i?e.jsx(at,{children:e.jsx(Pe,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(at,{children:e.jsx(Pe,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(Z=>e.jsxs(at,{children:[e.jsx(Pe,{children:e.jsx(Qs,{checked:ue.has(Z.person_id),onCheckedChange:()=>_e(Z.person_id),"aria-label":`选择 ${Z.person_name||Z.nickname||Z.user_id}`})}),e.jsx(Pe,{children:e.jsx("div",{className:$("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",Z.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:Z.is_known?"已认识":"未认识"})}),e.jsx(Pe,{className:"font-medium",children:Z.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Pe,{children:Z.nickname||"-"}),e.jsx(Pe,{children:Z.platform}),e.jsx(Pe,{className:"font-mono text-sm",children:Z.user_id}),e.jsx(Pe,{className:"text-sm text-muted-foreground",children:Ce(Z.last_know)}),e.jsx(Pe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>U(Z),children:[e.jsx(Wt,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(C,{variant:"default",size:"sm",onClick:()=>H(Z),children:[e.jsx(Dn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>A(Z),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(as,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Z.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(Z=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Qs,{checked:ue.has(Z.person_id),onCheckedChange:()=>_e(Z.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:$("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",Z.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:Z.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:Z.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),Z.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",Z.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),e.jsx("p",{className:"font-medium text-xs",children:Z.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:Z.user_id,children:Z.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),e.jsx("p",{className:"text-xs",children:Ce(Z.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>U(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Wt,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>H(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Dn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>A(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(as,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Z.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Rr,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(el,{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(oe,{type:"number",value:fe,onChange:Z=>ge(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&xe(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(C,{variant:"outline",size:"sm",onClick:xe,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ba,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Lr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(M4,{person:D,open:V,onOpenChange:M}),e.jsx(A4,{person:D,open:S,onOpenChange:E,onSuccess:()=>{K(),B(),E(!1)}}),e.jsx(hs,{open:!!I,onOpenChange:()=>A(null),children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认删除"}),e.jsxs(us,{children:['确定要删除人物信息 "',I?.person_name||I?.nickname||I?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:()=>I&&we(I),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(hs,{open:ve,onOpenChange:ne,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"确认批量删除"}),e.jsxs(us,{children:["确定要删除选中的 ",ue.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(os,{children:[e.jsx(xs,{children:"取消"}),e.jsx(ms,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function M4({person:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"人物详情"}),e.jsxs(lt,{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(vl,{icon:En,label:"人物名称",value:l.person_name}),e.jsx(vl,{icon:an,label:"昵称",value:l.nickname}),e.jsx(vl,{icon:zr,label:"用户ID",value:l.user_id,mono:!0}),e.jsx(vl,{icon:zr,label:"人物ID",value:l.person_id,mono:!0}),e.jsx(vl,{label:"平台",value:l.platform}),e.jsx(vl,{label:"状态",value:l.is_known?"已认识":"未认识"})]}),l.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:l.name_reason})]}),l.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:l.memory_points})]}),l.group_nick_name&&l.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:l.group_nick_name.map((u,x)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:u.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:u.group_nick_name})]},x))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(vl,{icon:bl,label:"认识时间",value:c(l.know_times)}),e.jsx(vl,{icon:bl,label:"首次记录",value:c(l.know_since)}),e.jsx(vl,{icon:bl,label:"最后更新",value:c(l.last_know)})]})]}),e.jsx(it,{children:e.jsx(C,{onClick:()=>i(!1),children:"关闭"})})]})})}function vl({icon:l,label:n,value:i,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:$("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function A4({person:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=m.useState({}),[h,f]=m.useState(!1),{toast:p}=Js();m.useEffect(()=>{l&&x({person_name:l.person_name||"",name_reason:l.name_reason||"",nickname:l.nickname||"",is_known:l.is_known})},[l]);const j=async()=>{if(l)try{f(!0),await S4(l.person_id,u),p({title:"保存成功",description:"人物信息已更新"}),c()}catch(N){p({title:"保存失败",description:N instanceof Error?N.message:"无法更新人物信息",variant:"destructive"})}finally{f(!1)}};return l?e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"编辑人物信息"}),e.jsxs(lt,{children:["修改 ",l.person_name||l.nickname||l.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"person_name",children:"人物名称"}),e.jsx(oe,{id:"person_name",value:u.person_name||"",onChange:N=>x({...u,person_name:N.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(oe,{id:"nickname",value:u.nickname||"",onChange:N=>x({...u,nickname:N.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(Zs,{id:"name_reason",value:u.name_reason||"",onChange:N=>x({...u,name_reason:N.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(T,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Ge,{id:"is_known",checked:u.is_known,onCheckedChange:N=>x({...u,is_known:N})})]})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:j,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var z4=b1();const fg=d0(z4),Vm="/api/webui";async function D4(l=100,n="all"){const i=`${Vm}/knowledge/graph?limit=${l}&node_type=${n}`,c=await fetch(i);if(!c.ok)throw new Error(`获取知识图谱失败: ${c.status}`);return c.json()}async function O4(){const l=await fetch(`${Vm}/knowledge/stats`);if(!l.ok)throw new Error("获取知识图谱统计信息失败");return l.json()}async function R4(l){const n=await fetch(`${Vm}/knowledge/search?query=${encodeURIComponent(l)}`);if(!n.ok)throw new Error("搜索知识节点失败");return n.json()}const xv=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(To,{type:"target",position:Eo.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:l.content,children:l.label}),e.jsx(To,{type:"source",position:Eo.Bottom})]}));xv.displayName="EntityNode";const hv=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(To,{type:"target",position:Eo.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:l.content,children:l.label}),e.jsx(To,{type:"source",position:Eo.Bottom})]}));hv.displayName="ParagraphNode";const L4={entity:xv,paragraph:hv};function U4(l,n){const i=new fg.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const c=[],u=[];return l.forEach(x=>{i.setNode(x.id,{width:150,height:50})}),n.forEach(x=>{i.setEdge(x.source,x.target)}),fg.layout(i),l.forEach(x=>{const h=i.node(x.id);c.push({id:x.id,type:x.type,position:{x:h.x-75,y:h.y-25},data:{label:x.content.slice(0,20)+(x.content.length>20?"...":""),content:x.content}})}),n.forEach((x,h)=>{const f={id:`edge-${h}`,source:x.source,target:x.target,animated:l.length<=200&&x.weight>5,style:{strokeWidth:Math.min(x.weight/2,5),opacity:.6}};x.weight>10&&l.length<100&&(f.label=`${x.weight.toFixed(0)}`),u.push(f)}),{nodes:c,edges:u}}function B4(){const l=sa(),[n,i]=m.useState(!1),[c,u]=m.useState(null),[x,h]=m.useState(""),[f,p]=m.useState("all"),[j,N]=m.useState(50),[v,b]=m.useState("50"),[w,y]=m.useState(!1),[L,D]=m.useState(!0),[k,V]=m.useState(!1),[M,S]=m.useState(!1),[E,I,A]=y1([]),[J,G,ue]=w1([]),[de,ve]=m.useState(0),[ne,fe]=m.useState(null),[ge,z]=m.useState(null),{toast:K}=Js(),B=m.useCallback(ee=>ee.type==="entity"?"#6366f1":ee.type==="paragraph"?"#10b981":"#6b7280",[]),U=m.useCallback(async(ee=!1)=>{try{if(!ee&&j>200){S(!0);return}i(!0);const[xe,Ce]=await Promise.all([D4(j,f),O4()]);if(u(Ce),xe.nodes.length===0){K({title:"提示",description:"知识库为空,请先导入知识数据"}),I([]),G([]);return}const{nodes:Z,edges:se}=U4(xe.nodes,xe.edges);I(Z),G(se),ve(Z.length),Ce&&Ce.total_nodes>j&&K({title:"提示",description:`知识图谱包含 ${Ce.total_nodes} 个节点,当前显示 ${Z.length} 个`}),K({title:"加载成功",description:`已加载 ${Z.length} 个节点,${se.length} 条边`})}catch(xe){console.error("加载知识图谱失败:",xe),K({title:"加载失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}finally{i(!1)}},[j,f,K]),H=m.useCallback(async()=>{if(!x.trim()){K({title:"提示",description:"请输入搜索关键词"});return}try{const ee=await R4(x);if(ee.length===0){K({title:"未找到",description:"没有找到匹配的节点"});return}const xe=new Set(ee.map(Ce=>Ce.id));I(Ce=>Ce.map(Z=>({...Z,style:{...Z.style,opacity:xe.has(Z.id)?1:.3,filter:xe.has(Z.id)?"brightness(1.2)":"brightness(0.8)"}}))),K({title:"搜索完成",description:`找到 ${ee.length} 个匹配节点`})}catch(ee){console.error("搜索失败:",ee),K({title:"搜索失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}},[x,K]),we=m.useCallback(()=>{I(ee=>ee.map(xe=>({...xe,style:{...xe.style,opacity:1,filter:"brightness(1)"}})))},[]),je=m.useCallback(()=>{D(!1),V(!0),U()},[U]),_e=m.useCallback(()=>{S(!1),setTimeout(()=>{U(!0)},0)},[U]),X=m.useCallback((ee,xe)=>{E.find(Z=>Z.id===xe.id)&&fe({id:xe.id,type:xe.type,content:xe.data.content})},[E]);m.useEffect(()=>{L||k&&U()},[j,f,L,k]);const be=m.useCallback((ee,xe)=>{const Ce=E.find(De=>De.id===xe.source),Z=E.find(De=>De.id===xe.target),se=J.find(De=>De.id===xe.id);Ce&&Z&&se&&z({source:{id:Ce.id,type:Ce.type,content:Ce.data.content},target:{id:Z.id,type:Z.type,content:Z.data.content},edge:{source:xe.source,target:xe.target,weight:parseFloat(xe.label||"0")}})},[E,J]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),c&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Mr,{className:"h-3 w-3"}),"节点: ",c.total_nodes]}),e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Nj,{className:"h-3 w-3"}),"边: ",c.total_edges]}),e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Gt,{className:"h-3 w-3"}),"实体: ",c.entity_nodes]}),e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Ia,{className:"h-3 w-3"}),"段落: ",c.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(oe,{placeholder:"搜索节点内容...",value:x,onChange:ee=>h(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&H(),className:"flex-1"}),e.jsx(C,{onClick:H,size:"sm",children:e.jsx(Ft,{className:"h-4 w-4"})}),e.jsx(C,{onClick:we,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Ue,{value:f,onValueChange:ee=>p(ee),children:[e.jsx(Oe,{className:"w-[120px]",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部节点"}),e.jsx(re,{value:"entity",children:"仅实体"}),e.jsx(re,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Ue,{value:j===1e4?"all":w?"custom":j.toString(),onValueChange:ee=>{ee==="custom"?(y(!0),b(j.toString())):ee==="all"?(y(!1),N(1e4)):(y(!1),N(Number(ee)))},children:[e.jsx(Oe,{className:"w-[120px]",children:e.jsx(Be,{})}),e.jsxs(Re,{children:[e.jsx(re,{value:"50",children:"50 节点"}),e.jsx(re,{value:"100",children:"100 节点"}),e.jsx(re,{value:"200",children:"200 节点"}),e.jsx(re,{value:"500",children:"500 节点"}),e.jsx(re,{value:"1000",children:"1000 节点"}),e.jsx(re,{value:"all",children:"全部 (最多10000)"}),e.jsx(re,{value:"custom",children:"自定义..."})]})]}),w&&e.jsx(oe,{type:"number",min:"50",value:v,onChange:ee=>b(ee.target.value),onBlur:()=>{const ee=parseInt(v);!isNaN(ee)&&ee>=50?N(ee):(b("50"),N(50))},onKeyDown:ee=>{if(ee.key==="Enter"){const xe=parseInt(v);!isNaN(xe)&&xe>=50?N(xe):(b("50"),N(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(C,{onClick:()=>U(),variant:"outline",size:"sm",disabled:n,children:e.jsx(wt,{className:$("h-4 w-4",n&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:n?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(wt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):E.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Mr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),e.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):e.jsxs(_1,{nodes:E,edges:J,onNodesChange:A,onEdgesChange:ue,onNodeClick:X,onEdgeClick:be,nodeTypes:L4,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:de<=500,nodesDraggable:de<=1e3,attributionPosition:"bottom-left",children:[e.jsx(S1,{variant:C1.Dots,gap:12,size:1}),e.jsx(k1,{}),de<=500&&e.jsx(T1,{nodeColor:B,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(E1,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[e.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),e.jsx("span",{children:"实体节点"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),e.jsx("span",{children:"段落节点"})]}),de>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:"已禁用动画"}),de>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Fs,{open:!!ne,onOpenChange:ee=>!ee&&fe(null),children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Bs,{children:e.jsx($s,{children:"节点详情"})}),ne&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),e.jsx("div",{className:"mt-1",children:e.jsx(ke,{variant:ne.type==="entity"?"default":"secondary",children:ne.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),e.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ne.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Ze,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ne.content})})]})]})]})}),e.jsx(Fs,{open:!!ge,onOpenChange:ee=>!ee&&z(null),children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Bs,{children:e.jsx($s,{children:"边详情"})}),ge&&e.jsx(Ze,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:ge.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[ge.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:ge.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[ge.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),e.jsx("div",{className:"mt-1",children:e.jsx(ke,{variant:"outline",className:"text-base font-mono",children:ge.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(hs,{open:L,onOpenChange:D,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"加载知识图谱"}),e.jsxs(us,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(os,{children:[e.jsx(xs,{onClick:()=>l({to:"/"}),children:"取消 (返回首页)"}),e.jsx(ms,{onClick:je,children:"确认加载"})]})]})}),e.jsx(hs,{open:M,onOpenChange:S,children:e.jsxs(is,{children:[e.jsxs(cs,{children:[e.jsx(ds,{children:"⚠️ 节点数量较多"}),e.jsx(us,{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(os,{children:[e.jsx(xs,{onClick:()=>{S(!1),j>200&&(N(50),y(!1))},children:"取消"}),e.jsx(ms,{onClick:_e,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function $4(){return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-none border-b bg-card/50 px-6 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"麦麦知识库管理"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"管理和组织麦麦的知识库内容"})]})})}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsxs(Me,{children:[e.jsxs(Je,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Mr,{className:"h-10 w-10 text-primary"})}),e.jsx(Xe,{className:"text-2xl",children:"麦麦知识库管理"}),e.jsx(Ls,{className:"text-base",children:"功能开发中,敬请期待"})]}),e.jsx(Ke,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"此功能将提供知识库的创建、编辑、导入和管理能力"})})]})})})]})}function pg({className:l,classNames:n,showOutsideDays:i=!0,captionLayout:c="label",buttonVariant:u="ghost",formatters:x,components:h,...f}){const p=Uj();return e.jsx(h1,{showOutsideDays:i,className:$("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,l),captionLayout:c,formatters:{formatMonthDropdown:j=>j.toLocaleString("default",{month:"short"}),...x},classNames:{root:$("w-fit",p.root),months:$("relative flex flex-col gap-4 md:flex-row",p.months),month:$("flex w-full flex-col gap-4",p.month),nav:$("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:$(Dr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:$(Dr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:$("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:$("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:$("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",p.dropdown_root),dropdown:$("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:$("select-none font-medium",c==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",p.caption_label),table:"w-full border-collapse",weekdays:$("flex",p.weekdays),weekday:$("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:$("mt-2 flex w-full",p.week),week_number_header:$("w-[--cell-size] select-none",p.week_number_header),week_number:$("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:$("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",p.day),range_start:$("bg-accent rounded-l-md",p.range_start),range_middle:$("rounded-none",p.range_middle),range_end:$("bg-accent rounded-r-md",p.range_end),today:$("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:$("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:$("text-muted-foreground opacity-50",p.disabled),hidden:$("invisible",p.hidden),...n},components:{Root:({className:j,rootRef:N,...v})=>e.jsx("div",{"data-slot":"calendar",ref:N,className:$(j),...v}),Chevron:({className:j,orientation:N,...v})=>N==="left"?e.jsx(el,{className:$("size-4",j),...v}):N==="right"?e.jsx(ba,{className:$("size-4",j),...v}):e.jsx(Oa,{className:$("size-4",j),...v}),DayButton:I4,WeekNumber:({children:j,...N})=>e.jsx("td",{...N,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:j})}),...h},...f})}function I4({className:l,day:n,modifiers:i,...c}){const u=Uj(),x=m.useRef(null);return m.useEffect(()=>{i.focused&&x.current?.focus()},[i.focused]),e.jsx(C,{ref:x,variant:"ghost",size:"icon","data-day":n.date.toLocaleDateString(),"data-selected-single":i.selected&&!i.range_start&&!i.range_end&&!i.range_middle,"data-range-start":i.range_start,"data-range-end":i.range_end,"data-range-middle":i.range_middle,className:$("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",u.day,l),...c})}const jo={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 H4(){const[l,n]=m.useState([]),[i,c]=m.useState(""),[u,x]=m.useState("all"),[h,f]=m.useState("all"),[p,j]=m.useState(void 0),[N,v]=m.useState(void 0),[b,w]=m.useState(!0),[y,L]=m.useState(!1),[D,k]=m.useState("xs"),[V,M]=m.useState(4),[S,E]=m.useState(!1),I=m.useRef(null);m.useEffect(()=>{const H=Cn.getAllLogs();n(H);const we=Cn.onLog(()=>{n(Cn.getAllLogs())}),je=Cn.onConnectionChange(_e=>{L(_e)});return()=>{we(),je()}},[]);const A=m.useMemo(()=>{const H=new Set(l.map(we=>we.module).filter(we=>we&&we.trim()!==""));return Array.from(H).sort()},[l]),J=H=>{switch(H){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},G=H=>{switch(H){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},ue=()=>{window.location.reload()},de=()=>{Cn.clearLogs(),n([])},ve=()=>{const H=ge.map(X=>`${X.timestamp} [${X.level.padEnd(8)}] [${X.module}] ${X.message}`).join(` +`),we=new Blob([H],{type:"text/plain;charset=utf-8"}),je=URL.createObjectURL(we),_e=document.createElement("a");_e.href=je,_e.download=`logs-${rm(new Date,"yyyy-MM-dd-HHmmss")}.txt`,_e.click(),URL.revokeObjectURL(je)},ne=()=>{w(!b)},fe=()=>{j(void 0),v(void 0)},ge=m.useMemo(()=>l.filter(H=>{const we=i===""||H.message.toLowerCase().includes(i.toLowerCase())||H.module.toLowerCase().includes(i.toLowerCase()),je=u==="all"||H.level===u,_e=h==="all"||H.module===h;let X=!0;if(p||N){const be=new Date(H.timestamp);if(p){const ee=new Date(p);ee.setHours(0,0,0,0),X=X&&be>=ee}if(N){const ee=new Date(N);ee.setHours(23,59,59,999),X=X&&be<=ee}}return we&&je&&_e&&X}),[l,i,u,h,p,N]),z=jo[D].rowHeight+V,K=s0({count:ge.length,getScrollElement:()=>I.current,estimateSize:()=>z,overscan:50}),B=m.useRef(!1),U=m.useRef(ge.length);return m.useEffect(()=>{const H=I.current;if(!H)return;const we=()=>{if(B.current)return;const{scrollTop:je,scrollHeight:_e,clientHeight:X}=H,be=_e-je-X;be>100&&b?w(!1):be<50&&!b&&w(!0)};return H.addEventListener("scroll",we,{passive:!0}),()=>H.removeEventListener("scroll",we)},[b]),m.useEffect(()=>{const H=ge.length>U.current;U.current=ge.length,b&&ge.length>0&&H&&(B.current=!0,K.scrollToIndex(ge.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{B.current=!1})}))},[ge.length,b,K]),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-shrink-0 space-y-2 sm:space-y-3 p-2 sm:p-3 lg:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg sm:text-xl lg:text-2xl font-bold",children:"日志查看器"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 hidden sm:block",children:"实时查看和分析麦麦运行日志"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:$("h-2 w-2 sm:h-2.5 sm:w-2.5 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:y?"已连接":"未连接"})]})]}),e.jsx(Me,{className:"p-2 sm:p-3",children:e.jsx(Vi,{open:S,onOpenChange:E,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(oe,{placeholder:"搜索日志...",value:i,onChange:H=>c(H.target.value),className:"pl-8 h-8 text-xs sm:text-sm"})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(C,{variant:b?"default":"outline",size:"sm",onClick:ne,className:"h-8 px-2",title:b?"自动滚动":"已暂停",children:[b?e.jsx(Gw,{className:"h-3.5 w-3.5"}):e.jsx(Fw,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:b?"滚动":"暂停"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:de,className:"h-8 px-2",title:"清空日志",children:[e.jsx(as,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden md:inline",children:"清空"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:ve,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(qt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(qi,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:"h-8 px-2",title:S?"收起筛选":"展开筛选",children:[e.jsx(No,{className:"h-3.5 w-3.5"}),S?e.jsx(Ar,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(Oa,{className:"h-3.5 w-3.5 ml-1"})]})})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground text-center sm:text-right -mt-1",children:[e.jsxs("span",{className:"font-mono",children:[ge.length," / ",l.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(Ki,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Ue,{value:u,onValueChange:x,children:[e.jsxs(Oe,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(No,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Be,{placeholder:"级别"})]}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部级别"}),e.jsx(re,{value:"DEBUG",children:"DEBUG"}),e.jsx(re,{value:"INFO",children:"INFO"}),e.jsx(re,{value:"WARNING",children:"WARNING"}),e.jsx(re,{value:"ERROR",children:"ERROR"}),e.jsx(re,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Ue,{value:h,onValueChange:f,children:[e.jsxs(Oe,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(No,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Be,{placeholder:"模块"})]}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部模块"}),A.map(H=>e.jsx(re,{value:H,children:H},H))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Za,{children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:$("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Fp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?rm(p,"PP",{locale:po}):"开始日期"})]})}),e.jsx(Pa,{className:"w-auto p-0",align:"start",children:e.jsx(pg,{mode:"single",selected:p,onSelect:j,initialFocus:!0,locale:po})})]}),e.jsxs(Za,{children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:$("w-full sm:flex-1 justify-start text-left font-normal h-8",!N&&"text-muted-foreground"),children:[e.jsx(Fp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:N?rm(N,"PP",{locale:po}):"结束日期"})]})}),e.jsx(Pa,{className:"w-auto p-0",align:"start",children:e.jsx(pg,{mode:"single",selected:N,onSelect:v,initialFocus:!0,locale:po})})]}),(p||N)&&e.jsxs(C,{variant:"outline",size:"sm",onClick:fe,className:"w-full sm:w-auto h-8",children:[e.jsx(Da,{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(Vw,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(jo).map(H=>e.jsx(C,{variant:D===H?"default":"outline",size:"sm",onClick:()=>k(H),className:"h-6 px-2 text-xs",children:jo[H].label},H))})]}),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(Na,{value:[V],onValueChange:([H])=>M(H),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[V,"px"]})]}),e.jsxs("div",{className:"flex gap-2 sm:hidden",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:ue,className:"flex-1 h-8",children:[e.jsx(wt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:ve,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.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(Me,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:I,className:$("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:$("p-2 sm:p-3 font-mono relative",jo[D].class),style:{height:`${K.getTotalSize()}px`},children:ge.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"暂无日志数据"}):K.getVirtualItems().map(H=>{const we=ge[H.index];return e.jsxs("div",{"data-index":H.index,ref:K.measureElement,className:$("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",G(we.level)),style:{transform:`translateY(${H.start}px)`,paddingTop:`${V/2}px`,paddingBottom:`${V/2}px`},children:[e.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-[10px]",children:we.timestamp}),e.jsxs("span",{className:$("font-semibold text-[10px]",J(we.level)),children:["[",we.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate text-[10px]",children:we.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words text-[10px]",children:we.message})]}),e.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:we.timestamp}),e.jsxs("span",{className:$("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",J(we.level)),children:["[",we.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:we.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:we.message})]})]},H.key)})})})})})]})}const P4="Mai-with-u",G4="plugin-repo",F4="main",V4="plugin_details.json";async function q4(){try{const l=await ye("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:P4,repo:G4,branch:F4,file_path:V4})});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const n=await l.json();if(!n.success||!n.data)throw new Error(n.error||"获取插件列表失败");return JSON.parse(n.data).filter(u=>!u?.id||!u?.manifest?(console.warn("跳过无效插件数据:",u),!1):!u.manifest.name||!u.manifest.version?(console.warn("跳过缺少必需字段的插件:",u.id),!1):!0).map(u=>({id:u.id,manifest:{manifest_version:u.manifest.manifest_version||1,name:u.manifest.name,version:u.manifest.version,description:u.manifest.description||"",author:u.manifest.author||{name:"Unknown"},license:u.manifest.license||"Unknown",host_application:u.manifest.host_application||{min_version:"0.0.0"},homepage_url:u.manifest.homepage_url,repository_url:u.manifest.repository_url,keywords:u.manifest.keywords||[],categories:u.manifest.categories||[],default_locale:u.manifest.default_locale||"zh-CN",locales_path:u.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(l){throw console.error("Failed to fetch plugin list:",l),l}}async function fv(){try{const l=await ye("/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 pv(){try{const l=await ye("/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 gv(l,n,i){const c=l.split(".").map(f=>parseInt(f)||0),u=c[0]||0,x=c[1]||0,h=c[2]||0;if(i.version_majorparseInt(v)||0),p=f[0]||0,j=f[1]||0,N=f[2]||0;if(i.version_major>p||i.version_major===p&&i.version_minor>j||i.version_major===p&&i.version_minor===j&&i.version_patch>N)return!1}return!0}async function K4(){try{const l=await ye("/api/webui/ws-token");if(!l.ok)return console.error("获取 WebSocket token 失败:",l.status),null;const n=await l.json();return n.success&&n.token?n.token:null}catch(l){return console.error("获取 WebSocket token 失败:",l),null}}async function Q4(l,n){const i=await K4();if(!i)return console.warn("无法获取 WebSocket token,可能未登录"),null;const c=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host,x=`${c}//${u}/api/webui/ws/plugin-progress?token=${encodeURIComponent(i)}`;try{const h=new WebSocket(x);return h.onopen=()=>{console.log("Plugin progress WebSocket connected");const f=setInterval(()=>{h.readyState===WebSocket.OPEN?h.send("ping"):clearInterval(f)},3e4)},h.onmessage=f=>{try{if(f.data==="pong")return;const p=JSON.parse(f.data);l(p)}catch(p){console.error("Failed to parse progress data:",p)}},h.onerror=f=>{console.error("Plugin progress WebSocket error:",f),n?.(f)},h.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},h}catch(h){return console.error("创建 WebSocket 连接失败:",h),null}}async function Nl(){try{const l=await ye("/api/webui/plugins/installed",{headers:zs()});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const n=await l.json();if(!n.success)throw new Error(n.message||"获取已安装插件列表失败");return n.plugins||[]}catch(l){return console.error("Failed to get installed plugins:",l),[]}}function en(l,n){return n.some(i=>i.id===l)}function sn(l,n){const i=n.find(c=>c.id===l);if(i)return i.manifest?.version||i.version}async function jv(l,n,i="main"){const c=await ye("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:n,branch:i})});if(!c.ok){const u=await c.json();throw new Error(u.detail||"安装失败")}return await c.json()}async function vv(l){const n=await ye("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"卸载失败")}return await n.json()}async function Nv(l,n,i="main"){const c=await ye("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:n,branch:i})});if(!c.ok){const u=await c.json();throw new Error(u.detail||"更新失败")}return await c.json()}async function Y4(l){const n=await ye(`/api/webui/plugins/config/${l}/schema`,{headers:zs()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置 Schema 失败")}catch{throw new Error(`获取配置 Schema 失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置 Schema 失败");return i.schema}async function J4(l){const n=await ye(`/api/webui/plugins/config/${l}`,{headers:zs()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置失败");return i.config}async function X4(l){const n=await ye(`/api/webui/plugins/config/${l}/raw`,{headers:zs()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置失败");return i.config}async function Z4(l,n){const i=await ye(`/api/webui/plugins/config/${l}`,{method:"PUT",headers:zs(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function W4(l,n){const i=await ye(`/api/webui/plugins/config/${l}/raw`,{method:"PUT",headers:zs(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function eC(l){const n=await ye(`/api/webui/plugins/config/${l}/reset`,{method:"POST",headers:zs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"重置配置失败")}return await n.json()}async function sC(l){const n=await ye(`/api/webui/plugins/config/${l}/toggle`,{method:"POST",headers:zs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"切换状态失败")}return await n.json()}const Xi="https://maibot-plugin-stats.maibot-webui.workers.dev";async function bv(l){try{const n=await fetch(`${Xi}/stats/${l}`);return n.ok?await n.json():(console.error("Failed to fetch plugin stats:",n.statusText),null)}catch(n){return console.error("Error fetching plugin stats:",n),null}}async function tC(l,n){try{const i=n||qm(),c=await fetch(`${Xi}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:i})}),u=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...u}:{success:!1,error:u.error||"点赞失败"}}catch(i){return console.error("Error liking plugin:",i),{success:!1,error:"网络错误"}}}async function aC(l,n){try{const i=n||qm(),c=await fetch(`${Xi}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:i})}),u=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...u}:{success:!1,error:u.error||"点踩失败"}}catch(i){return console.error("Error disliking plugin:",i),{success:!1,error:"网络错误"}}}async function lC(l,n,i,c){if(n<1||n>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const u=c||qm(),x=await fetch(`${Xi}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,rating:n,comment:i,user_id:u})}),h=await x.json();return x.status===429?{success:!1,error:"每天最多评分 3 次"}:x.ok?{success:!0,...h}:{success:!1,error:h.error||"评分失败"}}catch(u){return console.error("Error rating plugin:",u),{success:!1,error:"网络错误"}}}async function yv(l){try{const n=await fetch(`${Xi}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l})}),i=await n.json();return n.status===429?(console.warn("Download recording rate limited"),{success:!0}):n.ok?{success:!0,...i}:(console.error("Failed to record download:",i.error),{success:!1,error:i.error})}catch(n){return console.error("Error recording download:",n),{success:!1,error:"网络错误"}}}function nC(){const l=navigator,n=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,l.deviceMemory||0].join("|");let i=0;for(let c=0;c{const te=q.map(async Ie=>{try{const ie=await bv(Ie.id);return{id:Ie.id,stats:ie}}catch(ie){return console.warn(`Failed to load stats for ${Ie.id}:`,ie),{id:Ie.id,stats:null}}}),Ae=await Promise.all(te),Te={};Ae.forEach(({id:Ie,stats:ie})=>{ie&&(Te[Ie]=ie)}),G(Te)};m.useEffect(()=>{let q=null,te=!1;return(async()=>{if(q=await Q4(Te=>{te||(S(Te),Te.stage==="success"?setTimeout(()=>{te||S(null)},2e3):Te.stage==="error"&&(y(!1),D(Te.error||"加载失败")))},Te=>{console.error("WebSocket error:",Te),te||je({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(Te=>{if(!q){Te();return}const Ie=()=>{q&&q.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),Te()):q&&q.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),Te()):setTimeout(Ie,100)};Ie()}),!te){const Te=await fv();V(Te),Te.installed||je({title:"Git 未安装",description:Te.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!te){const Te=await pv();I(Te)}if(!te)try{y(!0),D(null);const Te=await q4();if(!te){const Ie=await Nl();A(Ie);const ie=Te.map(Ee=>{const Vs=en(Ee.id,Ie),Vt=sn(Ee.id,Ie);return{...Ee,installed:Vs,installed_version:Vt}});for(const Ee of Ie)!ie.some(Vt=>Vt.id===Ee.id)&&Ee.manifest&&ie.push({id:Ee.id,manifest:{manifest_version:Ee.manifest.manifest_version||1,name:Ee.manifest.name,version:Ee.manifest.version,description:Ee.manifest.description||"",author:Ee.manifest.author,license:Ee.manifest.license||"Unknown",host_application:Ee.manifest.host_application,homepage_url:Ee.manifest.homepage_url,repository_url:Ee.manifest.repository_url,keywords:Ee.manifest.keywords||[],categories:Ee.manifest.categories||[],default_locale:Ee.manifest.default_locale||"zh-CN",locales_path:Ee.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Ee.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});b(ie),_e(ie)}}catch(Te){if(!te){const Ie=Te instanceof Error?Te.message:"加载插件列表失败";D(Ie),je({title:"加载失败",description:Ie,variant:"destructive"})}}finally{te||y(!1)}})(),()=>{te=!0,q&&q.close()}},[je]);const X=q=>{if(!q.installed&&E&&!be(q))return e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(_t,{className:"h-3 w-3"}),"不兼容"]});if(q.installed){const te=q.installed_version?.trim(),Ae=q.manifest.version?.trim();if(te!==Ae){const Te=te?.split(".").map(Number)||[0,0,0],Ie=Ae?.split(".").map(Number)||[0,0,0];for(let ie=0;ie<3;ie++){if((Ie[ie]||0)>(Te[ie]||0))return e.jsxs(ke,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(_t,{className:"h-3 w-3"}),"可更新"]});if((Ie[ie]||0)<(Te[ie]||0))break}}return e.jsxs(ke,{variant:"default",className:"gap-1",children:[e.jsx(Zt,{className:"h-3 w-3"}),"已安装"]})}return null},be=q=>!E||!q.manifest?.host_application?!0:gv(q.manifest.host_application.min_version,q.manifest.host_application.max_version,E),ee=q=>{if(!q.installed||!q.installed_version||!q.manifest?.version)return!1;const te=q.installed_version.trim(),Ae=q.manifest.version.trim();if(te===Ae)return!1;const Te=te.split(".").map(Number),Ie=Ae.split(".").map(Number);for(let ie=0;ie<3;ie++){if((Ie[ie]||0)>(Te[ie]||0))return!0;if((Ie[ie]||0)<(Te[ie]||0))return!1}return!1},xe=v.filter(q=>{if(!q.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",q.id),!1;const te=c===""||q.manifest.name?.toLowerCase().includes(c.toLowerCase())||q.manifest.description?.toLowerCase().includes(c.toLowerCase())||q.manifest.keywords&&q.manifest.keywords.some(ie=>ie.toLowerCase().includes(c.toLowerCase())),Ae=x==="all"||q.manifest.categories&&q.manifest.categories.includes(x);let Te=!0;f==="installed"?Te=q.installed===!0:f==="updates"&&(Te=q.installed===!0&&ee(q));const Ie=!j||!E||be(q);return te&&Ae&&Te&&Ie}),Ce=q=>{if(!k?.installed){je({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(E&&!be(q)){je({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}ne(q),ge("main"),K(""),U("preset"),we(!1),de(!0)},Z=async()=>{if(!ve)return;const q=B==="custom"?z:fe;if(!q||q.trim()===""){je({title:"分支名称不能为空",variant:"destructive"});return}try{de(!1),await jv(ve.id,ve.manifest.repository_url||"",q),yv(ve.id).catch(Ae=>{console.warn("Failed to record download:",Ae)}),je({title:"安装成功",description:`${ve.manifest.name} 已成功安装`});const te=await Nl();A(te),b(Ae=>Ae.map(Te=>{if(Te.id===ve.id){const Ie=en(Te.id,te),ie=sn(Te.id,te);return{...Te,installed:Ie,installed_version:ie}}return Te}))}catch(te){je({title:"安装失败",description:te instanceof Error?te.message:"未知错误",variant:"destructive"})}finally{ne(null)}},se=async q=>{try{await vv(q.id),je({title:"卸载成功",description:`${q.manifest.name} 已成功卸载`});const te=await Nl();A(te),b(Ae=>Ae.map(Te=>{if(Te.id===q.id){const Ie=en(Te.id,te),ie=sn(Te.id,te);return{...Te,installed:Ie,installed_version:ie}}return Te}))}catch(te){je({title:"卸载失败",description:te instanceof Error?te.message:"未知错误",variant:"destructive"})}},De=async q=>{if(!k?.installed){je({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const te=await Nv(q.id,q.manifest.repository_url||"","main");je({title:"更新成功",description:`${q.manifest.name} 已从 ${te.old_version} 更新到 ${te.new_version}`});const Ae=await Nl();A(Ae),b(Te=>Te.map(Ie=>{if(Ie.id===q.id){const ie=en(Ie.id,Ae),Ee=sn(Ie.id,Ae);return{...Ie,installed:ie,installed_version:Ee}}return Ie}))}catch(te){je({title:"更新失败",description:te instanceof Error?te.message:"未知错误",variant:"destructive"})}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:()=>n(),disabled:i,children:[e.jsx(bj,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(C,{onClick:()=>l({to:"/plugin-mirrors"}),children:[e.jsx(qw,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]})]}),e.jsx(Me,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:e.jsx(Ke,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gt,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["安装、卸载或更新插件后,需要",e.jsx("span",{className:"font-semibold",children:"重启麦麦"}),"才能使更改生效"]})]})})}),k&&!k.installed&&e.jsxs(Me,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(Je,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Jt,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(Xe,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(Ls,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(Ke,{children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",e.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),e.jsx(Me,{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(oe,{placeholder:"搜索插件...",value:c,onChange:q=>u(q.target.value),className:"pl-9"})]}),e.jsxs(Ue,{value:x,onValueChange:h,children:[e.jsx(Oe,{className:"w-full sm:w-[200px]",children:e.jsx(Be,{placeholder:"选择分类"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"all",children:"全部分类"}),e.jsx(re,{value:"Group Management",children:"群组管理"}),e.jsx(re,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(re,{value:"Utility Tools",children:"实用工具"}),e.jsx(re,{value:"Content Generation",children:"内容生成"}),e.jsx(re,{value:"Multimedia",children:"多媒体"}),e.jsx(re,{value:"External Integration",children:"外部集成"}),e.jsx(re,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(re,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:"compatible-only",checked:j,onCheckedChange:q=>N(q===!0)}),e.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),e.jsx(ua,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(ea,{className:"grid w-full grid-cols-3",children:[e.jsxs(We,{value:"all",children:["全部插件 (",v.filter(q=>{if(!q.manifest)return!1;const te=c===""||q.manifest.name?.toLowerCase().includes(c.toLowerCase())||q.manifest.description?.toLowerCase().includes(c.toLowerCase())||q.manifest.keywords&&q.manifest.keywords.some(Ie=>Ie.toLowerCase().includes(c.toLowerCase())),Ae=x==="all"||q.manifest.categories&&q.manifest.categories.includes(x),Te=!j||!E||be(q);return te&&Ae&&Te}).length,")"]}),e.jsxs(We,{value:"installed",children:["已安装 (",v.filter(q=>{if(!q.manifest)return!1;const te=c===""||q.manifest.name?.toLowerCase().includes(c.toLowerCase())||q.manifest.description?.toLowerCase().includes(c.toLowerCase())||q.manifest.keywords&&q.manifest.keywords.some(Ie=>Ie.toLowerCase().includes(c.toLowerCase())),Ae=x==="all"||q.manifest.categories&&q.manifest.categories.includes(x),Te=!j||!E||be(q);return q.installed&&te&&Ae&&Te}).length,")"]}),e.jsxs(We,{value:"updates",children:["可更新 (",v.filter(q=>{if(!q.manifest)return!1;const te=c===""||q.manifest.name?.toLowerCase().includes(c.toLowerCase())||q.manifest.description?.toLowerCase().includes(c.toLowerCase())||q.manifest.keywords&&q.manifest.keywords.some(Ie=>Ie.toLowerCase().includes(c.toLowerCase())),Ae=x==="all"||q.manifest.categories&&q.manifest.categories.includes(x),Te=!j||!E||be(q);return q.installed&&ee(q)&&te&&Ae&&Te}).length,")"]})]})}),M&&M.stage==="loading"&&M.operation==="fetch"&&e.jsx(Me,{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(Es,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm font-medium",children:"加载插件列表"})]}),e.jsxs("span",{className:"text-sm font-medium",children:[M.progress,"%"]})]}),e.jsx(On,{value:M.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:M.message}),M.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",M.loaded_plugins," / ",M.total_plugins," 个插件"]})]})}),M&&M.stage==="error"&&M.error&&e.jsx(Me,{className:"border-destructive bg-destructive/10",children:e.jsx(Je,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Jt,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(Xe,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(Ls,{className:"text-destructive/80",children:M.error})]})]})})}),w?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Es,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):L?e.jsx(Me,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Jt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:L}),e.jsx(C,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):xe.length===0?e.jsx(Me,{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:c||x!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:xe.map(q=>e.jsxs(Me,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(Je,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(Xe,{className:"text-xl",children:q.manifest?.name||q.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[q.manifest?.categories&&q.manifest.categories[0]&&e.jsx(ke,{variant:"secondary",className:"text-xs whitespace-nowrap",children:rC[q.manifest.categories[0]]||q.manifest.categories[0]}),X(q)]})]}),e.jsx(Ls,{className:"line-clamp-2",children:q.manifest?.description||"无描述"})]}),e.jsx(Ke,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx("span",{children:(J[q.id]?.downloads??q.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Zl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(J[q.id]?.rating??q.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[q.manifest?.keywords&&q.manifest.keywords.slice(0,3).map(te=>e.jsx(ke,{variant:"outline",className:"text-xs",children:te},te)),q.manifest?.keywords&&q.manifest.keywords.length>3&&e.jsxs(ke,{variant:"outline",className:"text-xs",children:["+",q.manifest.keywords.length-3]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[e.jsxs("div",{children:["v",q.manifest?.version||"unknown"," · ",q.manifest?.author?.name||"Unknown"]}),q.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[q.manifest.host_application.min_version,q.manifest.host_application.max_version?` - ${q.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(Bo,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>l({to:"/plugin-detail",search:{pluginId:q.id}}),children:"查看详情"}),q.installed?ee(q)?e.jsxs(C,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>De(q),children:[e.jsx(wt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(C,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>se(q),children:[e.jsx(as,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(C,{size:"sm",disabled:!k?.installed||M?.operation==="install"||E!==null&&!be(q),title:k?.installed?E!==null&&!be(q)?`不兼容当前版本 (需要 ${q.manifest?.host_application?.min_version||"未知"}${q.manifest?.host_application?.max_version?` - ${q.manifest.host_application.max_version}`:"+"},当前 ${E?.version})`:void 0:"Git 未安装",onClick:()=>Ce(q),children:[e.jsx(qt,{className:"h-4 w-4 mr-1"}),M?.operation==="install"&&M?.plugin_id===q.id?"安装中...":"安装"]})]})}),M&&(M.stage==="loading"||M.stage==="success"||M.stage==="error")&&M.operation!=="fetch"&&M.plugin_id===q.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${M.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":M.stage==="error"?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900":"bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[M.stage==="loading"?e.jsx(Es,{className:"h-3 w-3 animate-spin"}):M.stage==="success"?e.jsx(Zt,{className:"h-3 w-3 text-green-600"}):e.jsx(_t,{className:"h-3 w-3 text-red-600"}),e.jsx("span",{className:`text-xs font-medium ${M.stage==="success"?"text-green-700 dark:text-green-300":M.stage==="error"?"text-red-700 dark:text-red-300":""}`,children:M.stage==="loading"?e.jsxs(e.Fragment,{children:[M.operation==="install"&&"正在安装",M.operation==="uninstall"&&"正在卸载",M.operation==="update"&&"正在更新"]}):M.stage==="success"?e.jsxs(e.Fragment,{children:[M.operation==="install"&&"安装完成",M.operation==="uninstall"&&"卸载完成",M.operation==="update"&&"更新完成"]}):e.jsxs(e.Fragment,{children:[M.operation==="install"&&"安装失败",M.operation==="uninstall"&&"卸载失败",M.operation==="update"&&"更新失败"]})})]}),M.stage!=="error"&&e.jsxs("span",{className:`text-xs font-medium ${M.stage==="success"?"text-green-700 dark:text-green-300":""}`,children:[M.progress,"%"]})]}),M.stage!=="error"&&e.jsx(On,{value:M.progress,className:`h-1.5 ${M.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${M.stage==="success"?"text-green-600 dark:text-green-400 truncate":M.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:M.stage==="error"?M.error||M.message||"操作失败":M.message})]})})]},q.id))}),e.jsx(Fs,{open:ue,onOpenChange:de,children:e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"安装插件"}),e.jsxs(lt,{children:["安装 ",ve?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",ve?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof ve?.manifest.author=="string"?ve.manifest.author:ve?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:"advanced-options",checked:H,onCheckedChange:q=>we(q)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),H&&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(ua,{value:B,onValueChange:q=>U(q),children:[e.jsxs(ea,{className:"grid w-full grid-cols-2",children:[e.jsx(We,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(We,{value:"custom",className:"text-xs",children:"自定义分支"})]}),B==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Ue,{value:fe,onValueChange:ge,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:"选择分支"})}),e.jsxs(Re,{children:[e.jsx(re,{value:"main",children:"main (默认)"}),e.jsx(re,{value:"master",children:"master"}),e.jsx(re,{value:"dev",children:"dev (开发版)"}),e.jsx(re,{value:"develop",children:"develop"}),e.jsx(re,{value:"beta",children:"beta (测试版)"}),e.jsx(re,{value:"stable",children:"stable (稳定版)"})]})]})}),B==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"输入分支名称,例如: feature/new-feature",value:z,onChange:q=>K(q.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!H&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>de(!1),children:"取消"}),e.jsxs(C,{onClick:Z,children:[e.jsx(qt,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})}),e.jsx(Bn,{})]})})}function oC(){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(yj,{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(Me,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(Je,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Xt,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(Xe,{className:"text-2xl",children:"功能开发中"}),e.jsx(Ls,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(Ke,{children:e.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground",children:"📦 即将推出的功能:"}),e.jsxs("ul",{className:"space-y-2 ml-6",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"浏览社区共享的模型分配预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"一键下载和应用预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"分享自己的模型分配方案"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"预设配置评分和评论系统"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"根据使用场景智能推荐配置"})]})]})]})})]})})})]})}function dC({field:l,value:n,onChange:i}){const[c,u]=m.useState(!1);switch(l.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:l.label}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]}),e.jsx(Ge,{checked:!!n,onCheckedChange:i,disabled:l.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsx(oe,{type:"number",value:n??l.default,onChange:x=>i(parseFloat(x.target.value)||0),min:l.min,max:l.max,step:l.step??1,placeholder:l.placeholder,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:l.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:n??l.default})]}),e.jsx(Na,{value:[n??l.default],onValueChange:x=>i(x[0]),min:l.min??0,max:l.max??100,step:l.step??1,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsxs(Ue,{value:String(n??l.default),onValueChange:i,disabled:l.disabled,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:l.placeholder??"请选择"})}),e.jsx(Re,{children:l.choices?.map(x=>e.jsx(re,{value:String(x),children:String(x)},String(x)))})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsx(Zs,{value:n??l.default,onChange:x=>i(x.target.value),placeholder:l.placeholder,rows:l.rows??3,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsxs("div",{className:"relative",children:[e.jsx(oe,{type:c?"text":"password",value:n??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,disabled:l.disabled,className:"pr-10"}),e.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>u(!c),children:c?e.jsx(Ii,{className:"h-4 w-4"}):e.jsx(Wt,{className:"h-4 w-4"})})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsx(f_,{value:Array.isArray(n)?n:[],onChange:x=>i(x),itemType:l.item_type??"string",itemFields:l.item_fields,minItems:l.min_items,maxItems:l.max_items,disabled:l.disabled,placeholder:l.placeholder}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsx(oe,{type:"text",value:n??l.default??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,maxLength:l.max_length,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]})}}function gg({section:l,config:n,onChange:i}){const[c,u]=m.useState(!l.collapsed),x=Object.entries(l.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(Vi,{open:c,onOpenChange:u,children:e.jsxs(Me,{children:[e.jsx(qi,{asChild:!0,children:e.jsxs(Je,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c?e.jsx(Oa,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ba,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Xe,{className:"text-lg",children:l.title})]}),e.jsxs(ke,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),l.description&&e.jsx(Ls,{className:"ml-6",children:l.description})]})}),e.jsx(Ki,{children:e.jsx(Ke,{className:"space-y-4 pt-0",children:x.map(([h,f])=>e.jsx(dC,{field:f,value:n[l.name]?.[h],onChange:p=>i(l.name,h,p),sectionName:l.name},h))})})]})})}function uC({plugin:l,onBack:n}){const{toast:i}=Js(),{triggerRestart:c,isRestarting:u}=ln(),[x,h]=m.useState("visual"),[f,p]=m.useState(null),[j,N]=m.useState({}),[v,b]=m.useState({}),[w,y]=m.useState(""),[L,D]=m.useState(""),[k,V]=m.useState(!0),[M,S]=m.useState(!1),[E,I]=m.useState(!1),[A,J]=m.useState(!1),[G,ue]=m.useState(!1),de=m.useCallback(async()=>{V(!0);try{const[B,U,H]=await Promise.all([Y4(l.id),J4(l.id),X4(l.id)]);p(B),N(U),b(JSON.parse(JSON.stringify(U))),y(H),D(H)}catch(B){i({title:"加载配置失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{V(!1)}},[l.id,i]);m.useEffect(()=>{de()},[de]),m.useEffect(()=>{I(x==="visual"?JSON.stringify(j)!==JSON.stringify(v):w!==L)},[j,v,w,L,x]);const ve=(B,U,H)=>{N(we=>({...we,[B]:{...we[B]||{},[U]:H}}))},ne=async()=>{S(!0);try{if(x==="source"){try{dv(w)}catch(B){J(!0),i({title:"TOML 格式错误",description:B instanceof Error?B.message:"无法解析 TOML 配置,请检查语法",variant:"destructive"}),S(!1);return}await W4(l.id,w),D(w),J(!1)}else await Z4(l.id,j),b(JSON.parse(JSON.stringify(j)));i({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(B){i({title:"保存失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{S(!1)}},fe=async()=>{try{await eC(l.id),i({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),ue(!1),de()}catch(B){i({title:"重置失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}},ge=async()=>{try{const B=await sC(l.id);i({title:B.message,description:B.note}),de()}catch(B){i({title:"切换状态失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}};if(k)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Es,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(_t,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(C,{onClick:n,variant:"outline",children:[e.jsx(Ha,{className:"h-4 w-4 mr-2"}),"返回"]})]});const z=Object.values(f.sections).sort((B,U)=>B.order-U.order),K=j.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(C,{variant:"ghost",size:"icon",onClick:n,children:e.jsx(Ha,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:f.plugin_info.name||l.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(ke,{variant:K?"default":"secondary",children:K?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",f.plugin_info.version||l.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>h(x==="visual"?"source":"visual"),children:x==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(gj,{className:"h-4 w-4 mr-2"}),"源代码"]}):e.jsxs(e.Fragment,{children:[e.jsx(pj,{className:"h-4 w-4 mr-2"}),"可视化"]})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>c(),disabled:u,children:[e.jsx(bj,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:ge,children:[e.jsx(Qi,{className:"h-4 w-4 mr-2"}),K?"禁用":"启用"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>ue(!0),children:[e.jsx($i,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(C,{size:"sm",onClick:ne,disabled:!E||M,children:[M?e.jsx(Es,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Yi,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),E&&e.jsx(Me,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(Ke,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gt,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),x==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(dt,{children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsxs(ut,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。保存时会验证格式,只有格式正确才能保存。",A&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Zj,{value:w,onChange:B=>{y(B),A&&J(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsxs(ut,{children:[e.jsx("strong",{children:"提示:"}),"如果插件当前未加载或未启用,WebUI 适配器的高级插件可视化编辑功能可能会不可用。 请确保插件已启用并成功加载后,再进行配置编辑。"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(ua,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(ea,{children:f.layout.tabs.map(B=>e.jsxs(We,{value:B.id,children:[B.title,B.badge&&e.jsx(ke,{variant:"secondary",className:"ml-2 text-xs",children:B.badge})]},B.id))}),f.layout.tabs.map(B=>e.jsx(vs,{value:B.id,className:"space-y-4 mt-4",children:B.sections.map(U=>{const H=f.sections[U];return H?e.jsx(gg,{section:H,config:j,onChange:ve},U):null})},B.id))]}):e.jsx("div",{className:"space-y-4",children:z.map(B=>e.jsx(gg,{section:B,config:j,onChange:ve},B.name))})]}),e.jsx(Fs,{open:G,onOpenChange:ue,children:e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"确认重置配置"}),e.jsx(lt,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>ue(!1),children:"取消"}),e.jsx(C,{variant:"destructive",onClick:fe,children:"确认重置"})]})]})})]})}function mC(){return e.jsx(Un,{children:e.jsx(xC,{})})}function xC(){const{toast:l}=Js(),[n,i]=m.useState([]),[c,u]=m.useState(!0),[x,h]=m.useState(""),[f,p]=m.useState(null),j=async()=>{u(!0);try{const y=await Nl();i(y)}catch(y){l({title:"加载插件列表失败",description:y instanceof Error?y.message:"未知错误",variant:"destructive"})}finally{u(!1)}};m.useEffect(()=>{j()},[]);const v=n.filter(y=>{const L=x.toLowerCase();return y.id.toLowerCase().includes(L)||y.manifest.name.toLowerCase().includes(L)||y.manifest.description?.toLowerCase().includes(L)}).filter((y,L,D)=>L===D.findIndex(k=>k.id===y.id)),b=n.length,w=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(uC,{plugin:f,onBack:()=>p(null)})})}),e.jsx(Bn,{})]}):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(C,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(wt,{className:`h-4 w-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:c?"正在加载...":"个插件"})]})]}),e.jsxs(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"已启用"}),e.jsx(Zt,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(Ke,{children:[e.jsx("div",{className:"text-2xl font-bold",children:b}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),e.jsxs(Me,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Xe,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(_t,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(Ke,{children:[e.jsx("div",{className:"text-2xl font-bold",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"搜索插件...",value:x,onChange:y=>h(y.target.value),className:"pl-9"})]}),e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"已安装的插件"}),e.jsx(Ls,{children:"点击插件查看和编辑配置"})]}),e.jsx(Ke,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Es,{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(Xt,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:x?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:v.map(y=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>p(y),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(Xt,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:y.manifest.name}),e.jsxs(ke,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",y.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(C,{variant:"ghost",size:"sm",children:e.jsx(Ln,{className:"h-4 w-4"})}),e.jsx(ba,{className:"h-4 w-4 text-muted-foreground"})]})]},y.id))})})]})]})})}function hC(){const l=sa(),{toast:n}=Js(),[i,c]=m.useState([]),[u,x]=m.useState(!0),[h,f]=m.useState(null),[p,j]=m.useState(null),[N,v]=m.useState(!1),[b,w]=m.useState(!1),[y,L]=m.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D=m.useCallback(async()=>{try{x(!0),f(null);const A=await ye("/api/webui/plugins/mirrors");if(!A.ok)throw new Error("获取镜像源列表失败");const J=await A.json();c(J.mirrors||[])}catch(A){const J=A instanceof Error?A.message:"加载镜像源失败";f(J),n({title:"加载失败",description:J,variant:"destructive"})}finally{x(!1)}},[n]);m.useEffect(()=>{D()},[D]);const k=async()=>{try{const A=await ye("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(y)});if(!A.ok){const J=await A.json();throw new Error(J.detail||"添加镜像源失败")}n({title:"添加成功",description:"镜像源已添加"}),v(!1),L({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D()}catch(A){n({title:"添加失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},V=async()=>{if(p)try{if(!(await ye(`/api/webui/plugins/mirrors/${p.id}`,{method:"PUT",body:JSON.stringify({name:y.name,raw_prefix:y.raw_prefix,clone_prefix:y.clone_prefix,enabled:y.enabled,priority:y.priority})})).ok)throw new Error("更新镜像源失败");n({title:"更新成功",description:"镜像源已更新"}),w(!1),j(null),D()}catch(A){n({title:"更新失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},M=async A=>{if(confirm("确定要删除这个镜像源吗?"))try{if(!(await ye(`/api/webui/plugins/mirrors/${A}`,{method:"DELETE"})).ok)throw new Error("删除镜像源失败");n({title:"删除成功",description:"镜像源已删除"}),D()}catch(J){n({title:"删除失败",description:J instanceof Error?J.message:"未知错误",variant:"destructive"})}},S=async A=>{try{if(!(await ye(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",body:JSON.stringify({enabled:!A.enabled})})).ok)throw new Error("更新状态失败");D()}catch(J){n({title:"更新失败",description:J instanceof Error?J.message:"未知错误",variant:"destructive"})}},E=A=>{j(A),L({id:A.id,name:A.name,raw_prefix:A.raw_prefix,clone_prefix:A.clone_prefix,enabled:A.enabled,priority:A.priority}),w(!0)},I=async(A,J)=>{const G=J==="up"?A.priority-1:A.priority+1;if(!(G<1))try{if(!(await ye(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",body:JSON.stringify({priority:G})})).ok)throw new Error("更新优先级失败");D()}catch(ue){n({title:"更新失败",description:ue instanceof Error?ue.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(C,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(Ha,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),e.jsxs(C,{onClick:()=>v(!0),children:[e.jsx(tt,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),u?e.jsx(Me,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Es,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(Me,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Jt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:h}),e.jsx(C,{onClick:D,children:"重新加载"})]})}):e.jsxs(Me,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(_l,{children:[e.jsx(Sl,{children:e.jsxs(at,{children:[e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"ID"}),e.jsx(Ye,{children:"优先级"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Cl,{children:i.map(A=>e.jsxs(at,{children:[e.jsx(Pe,{children:e.jsx(Ge,{checked:A.enabled,onCheckedChange:()=>S(A)})}),e.jsx(Pe,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:A.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",A.raw_prefix]})]})}),e.jsx(Pe,{children:e.jsx(ke,{variant:"outline",children:A.id})}),e.jsx(Pe,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:A.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(C,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>I(A,"up"),disabled:A.priority===1,children:e.jsx(Ar,{className:"h-3 w-3"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>I(A,"down"),children:e.jsx(Oa,{className:"h-3 w-3"})})]})]})}),e.jsx(Pe,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>E(A),children:e.jsx(Mn,{className:"h-4 w-4"})}),e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>M(A.id),children:e.jsx(as,{className:"h-4 w-4 text-destructive"})})]})})]},A.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:i.map(A=>e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:A.name}),A.enabled&&e.jsx(ke,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(ke,{variant:"outline",className:"mt-1 text-xs",children:A.id})]}),e.jsx(Ge,{checked:A.enabled,onCheckedChange:()=>S(A)})]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Raw: "}),e.jsx("span",{className:"break-all",children:A.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:A.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(C,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>E(A),children:[e.jsx(Mn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>I(A,"up"),disabled:A.priority===1,children:e.jsx(Ar,{className:"h-4 w-4"})}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>I(A,"down"),children:e.jsx(Oa,{className:"h-4 w-4"})}),e.jsx(C,{variant:"destructive",size:"sm",onClick:()=>M(A.id),children:e.jsx(as,{className:"h-4 w-4"})})]})]})},A.id))})]}),e.jsx(Fs,{open:N,onOpenChange:v,children:e.jsxs(Us,{className:"max-w-lg",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"添加镜像源"}),e.jsx(lt,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(oe,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:A=>L({...y,id:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-name",children:"名称 *"}),e.jsx(oe,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:A=>L({...y,name:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(oe,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:A=>L({...y,raw_prefix:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(oe,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:A=>L({...y,clone_prefix:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-priority",children:"优先级"}),e.jsx(oe,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:A=>L({...y,priority:parseInt(A.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"add-enabled",checked:y.enabled,onCheckedChange:A=>L({...y,enabled:A})}),e.jsx(T,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(C,{onClick:k,children:"添加"})]})]})}),e.jsx(Fs,{open:b,onOpenChange:w,children:e.jsxs(Us,{className:"max-w-lg",children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"编辑镜像源"}),e.jsx(lt,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"镜像源 ID"}),e.jsx(oe,{value:y.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(oe,{id:"edit-name",value:y.name,onChange:A=>L({...y,name:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(oe,{id:"edit-raw",value:y.raw_prefix,onChange:A=>L({...y,raw_prefix:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(oe,{id:"edit-clone",value:y.clone_prefix,onChange:A=>L({...y,clone_prefix:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(oe,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:A=>L({...y,priority:parseInt(A.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit-enabled",checked:y.enabled,onCheckedChange:A=>L({...y,enabled:A})}),e.jsx(T,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>w(!1),children:"取消"}),e.jsx(C,{onClick:V,children:"保存"})]})]})})]})})}function fC({pluginId:l,compact:n=!1}){const[i,c]=m.useState(null),[u,x]=m.useState(!0),[h,f]=m.useState(0),[p,j]=m.useState(""),[N,v]=m.useState(!1),{toast:b}=Js(),w=async()=>{x(!0);const k=await bv(l);k&&c(k),x(!1)};m.useEffect(()=>{w()},[l]);const y=async()=>{const k=await tC(l);k.success?(b({title:"已点赞",description:"感谢你的支持!"}),w()):b({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},L=async()=>{const k=await aC(l);k.success?(b({title:"已反馈",description:"感谢你的反馈!"}),w()):b({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},D=async()=>{if(h===0){b({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await lC(l,h,p||void 0);k.success?(b({title:"评分成功",description:"感谢你的评价!"}),v(!1),f(0),j(""),w()):b({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return u?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Zl,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):i?n?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${i.downloads.toLocaleString()}`,children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx("span",{children:i.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${i.rating.toFixed(1)} (${i.rating_count} 条评价)`,children:[e.jsx(Zl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:i.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${i.likes}`,children:[e.jsx(cm,{className:"h-4 w-4"}),e.jsx("span",{children:i.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(qt,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Zl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:i.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[i.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(cm,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Vp,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:y,children:[e.jsx(cm,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:L,children:[e.jsx(Vp,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Fs,{open:N,onOpenChange:v,children:[e.jsx(Io,{asChild:!0,children:e.jsxs(C,{variant:"default",size:"sm",children:[e.jsx(Zl,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx($s,{children:"为插件评分"}),e.jsx(lt,{children:"分享你的使用体验,帮助其他用户"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>e.jsx("button",{onClick:()=>f(k),className:"focus:outline-none",children:e.jsx(Zl,{className:`h-8 w-8 transition-colors ${k<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h===0&&"点击星星进行评分",h===1&&"很差",h===2&&"一般",h===3&&"还行",h===4&&"不错",h===5&&"非常好"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),e.jsx(Zs,{value:p,onChange:k=>j(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[p.length," / 500"]})]})]}),e.jsxs(it,{children:[e.jsx(C,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(C,{onClick:D,disabled:h===0,children:"提交评分"})]})]})]})]}),i.recent_ratings&&i.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),e.jsx("div",{className:"space-y-3",children:i.recent_ratings.map((k,V)=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(M=>e.jsx(Zl,{className:`h-3 w-3 ${M<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},M))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},V))})]})]}):null}const pC={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function gC(){const l=sa(),n=t0({strict:!1}),{toast:i}=Js(),[c,u]=m.useState(null),[x,h]=m.useState(""),[f,p]=m.useState(!0),[j,N]=m.useState(!0),[v,b]=m.useState(null),[w,y]=m.useState(null),[L,D]=m.useState(null),[k,V]=m.useState(!1),[M,S]=m.useState(),[E,I]=m.useState(!1);m.useEffect(()=>{(async()=>{if(!n.pluginId){b("缺少插件 ID"),p(!1);return}try{p(!0),b(null);const fe=await ye("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:"Mai-with-u",repo:"plugin-repo",branch:"main",file_path:"plugin_details.json"})});if(!fe.ok)throw new Error("获取插件列表失败");const ge=await fe.json();if(!ge.success||!ge.data)throw new Error(ge.error||"获取插件列表失败");const K=JSON.parse(ge.data).find(je=>je.id===n.pluginId);if(!K)throw new Error("未找到该插件");const B={id:K.id,manifest:K.manifest,downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()};u(B);const[U,H,we]=await Promise.all([fv(),pv(),Nl()]);y(U),D(H),V(en(n.pluginId,we)),S(sn(n.pluginId,we))}catch(fe){b(fe instanceof Error?fe.message:"加载失败")}finally{p(!1)}})()},[n.pluginId]),m.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){N(!1);return}try{N(!0);const fe=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!fe){h("无法解析仓库地址");return}const[,ge,z]=fe,K=z.replace(/\.git$/,""),B=await ye("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:ge,repo:K,branch:"main",file_path:"README.md"})});if(!B.ok)throw new Error("获取 README 失败");const U=await B.json();U.success&&U.data?h(U.data):h("该插件暂无 README 文档")}catch(fe){console.error("加载 README 失败:",fe),h("加载 README 失败")}finally{N(!1)}})()},[c]);const A=()=>!c||!k||!M?!1:M!==c.manifest.version,J=()=>!c||!L?!0:gv(c.manifest.host_application.min_version,c.manifest.host_application.max_version,L),G=async()=>{if(!(!c||!w?.installed))try{I(!0),await jv(c.id,c.manifest.repository_url||"","main"),yv(c.id).catch(fe=>{console.warn("Failed to record download:",fe)}),i({title:"安装成功",description:`${c.manifest.name} 已成功安装`});const ne=await Nl();V(en(c.id,ne)),S(sn(c.id,ne))}catch(ne){i({title:"安装失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}finally{I(!1)}},ue=async()=>{if(c)try{I(!0),await vv(c.id),i({title:"卸载成功",description:`${c.manifest.name} 已成功卸载`});const ne=await Nl();V(en(c.id,ne)),S(sn(c.id,ne))}catch(ne){i({title:"卸载失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}finally{I(!1)}},de=async()=>{if(!(!c||!w?.installed))try{I(!0);const ne=await Nv(c.id,c.manifest.repository_url||"","main");i({title:"更新成功",description:`${c.manifest.name} 已从 ${ne.old_version} 更新到 ${ne.new_version}`});const fe=await Nl();V(en(c.id,fe)),S(sn(c.id,fe))}catch(ne){i({title:"更新失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}finally{I(!1)}};if(f)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(Ha,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Es,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件信息中..."})]})]});if(v||!c)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(Ha,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsx(Me,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(_t,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:v}),e.jsx(C,{onClick:()=>l({to:"/plugins"}),children:"返回插件列表"})]})})]});const ve=J();return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),className:"shrink-0",children:e.jsx(Ha,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:c.manifest.name})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:k?e.jsxs(e.Fragment,{children:[A()?e.jsx(C,{disabled:!w?.installed||E,onClick:de,title:w?.installed?void 0:"Git 未安装",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Es,{className:"h-4 w-4 mr-2 animate-spin"}),"更新中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(wt,{className:"h-4 w-4 mr-2"}),"更新"]})}):null,e.jsx(C,{variant:"destructive",disabled:!w?.installed||E,onClick:ue,title:w?.installed?void 0:"Git 未安装",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Es,{className:"h-4 w-4 mr-2 animate-spin"}),"卸载中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(as,{className:"h-4 w-4 mr-2"}),"卸载"]})})]}):e.jsx(C,{disabled:!w?.installed||!ve||E,onClick:G,title:w?.installed?ve?void 0:`不兼容当前版本 (需要 ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"},当前 ${L?.version})`:"Git 未安装",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Es,{className:"h-4 w-4 mr-2 animate-spin"}),"安装中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(qt,{className:"h-4 w-4 mr-2"}),"安装"]})})})]}),e.jsx(Ze,{className:"h-[calc(100vh-200px)] sm:h-[calc(100vh-220px)]",children:e.jsxs("div",{className:"space-y-6 pr-4",children:[e.jsx(Me,{children:e.jsx(Je,{children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(Xe,{className:"text-2xl",children:c.manifest.name}),e.jsxs(ke,{variant:"secondary",className:"text-sm",children:["v",c.manifest.version]}),k&&e.jsxs(ke,{variant:"default",className:"text-sm",children:[e.jsx(Zt,{className:"h-3 w-3 mr-1"}),"已安装 ",M&&`(v${M})`]}),A()&&e.jsxs(ke,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(wt,{className:"h-3 w-3 mr-1"}),"可更新"]}),!ve&&e.jsxs(ke,{variant:"destructive",className:"text-sm",children:[e.jsx(_t,{className:"h-3 w-3 mr-1"}),"不兼容"]})]}),e.jsx(Ls,{className:"text-base",children:c.manifest.description})]})})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1 space-y-6",children:[e.jsxs(Me,{children:[e.jsx(Je,{children:e.jsx(Xe,{className:"text-lg",children:"统计信息"})}),e.jsx(Ke,{children:e.jsx(fC,{pluginId:c.id})})]}),e.jsxs(Me,{children:[e.jsx(Je,{children:e.jsx(Xe,{className:"text-lg",children:"基本信息"})}),e.jsx(Ke,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(En,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"作者:"}),e.jsx("span",{className:"font-medium",children:c.manifest.author?.name||"Unknown"}),c.manifest.author?.url&&e.jsx("a",{href:c.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.jsx(vo,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"版本:"}),e.jsxs("span",{className:"font-medium",children:["v",c.manifest.version]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(dj,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"许可证:"}),e.jsx("span",{className:"font-medium",children:c.manifest.license})]}),c.manifest.homepage_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(So,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"主页:"}),e.jsxs("a",{href:c.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["访问",e.jsx(vo,{className:"h-3 w-3"})]})]}),c.manifest.repository_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Kw,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"仓库:"}),e.jsxs("a",{href:c.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["GitHub",e.jsx(vo,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm mb-2",children:[e.jsx(Gt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"支持版本:"})]}),e.jsxs("div",{className:"text-sm pl-6 font-medium",children:[c.manifest.host_application.min_version,c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:" - 最新版本"]})]})]})})]}),(c.manifest.categories||c.manifest.keywords)&&e.jsxs(Me,{children:[e.jsx(Je,{children:e.jsx(Xe,{className:"text-lg",children:"分类与标签"})}),e.jsxs(Ke,{className:"space-y-4",children:[c.manifest.categories&&c.manifest.categories.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"分类"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.categories.map(ne=>e.jsx(ke,{variant:"secondary",children:pC[ne]||ne},ne))})]}),c.manifest.keywords&&c.manifest.keywords.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"标签"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.keywords.map(ne=>e.jsxs(ke,{variant:"outline",className:"text-xs",children:[e.jsx(Uo,{className:"h-3 w-3 mr-1"}),ne]},ne))})]})]})]})]}),e.jsxs(Me,{className:"lg:col-span-2",children:[e.jsx(Je,{children:e.jsx(Xe,{className:"text-lg",children:"插件说明"})}),e.jsx(Ke,{children:e.jsx(Ze,{className:"h-[600px] pr-4",children:j?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Es,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"加载说明文档中..."})]}):x?e.jsx(Bm,{content:x}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"暂无说明文档"})})})]})]})]})})]})}const Ri=m.forwardRef(({className:l,...n},i)=>e.jsx(Ug,{ref:i,className:$("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",l),...n}));Ri.displayName=Ug.displayName;const jC=m.forwardRef(({className:l,...n},i)=>e.jsx(Bg,{ref:i,className:$("aspect-square h-full w-full",l),...n}));jC.displayName=Bg.displayName;const Li=m.forwardRef(({className:l,...n},i)=>e.jsx($g,{ref:i,className:$("flex h-full w-full items-center justify-center rounded-full bg-muted",l),...n}));Li.displayName=$g.displayName;function vC(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function NC(){const l="maibot_webui_user_id";let n=localStorage.getItem(l);return n||(n=vC(),localStorage.setItem(l,n)),n}function bC(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function yC(l){localStorage.setItem("maibot_webui_user_name",l)}const wv="maibot_webui_virtual_tabs";function wC(){try{const l=localStorage.getItem(wv);if(l)return JSON.parse(l)}catch(l){console.error("[Chat] 加载虚拟标签页失败:",l)}return[]}function jg(l){try{localStorage.setItem(wv,JSON.stringify(l))}catch(n){console.error("[Chat] 保存虚拟标签页失败:",n)}}function _C({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:$("rounded-lg max-w-full",l.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:n=>{const i=n.target;i.style.display="none",i.parentElement?.insertAdjacentHTML("beforeend",`[${l.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(l.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(l.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(l.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(l.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[回复消息]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[转发消息]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",l.original_type||"未知消息","]"]})}}function SC({message:l,isBot:n}){return l.message_type==="rich"&&l.segments&&l.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:l.segments.map((i,c)=>e.jsx(_C,{segment:i},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:l.content})}function CC(){const l={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},n=()=>{const Fe=wC().map(He=>{const qe=He.virtualConfig;return!qe.groupId&&qe.platform&&qe.userId&&(qe.groupId=`webui_virtual_group_${qe.platform}_${qe.userId}`),{id:He.id,type:"virtual",label:He.label,virtualConfig:qe,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[l,...Fe]},[i,c]=m.useState(n),[u,x]=m.useState("webui-default"),h=i.find(Y=>Y.id===u)||i[0],[f,p]=m.useState(""),[j,N]=m.useState(!1),[v,b]=m.useState(!0),[w,y]=m.useState(bC()),[L,D]=m.useState(!1),[k,V]=m.useState(""),[M,S]=m.useState(!1),[E,I]=m.useState([]),[A,J]=m.useState([]),[G,ue]=m.useState(!1),[de,ve]=m.useState(!1),[ne,fe]=m.useState(""),[ge,z]=m.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),K=m.useRef(NC()),B=m.useRef(new Map),U=m.useRef(null),H=m.useRef(new Map),we=m.useRef(0),je=m.useRef(new Map),{toast:_e}=Js(),X=Y=>(we.current+=1,`${Y}-${Date.now()}-${we.current}-${Math.random().toString(36).substr(2,9)}`),be=m.useCallback((Y,Fe)=>{c(He=>He.map(qe=>qe.id===Y?{...qe,...Fe}:qe))},[]),ee=m.useCallback((Y,Fe)=>{c(He=>He.map(qe=>qe.id===Y?{...qe,messages:[...qe.messages,Fe]}:qe))},[]),xe=m.useCallback(()=>{U.current?.scrollIntoView({behavior:"smooth"})},[]);m.useEffect(()=>{xe()},[h?.messages,xe]);const Ce=m.useCallback(async()=>{ue(!0);try{const Y=await ye("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",Y.status,Y.headers.get("content-type")),Y.ok){const Fe=Y.headers.get("content-type");if(Fe&&Fe.includes("application/json")){const He=await Y.json();console.log("[Chat] 平台列表数据:",He),I(He.platforms||[])}else{const He=await Y.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",He.substring(0,200)),_e({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",Y.status),_e({title:"获取平台失败",description:`服务器返回错误: ${Y.status}`,variant:"destructive"})}catch(Y){console.error("[Chat] 获取平台列表失败:",Y),_e({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{ue(!1)}},[_e]),Z=m.useCallback(async(Y,Fe)=>{ve(!0);try{const He=new URLSearchParams;Y&&He.append("platform",Y),Fe&&He.append("search",Fe),He.append("limit","50");const qe=await ye(`/api/chat/persons?${He.toString()}`);if(qe.ok){const Ds=qe.headers.get("content-type");if(Ds&&Ds.includes("application/json")){const Se=await qe.json();J(Se.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(He){console.error("[Chat] 获取用户列表失败:",He)}finally{ve(!1)}},[]);m.useEffect(()=>{ge.platform&&Z(ge.platform,ne)},[ge.platform,ne,Z]);const se=m.useCallback(async(Y,Fe)=>{b(!0);try{const He=new URLSearchParams;He.append("user_id",K.current),He.append("limit","50"),Fe&&He.append("group_id",Fe);const qe=`/api/chat/history?${He.toString()}`;console.log("[Chat] 正在加载历史消息:",qe);const Ds=await ye(qe);if(Ds.ok){const Se=await Ds.text();try{const ns=JSON.parse(Se);if(ns.messages&&ns.messages.length>0){const Cs=ns.messages.map(ss=>({id:ss.id,type:ss.type,content:ss.content,timestamp:ss.timestamp,sender:{name:ss.sender_name||(ss.is_bot?"麦麦":"WebUI用户"),user_id:ss.user_id,is_bot:ss.is_bot}}));be(Y,{messages:Cs});const Ms=je.current.get(Y)||new Set;Cs.forEach(ss=>{if(ss.type==="bot"){const es=`bot-${ss.content}-${Math.floor(ss.timestamp*1e3)}`;Ms.add(es)}}),je.current.set(Y,Ms)}}catch(ns){console.error("[Chat] JSON 解析失败:",ns)}}}catch(He){console.error("[Chat] 加载历史消息失败:",He)}finally{b(!1)}},[be]),De=m.useCallback(async(Y,Fe,He)=>{const qe=B.current.get(Y);if(qe?.readyState===WebSocket.OPEN||qe?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${Y}] WebSocket 已存在,跳过连接`);return}N(!0);let Ds=null;try{const Ms=await ye("/api/webui/ws-token");if(Ms.ok){const ss=await Ms.json();if(ss.success&&ss.token)Ds=ss.token;else{console.warn(`[Tab ${Y}] 获取 WebSocket token 失败: ${ss.message||"未登录"}`),N(!1);return}}}catch(Ms){console.error(`[Tab ${Y}] 获取 WebSocket token 失败:`,Ms),N(!1);return}if(!Ds){N(!1);return}const Se=window.location.protocol==="https:"?"wss:":"ws:",ns=new URLSearchParams;ns.append("token",Ds),Fe==="virtual"&&He?(ns.append("user_id",He.userId),ns.append("user_name",He.userName),ns.append("platform",He.platform),ns.append("person_id",He.personId),ns.append("group_name",He.groupName||"WebUI虚拟群聊"),He.groupId&&ns.append("group_id",He.groupId)):(ns.append("user_id",K.current),ns.append("user_name",w));const Cs=`${Se}//${window.location.host}/api/chat/ws?${ns.toString()}`;console.log(`[Tab ${Y}] 正在连接 WebSocket:`,Cs);try{const Ms=new WebSocket(Cs);B.current.set(Y,Ms),Ms.onopen=()=>{be(Y,{isConnected:!0}),N(!1),console.log(`[Tab ${Y}] WebSocket 已连接`)},Ms.onmessage=ss=>{try{const es=JSON.parse(ss.data);switch(es.type){case"session_info":be(Y,{sessionInfo:{session_id:es.session_id,user_id:es.user_id,user_name:es.user_name,bot_name:es.bot_name}});break;case"system":ee(Y,{id:X("sys"),type:"system",content:es.content||"",timestamp:es.timestamp||Date.now()/1e3});break;case"user_message":{const ps=es.sender?.user_id,mt=Fe==="virtual"&&He?He.userId:K.current;console.log(`[Tab ${Y}] 收到 user_message, sender: ${ps}, current: ${mt}`);const zt=ps?ps.replace(/^webui_user_/,""):"",nt=mt?mt.replace(/^webui_user_/,""):"";if(zt&&nt&&zt===nt){console.log(`[Tab ${Y}] 跳过自己的消息(user_id 匹配)`);break}const ts=je.current.get(Y)||new Set,St=`user-${es.content}-${Math.floor((es.timestamp||0)*1e3)}`;if(ts.has(St)){console.log(`[Tab ${Y}] 跳过自己的消息(内容去重)`);break}if(ts.add(St),je.current.set(Y,ts),ts.size>100){const Lt=ts.values().next().value;Lt&&ts.delete(Lt)}ee(Y,{id:es.message_id||X("user"),type:"user",content:es.content||"",timestamp:es.timestamp||Date.now()/1e3,sender:es.sender});break}case"bot_message":{be(Y,{isTyping:!1});const ps=je.current.get(Y)||new Set,mt=`bot-${es.content}-${Math.floor((es.timestamp||0)*1e3)}`;if(ps.has(mt))break;if(ps.add(mt),je.current.set(Y,ps),ps.size>100){const zt=ps.values().next().value;zt&&ps.delete(zt)}c(zt=>zt.map(nt=>{if(nt.id!==Y)return nt;const ts=nt.messages.filter(Lt=>Lt.type!=="thinking"),St={id:X("bot"),type:"bot",content:es.content||"",message_type:es.message_type==="rich"?"rich":"text",segments:es.segments,timestamp:es.timestamp||Date.now()/1e3,sender:es.sender};return{...nt,messages:[...ts,St]}}));break}case"typing":be(Y,{isTyping:es.is_typing||!1});break;case"error":c(ps=>ps.map(mt=>{if(mt.id!==Y)return mt;const zt=mt.messages.filter(nt=>nt.type!=="thinking");return{...mt,messages:[...zt,{id:X("error"),type:"error",content:es.content||"发生错误",timestamp:es.timestamp||Date.now()/1e3}]}})),_e({title:"错误",description:es.content,variant:"destructive"});break;case"pong":break;case"history":{const ps=es.messages||[];if(ps.length>0){const mt=je.current.get(Y)||new Set,zt=ps.map(nt=>{const ts=nt.is_bot||!1,St=nt.id||X(ts?"bot":"user"),Lt=`${ts?"bot":"user"}-${nt.content}-${Math.floor(nt.timestamp*1e3)}`;return mt.add(Lt),{id:St,type:ts?"bot":"user",content:nt.content,timestamp:nt.timestamp,sender:{name:nt.sender_name||(ts?"麦麦":"用户"),user_id:nt.sender_id,is_bot:ts}}});je.current.set(Y,mt),be(Y,{messages:zt}),console.log(`[Tab ${Y}] 已加载 ${zt.length} 条历史消息`)}break}default:console.log("未知消息类型:",es.type)}}catch(es){console.error("解析消息失败:",es)}},Ms.onclose=()=>{be(Y,{isConnected:!1}),N(!1),B.current.delete(Y),console.log(`[Tab ${Y}] WebSocket 已断开`);const ss=H.current.get(Y);ss&&clearTimeout(ss);const es=window.setTimeout(()=>{if(!q.current){const ps=i.find(mt=>mt.id===Y);ps&&De(Y,ps.type,ps.virtualConfig)}},5e3);H.current.set(Y,es)},Ms.onerror=ss=>{console.error(`[Tab ${Y}] WebSocket 错误:`,ss),N(!1)}}catch(Ms){console.error(`[Tab ${Y}] 创建 WebSocket 失败:`,Ms),N(!1)}},[w,be,ee,_e,i]),q=m.useRef(!1);m.useEffect(()=>{q.current=!1;const Y=B.current,Fe=H.current,He=je.current;se("webui-default");const qe=setTimeout(()=>{q.current||(De("webui-default","webui"),i.forEach(Se=>{Se.type==="virtual"&&Se.virtualConfig&&(He.set(Se.id,new Set),setTimeout(()=>{q.current||De(Se.id,"virtual",Se.virtualConfig)},200))}))},100),Ds=setInterval(()=>{Y.forEach(Se=>{Se.readyState===WebSocket.OPEN&&Se.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{q.current=!0,clearTimeout(qe),clearInterval(Ds),Fe.forEach(Se=>{clearTimeout(Se)}),Fe.clear(),Y.forEach(Se=>{Se.close()}),Y.clear()}},[]);const te=m.useCallback(()=>{const Y=B.current.get(u);if(!f.trim()||!Y||Y.readyState!==WebSocket.OPEN)return;const Fe=h?.type==="virtual"&&h.virtualConfig?.userName||w,He=f.trim(),qe=Date.now()/1e3;Y.send(JSON.stringify({type:"message",content:He,user_name:Fe}));const Ds=je.current.get(u)||new Set,Se=`user-${He}-${Math.floor(qe*1e3)}`;if(Ds.add(Se),je.current.set(u,Ds),Ds.size>100){const Ms=Ds.values().next().value;Ms&&Ds.delete(Ms)}const ns={id:X("user"),type:"user",content:He,timestamp:qe,sender:{name:Fe,is_bot:!1}};ee(u,ns);const Cs={id:X("thinking"),type:"thinking",content:"",timestamp:qe+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};ee(u,Cs),p("")},[f,w,u,h,ee]),Ae=Y=>{Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),te())},Te=()=>{V(w),D(!0)},Ie=()=>{const Y=k.trim()||"WebUI用户";y(Y),yC(Y),D(!1);const Fe=B.current.get(u);Fe?.readyState===WebSocket.OPEN&&Fe.send(JSON.stringify({type:"update_nickname",user_name:Y}))},ie=()=>{V(""),D(!1)},Ee=Y=>new Date(Y*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),Vs=()=>{const Y=B.current.get(u);Y&&(Y.close(),B.current.delete(u)),De(u,h?.type||"webui",h?.virtualConfig)},Vt=()=>{z({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),fe(""),Ce(),S(!0)},Kt=()=>{if(!ge.platform||!ge.personId){_e({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const Y=`webui_virtual_group_${ge.platform}_${ge.userId}`,Fe=`virtual-${ge.platform}-${ge.userId}-${Date.now()}`,He=ge.userName||ge.userId,qe={id:Fe,type:"virtual",label:He,virtualConfig:{...ge,groupId:Y},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Ds=>{const Se=[...Ds,qe],ns=Se.filter(Cs=>Cs.type==="virtual"&&Cs.virtualConfig).map(Cs=>({id:Cs.id,label:Cs.label,virtualConfig:Cs.virtualConfig,createdAt:Date.now()}));return jg(ns),Se}),x(Fe),S(!1),je.current.set(Fe,new Set),setTimeout(()=>{De(Fe,"virtual",ge)},100),_e({title:"虚拟身份标签页",description:`已创建 ${He} 的对话`})},Qt=(Y,Fe)=>{if(Fe?.stopPropagation(),Y==="webui-default")return;const He=B.current.get(Y);He&&(He.close(),B.current.delete(Y));const qe=H.current.get(Y);qe&&(clearTimeout(qe),H.current.delete(Y)),je.current.delete(Y),c(Ds=>{const Se=Ds.filter(Cs=>Cs.id!==Y),ns=Se.filter(Cs=>Cs.type==="virtual"&&Cs.virtualConfig).map(Cs=>({id:Cs.id,label:Cs.label,virtualConfig:Cs.virtualConfig,createdAt:Date.now()}));return jg(ns),Se}),u===Y&&x("webui-default")},fs=Y=>{x(Y)},Is=Y=>{z(Fe=>({...Fe,personId:Y.person_id,userId:Y.user_id,userName:Y.nickname||Y.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Fs,{open:M,onOpenChange:S,children:e.jsxs(Us,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Bs,{children:[e.jsxs($s,{className:"flex items-center gap-2",children:[e.jsx(om,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(lt,{children:"选择一个麦麦已认识的用户,以该用户的身份与麦麦对话。麦麦将使用她对该用户的记忆和认知来回应。"})]}),e.jsxs("div",{className:"space-y-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(So,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Ue,{value:ge.platform,onValueChange:Y=>{z(Fe=>({...Fe,platform:Y,personId:"",userId:"",userName:""})),J([])},children:[e.jsx(Oe,{disabled:G,children:e.jsx(Be,{placeholder:G?"加载中...":"选择平台"})}),e.jsx(Re,{children:E.map(Y=>e.jsxs(re,{value:Y.platform,children:[Y.platform," (",Y.count," 人)"]},Y.platform))})]})]}),ge.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(Cm,{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(oe,{placeholder:"搜索用户名...",value:ne,onChange:Y=>fe(Y.target.value),className:"pl-9"})]}),e.jsx(Ze,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:de?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Es,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(Cm,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:A.map(Y=>e.jsxs("button",{onClick:()=>Is(Y),className:$("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",ge.personId===Y.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(Ri,{className:"h-8 w-8 shrink-0",children:e.jsx(Li,{className:$("text-xs",ge.personId===Y.person_id?"bg-primary-foreground/20":"bg-muted"),children:(Y.nickname||Y.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:Y.nickname||Y.person_name}),e.jsxs("div",{className:$("text-xs truncate",ge.personId===Y.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",Y.user_id,Y.is_known&&" · 已认识"]})]})]},Y.person_id))})})})]}),ge.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"虚拟群名(可选)"}),e.jsx(oe,{placeholder:"WebUI虚拟群聊",value:ge.groupName,onChange:Y=>z(Fe=>({...Fe,groupName:Y.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(it,{className:"gap-2 sm:gap-0",children:[e.jsx(C,{variant:"outline",onClick:()=>S(!1),children:"取消"}),e.jsx(C,{onClick:Kt,disabled:!ge.platform||!ge.personId,children:"创建对话"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[i.map(Y=>e.jsxs("div",{className:$("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===Y.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>fs(Y.id),children:[Y.type==="webui"?e.jsx(an,{className:"h-3.5 w-3.5"}):e.jsx(om,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:Y.label}),e.jsx("span",{className:$("w-1.5 h-1.5 rounded-full",Y.isConnected?"bg-green-500":"bg-muted-foreground/50")}),Y.id!=="webui-default"&&e.jsx("span",{onClick:Fe=>Qt(Y.id,Fe),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:Fe=>{(Fe.key==="Enter"||Fe.key===" ")&&(Fe.preventDefault(),Qt(Y.id,Fe))},children:e.jsx(Da,{className:"h-3 w-3"})})]},Y.id)),e.jsx("button",{onClick:Vt,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(tt,{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(Ri,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(Li,{className:"bg-primary/10 text-primary",children:e.jsx(Di,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:h?.sessionInfo.bot_name||"麦麦"}),e.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:h?.isConnected?e.jsxs(e.Fragment,{children:[e.jsx(Qw,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):j?e.jsxs(e.Fragment,{children:[e.jsx(Es,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Yw,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[v&&e.jsx(Es,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Vs,disabled:j,title:"重新连接",children:e.jsx(wt,{className:$("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(om,{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(En,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),L?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{value:k,onChange:Y=>V(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&Ie(),Y.key==="Escape"&&ie()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(C,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Ie,children:"保存"}),e.jsx(C,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:ie,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:w}),e.jsx(C,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:Te,title:"修改昵称",children:e.jsx(Jw,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(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&&!v&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Di,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(Y=>e.jsxs("div",{className:$("flex gap-2 sm:gap-3",Y.type==="user"&&"flex-row-reverse",Y.type==="system"&&"justify-center",Y.type==="error"&&"justify-center"),children:[Y.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:Y.content}),Y.type==="error"&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:Y.content}),Y.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(Ri,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Li,{className:"bg-primary/10 text-primary",children:e.jsx(Di,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:"flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",children:[e.jsx("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:e.jsx("span",{className:"hidden sm:inline",children:Y.sender?.name||h?.sessionInfo.bot_name})}),e.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"思考中..."})]})})]})]}),(Y.type==="user"||Y.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(Ri,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Li,{className:$("text-xs",Y.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:Y.type==="bot"?e.jsx(Di,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(En,{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%]",Y.type==="user"&&"items-end"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:Y.sender?.name||(Y.type==="bot"?h?.sessionInfo.bot_name:w)}),e.jsx("span",{children:Ee(Y.timestamp)})]}),e.jsx("div",{className:$("rounded-2xl px-3 py-2 text-sm break-words",Y.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(SC,{message:Y,isBot:Y.type==="bot"})})]})]})]},Y.id)),e.jsx("div",{ref:U})]})})}),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(oe,{value:f,onChange:Y=>p(Y.target.value),onKeyDown:Ae,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(C,{onClick:te,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(Xw,{className:"h-4 w-4"})})]})})})]})}var Km="Radio",[kC,_v]=Oo(Km),[TC,EC]=kC(Km),Sv=m.forwardRef((l,n)=>{const{__scopeRadio:i,name:c,checked:u=!1,required:x,disabled:h,value:f="on",onCheck:p,form:j,...N}=l,[v,b]=m.useState(null),w=Ro(n,D=>b(D)),y=m.useRef(!1),L=v?j||!!v.closest("form"):!0;return e.jsxs(TC,{scope:i,checked:u,disabled:h,children:[e.jsx(Rn.button,{type:"button",role:"radio","aria-checked":u,"data-state":Ev(u),"data-disabled":h?"":void 0,disabled:h,value:f,...N,ref:w,onClick:tn(l.onClick,D=>{u||p?.(),L&&(y.current=D.isPropagationStopped(),y.current||D.stopPropagation())})}),L&&e.jsx(Tv,{control:v,bubbles:!y.current,name:c,value:f,checked:u,required:x,disabled:h,form:j,style:{transform:"translateX(-100%)"}})]})});Sv.displayName=Km;var Cv="RadioIndicator",kv=m.forwardRef((l,n)=>{const{__scopeRadio:i,forceMount:c,...u}=l,x=EC(Cv,i);return e.jsx(gw,{present:c||x.checked,children:e.jsx(Rn.span,{"data-state":Ev(x.checked),"data-disabled":x.disabled?"":void 0,...u,ref:n})})});kv.displayName=Cv;var MC="RadioBubbleInput",Tv=m.forwardRef(({__scopeRadio:l,control:n,checked:i,bubbles:c=!0,...u},x)=>{const h=m.useRef(null),f=Ro(h,x),p=jw(i),j=vw(n);return m.useEffect(()=>{const N=h.current;if(!N)return;const v=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(v,"checked").set;if(p!==i&&w){const y=new Event("click",{bubbles:c});w.call(N,i),N.dispatchEvent(y)}},[p,i,c]),e.jsx(Rn.input,{type:"radio","aria-hidden":!0,defaultChecked:i,...u,tabIndex:-1,ref:f,style:{...u.style,...j,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Tv.displayName=MC;function Ev(l){return l?"checked":"unchecked"}var AC=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],qo="RadioGroup",[zC]=Oo(qo,[Ig,_v]),Mv=Ig(),Av=_v(),[DC,OC]=zC(qo),zv=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,name:c,defaultValue:u,value:x,required:h=!1,disabled:f=!1,orientation:p,dir:j,loop:N=!0,onValueChange:v,...b}=l,w=Mv(i),y=tj(j),[L,D]=Do({prop:x,defaultProp:u??null,onChange:v,caller:qo});return e.jsx(DC,{scope:i,name:c,required:h,disabled:f,value:L,onValueChange:D,children:e.jsx(A0,{asChild:!0,...w,orientation:p,dir:y,loop:N,children:e.jsx(Rn.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:y,...b,ref:n})})})});zv.displayName=qo;var Dv="RadioGroupItem",Ov=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,disabled:c,...u}=l,x=OC(Dv,i),h=x.disabled||c,f=Mv(i),p=Av(i),j=m.useRef(null),N=Ro(n,j),v=x.value===u.value,b=m.useRef(!1);return m.useEffect(()=>{const w=L=>{AC.includes(L.key)&&(b.current=!0)},y=()=>b.current=!1;return document.addEventListener("keydown",w),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",w),document.removeEventListener("keyup",y)}},[]),e.jsx(z0,{asChild:!0,...f,focusable:!h,active:v,children:e.jsx(Sv,{disabled:h,required:x.required,checked:v,...p,...u,name:x.name,ref:N,onCheck:()=>x.onValueChange(u.value),onKeyDown:tn(w=>{w.key==="Enter"&&w.preventDefault()}),onFocus:tn(u.onFocus,()=>{b.current&&j.current?.click()})})})});Ov.displayName=Dv;var RC="RadioGroupIndicator",Rv=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,...c}=l,u=Av(i);return e.jsx(kv,{...u,...c,ref:n})});Rv.displayName=RC;var Lv=zv,Uv=Ov,LC=Rv;const Qm=m.forwardRef(({className:l,...n},i)=>e.jsx(Lv,{className:$("grid gap-2",l),...n,ref:i}));Qm.displayName=Lv.displayName;const Ao=m.forwardRef(({className:l,...n},i)=>e.jsx(Uv,{ref:i,className:$("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",l),...n,children:e.jsx(LC,{className:"flex items-center justify-center",children:e.jsx(wj,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ao.displayName=Uv.displayName;function UC({question:l,value:n,onChange:i,error:c,disabled:u=!1}){const[x,h]=m.useState(null),f=u||l.readOnly,p=()=>{switch(l.type){case"single":return e.jsx(Qm,{value:n||"",onValueChange:i,disabled:f,className:"space-y-2",children:l.options?.map(j=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ao,{value:j.value,id:`${l.id}-${j.id}`}),e.jsx(T,{htmlFor:`${l.id}-${j.id}`,className:"cursor-pointer font-normal",children:j.label})]},j.id))});case"multiple":{const j=n||[];return e.jsxs("div",{className:"space-y-2",children:[l.options?.map(N=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:`${l.id}-${N.id}`,checked:j.includes(N.value),disabled:f||l.maxSelections!==void 0&&j.length>=l.maxSelections&&!j.includes(N.value),onCheckedChange:v=>{i(v?[...j,N.value]:j.filter(b=>b!==N.value))}}),e.jsx(T,{htmlFor:`${l.id}-${N.id}`,className:"cursor-pointer font-normal",children:N.label})]},N.id)),l.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",l.maxSelections," 项"]})]})}case"text":return e.jsx(oe,{value:n||"",onChange:j=>i(j.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,className:$(l.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(Zs,{value:n||"",onChange:j=>i(j.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,rows:4,className:$(l.readOnly&&"bg-muted cursor-not-allowed")}),l.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(n||"").length," / ",l.maxLength]})]});case"rating":{const j=n||0,N=x!==null?x:j;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(v=>e.jsx("button",{type:"button",disabled:f,className:$("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",f&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!f&&h(v),onMouseLeave:()=>h(null),onClick:()=>!f&&i(v),children:e.jsx(Zl,{className:$("h-6 w-6 transition-colors",v<=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},v)),j>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[j," / 5"]})]})}case"scale":{const j=l.min??1,N=l.max??10,v=l.step??1,b=n??j;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Na,{value:[b],onValueChange:([w])=>i(w),min:j,max:N,step:v,disabled:f}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:l.minLabel||j}),e.jsx("span",{className:"font-medium text-foreground",children:b}),e.jsx("span",{children:l.maxLabel||N})]})]})}case"dropdown":return e.jsxs(Ue,{value:n||"",onValueChange:i,disabled:f,children:[e.jsx(Oe,{children:e.jsx(Be,{placeholder:l.placeholder||"请选择..."})}),e.jsx(Re,{children:l.options?.map(j=>e.jsx(re,{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(T,{className:"text-base font-medium",children:[l.title,l.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),l.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:l.description})]}),p(),c&&e.jsx("p",{className:"text-sm text-destructive",children:c})]})}const Bv="https://maibot-plugin-stats.maibot-webui.workers.dev";function $v(){const l="maibot_user_id";let n=localStorage.getItem(l);if(!n){const i=Math.random().toString(36).substring(2,10),c=Date.now().toString(36),u=Math.random().toString(36).substring(2,10);n=`fp_${i}_${c}_${u}`,localStorage.setItem(l,n)}return n}async function BC(l,n,i,c){try{const u=c?.userId||$v(),x={surveyId:l,surveyVersion:n,userId:u,answers:i,submittedAt:new Date().toISOString(),allowMultiple:c?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${Bv}/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 $C(l,n){try{const i=n||$v(),c=new URLSearchParams({user_id:i,survey_id:l}),u=await fetch(`${Bv}/survey/check?${c}`);return u.ok?{success:!0,hasSubmitted:(await u.json()).hasSubmitted}:{success:!1,error:(await u.json()).error||"检查失败"}}catch(i){return console.error("Error checking submission:",i),{success:!1,error:"网络错误"}}}function Iv({config:l,initialAnswers:n,onSubmitSuccess:i,onSubmitError:c,showProgress:u=!0,paginateQuestions:x=!1,className:h}){const f=m.useCallback(()=>!n||n.length===0?{}:n.reduce((B,U)=>(B[U.questionId]=U.value,B),{}),[n]),[p,j]=m.useState(()=>f()),[N,v]=m.useState({}),[b,w]=m.useState(0),[y,L]=m.useState(!1),[D,k]=m.useState(!1),[V,M]=m.useState(null),[S,E]=m.useState(null),[I,A]=m.useState(!1),[J,G]=m.useState(!0);m.useEffect(()=>{n&&n.length>0&&j(B=>({...B,...f()}))},[n,f]),m.useEffect(()=>{(async()=>{if(!l.settings?.allowMultiple){const U=await $C(l.id);U.success&&U.hasSubmitted&&A(!0)}G(!1)})()},[l.id,l.settings?.allowMultiple]);const ue=m.useCallback(()=>{const B=new Date;return!(l.settings?.startTime&&new Date(l.settings.startTime)>B||l.settings?.endTime&&new Date(l.settings.endTime){const U=p[B.id];return U==null?!1:Array.isArray(U)?U.length>0:typeof U=="string"?U.trim()!=="":!0}).length,ve=de/l.questions.length*100,ne=m.useCallback((B,U)=>{j(H=>({...H,[B]:U})),v(H=>{const we={...H};return delete we[B],we})},[]),fe=m.useCallback(()=>{const B={};for(const U of l.questions){if(U.required){const H=p[U.id];if(H==null){B[U.id]="此题为必填项";continue}if(Array.isArray(H)&&H.length===0){B[U.id]="请至少选择一项";continue}if(typeof H=="string"&&H.trim()===""){B[U.id]="此题为必填项";continue}}U.minLength&&typeof p[U.id]=="string"&&p[U.id].length{if(!fe()){if(x){const B=l.questions.findIndex(U=>N[U.id]);B>=0&&w(B)}return}L(!0),M(null);try{const B=l.questions.filter(H=>p[H.id]!==void 0).map(H=>({questionId:H.id,value:p[H.id]})),U=await BC(l.id,l.version,B,{allowMultiple:l.settings?.allowMultiple});if(U.success&&U.submissionId)k(!0),E(U.submissionId),i?.(U.submissionId);else{const H=U.error||"提交失败";M(H),c?.(H)}}catch(B){const U=B instanceof Error?B.message:"提交失败";M(U),c?.(U)}finally{L(!1)}},[fe,x,l,p,N,i,c]),z=m.useCallback(B=>{B>=0&&Be.jsxs("div",{className:$("p-4 rounded-lg border bg-card",N[B.id]?"border-destructive bg-destructive/5":"border-border"),children:[x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",b+1," / ",l.questions.length]}),!x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[U+1,"."]}),e.jsx(UC,{question:B,value:p[B.id],onChange:H=>ne(B.id,H),error:N[B.id],disabled:y})]},B.id)),V&&e.jsxs(dt,{variant:"destructive",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(ut,{children:V})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(C,{variant:"outline",onClick:()=>z(b-1),disabled:b===0||y,children:[e.jsx(el,{className:"h-4 w-4 mr-1"}),"上一题"]}),b===l.questions.length-1?e.jsxs(C,{onClick:ge,disabled:y,children:[y&&e.jsx(Es,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(C,{onClick:()=>z(b+1),disabled:y,children:["下一题",e.jsx(ba,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(N).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(N).length," 个必填项未完成"]})}),e.jsxs(C,{onClick:ge,disabled:y,size:"lg",children:[y&&e.jsx(Es,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const IC={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:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},HC={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 PC(){const[l,n]=m.useState(!0),i=m.useMemo(()=>JSON.parse(JSON.stringify(IC)),[]);m.useEffect(()=>{n(!1)},[]);const c=m.useMemo(()=>[{questionId:"webui_version",value:`v${$o}`}],[]),u=m.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),x=m.useCallback(h=>{console.error("WebUI Survey submission error:",h)},[]);return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Es,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(_j,{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(Iv,{config:i,initialAnswers:c,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:u,onSubmitError:x})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(dt,{variant:"destructive",className:"max-w-md",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(ut,{children:"无法加载问卷配置"})]}),e.jsx(C,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function GC(){const[l,n]=m.useState(null),[i,c]=m.useState(!0),[u,x]=m.useState("未知版本");m.useEffect(()=>{(async()=>{try{const v=await H1();x(v.version||"未知版本")}catch(v){console.error("Failed to get MaiBot version:",v),x("获取失败")}const N=JSON.parse(JSON.stringify(HC));n(N),c(!1)})()},[]);const h=m.useMemo(()=>[{questionId:"maibot_version",value:u}],[u]),f=m.useCallback(j=>{console.log("MaiBot Survey submitted:",j)},[]),p=m.useCallback(j=>{console.error("MaiBot Survey submission error:",j)},[]);return i?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Es,{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(_j,{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(Iv,{config:l,initialAnswers:h,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:f,onSubmitError:p})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(dt,{variant:"destructive",className:"max-w-md",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(ut,{children:"无法加载问卷配置"})]}),e.jsx(C,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}var Ko="DropdownMenu",[FC]=Oo(Ko,[Hg]),ta=Hg(),[VC,Hv]=FC(Ko),Pv=l=>{const{__scopeDropdownMenu:n,children:i,dir:c,open:u,defaultOpen:x,onOpenChange:h,modal:f=!0}=l,p=ta(n),j=m.useRef(null),[N,v]=Do({prop:u,defaultProp:x??!1,onChange:h,caller:Ko});return e.jsx(VC,{scope:n,triggerId:Sm(),triggerRef:j,contentId:Sm(),open:N,onOpenChange:v,onOpenToggle:m.useCallback(()=>v(b=>!b),[v]),modal:f,children:e.jsx(G0,{...p,open:N,onOpenChange:v,dir:c,modal:f,children:i})})};Pv.displayName=Ko;var Gv="DropdownMenuTrigger",Fv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,disabled:c=!1,...u}=l,x=Hv(Gv,i),h=ta(i);return e.jsx(F0,{asChild:!0,...h,children:e.jsx(Rn.button,{type:"button",id:x.triggerId,"aria-haspopup":"menu","aria-expanded":x.open,"aria-controls":x.open?x.contentId:void 0,"data-state":x.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...u,ref:Nw(n,x.triggerRef),onPointerDown:tn(l.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(x.onOpenToggle(),x.open||f.preventDefault())}),onKeyDown:tn(l.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&x.onOpenToggle(),f.key==="ArrowDown"&&x.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});Fv.displayName=Gv;var qC="DropdownMenuPortal",Vv=l=>{const{__scopeDropdownMenu:n,...i}=l,c=ta(n);return e.jsx(R0,{...c,...i})};Vv.displayName=qC;var qv="DropdownMenuContent",Kv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Hv(qv,i),x=ta(i),h=m.useRef(!1);return e.jsx(L0,{id:u.contentId,"aria-labelledby":u.triggerId,...x,...c,ref:n,onCloseAutoFocus:tn(l.onCloseAutoFocus,f=>{h.current||u.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:tn(l.onInteractOutside,f=>{const p=f.detail.originalEvent,j=p.button===0&&p.ctrlKey===!0,N=p.button===2||j;(!u.modal||N)&&(h.current=!0)}),style:{...l.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Kv.displayName=qv;var KC="DropdownMenuGroup",QC=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(V0,{...u,...c,ref:n})});QC.displayName=KC;var YC="DropdownMenuLabel",Qv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(H0,{...u,...c,ref:n})});Qv.displayName=YC;var JC="DropdownMenuItem",Yv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(U0,{...u,...c,ref:n})});Yv.displayName=JC;var XC="DropdownMenuCheckboxItem",Jv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(B0,{...u,...c,ref:n})});Jv.displayName=XC;var ZC="DropdownMenuRadioGroup",WC=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(q0,{...u,...c,ref:n})});WC.displayName=ZC;var ek="DropdownMenuRadioItem",Xv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(I0,{...u,...c,ref:n})});Xv.displayName=ek;var sk="DropdownMenuItemIndicator",Zv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx($0,{...u,...c,ref:n})});Zv.displayName=sk;var tk="DropdownMenuSeparator",Wv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(P0,{...u,...c,ref:n})});Wv.displayName=tk;var ak="DropdownMenuArrow",lk=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(K0,{...u,...c,ref:n})});lk.displayName=ak;var nk="DropdownMenuSubTrigger",eN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(D0,{...u,...c,ref:n})});eN.displayName=nk;var rk="DropdownMenuSubContent",sN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=ta(i);return e.jsx(O0,{...u,...c,ref:n,style:{...l.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});sN.displayName=rk;var ik=Pv,ck=Fv,ok=Vv,tN=Kv,aN=Qv,lN=Yv,nN=Jv,rN=Xv,iN=Zv,cN=Wv,oN=eN,dN=sN;const dk=ik,uk=ck,mk=m.forwardRef(({className:l,inset:n,children:i,...c},u)=>e.jsxs(oN,{ref:u,className:$("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",n&&"pl-8",l),...c,children:[i,e.jsx(ba,{className:"ml-auto h-4 w-4"})]}));mk.displayName=oN.displayName;const xk=m.forwardRef(({className:l,...n},i)=>e.jsx(dN,{ref:i,className:$("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",l),...n}));xk.displayName=dN.displayName;const uN=m.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(ok,{children:e.jsx(tN,{ref:c,sideOffset:n,className:$("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",l),...i})}));uN.displayName=tN.displayName;const mN=m.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(lN,{ref:c,className:$("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",l),...i}));mN.displayName=lN.displayName;const hk=m.forwardRef(({className:l,children:n,checked:i,...c},u)=>e.jsxs(nN,{ref:u,className:$("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),checked:i,...c,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(iN,{children:e.jsx(yt,{className:"h-4 w-4"})})}),n]}));hk.displayName=nN.displayName;const fk=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(rN,{ref:c,className:$("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),...i,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(iN,{children:e.jsx(wj,{className:"h-2 w-2 fill-current"})})}),n]}));fk.displayName=rN.displayName;const pk=m.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(aN,{ref:c,className:$("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",l),...i}));pk.displayName=aN.displayName;const gk=m.forwardRef(({className:l,...n},i)=>e.jsx(cN,{ref:i,className:$("-mx-1 my-1 h-px bg-muted",l),...n}));gk.displayName=cN.displayName;const xN=({className:l,...n})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:$("mx-auto flex w-full justify-center",l),...n});xN.displayName="Pagination";const hN=m.forwardRef(({className:l,...n},i)=>e.jsx("ul",{ref:i,className:$("flex flex-row items-center gap-1",l),...n}));hN.displayName="PaginationContent";const wo=m.forwardRef(({className:l,...n},i)=>e.jsx("li",{ref:i,className:$("",l),...n}));wo.displayName="PaginationItem";const Qo=({className:l,isActive:n,size:i="icon",...c})=>e.jsx("a",{"aria-current":n?"page":void 0,className:$(Dr({variant:n?"outline":"ghost",size:i}),l),...c});Qo.displayName="PaginationLink";const fN=({className:l,...n})=>e.jsxs(Qo,{"aria-label":"Go to previous page",size:"default",className:$("gap-1 pl-2.5",l),...n,children:[e.jsx(el,{className:"h-4 w-4"}),e.jsx("span",{children:"上一页"})]});fN.displayName="PaginationPrevious";const pN=({className:l,...n})=>e.jsxs(Qo,{"aria-label":"Go to next page",size:"default",className:$("gap-1 pr-2.5",l),...n,children:[e.jsx("span",{children:"下一页"}),e.jsx(ba,{className:"h-4 w-4"})]});pN.displayName="PaginationNext";const _m=[{value:"created_at",label:"最新发布",icon:bl},{value:"downloads",label:"下载最多",icon:qt},{value:"likes",label:"最受欢迎",icon:Co}];function jk(){const l=sa(),[n,i]=m.useState([]),[c,u]=m.useState(!0),[x,h]=m.useState(""),[f,p]=m.useState("downloads"),[j,N]=m.useState(1),[v,b]=m.useState(1),[w,y]=m.useState(0),[L,D]=m.useState(new Set),[k,V]=m.useState(new Set),M=iv(),S=m.useCallback(async()=>{u(!0);try{const G=await L_({status:"approved",page:j,page_size:12,search:x||void 0,sort_by:f,sort_order:"desc"});i(G.packs),b(G.total_pages),y(G.total);const ue=new Set;for(const de of G.packs)await rv(de.id,M)&&ue.add(de.id);D(ue)}catch(G){console.error("加载 Pack 列表失败:",G),Pt({title:"加载 Pack 列表失败",variant:"destructive"})}finally{u(!1)}},[j,x,f,M]);m.useEffect(()=>{S()},[S]);const E=G=>{G.preventDefault(),N(1),S()},I=async G=>{if(!k.has(G)){V(ue=>new Set(ue).add(G));try{const ue=await nv(G,M);D(de=>{const ve=new Set(de);return ue.liked?ve.add(G):ve.delete(G),ve}),i(de=>de.map(ve=>ve.id===G?{...ve,likes:ue.likes}:ve))}catch(ue){console.error("点赞失败:",ue),Pt({title:"点赞失败",variant:"destructive"})}finally{V(ue=>{const de=new Set(ue);return de.delete(G),de})}}},A=G=>{l({to:"/config/pack-market/$packId",params:{packId:G}})},J=_m.find(G=>G.value===f)||_m[0];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Xt,{className:"h-8 w-8",strokeWidth:2}),"配置模板市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和应用社区分享的模型配置模板,快速配置你的 MaiBot"})]}),e.jsxs(C,{variant:"outline",onClick:S,disabled:c,className:"gap-2",children:[e.jsx(wt,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"刷新"]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 flex-wrap",children:[e.jsx("form",{onSubmit:E,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"搜索模板名称、描述...",value:x,onChange:G=>h(G.target.value),className:"pl-10"})]})}),e.jsxs(dk,{children:[e.jsx(uk,{asChild:!0,children:e.jsxs(C,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(Zw,{className:"w-4 h-4"}),J.label,e.jsx(Oa,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(uN,{align:"end",children:_m.map(G=>e.jsxs(mN,{onClick:()=>{p(G.value),N(1)},children:[e.jsx(G.icon,{className:"w-4 h-4 mr-2"}),G.label]},G.value))})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共找到 ",e.jsx("span",{className:"font-medium text-foreground",children:w})," 个模板"]}),c?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((G,ue)=>e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Ks,{className:"h-6 w-3/4"}),e.jsx(Ks,{className:"h-4 w-full mt-2"})]}),e.jsx(Ke,{children:e.jsx(Ks,{className:"h-20 w-full"})}),e.jsx(Bo,{children:e.jsx(Ks,{className:"h-9 w-full"})})]},ue))}):n.length===0?e.jsx(Me,{className:"py-12",children:e.jsxs(Ke,{className:"text-center text-muted-foreground",children:[e.jsx(Xt,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg font-medium",children:"暂无模板"}),e.jsx("p",{className:"mt-1",children:"还没有人分享配置模板,快来分享第一个吧!"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.map(G=>e.jsx(vk,{pack:G,liked:L.has(G.id),liking:k.has(G.id),onLike:()=>I(G.id),onView:()=>A(G.id)},G.id))}),v>1&&e.jsx(xN,{children:e.jsxs(hN,{children:[e.jsx(wo,{children:e.jsx(fN,{onClick:()=>N(G=>Math.max(1,G-1)),className:j===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:v},(G,ue)=>ue+1).filter(G=>G===1||G===v||Math.abs(G-j)<=1).map((G,ue,de)=>{const ve=ue>0&&G-de[ue-1]>1;return e.jsxs(wo,{children:[ve&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(Qo,{onClick:()=>N(G),isActive:G===j,className:"cursor-pointer",children:G})]},G)}),e.jsx(wo,{children:e.jsx(pN,{onClick:()=>N(G=>Math.min(v,G+1)),className:j===v?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function vk({pack:l,liked:n,liking:i,onLike:c,onView:u}){const x=h=>new Date(h).toLocaleDateString("zh-CN",{year:"numeric",month:"short",day:"numeric"});return e.jsxs(Me,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(Je,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(Xe,{className:"text-lg line-clamp-1",children:l.name}),e.jsxs(ke,{variant:"secondary",className:"text-xs",children:["v",l.version]})]}),e.jsx(Ls,{className:"line-clamp-2 min-h-[40px]",children:l.description})]}),e.jsxs(Ke,{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(En,{className:"w-3.5 h-3.5"}),l.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(bl,{className:"w-3.5 h-3.5"}),x(l.created_at)]})]}),e.jsxs("div",{className:"flex gap-4 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"提供商数量",children:[e.jsx(wl,{className:"w-3.5 h-3.5"}),l.provider_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"模型数量",children:[e.jsx(An,{className:"w-3.5 h-3.5"}),l.model_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"任务配置数",children:[e.jsx(zn,{className:"w-3.5 h-3.5"}),l.task_count]})]}),l.tags&&l.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[l.tags.slice(0,3).map(h=>e.jsxs(ke,{variant:"outline",className:"text-xs",children:[e.jsx(Uo,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),l.tags.length>3&&e.jsxs(ke,{variant:"outline",className:"text-xs",children:["+",l.tags.length-3]})]})]}),e.jsx(Bo,{className:"pt-3 border-t",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(qt,{className:"w-4 h-4"}),l.downloads]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c()},disabled:i,className:`flex items-center gap-1 transition-colors ${n?"text-red-500":"hover:text-red-500"} ${i?"opacity-50":""}`,children:[e.jsx(Co,{className:`w-4 h-4 ${n?"fill-current":""}`}),l.likes]})]}),e.jsx(C,{size:"sm",onClick:u,children:"查看详情"})]})})]})}var Ga="Accordion",Nk=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Ym,bk,yk]=bw(Ga),[Yo]=Oo(Ga,[yk,Pg]),Jm=Pg(),gN=Ss.forwardRef((l,n)=>{const{type:i,...c}=l,u=c,x=c;return e.jsx(Ym.Provider,{scope:l.__scopeAccordion,children:i==="multiple"?e.jsx(Ck,{...x,ref:n}):e.jsx(Sk,{...u,ref:n})})});gN.displayName=Ga;var[jN,wk]=Yo(Ga),[vN,_k]=Yo(Ga,{collapsible:!1}),Sk=Ss.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},collapsible:x=!1,...h}=l,[f,p]=Do({prop:i,defaultProp:c??"",onChange:u,caller:Ga});return e.jsx(jN,{scope:l.__scopeAccordion,value:Ss.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:Ss.useCallback(()=>x&&p(""),[x,p]),children:e.jsx(vN,{scope:l.__scopeAccordion,collapsible:x,children:e.jsx(NN,{...h,ref:n})})})}),Ck=Ss.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},...x}=l,[h,f]=Do({prop:i,defaultProp:c??[],onChange:u,caller:Ga}),p=Ss.useCallback(N=>f((v=[])=>[...v,N]),[f]),j=Ss.useCallback(N=>f((v=[])=>v.filter(b=>b!==N)),[f]);return e.jsx(jN,{scope:l.__scopeAccordion,value:h,onItemOpen:p,onItemClose:j,children:e.jsx(vN,{scope:l.__scopeAccordion,collapsible:!0,children:e.jsx(NN,{...x,ref:n})})})}),[kk,Jo]=Yo(Ga),NN=Ss.forwardRef((l,n)=>{const{__scopeAccordion:i,disabled:c,dir:u,orientation:x="vertical",...h}=l,f=Ss.useRef(null),p=Ro(f,n),j=bk(i),v=tj(u)==="ltr",b=tn(l.onKeyDown,w=>{if(!Nk.includes(w.key))return;const y=w.target,L=j().filter(J=>!J.ref.current?.disabled),D=L.findIndex(J=>J.ref.current===y),k=L.length;if(D===-1)return;w.preventDefault();let V=D;const M=0,S=k-1,E=()=>{V=D+1,V>S&&(V=M)},I=()=>{V=D-1,V{const{__scopeAccordion:i,value:c,...u}=l,x=Jo(zo,i),h=wk(zo,i),f=Jm(i),p=Sm(),j=c&&h.value.includes(c)||!1,N=x.disabled||l.disabled;return e.jsx(Tk,{scope:i,open:j,disabled:N,triggerId:p,children:e.jsx(Lg,{"data-orientation":x.orientation,"data-state":kN(j),...f,...u,ref:n,disabled:N,open:j,onOpenChange:v=>{v?h.onItemOpen(c):h.onItemClose(c)}})})});bN.displayName=zo;var yN="AccordionHeader",wN=Ss.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=Jo(Ga,i),x=Xm(yN,i);return e.jsx(Rn.h3,{"data-orientation":u.orientation,"data-state":kN(x.open),"data-disabled":x.disabled?"":void 0,...c,ref:n})});wN.displayName=yN;var Am="AccordionTrigger",_N=Ss.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=Jo(Ga,i),x=Xm(Am,i),h=_k(Am,i),f=Jm(i);return e.jsx(Ym.ItemSlot,{scope:i,children:e.jsx(Q0,{"aria-disabled":x.open&&!h.collapsible||void 0,"data-orientation":u.orientation,id:x.triggerId,...f,...c,ref:n})})});_N.displayName=Am;var SN="AccordionContent",CN=Ss.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=Jo(Ga,i),x=Xm(SN,i),h=Jm(i);return e.jsx(Y0,{role:"region","aria-labelledby":x.triggerId,"data-orientation":u.orientation,...h,...c,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...l.style}})});CN.displayName=SN;function kN(l){return l?"open":"closed"}var Ek=gN,Mk=bN,Ak=wN,TN=_N,EN=CN;const zk=Ek,MN=m.forwardRef(({className:l,...n},i)=>e.jsx(Mk,{ref:i,className:$("border-b",l),...n}));MN.displayName="AccordionItem";const AN=m.forwardRef(({className:l,children:n,...i},c)=>e.jsx(Ak,{className:"flex",children:e.jsxs(TN,{ref:c,className:$("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",l),...i,children:[n,e.jsx(Oa,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));AN.displayName=TN.displayName;const zN=m.forwardRef(({className:l,children:n,...i},c)=>e.jsx(EN,{ref:c,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...i,children:e.jsx("div",{className:$("pb-4 pt-0",l),children:n})}));zN.displayName=EN.displayName;const Dk={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"};function Ok(){const{packId:l}=UN.useParams(),n=sa(),[i,c]=m.useState(null),[u,x]=m.useState(!0),[h,f]=m.useState(!1),[p,j]=m.useState(!1),[N,v]=m.useState(!1),[b,w]=m.useState(1),[y,L]=m.useState(null),[D,k]=m.useState(!1),[V,M]=m.useState(!1),[S,E]=m.useState({apply_providers:!0,apply_models:!0,apply_task_config:!0,task_mode:"append",selected_providers:void 0,selected_models:void 0,selected_tasks:void 0}),[I,A]=m.useState({}),[J,G]=m.useState({}),ue=iv(),de=m.useCallback(async()=>{if(l){x(!0);try{const z=await U_(l);c(z);const K=await rv(l,ue);f(K)}catch(z){console.error("加载 Pack 失败:",z),Pt({title:"加载模板失败",variant:"destructive"})}finally{x(!1)}}},[l,ue]);m.useEffect(()=>{de()},[de]);const ve=async()=>{if(!(!l||p)){j(!0);try{const z=await nv(l,ue);f(z.liked),i&&c({...i,likes:z.likes})}catch(z){console.error("点赞失败:",z),Pt({title:"点赞失败",variant:"destructive"})}finally{j(!1)}}},ne=async()=>{if(i){v(!0),w(1),k(!0);try{const z=await I_(i);L(z);const K={};for(const U of z.existing_providers)K[U.pack_provider.name]=U.local_providers[0].name;A(K);const B={};for(const U of z.new_providers)B[U.name]="";G(B)}catch(z){console.error("检测冲突失败:",z),Pt({title:"检测配置冲突失败",variant:"destructive"}),v(!1)}finally{k(!1)}}},fe=async()=>{if(i){if(S.apply_providers&&y){for(const z of y.new_providers)if(!J[z.name]){Pt({title:`请填写提供商 "${z.name}" 的 API Key`,variant:"destructive"});return}}M(!0);try{await H_(i,S,I,J),await $_(i.id,ue),c({...i,downloads:i.downloads+1}),Pt({title:"配置模板应用成功!"}),v(!1)}catch(z){console.error("应用 Pack 失败:",z),Pt({title:z instanceof Error?z.message:"应用配置失败",variant:"destructive"})}finally{M(!1)}}},ge=z=>new Date(z).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return u?e.jsx(Lk,{}):i?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>n({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx(Ha,{className:"w-4 h-4"}),"返回市场"]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Xt,{className:"w-10 h-10 text-primary mt-1"}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[i.name,e.jsxs(ke,{variant:"secondary",children:["v",i.version]})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:i.description})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(En,{className:"w-4 h-4"}),i.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(bl,{className:"w-4 h-4"}),ge(i.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(qt,{className:"w-4 h-4"}),i.downloads," 次下载"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Co,{className:`w-4 h-4 ${h?"fill-red-500 text-red-500":""}`}),i.likes," 赞"]})]}),i.tags&&i.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:i.tags.map(z=>e.jsxs(ke,{variant:"outline",children:[e.jsx(Uo,{className:"w-3 h-3 mr-1"}),z]},z))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(C,{size:"lg",onClick:ne,children:[e.jsx(qt,{className:"w-4 h-4 mr-2"}),"应用模板"]}),e.jsxs(C,{variant:"outline",onClick:ve,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(Co,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"已点赞":"点赞"]})]})]}),e.jsx(Ur,{}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(Me,{children:e.jsxs(Ke,{className:"flex items-center gap-3 py-4",children:[e.jsx(wl,{className:"w-8 h-8 text-blue-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:i.providers.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"API 提供商"})]})]})}),e.jsx(Me,{children:e.jsxs(Ke,{className:"flex items-center gap-3 py-4",children:[e.jsx(An,{className:"w-8 h-8 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:i.models.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"模型配置"})]})]})}),e.jsx(Me,{children:e.jsxs(Ke,{className:"flex items-center gap-3 py-4",children:[e.jsx(zn,{className:"w-8 h-8 text-purple-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Object.keys(i.task_config).length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"任务配置"})]})]})})]}),e.jsxs(ua,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(ea,{children:[e.jsxs(We,{value:"providers",children:[e.jsx(wl,{className:"w-4 h-4 mr-2"}),"提供商 (",i.providers.length,")"]}),e.jsxs(We,{value:"models",children:[e.jsx(An,{className:"w-4 h-4 mr-2"}),"模型 (",i.models.length,")"]}),e.jsxs(We,{value:"tasks",children:[e.jsx(zn,{className:"w-4 h-4 mr-2"}),"任务配置 (",Object.keys(i.task_config).length,")"]})]}),e.jsx(vs,{value:"providers",children:e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"API 提供商"}),e.jsx(Ls,{children:"模板中包含的 API 提供商配置(不含 API Key)"})]}),e.jsx(Ke,{children:e.jsxs(_l,{children:[e.jsx(Sl,{children:e.jsxs(at,{children:[e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"Base URL"}),e.jsx(Ye,{children:"类型"})]})}),e.jsx(Cl,{children:i.providers.map(z=>e.jsxs(at,{children:[e.jsx(Pe,{className:"font-medium",children:z.name}),e.jsx(Pe,{className:"text-muted-foreground font-mono text-sm",children:z.base_url}),e.jsx(Pe,{children:e.jsx(ke,{variant:"outline",children:z.client_type})})]},z.name))})]})})]})}),e.jsx(vs,{value:"models",children:e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"模型配置"}),e.jsx(Ls,{children:"模板中包含的模型配置"})]}),e.jsx(Ke,{children:e.jsxs(_l,{children:[e.jsx(Sl,{children:e.jsxs(at,{children:[e.jsx(Ye,{children:"模型名称"}),e.jsx(Ye,{children:"标识符"}),e.jsx(Ye,{children:"提供商"}),e.jsx(Ye,{className:"text-right",children:"价格 (入/出)"})]})}),e.jsx(Cl,{children:i.models.map(z=>e.jsxs(at,{children:[e.jsx(Pe,{className:"font-medium",children:z.name}),e.jsx(Pe,{className:"text-muted-foreground font-mono text-sm",children:z.model_identifier}),e.jsx(Pe,{children:z.api_provider}),e.jsxs(Pe,{className:"text-right text-muted-foreground",children:["¥",z.price_in," / ¥",z.price_out]})]},z.name))})]})})]})}),e.jsx(vs,{value:"tasks",children:e.jsxs(Me,{children:[e.jsxs(Je,{children:[e.jsx(Xe,{children:"任务配置"}),e.jsx(Ls,{children:"模板中各任务类型的模型分配"})]}),e.jsx(Ke,{children:e.jsx(zk,{type:"multiple",className:"w-full",children:Object.entries(i.task_config).map(([z,K])=>e.jsxs(MN,{value:z,children:[e.jsx(AN,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ln,{className:"w-4 h-4"}),Dk[z]||z,e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[K.model_list.length," 个模型"]})]})}),e.jsx(zN,{children:e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"分配的模型:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:K.model_list.map(B=>e.jsx(ke,{variant:"outline",children:B},B))}),K.temperature!==void 0&&e.jsxs("div",{className:"text-sm",children:["Temperature: ",e.jsx("span",{className:"font-mono",children:K.temperature})]}),K.max_tokens!==void 0&&e.jsxs("div",{className:"text-sm",children:["Max Tokens: ",e.jsx("span",{className:"font-mono",children:K.max_tokens})]})]})})]},z))})})]})})]}),e.jsx(Rk,{open:N,onOpenChange:v,pack:i,step:b,setStep:w,conflicts:y,detectingConflicts:D,applying:V,options:S,setOptions:E,_providerMapping:I,_setProviderMapping:A,newProviderApiKeys:J,setNewProviderApiKeys:G,onApply:fe})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Xt,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),e.jsx("h2",{className:"text-xl font-semibold",children:"模板不存在"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"该配置模板可能已被删除或尚未通过审核"}),e.jsxs(C,{className:"mt-4",onClick:()=>n({to:"/config/pack-market"}),children:[e.jsx(Ha,{className:"w-4 h-4 mr-2"}),"返回市场"]})]})}function Rk({open:l,onOpenChange:n,pack:i,step:c,setStep:u,conflicts:x,detectingConflicts:h,applying:f,options:p,setOptions:j,_providerMapping:N,_setProviderMapping:v,newProviderApiKeys:b,setNewProviderApiKeys:w,onApply:y}){return e.jsx(Fs,{open:l,onOpenChange:n,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsxs($s,{className:"flex items-center gap-2",children:[e.jsx(Xt,{className:"w-5 h-5"}),"应用配置模板"]}),e.jsxs(lt,{children:["步骤 ",c," / ",3,":",c===1&&"选择要应用的内容",c===2&&"配置提供商映射",c===3&&"确认并应用"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Es,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在检测配置冲突..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:"apply_providers",checked:p.apply_providers,onCheckedChange:D=>j({...p,apply_providers:D})}),e.jsxs(T,{htmlFor:"apply_providers",className:"flex items-center gap-2",children:[e.jsx(wl,{className:"w-4 h-4"}),"应用提供商配置 (",i.providers.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:"apply_models",checked:p.apply_models,onCheckedChange:D=>j({...p,apply_models:D})}),e.jsxs(T,{htmlFor:"apply_models",className:"flex items-center gap-2",children:[e.jsx(An,{className:"w-4 h-4"}),"应用模型配置 (",i.models.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qs,{id:"apply_task_config",checked:p.apply_task_config,onCheckedChange:D=>j({...p,apply_task_config:D})}),e.jsxs(T,{htmlFor:"apply_task_config",className:"flex items-center gap-2",children:[e.jsx(zn,{className:"w-4 h-4"}),"应用任务配置 (",Object.keys(i.task_config).length," 个)"]})]})]}),p.apply_task_config&&e.jsxs("div",{className:"pl-6 space-y-2 border-l-2 border-muted",children:[e.jsx(T,{className:"text-sm font-medium",children:"任务配置应用模式"}),e.jsxs(Qm,{value:p.task_mode,onValueChange:D=>j({...p,task_mode:D}),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ao,{value:"append",id:"mode_append"}),e.jsx(T,{htmlFor:"mode_append",className:"font-normal",children:"追加模式 - 将模板中的模型添加到现有配置"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ao,{value:"replace",id:"mode_replace"}),e.jsx(T,{htmlFor:"mode_replace",className:"font-normal",children:"替换模式 - 用模板配置完全替换现有配置"})]})]})]})]}),c===2&&x&&e.jsxs("div",{className:"space-y-4",children:[p.apply_providers&&x.existing_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(kn,{children:"发现已有的提供商"}),e.jsx(ut,{children:"以下提供商的 URL 与您本地配置中的提供商匹配,将自动使用本地提供商:"})]}),e.jsx("div",{className:"space-y-2",children:x.existing_providers.map(({pack_provider:D,local_providers:k})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(yt,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),e.jsx("span",{className:"font-medium flex-shrink-0",children:D.name}),e.jsx(ba,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),k.length===1?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:k[0].name}),e.jsx(ke,{variant:"outline",className:"ml-auto",children:"URL 匹配"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ue,{value:N[D.name]||k[0].name,onValueChange:V=>v({...N,[D.name]:V}),children:[e.jsx(Oe,{className:"w-[200px]",children:e.jsx(Be,{})}),e.jsx(Re,{children:k.map(V=>e.jsx(re,{value:V.name,children:V.name},V.name))})]}),e.jsxs(ke,{variant:"outline",className:"ml-auto",children:[k.length," 个匹配"]})]})]},D.name))})]}),p.apply_providers&&x.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(dt,{variant:"destructive",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsx(kn,{children:"需要配置 API Key"}),e.jsx(ut,{children:"以下提供商在您的本地配置中不存在,需要填写 API Key:"})]}),e.jsx("div",{className:"space-y-4",children:x.new_providers.map(D=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(zm,{className:"w-4 h-4 text-amber-500"}),e.jsx("span",{className:"font-medium",children:D.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",D.base_url,")"]})]}),e.jsx(oe,{type:"password",placeholder:`输入 ${D.name} 的 API Key`,value:b[D.name]||"",onChange:k=>w({...b,[D.name]:k.target.value})})]},D.name))})]}),(!p.apply_providers||x.existing_providers.length===0&&x.new_providers.length===0)&&e.jsxs(dt,{children:[e.jsx(yt,{className:"h-4 w-4"}),e.jsx(kn,{children:"无需配置"}),e.jsx(ut,{children:"模板中没有提供商配置,或您选择不应用提供商。"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(dt,{children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(kn,{children:"确认应用"}),e.jsx(ut,{children:"请确认以下将要应用的内容:"})]}),e.jsxs("div",{className:"space-y-2",children:[p.apply_providers&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(yt,{className:"w-4 h-4 text-green-500"}),e.jsx(wl,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",i.providers.length," 个提供商配置"]})]}),p.apply_models&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(yt,{className:"w-4 h-4 text-green-500"}),e.jsx(An,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",i.models.length," 个模型配置"]})]}),p.apply_task_config&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(yt,{className:"w-4 h-4 text-green-500"}),e.jsx(zn,{className:"w-4 h-4"}),e.jsxs("span",{children:[p.task_mode==="append"?"追加":"替换"," ",Object.keys(i.task_config).length," 个任务配置"]})]})]}),x&&x.new_providers.length>0&&e.jsxs(dt,{variant:"destructive",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(ut,{children:["将添加 ",x.new_providers.length," 个新提供商,请确保已填写正确的 API Key。"]})]})]})]}),e.jsxs(it,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(C,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(C,{variant:"outline",onClick:()=>n(!1),disabled:f,children:"取消"}),c<3?e.jsx(C,{onClick:()=>u(c+1),disabled:h,children:"下一步"}):e.jsxs(C,{onClick:y,disabled:f,children:[f&&e.jsx(Es,{className:"w-4 h-4 mr-2 animate-spin"}),"应用模板"]})]})]})]})})}function Lk(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Ks,{className:"h-9 w-24"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ks,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Ks,{className:"h-8 w-2/3"}),e.jsx(Ks,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(Ks,{className:"h-4 w-24"}),e.jsx(Ks,{className:"h-4 w-32"}),e.jsx(Ks,{className:"h-4 w-28"}),e.jsx(Ks,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Ks,{className:"h-6 w-20"}),e.jsx(Ks,{className:"h-6 w-24"}),e.jsx(Ks,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(Ks,{className:"h-10 w-full"}),e.jsx(Ks,{className:"h-10 w-full"})]})]}),e.jsx(Ks,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(Ks,{className:"h-24"}),e.jsx(Ks,{className:"h-24"}),e.jsx(Ks,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ks,{className:"h-10 w-32"}),e.jsx(Ks,{className:"h-10 w-32"}),e.jsx(Ks,{className:"h-10 w-32"})]}),e.jsx(Ks,{className:"h-96 w-full"})]})]})})})}function Uk(){const l=sa(),[n,i]=m.useState(!0);return m.useEffect(()=>{let c=!1;return(async()=>{try{const x=await Pi();!c&&!x&&l({to:"/auth"})}catch{c||l({to:"/auth"})}finally{c||i(!1)}})(),()=>{c=!0}},[l]),{checking:n}}async function Bk(){return await Pi()}const $k=Or("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"}}),DN=m.forwardRef(({className:l,size:n,abbrTitle:i,children:c,...u},x)=>e.jsx("kbd",{className:$($k({size:n,className:l})),ref:x,...u,children:i?e.jsx("abbr",{title:i,children:c}):c}));DN.displayName="Kbd";const Ik=[{icon:Lo,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Ia,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:wl,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:Sj,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Dm,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:an,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:Cj,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:zr,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:Ww,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Xt,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Om,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Ln,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Hk({open:l,onOpenChange:n}){const[i,c]=m.useState(""),[u,x]=m.useState(0),h=sa(),f=Ik.filter(N=>N.title.toLowerCase().includes(i.toLowerCase())||N.description.toLowerCase().includes(i.toLowerCase())||N.category.toLowerCase().includes(i.toLowerCase())),p=m.useCallback(N=>{h({to:N}),n(!1),c(""),x(0)},[h,n]),j=m.useCallback(N=>{N.key==="ArrowDown"?(N.preventDefault(),x(v=>(v+1)%f.length)):N.key==="ArrowUp"?(N.preventDefault(),x(v=>(v-1+f.length)%f.length)):N.key==="Enter"&&f[u]&&(N.preventDefault(),p(f[u].path))},[f,u,p]);return e.jsx(Fs,{open:l,onOpenChange:n,children:e.jsxs(Us,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Bs,{className:"px-4 pt-4 pb-0",children:[e.jsx($s,{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(oe,{value:i,onChange:N=>{c(N.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((N,v)=>{const b=N.icon;return e.jsxs("button",{onClick:()=>p(N.path),onMouseEnter:()=>x(v),className:$("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",v===u?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(b,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:N.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:N.description})]}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:N.category})]},N.path)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Ft,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Pk(){const l=window.location.protocol==="http:",n=window.location.hostname.toLowerCase(),i=n==="localhost"||n==="127.0.0.1"||n==="::1",c=sessionStorage.getItem("http-warning-dismissed")==="true",[u,x]=m.useState(l&&!i&&!c),[h,f]=m.useState(!1),p=()=>{f(!0),x(!1),sessionStorage.setItem("http-warning-dismissed","true")};return!u||h?null:e.jsx("div",{className:"relative bg-amber-500/10 border-b border-amber-500/20 backdrop-blur-sm",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(Jt,{className:"h-5 w-5 text-amber-600 dark:text-amber-500 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-semibold",children:"安全警告:"}),"您正在使用 ",e.jsx("strong",{children:"HTTP"})," 访问 MaiBot WebUI"]}),e.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-200 mt-1",children:"如果这是公网服务器,您的数据(包括 Token、聊天记录等)可能在传输过程中被窃取。强烈建议使用 HTTPS 访问或仅在本地网络使用。"})]})]}),e.jsx(C,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 text-amber-700 hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-200 flex-shrink-0","aria-label":"关闭警告",children:e.jsx(Da,{className:"h-4 w-4"})})]})})})}function Gk(){const[l,n]=m.useState(0),[i,c]=m.useState(!1),u=m.useRef(null);m.useEffect(()=>{const j=N=>{const v=N.target;if(v.scrollHeight>v.clientHeight+100){u.current=v;const b=v.scrollTop,w=v.scrollHeight-v.clientHeight,y=w>0?b/w*100:0;n(y),c(b>300)}};return window.addEventListener("scroll",j,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",j,{capture:!0})},[]);const x=()=>{u.current?.scrollTo({top:0,behavior:"smooth"})},h=18,f=2*Math.PI*h,p=f-l/100*f;return e.jsx("div",{className:$("fixed bottom-24 right-8 z-50 transition-all duration-500 ease-in-out transform",i?"translate-x-0 opacity-100":"translate-x-32 opacity-0 pointer-events-none"),children:e.jsxs(C,{variant:"outline",size:"icon",className:$("relative h-12 w-12 rounded-full shadow-xl","bg-background/80 backdrop-blur-md border-border/50","hover:bg-accent hover:scale-110 hover:shadow-2xl hover:border-primary/50","transition-all duration-300","group"),onClick:x,"aria-label":"回到顶部",children:[e.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90 transform p-1",viewBox:"0 0 44 44",children:[e.jsx("circle",{className:"text-muted-foreground/10",strokeWidth:"3",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"}),e.jsx("circle",{className:"text-primary transition-all duration-100 ease-out",strokeWidth:"3",strokeDasharray:f,strokeDashoffset:p,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"})]}),e.jsx(e1,{className:"h-5 w-5 text-primary transition-transform duration-300 group-hover:-translate-y-1 group-hover:scale-110",strokeWidth:2.5}),e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]})})}const Fk=ww,Vk=_w,qk=Sw,ON=m.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(yw,{children:e.jsx(aj,{ref:c,sideOffset:n,className:$("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",l),...i})}));ON.displayName=aj.displayName;function Kk({children:l}){const{checking:n}=Uk(),[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),{theme:p,setTheme:j}=Lm(),N=a0();if(m.useEffect(()=>{const L=D=>{(D.metaKey||D.ctrlKey)&&D.key==="k"&&(D.preventDefault(),f(!0))};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[]),n)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const v=[{title:"概览",items:[{icon:Lo,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Ia,label:"麦麦主程序配置",path:"/config/bot"},{icon:wl,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:Sj,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:qp,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Dm,label:"表情包管理",path:"/resource/emoji"},{icon:an,label:"表达方式管理",path:"/resource/expression"},{icon:zr,label:"黑话管理",path:"/resource/jargon"},{icon:Cj,label:"人物信息管理",path:"/resource/person"},{icon:Nj,label:"知识库图谱可视化",path:"/resource/knowledge-graph"},{icon:Mr,label:"麦麦知识库管理",path:"/resource/knowledge-base"}]},{title:"扩展与监控",items:[{icon:Xt,label:"插件市场",path:"/plugins"},{icon:yj,label:"配置模板市场",path:"/config/pack-market"},{icon:qp,label:"插件配置",path:"/plugin-config"},{icon:Om,label:"日志查看器",path:"/logs"},{icon:an,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:Ln,label:"系统设置",path:"/settings"}]}],w=p==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":p,y=async()=>{await R1()};return e.jsx(Fk,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:$("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",i?"lg:w-64":"lg:w-16",u?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:$("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!i&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:$("flex items-baseline gap-2",!i&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:n2()})]}),!i&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Ze,{className:$("flex-1 overflow-x-hidden",!i&&"lg:w-16"),children:e.jsx("nav",{className:$("p-4",!i&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:$("space-y-6",!i&&"lg:space-y-3 lg:w-full"),children:v.map((L,D)=>e.jsxs("li",{children:[e.jsx("div",{className:$("px-3 h-[1.25rem]","mb-2",!i&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:L.title})}),!i&&D>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:L.items.map(k=>{const V=N({to:k.path}),M=k.icon,S=e.jsxs(e.Fragment,{children:[V&&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:$("flex items-center transition-all duration-300",i?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(M,{className:$("h-5 w-5 flex-shrink-0",V&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:$("text-sm font-medium whitespace-nowrap transition-all duration-300",V&&"font-semibold",i?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:k.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(Vk,{children:[e.jsx(qk,{asChild:!0,children:e.jsx(Sr,{to:k.path,"data-tour":k.tourId,className:$("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",V?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",i?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>x(!1),children:S})}),!i&&e.jsx(ON,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:k.label})})]})},k.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.jsx(Pk,{}),e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>x(!u),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(s1,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>c(!i),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:i?"收起侧边栏":"展开侧边栏",children:e.jsx(el,{className:$("h-5 w-5 transition-transform",!i&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>f(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx(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(DN,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(Hk,{open:h,onOpenChange:f}),e.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(t1,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:L=>{J1(w==="dark"?"light":"dark",j,L)},className:"rounded-lg p-2 hover:bg-accent",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(mj,{className:"h-5 w-5"}):e.jsx(xj,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(C,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[e.jsx(a1,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:l}),e.jsx(Gk,{})]})]})})}function Qk(l){const n=l.split(` +`).slice(1),i=[];for(const c of n){const u=c.trim();if(!u.startsWith("at "))continue;const x=u.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);x?i.push({functionName:x[1]||"",fileName:x[2],lineNumber:x[3],columnNumber:x[4],raw:u}):i.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:u})}return i}function Yk({error:l,errorInfo:n}){const[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),p=l.stack?Qk(l.stack):[],j=async()=>{const N=` +Error: ${l.name} +Message: ${l.message} + +Stack Trace: +${l.stack||"No stack trace available"} + +Component Stack: +${n?.componentStack||"No component stack available"} + +URL: ${window.location.href} +User Agent: ${navigator.userAgent} +Time: ${new Date().toISOString()} + `.trim();try{await navigator.clipboard.writeText(N),f(!0),setTimeout(()=>f(!1),2e3)}catch(v){console.error("Failed to copy:",v)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(dt,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(ut,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[l.name,":"]})," ",l.message]})]}),p.length>0&&e.jsxs(Vi,{open:i,onOpenChange:c,children:[e.jsx(qi,{asChild:!0,children:e.jsxs(C,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(l1,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),i?e.jsx(Ar,{className:"h-4 w-4"}):e.jsx(Oa,{className:"h-4 w-4"})]})}),e.jsx(Ki,{children:e.jsx(Ze,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((N,v)=>e.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[v+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:N.functionName}),N.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[N.fileName,N.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",N.lineNumber,":",N.columnNumber]})]})]})]})},v))})})})]}),n?.componentStack&&e.jsxs(Vi,{open:u,onOpenChange:x,children:[e.jsx(qi,{asChild:!0,children:e.jsxs(C,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Jt,{className:"h-4 w-4"}),"Component Stack"]}),u?e.jsx(Ar,{className:"h-4 w-4"}):e.jsx(Oa,{className:"h-4 w-4"})]})}),e.jsx(Ki,{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:n.componentStack})})})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:j,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(yt,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(_o,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function RN({error:l,errorInfo:n}){const i=()=>{window.location.href="/"},c=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(Me,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(Je,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(Jt,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(Xe,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(Ls,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(Ke,{className:"space-y-4",children:[e.jsx(Yk,{error:l,errorInfo:n}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(C,{onClick:c,className:"flex-1",children:[e.jsx(wt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(C,{onClick:i,variant:"outline",className:"flex-1",children:[e.jsx(Lo,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class Jk extends m.Component{constructor(n){super(n),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,i){console.error("ErrorBoundary caught an error:",n,i),this.setState({errorInfo:i})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(RN,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function LN({error:l}){return e.jsx(RN,{error:l,errorInfo:null})}const Zi=l0({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(vg,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!Bk())throw r0({to:"/auth"})}}),Xk=Ys({getParentRoute:()=>Zi,path:"/auth",component:y2}),Zk=Ys({getParentRoute:()=>Zi,path:"/setup",component:B2}),ct=Ys({getParentRoute:()=>Zi,id:"protected",component:()=>e.jsx(Kk,{children:e.jsx(vg,{})}),errorComponent:({error:l})=>e.jsx(LN,{error:l})}),Wk=Ys({getParentRoute:()=>ct,path:"/",component:q1}),e3=Ys({getParentRoute:()=>ct,path:"/config/bot",component:j_}),s3=Ys({getParentRoute:()=>ct,path:"/config/modelProvider",component:M_}),t3=Ys({getParentRoute:()=>ct,path:"/config/model",component:tS}),a3=Ys({getParentRoute:()=>ct,path:"/config/adapter",component:_S}),l3=Ys({getParentRoute:()=>ct,path:"/resource/emoji",component:KS}),n3=Ys({getParentRoute:()=>ct,path:"/resource/expression",component:n4}),r3=Ys({getParentRoute:()=>ct,path:"/resource/person",component:E4}),i3=Ys({getParentRoute:()=>ct,path:"/resource/jargon",component:v4}),c3=Ys({getParentRoute:()=>ct,path:"/resource/knowledge-graph",component:B4}),o3=Ys({getParentRoute:()=>ct,path:"/resource/knowledge-base",component:$4}),d3=Ys({getParentRoute:()=>ct,path:"/logs",component:H4}),u3=Ys({getParentRoute:()=>ct,path:"/chat",component:CC}),m3=Ys({getParentRoute:()=>ct,path:"/plugins",component:iC}),x3=Ys({getParentRoute:()=>ct,path:"/plugin-detail",component:gC}),h3=Ys({getParentRoute:()=>ct,path:"/model-presets",component:oC}),f3=Ys({getParentRoute:()=>ct,path:"/plugin-config",component:mC}),p3=Ys({getParentRoute:()=>ct,path:"/plugin-mirrors",component:hC}),g3=Ys({getParentRoute:()=>ct,path:"/settings",component:f2}),j3=Ys({getParentRoute:()=>ct,path:"/config/pack-market",component:jk}),UN=Ys({getParentRoute:()=>ct,path:"/config/pack-market/$packId",component:Ok}),v3=Ys({getParentRoute:()=>ct,path:"/survey/webui-feedback",component:PC}),N3=Ys({getParentRoute:()=>ct,path:"/survey/maibot-feedback",component:GC}),b3=Ys({getParentRoute:()=>Zi,path:"*",component:Yj}),y3=Zi.addChildren([Xk,Zk,ct.addChildren([Wk,e3,s3,t3,a3,l3,n3,i3,r3,c3,o3,m3,x3,h3,f3,p3,d3,u3,g3,j3,UN,v3,N3]),b3]),w3=n0({routeTree:y3,defaultNotFoundComponent:Yj,defaultErrorComponent:({error:l})=>e.jsx(LN,{error:l})});function _3({children:l,defaultTheme:n="system",storageKey:i="ui-theme",...c}){const[u,x]=m.useState(()=>localStorage.getItem(i)||n);m.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),u==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(p);return}f.classList.add(u)},[u]),m.useEffect(()=>{const f=localStorage.getItem("accent-color");if(f){const p=document.documentElement,N={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[f];N&&(p.style.setProperty("--primary",N.hsl),N.gradient?(p.style.setProperty("--primary-gradient",N.gradient),p.classList.add("has-gradient")):(p.style.removeProperty("--primary-gradient"),p.classList.remove("has-gradient")))}},[]);const h={theme:u,setTheme:f=>{localStorage.setItem(i,f),x(f)}};return e.jsx(Gj.Provider,{...c,value:h,children:l})}function S3({children:l,defaultEnabled:n=!0,defaultWavesEnabled:i=!0,storageKey:c="enable-animations",wavesStorageKey:u="enable-waves-background"}){const[x,h]=m.useState(()=>{const N=localStorage.getItem(c);return N!==null?N==="true":n}),[f,p]=m.useState(()=>{const N=localStorage.getItem(u);return N!==null?N==="true":i});m.useEffect(()=>{const N=document.documentElement;x?N.classList.remove("no-animations"):N.classList.add("no-animations"),localStorage.setItem(c,String(x))},[x,c]),m.useEffect(()=>{localStorage.setItem(u,String(f))},[f,u]);const j={enableAnimations:x,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(Fj.Provider,{value:j,children:l})}const C3=Cw,BN=m.forwardRef(({className:l,...n},i)=>e.jsx(lj,{ref:i,className:$("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",l),...n}));BN.displayName=lj.displayName;const k3=Or("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"}}),$N=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(nj,{ref:c,className:$(k3({variant:n}),l),...i}));$N.displayName=nj.displayName;const T3=m.forwardRef(({className:l,...n},i)=>e.jsx(rj,{ref:i,className:$("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",l),...n}));T3.displayName=rj.displayName;const IN=m.forwardRef(({className:l,...n},i)=>e.jsx(ij,{ref:i,className:$("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",l),"toast-close":"",...n,children:e.jsx(Da,{className:"h-4 w-4"})}));IN.displayName=ij.displayName;const HN=m.forwardRef(({className:l,...n},i)=>e.jsx(cj,{ref:i,className:$("text-sm font-semibold [&+div]:text-xs",l),...n}));HN.displayName=cj.displayName;const PN=m.forwardRef(({className:l,...n},i)=>e.jsx(oj,{ref:i,className:$("text-sm opacity-90",l),...n}));PN.displayName=oj.displayName;function E3(){const{toasts:l}=Js();return e.jsxs(C3,{children:[l.map(function({id:n,title:i,description:c,action:u,...x}){return e.jsxs($N,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[i&&e.jsx(HN,{children:i}),c&&e.jsx(PN,{children:c})]}),u,e.jsx(IN,{})]},n)}),e.jsx(BN,{})]})}O1.createRoot(document.getElementById("root")).render(e.jsx(m.StrictMode,{children:e.jsx(Jk,{children:e.jsx(_3,{defaultTheme:"system",children:e.jsx(S3,{children:e.jsxs(__,{children:[e.jsx(i0,{router:w3}),e.jsx(k_,{}),e.jsx(E3,{})]})})})})})); diff --git a/webui/dist/assets/index-Vd1XbDiA.css b/webui/dist/assets/index-Vd1XbDiA.css new file mode 100644 index 00000000..13480cdc --- /dev/null +++ b/webui/dist/assets/index-Vd1XbDiA.css @@ -0,0 +1 @@ +@charset "UTF-8";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-16{inset:4rem}.inset-8{inset:2rem}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-24{bottom:6rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/3{right:33.333333%}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.right-8{right:2rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-3\/4{top:75%}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-1{margin-top:-.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[140px\]{height:140px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[600px\]{height:600px}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[calc\(85vh-220px\)\]{height:calc(85vh - 220px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[140px\]{min-height:140px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[600px\]{width:600px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[100px\]{max-width:100px}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-32{--tw-translate-x: 8rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[ping_3s_ease-in-out_infinite\]{animation:ping 3s ease-in-out infinite}.animate-\[ping_3s_ease-in-out_infinite_0\.5s\]{animation:ping 3s ease-in-out infinite .5s}.animate-\[ping_3s_ease-in-out_infinite_1s\]{animation:ping 3s ease-in-out infinite 1s}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[1fr_1fr_90px_32px\]{grid-template-columns:1fr 1fr 90px 32px}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-500{--tw-border-opacity: 1;border-color:rgb(249 115 22 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/10{border-color:hsl(var(--primary) / .1)}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/50{background-color:hsl(var(--card) / .5)}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-red-500{fill:#ef4444}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/10{color:hsl(var(--muted-foreground) / .1)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-150{transition-delay:.15s}.delay-300{transition-delay:.3s}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-900:hover{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-2xl:hover{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-y-1{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-green-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(20 83 45 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-purple-900\/30:is(.dark *){background-color:#581c874d}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/20:is(.dark *){background-color:#450a0a33}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-200:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-amber-500:is(.dark *){--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-amber-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-2\.5{height:.625rem}.sm\:h-24{height:6rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-220px\)\]{height:calc(100vh - 220px)}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-2\.5{width:.625rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-3{padding-bottom:.75rem}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:inline{display:inline}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-4{padding:1rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:pb-4{padding-bottom:1rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>div\]\:bg-green-500>div{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.27"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.uppy-Root{box-sizing:border-box;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1;position:relative;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.uppy-Root[dir=rtl],[dir=rtl] .uppy-Root{text-align:right}.uppy-Root *,.uppy-Root :after,.uppy-Root :before{box-sizing:inherit}.uppy-Root [hidden]{display:none}.uppy-u-reset{all:initial;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1}[dir=rtl] .uppy-u-reset{text-align:right}.uppy-truncate-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-c-textInput{background-color:#fff;border:1px solid #ddd;border-radius:4px;font-family:inherit;font-size:14px;line-height:1.5;padding:6px 8px}.uppy-size--md .uppy-c-textInput{padding:8px 10px}.uppy-c-textInput:focus{border-color:#1269cf99;box-shadow:0 0 0 3px #1269cf26;outline:none}[data-uppy-theme=dark] .uppy-c-textInput{background-color:#333;border-color:#333;color:#eaeaea}[data-uppy-theme=dark] .uppy-c-textInput:focus{border-color:#525252;box-shadow:none}.uppy-c-icon{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;fill:currentColor}.uppy-c-btn{align-items:center;color:inherit;display:inline-flex;font-family:inherit;font-size:inherit;font-weight:500;justify-content:center;line-height:1;transition-duration:.3s;transition-property:background-color,color;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.uppy-c-btn,[dir=rtl] .uppy-c-btn{text-align:center}.uppy-c-btn:not(:disabled):not(.disabled){cursor:pointer}.uppy-c-btn::-moz-focus-inner{border:0}.uppy-c-btn-primary{background-color:#1269cf;border-radius:4px;color:#fff;font-size:14px;padding:10px 18px}.uppy-c-btn-primary:not(:disabled):hover{background-color:#0e51a0}.uppy-c-btn-primary:focus{box-shadow:0 0 0 3px #1269cf66;outline:none}.uppy-size--md .uppy-c-btn-primary{padding:13px 22px}[data-uppy-theme=dark] .uppy-c-btn-primary{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-primary::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-c-btn-primary.uppy-c-btn--disabled{background-color:#8eb2db}.uppy-c-btn-link{background-color:initial;border-radius:4px;color:#525252;font-size:14px;line-height:1;padding:10px 15px}.uppy-c-btn-link:hover{color:#333}.uppy-c-btn-link:focus{box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-size--md .uppy-c-btn-link{padding:13px 18px}[data-uppy-theme=dark] .uppy-c-btn-link{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-link:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-link::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-link:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-c-btn-link:hover{color:#939393}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;padding:6px}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list:after,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list:after{content:"";flex:auto}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{margin:0;position:relative;width:50%}.uppy-size--md .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--md .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:33.3333%}.uppy-size--lg .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--lg .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:25%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem:before,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem:before{content:"";display:block;padding-top:100%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected svg{opacity:.85}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--disabled,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--disabled{opacity:.5}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#93939333}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#eaeaea33}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{height:30%;width:30%;fill:#000000b3}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{fill:#fffc}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{border-radius:4px;height:calc(100% - 14px);inset:7px;overflow:hidden;position:absolute;text-align:center;width:calc(100% - 14px)}@media(hover:none){.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author{display:block}}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{box-shadow:0 0 0 3px #aae1ffb3}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner img{border-radius:4px;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author{background:#0000004d;bottom:0;color:#fff;display:none;font-size:12px;font-weight:500;left:0;margin:0;padding:5px;position:absolute;text-decoration:none;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author:hover,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author:hover{background:#0006;text-decoration:underline}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-radius:50%;height:26px;opacity:0;position:absolute;right:16px;top:16px;width:26px;z-index:1002}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox:after{height:7px;inset-inline-start:7px;top:8px;width:12px}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{opacity:1}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author{display:block}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus{outline:none}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner{border:0}.uppy-ProviderBrowser-viewType--list{background-color:#fff}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list{background-color:#1f1f1f}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{align-items:center;display:flex;margin:0;padding:7px 15px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{color:#eaeaea}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem--disabled{opacity:.6}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox{background-color:#fff;border:1px solid #cfcfcf;border-radius:3px;height:17px;margin-inline-end:15px;width:17px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border:1px solid #1269cf;box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:after{height:5px;inset-inline-start:3px;opacity:0;top:4px;width:9px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border-color:#02baf2b3;box-shadow:0 0 0 3px #02baf233}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-color:#1269cf}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{opacity:1}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner{align-items:center;color:inherit;display:flex;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;overflow:hidden;padding:2px;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner:focus{outline:none;text-decoration:underline}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner svg{margin-inline-end:8px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner span{line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--disabled .uppy-ProviderBrowserItem-inner{cursor:default}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-iconWrap{margin-inline-end:7px;width:20px}.uppy-ProviderBrowserItem-checkbox{cursor:pointer;flex-shrink:0;position:relative}.uppy-ProviderBrowserItem-checkbox:disabled,.uppy-ProviderBrowserItem-checkbox:disabled:after{cursor:default}[data-uppy-theme=dark] .uppy-ProviderBrowserItem-checkbox{background-color:#1f1f1f;border-color:#939393}[data-uppy-theme=dark] .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{background-color:#333}.uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after{border-bottom:2px solid #eaeaea;border-left:2px solid #eaeaea;content:"";cursor:pointer;position:absolute;transform:rotate(-45deg)}.uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{background-color:#eaeaea!important;content:""!important;height:2px!important;left:20%!important;position:absolute!important;right:20%!important;top:50%!important;transform:translateY(-50%)!important}.uppy-SearchProvider{align-items:center;display:flex;flex:1;flex-direction:column;height:100%;justify-content:center;width:100%}[data-uppy-theme=dark] .uppy-SearchProvider{background-color:#1f1f1f}.uppy-SearchProvider-input{margin-bottom:15px;max-width:650px;width:90%}.uppy-size--md .uppy-SearchProvider-input{margin-bottom:20px}.uppy-SearchProvider-input::-webkit-search-cancel-button{display:none}.uppy-SearchProvider-searchButton{padding:13px 25px}.uppy-size--md .uppy-SearchProvider-searchButton{padding:13px 30px}.uppy-DashboardContent-panelBody{align-items:center;display:flex;flex:1;justify-content:center}[data-uppy-theme=dark] .uppy-DashboardContent-panelBody{background-color:#1f1f1f}.uppy-Provider-auth,.uppy-Provider-empty,.uppy-Provider-error,.uppy-Provider-loading{align-items:center;color:#939393;display:flex;flex:1;flex-flow:column wrap;justify-content:center}.uppy-Provider-empty{color:#939393}.uppy-Provider-authIcon svg{height:75px;width:100px}.uppy-Provider-authTitle{color:#757575;font-size:17px;font-weight:400;line-height:1.4;margin-bottom:30px;max-width:500px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Provider-authTitle{font-size:20px}[data-uppy-theme=dark] .uppy-Provider-authTitle{color:#cfcfcf}.uppy-Provider-btn-google{align-items:center;background:#4285f4;display:flex;padding:8px 12px!important}.uppy-Provider-btn-google:hover{background-color:#1266f1}.uppy-Provider-btn-google:focus{box-shadow:0 0 0 3px #4285f466;outline:none}.uppy-Provider-btn-google svg{margin-right:8px}.uppy-Provider-breadcrumbs{color:#525252;flex:1;font-size:12px;margin-bottom:10px;text-align:start}.uppy-size--md .uppy-Provider-breadcrumbs{margin-bottom:0}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs{color:#eaeaea}.uppy-Provider-breadcrumbsIcon{color:#525252;display:inline-block;line-height:1;margin-inline-end:4px;vertical-align:middle}.uppy-Provider-breadcrumbsIcon svg{height:13px;width:13px;fill:#525252}.uppy-Provider-breadcrumbs button{border-radius:3px;display:inline-block;line-height:inherit;padding:4px}.uppy-Provider-breadcrumbs button:focus{outline:none}.uppy-Provider-breadcrumbs button::-moz-focus-inner{border:0}.uppy-Provider-breadcrumbs button:hover{color:#0e51a0}.uppy-Provider-breadcrumbs button:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button:focus{background-color:#333}.uppy-Provider-breadcrumbs button:not(:last-of-type){text-decoration:underline}.uppy-Provider-breadcrumbs button:last-of-type{color:#333;cursor:normal;font-weight:500;pointer-events:none}.uppy-Provider-breadcrumbs button:hover{cursor:pointer}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button{color:#eaeaea}.uppy-ProviderBrowser{display:flex;flex:1;flex-direction:column;font-size:14px;font-weight:400;height:100%}.uppy-ProviderBrowser-user{color:#333;font-weight:500;margin:0 8px 0 0}[data-uppy-theme=dark] .uppy-ProviderBrowser-user{color:#eaeaea}.uppy-ProviderBrowser-user:after{color:#939393;content:"·";font-weight:400;inset-inline-start:4px;position:relative}.uppy-ProviderBrowser-header{border-bottom:1px solid #eaeaea;position:relative;z-index:1001}[data-uppy-theme=dark] .uppy-ProviderBrowser-header{border-bottom:1px solid #333}.uppy-ProviderBrowser-headerBar{background-color:#fafafa;color:#757575;font-size:12px;line-height:1.4;padding:7px 15px;z-index:1001}.uppy-size--md .uppy-ProviderBrowser-headerBar{align-items:center;display:flex}[data-uppy-theme=dark] .uppy-ProviderBrowser-headerBar{background-color:#1f1f1f}.uppy-ProviderBrowser-headerBar--simple{display:block;justify-content:center;text-align:center}.uppy-ProviderBrowser-headerBar--simple .uppy-Provider-breadcrumbsWrap{display:inline-block;flex:none;vertical-align:middle}.uppy-ProviderBrowser-searchFilter{align-items:center;display:flex;height:30px;margin-bottom:15px;margin-top:15px;padding-left:8px;padding-right:8px;position:relative;width:100%}.uppy-ProviderBrowser-searchFilterInput{background-color:#eaeaea;border:0;border-radius:4px;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;font-size:13px;height:30px;line-height:1.4;outline:0;padding-inline-end:30px;padding-inline-start:30px;width:100%;z-index:1001}.uppy-ProviderBrowser-searchFilterInput::-webkit-search-cancel-button{display:none}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput{background-color:#1f1f1f;color:#eaeaea}.uppy-ProviderBrowser-searchFilterInput:focus{background-color:#cfcfcf;border:0}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput:focus{background-color:#333}.uppy-ProviderBrowser-searchFilterIcon{color:#757575;height:12px;inset-inline-start:16px;position:absolute;width:12px;z-index:1002}.uppy-ProviderBrowser-searchFilterInput::-moz-placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterInput::placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterReset{border-radius:3px;color:#939393;cursor:pointer;height:22px;inset-inline-end:16px;padding:6px;position:absolute;width:22px;z-index:1002}.uppy-ProviderBrowser-searchFilterReset:focus{outline:none}.uppy-ProviderBrowser-searchFilterReset::-moz-focus-inner{border:0}.uppy-ProviderBrowser-searchFilterReset:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-searchFilterReset:hover{color:#757575}.uppy-ProviderBrowser-searchFilterReset svg{vertical-align:text-top}.uppy-ProviderBrowser-userLogout{border-radius:3px;color:#1269cf;cursor:pointer;line-height:inherit;padding:4px}.uppy-ProviderBrowser-userLogout:focus{outline:none}.uppy-ProviderBrowser-userLogout::-moz-focus-inner{border:0}.uppy-ProviderBrowser-userLogout:hover{color:#0e51a0}.uppy-ProviderBrowser-userLogout:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout:focus{background-color:#333}.uppy-ProviderBrowser-userLogout:hover{text-decoration:underline}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout{color:#eaeaea}.uppy-ProviderBrowser-body{flex:1;position:relative}.uppy-ProviderBrowser-list{background-color:#fff;border-spacing:0;display:block;flex:1;height:100%;inset:0;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;width:100%;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-ProviderBrowser-list{background-color:#1f1f1f}.uppy-ProviderBrowser-list:focus{outline:none}.uppy-ProviderBrowserItem-inner{cursor:pointer;font-size:13px;font-weight:500}.uppy-ProviderBrowser-footer{align-items:center;background-color:#fff;border-top:1px solid #eaeaea;display:flex;justify-content:space-between;padding:15px}.uppy-ProviderBrowser-footer button{margin-inline-end:8px}[data-uppy-theme=dark] .uppy-ProviderBrowser-footer{background-color:#1f1f1f;border-top:1px solid #333}.uppy-ProviderBrowser-footer-buttons{flex-shrink:0}.uppy-ProviderBrowser-footer-error{color:#e32437;line-height:18px}@media(max-width:426px){.uppy-ProviderBrowser-footer{align-items:stretch;flex-direction:column-reverse}.uppy-ProviderBrowser-footer-error{padding-bottom:10px}}.picker-dialog-bg{z-index:20000!important}.picker-dialog{z-index:20001!important}.uppy-Dashboard-Item-previewInnerWrap{align-items:center;border-radius:3px;box-shadow:0 0 2px #0006;display:flex;flex-direction:column;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.uppy-size--md .uppy-Dashboard-Item-previewInnerWrap{box-shadow:0 1px 2px #00000026}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewInnerWrap{box-shadow:none}.uppy-Dashboard-Item-previewInnerWrap:after{background-color:#000000a6;content:"";display:none;inset:0;position:absolute;z-index:1001}.uppy-Dashboard-Item-previewLink{inset:0;position:absolute;z-index:1002}.uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #579df0}[data-uppy-theme=dark] .uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #016c8d}.uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;height:100%;-o-object-fit:cover;object-fit:cover;transform:translateZ(0);width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{height:auto;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;padding:10px;width:auto}.uppy-Dashboard-Item-progress{color:#fff;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%);transition:all .35 ease;width:120px;z-index:1002}.uppy-Dashboard-Item-progressIndicator{color:#fff;display:inline-block;height:38px;opacity:.9;width:38px}.uppy-size--md .uppy-Dashboard-Item-progressIndicator{height:55px;width:55px}button.uppy-Dashboard-Item-progressIndicator{cursor:pointer}button.uppy-Dashboard-Item-progressIndicator:focus{outline:none}button.uppy-Dashboard-Item-progressIndicator::-moz-focus-inner{border:0}button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--bg,button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--retry{fill:#579df0}.uppy-Dashboard-Item-progressIcon--circle{height:100%;width:100%}.uppy-Dashboard-Item-progressIcon--bg{stroke:#fff6}.uppy-Dashboard-Item-progressIcon--progress{transition:stroke-dashoffset .5s ease-out;stroke:#fff}.uppy-Dashboard-Item-progressIcon--play{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--cancel{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--pause{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--check{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--retry{fill:#fff}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{inset-inline-end:-8px;inset-inline-start:auto;top:-9px;transform:none;width:auto}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:18px;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:28px;width:28px}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:18px;opacity:1;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:22px;width:22px}.uppy-Dashboard-Item.is-processing .uppy-Dashboard-Item-progress{opacity:0}.uppy-Dashboard-Item-fileInfo{padding-inline-end:5px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:10px}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:15px}.uppy-Dashboard-Item-name{font-size:12px;font-weight:500;line-height:1.3;margin-bottom:5px;word-wrap:anywhere;word-break:break-all}[data-uppy-theme=dark] .uppy-Dashboard-Item-name{color:#eaeaea}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-name{font-size:14px;line-height:1.4}.uppy-Dashboard-Item-fileName{align-items:baseline;display:flex}.uppy-Dashboard-Item-fileName button{margin-left:5px}.uppy-Dashboard-Item-author{color:#757575;display:inline-block;font-size:11px;font-weight:400;line-height:1;margin-bottom:5px;vertical-align:bottom}.uppy-Dashboard-Item-author a{color:#757575}.uppy-Dashboard-Item-status{color:#757575;font-size:11px;font-weight:400;line-height:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-status{color:#bbb}.uppy-Dashboard-Item-statusSize{display:inline-block;margin-bottom:5px;text-transform:uppercase;vertical-align:bottom}.uppy-Dashboard-Item-reSelect{color:#1269cf;font-family:inherit;font-size:inherit;font-weight:600}.uppy-Dashboard-Item-errorMessage{background-color:#fdeff1;color:#a51523;font-size:11px;font-weight:500;line-height:1.3;padding:5px 6px}.uppy-Dashboard-Item-errorMessageBtn{color:#a51523;cursor:pointer;font-size:11px;font-weight:500;text-decoration:underline}.uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{display:none}.uppy-size--md .uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-top:1px solid #f7c2c8;bottom:0;display:block;left:0;line-height:1.4;padding:6px 8px;position:absolute;right:0}.uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{border:1px solid #f7c2c8;border-radius:3px;display:inline-block;position:static}.uppy-size--md .uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{display:none}.uppy-Dashboard-Item-action{color:#939393;cursor:pointer}.uppy-Dashboard-Item-action:focus{outline:none}.uppy-Dashboard-Item-action::-moz-focus-inner{border:0}.uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-Item-action:hover{color:#1f1f1f;opacity:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-action{color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{outline:none}[data-uppy-theme=dark] .uppy-Dashboard-Item-action::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:hover{color:#eaeaea}.uppy-Dashboard-Item-action--remove{color:#1f1f1f;opacity:.95}.uppy-Dashboard-Item-action--remove:hover{color:#000;opacity:1}.uppy-size--md .uppy-Dashboard-Item-action--remove{height:18px;inset-inline-end:-8px;padding:0;position:absolute;top:-8px;width:18px;z-index:1002}.uppy-size--md .uppy-Dashboard-Item-action--remove:focus{border-radius:50%}.uppy-Dashboard--singleFile.uppy-size--height-md .uppy-Dashboard-Item-action--remove{inset-inline-end:8px;position:absolute;top:8px}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove{color:#525252}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove:hover{color:#333}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-actionWrapper{align-items:center;display:flex}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action{height:22px;margin-left:3px;padding:3px;width:22px}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action:focus{border-radius:3px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink,.uppy-size--md .uppy-Dashboard-Item-action--edit{height:16px;padding:0;width:16px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink:focus,.uppy-size--md .uppy-Dashboard-Item-action--edit:focus{border-radius:3px}.uppy-Dashboard-Item{align-items:center;border-bottom:1px solid #eaeaea;display:flex;padding:10px}.uppy-Dashboard:not(.uppy-Dashboard--singleFile) .uppy-Dashboard-Item{padding-inline-end:0}[data-uppy-theme=dark] .uppy-Dashboard-Item{border-bottom:1px solid #333}.uppy-size--md .uppy-Dashboard-Item{border-bottom:0;display:block;float:inline-start;height:215px;margin:5px 15px;padding:0;position:relative;width:calc(33.333% - 30px)}.uppy-size--lg .uppy-Dashboard-Item{height:190px;margin:5px 15px;padding:0;width:calc(25% - 30px)}.uppy-size--xl .uppy-Dashboard-Item{height:210px;padding:0;width:calc(20% - 30px)}.uppy-Dashboard--singleFile .uppy-Dashboard-Item{border-bottom:0;display:flex;flex-direction:column;height:100%;max-width:400px;padding:15px;position:relative;width:100%}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-previewInnerWrap{opacity:.2}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-name{opacity:.7}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='35' height='39' viewBox='0 0 35 39'%3E%3Cpath fill='%2523000' d='M1.708 38.66c1.709 0 3.417-3.417 6.834-3.417s5.125 3.417 8.61 3.417c3.348 0 5.056-3.417 8.473-3.417 4.305 0 5.125 3.417 6.833 3.417.889 0 1.709-.889 1.709-1.709v-19.68C34.167-5.757 0-5.757 0 17.271v19.68c0 .82.888 1.709 1.708 1.709m8.542-17.084a3.383 3.383 0 0 1-3.417-3.416 3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.417 3.417 3.383 3.383 0 0 1-3.417 3.416m13.667 0A3.383 3.383 0 0 1 20.5 18.16a3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.416 3.417 3.383 3.383 0 0 1-3.416 3.416'/%3E%3C/svg%3E");background-position:50% 10px;background-repeat:no-repeat;background-size:25px;content:"";inset:0;opacity:.5;position:absolute;z-index:1005}.uppy-size--md .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:40px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:30%}.uppy-Dashboard-Item-preview{flex-grow:0;flex-shrink:0;height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-Item-preview{height:140px;width:100%}.uppy-size--lg .uppy-Dashboard-Item-preview{height:120px}.uppy-size--xl .uppy-Dashboard-Item-preview{height:140px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview{flex-grow:1;max-height:75%;width:100%}.uppy-Dashboard--singleFile.uppy-size--md .uppy-Dashboard-Item-preview{max-height:100%}.uppy-Dashboard-Item-fileInfoAndButtons{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-inline-end:8px;padding-inline-start:12px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons,.uppy-size--md .uppy-Dashboard-Item-fileInfoAndButtons{align-items:flex-start;padding:9px 0 0}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons{flex-grow:0;width:100%}.uppy-Dashboard-Item-fileInfo{flex-grow:1;flex-shrink:1}.uppy-Dashboard-Item-actionWrapper{flex-grow:0;flex-shrink:0}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-previewInnerWrap:after,.uppy-Dashboard-Item.is-inprogress .uppy-Dashboard-Item-previewInnerWrap:after{display:block}.uppy-Dashboard-Item-errorDetails{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border:none;border-radius:50%;color:#fff;cursor:help;flex-shrink:0;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;width:13px}.uppy-Dashboard-Item-errorDetails:after{line-height:1.3;word-wrap:break-word}.uppy-Dashboard-FileCard{background-color:#fff;border-radius:5px;box-shadow:0 0 10px 4px #0000001a;display:flex;flex-direction:column;height:100%;inset:0;position:absolute;width:100%;z-index:1005}.uppy-Dashboard-FileCard .uppy-DashboardContent-bar{border-top-left-radius:5px;border-top-right-radius:5px}.uppy-Dashboard-FileCard .uppy-Dashboard-FileCard-actions{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.uppy-Dashboard-FileCard-inner{display:flex;flex-direction:column;flex-grow:1;flex-shrink:1;height:100%;min-height:0}.uppy-Dashboard-FileCard-preview{align-items:center;border-bottom:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:1;height:60%;justify-content:center;min-height:0;position:relative}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-preview{background-color:#333;border-bottom:0}.uppy-Dashboard-FileCard-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;box-shadow:0 3px 20px #00000026;flex:0 0 auto;max-height:90%;max-width:90%;-o-object-fit:cover;object-fit:cover}.uppy-Dashboard-FileCard-edit{background-color:#00000080;border-radius:50px;color:#fff;font-size:13px;inset-inline-end:10px;padding:7px 15px;position:absolute;top:10px}.uppy-Dashboard-FileCard-edit:focus{outline:none}.uppy-Dashboard-FileCard-edit::-moz-focus-inner{border:0}.uppy-Dashboard-FileCard-edit:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-FileCard-edit:hover{background-color:#000c}.uppy-Dashboard-FileCard-info{flex-grow:0;flex-shrink:0;height:40%;overflow-y:auto;padding:30px 20px 20px;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-info{background-color:#1f1f1f}.uppy-Dashboard-FileCard-fieldset{border:0;font-size:0;margin:auto auto 12px;max-width:640px;padding:0}.uppy-Dashboard-FileCard-label{color:#525252;display:inline-block;font-size:12px;vertical-align:middle;width:22%}.uppy-size--md .uppy-Dashboard-FileCard-label{font-size:14px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-label{color:#eaeaea}.uppy-Dashboard-FileCard-input{display:inline-block;vertical-align:middle;width:78%}.uppy-Dashboard-FileCard-actions{align-items:center;background-color:#fafafa;border-top:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:0;height:55px;padding:0 15px}.uppy-size--md .uppy-Dashboard-FileCard-actions{height:65px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-actions{background-color:#1f1f1f;border-top:1px solid #333}.uppy-Dashboard-FileCard-actionsBtn{margin-inline-end:10px}.uppy-Informer{bottom:60px;left:0;position:absolute;right:0;text-align:center;z-index:1005}.uppy-Informer span>div{margin-bottom:6px}.uppy-Informer-animated{opacity:0;transform:translateY(350%);transition:all .3s ease-in;z-index:-1000}.uppy-Informer p{background-color:#757575;border-radius:18px;color:#fff;display:inline-block;font-size:12px;font-weight:400;line-height:1.4;margin:0;max-width:90%;padding:6px 15px}.uppy-size--md .uppy-Informer p{font-size:14px;line-height:1.3;max-width:500px;padding:10px 20px}[data-uppy-theme=dark] .uppy-Informer p{background-color:#333}.uppy-Informer p span{background-color:#fff;border-radius:50%;color:#525252;display:inline-block;font-size:10px;height:13px;inset-inline-start:3px;line-height:12px;margin-inline-start:-1px;position:relative;top:-1px;vertical-align:middle;width:13px}.uppy-Informer p span:hover{cursor:help}.uppy-Informer p span:after{line-height:1.3;word-wrap:break-word}.uppy-Root [aria-label][role~=tooltip]{position:relative}.uppy-Root [aria-label][role~=tooltip]:after,.uppy-Root [aria-label][role~=tooltip]:before{backface-visibility:hidden;box-sizing:border-box;opacity:0;pointer-events:none;position:absolute;transform:translateZ(0);transform-origin:top;transition:all var(--microtip-transition-duration,.18s) var(--microtip-transition-easing,ease-in-out) var(--microtip-transition-delay,0s);will-change:transform;z-index:10}.uppy-Root [aria-label][role~=tooltip]:before{background-size:100% auto!important;content:""}.uppy-Root [aria-label][role~=tooltip]:after{background:#111111e6;border-radius:4px;box-sizing:initial;color:#fff;content:attr(aria-label);font-size:var(--microtip-font-size,13px);font-weight:var(--microtip-font-weight,normal);padding:.5em 1em;text-transform:var(--microtip-text-transform,none);white-space:nowrap}.uppy-Root [aria-label][role~=tooltip]:focus:after,.uppy-Root [aria-label][role~=tooltip]:focus:before,.uppy-Root [aria-label][role~=tooltip]:hover:after,.uppy-Root [aria-label][role~=tooltip]:hover:before{opacity:1;pointer-events:auto}.uppy-Root [role~=tooltip][data-microtip-position|=top]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M2.658 0h32.004c-6 0-11.627 12.002-16.002 12.002S8.594 0 2.658 0'/%3E%3C/svg%3E") no-repeat;bottom:100%;height:6px;left:50%;margin-bottom:5px;transform:translate3d(-50%,0,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=top]:after{bottom:100%;left:50%;margin-bottom:11px;transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=top]:hover:before{transform:translate3d(-50%,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:after{bottom:100%;transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:hover:after{transform:translate3d(calc(-100% + 16px),-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:after{bottom:100%;transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:hover:after{transform:translate3d(-16px,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M33.342 12H1.338c6 0 11.627-12.002 16.002-12.002S27.406 12 33.342 12'/%3E%3C/svg%3E") no-repeat;bottom:auto;height:6px;left:50%;margin-bottom:0;margin-top:5px;top:100%;transform:translate3d(-50%,-10px,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:after{left:50%;margin-top:11px;top:100%;transform:translate3d(-50%,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:hover:before{transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:after{top:100%;transform:translate3d(calc(-100% + 16px),-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:hover:after{transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:after{top:100%;transform:translate3d(-16px,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:hover:after{transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:before{inset:50% 100% auto auto;transform:translate3d(10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M0 33.342V1.338c0 6 12.002 11.627 12.002 16.002S0 27.406 0 33.342'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-right:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=left]:after{margin-right:11px}.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:before{bottom:auto;left:100%;top:50%;transform:translate3d(-10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M12 2.658v32.004c0-6-12.002-11.627-12.002-16.002S12 8.594 12 2.658'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-left:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=right]:after{margin-left:11px}.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-size=small]:after{white-space:normal;width:80px}.uppy-Root [role~=tooltip][data-microtip-size=medium]:after{white-space:normal;width:150px}.uppy-Root [role~=tooltip][data-microtip-size=large]:after{white-space:normal;width:260px}.uppy-StatusBar{background-color:#fff;color:#fff;display:flex;font-size:12px;font-weight:400;height:46px;line-height:40px;position:relative;transition:height .2s;z-index:1001}[data-uppy-theme=dark] .uppy-StatusBar{background-color:#1f1f1f}.uppy-StatusBar:before{background-color:#eaeaea;content:"";height:2px;inset:0;position:absolute;width:100%}[data-uppy-theme=dark] .uppy-StatusBar:before{background-color:#757575}.uppy-StatusBar[aria-hidden=true]{height:0;overflow-y:hidden}.uppy-StatusBar.is-complete .uppy-StatusBar-progress{background-color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-progress{background-color:#e32437}.uppy-StatusBar.is-complete .uppy-StatusBar-statusIndicator{color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-statusIndicator{color:#e32437}.uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#fff;border-top:1px solid #eaeaea;height:65px}[data-uppy-theme=dark] .uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#1f1f1f;border-top:1px solid #333}.uppy-StatusBar-progress{background-color:#1269cf;height:2px;position:absolute;transition:background-color,width .3s ease-out;z-index:1001}.uppy-StatusBar-progress.is-indeterminate{animation:uppy-StatusBar-ProgressStripes 1s linear infinite;background-image:linear-gradient(45deg,#0000004d 25%,#0000 0 50%,#0000004d 0 75%,#0000 0,#0000);background-size:64px 64px}@keyframes uppy-StatusBar-ProgressStripes{0%{background-position:0 0}to{background-position:64px 0}}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-progress,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-progress{background-color:#f6a623}.uppy-StatusBar.is-waiting .uppy-StatusBar-progress{display:none}.uppy-StatusBar-content{align-items:center;color:#333;display:flex;height:100%;padding-inline-start:10px;position:relative;text-overflow:ellipsis;white-space:nowrap;z-index:1002}.uppy-size--md .uppy-StatusBar-content{padding-inline-start:15px}[data-uppy-theme=dark] .uppy-StatusBar-content{color:#eaeaea}.uppy-StatusBar-status{display:flex;flex-direction:column;font-weight:400;justify-content:center;line-height:1.4;padding-inline-end:.3em}.uppy-StatusBar-statusPrimary{display:flex;font-weight:500;line-height:1}.uppy-StatusBar-statusPrimary button.uppy-StatusBar-details{margin-left:5px}[data-uppy-theme=dark] .uppy-StatusBar-statusPrimary{color:#eaeaea}.uppy-StatusBar-statusSecondary{color:#757575;display:inline-block;font-size:11px;line-height:1.2;margin-top:1px;white-space:nowrap}[data-uppy-theme=dark] .uppy-StatusBar-statusSecondary{color:#bbb}.uppy-StatusBar-statusSecondaryHint{display:inline-block;line-height:1;margin-inline-end:5px;vertical-align:middle}.uppy-size--md .uppy-StatusBar-statusSecondaryHint{margin-inline-end:8px}.uppy-StatusBar-statusIndicator{color:#525252;margin-inline-end:7px;position:relative;top:1px}.uppy-StatusBar-statusIndicator svg{vertical-align:text-bottom}.uppy-StatusBar-actions{align-items:center;bottom:0;display:flex;inset-inline-end:10px;position:absolute;top:0;z-index:1004}.uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#fafafa;height:100%;padding:0 15px;position:static;width:100%}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#1f1f1f}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:column;height:90px}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:row;height:65px}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:column;justify-content:center}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:row;justify-content:normal}.uppy-StatusBar-actionCircleBtn{cursor:pointer;line-height:1;margin:3px;opacity:.9}.uppy-StatusBar-actionCircleBtn:focus{outline:none}.uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}.uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionCircleBtn:hover{opacity:1}.uppy-StatusBar-actionCircleBtn:focus{border-radius:50%}.uppy-StatusBar-actionCircleBtn svg{vertical-align:bottom}.uppy-StatusBar-actionBtn{color:#1269cf;display:inline-block;font-size:10px;line-height:inherit;vertical-align:middle}.uppy-size--md .uppy-StatusBar-actionBtn{font-size:11px}.uppy-StatusBar-actionBtn--disabled{opacity:.4}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--disabled{opacity:.7}.uppy-StatusBar-actionBtn--retry{background-color:#ff4b23;border-radius:8px;color:#fff;height:16px;line-height:1;margin-inline-end:6px;padding:1px 6px 3px 18px;position:relative}.uppy-StatusBar-actionBtn--retry:focus{outline:none}.uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionBtn--retry:hover{background-color:#f92d00}.uppy-StatusBar-actionBtn--retry svg{inset-inline-start:6px;position:absolute;top:3px}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1bb240;color:#fff;font-size:14px;line-height:1;padding:15px 10px;width:100%}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#189c38}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1c8b37}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#18762f}.uppy-size--md .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{padding:13px 22px;width:auto}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1bb240;cursor:not-allowed}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1c8b37}.uppy-StatusBar:not(.is-waiting) .uppy-StatusBar-actionBtn--upload{background-color:initial;color:#1269cf}.uppy-StatusBar-actionBtn--uploadNewlyAdded{border-radius:3px;padding-inline-end:3px;padding-bottom:1px;padding-inline-start:3px}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}.uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded{display:none}.uppy-StatusBar-actionBtn--done{border-radius:3px;line-height:1;padding:7px 8px}.uppy-StatusBar-actionBtn--done:focus{outline:none}.uppy-StatusBar-actionBtn--done::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--done:hover{color:#0e51a0}.uppy-StatusBar-actionBtn--done:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done:focus{background-color:#333}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done{color:#02baf2}.uppy-size--md .uppy-StatusBar-actionBtn--done{font-size:14px}.uppy-StatusBar-serviceMsg{color:#000;font-size:11px;line-height:1.1;padding-left:10px}.uppy-size--md .uppy-StatusBar-serviceMsg{font-size:14px;padding-left:15px}[data-uppy-theme=dark] .uppy-StatusBar-serviceMsg{color:#eaeaea}.uppy-StatusBar-serviceMsg-ghostsIcon{left:6px;opacity:.5;position:relative;top:2px;vertical-align:text-bottom;width:10px}.uppy-size--md .uppy-StatusBar-serviceMsg-ghostsIcon{left:10px;top:1px;width:15px}.uppy-StatusBar-details{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border-radius:50%;color:#fff;cursor:help;display:inline-block;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;vertical-align:middle;width:13px}.uppy-StatusBar-details:after{line-height:1.3;word-wrap:break-word}.uppy-StatusBar-spinner{animation-duration:1s;animation-iteration-count:infinite;animation-name:uppy-StatusBar-spinnerAnimation;animation-timing-function:linear;fill:#1269cf;margin-inline-end:10px}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-spinner,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-spinner{fill:#f6a623}@keyframes uppy-StatusBar-spinnerAnimation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.uppy-transition-slideDownUp-enter{opacity:.01;transform:translate3d(0,-105%,0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-enter.uppy-transition-slideDownUp-enter-active{opacity:1;transform:translateZ(0)}.uppy-transition-slideDownUp-leave{opacity:1;transform:translateZ(0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-leave.uppy-transition-slideDownUp-leave-active{opacity:.01;transform:translate3d(0,-105%,0)}@keyframes uppy-Dashboard-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes uppy-Dashboard-fadeOut{0%{opacity:1}to{opacity:0}}@keyframes uppy-Dashboard-slideDownAndFadeIn{0%{opacity:0;transform:translate3d(-50%,-70%,0)}to{opacity:1;transform:translate3d(-50%,-50%,0)}}@keyframes uppy-Dashboard-slideDownAndFadeIn--small{0%{opacity:0;transform:translate3d(0,-20%,0)}to{opacity:1;transform:translateZ(0)}}@keyframes uppy-Dashboard-slideUpFadeOut{0%{opacity:1;transform:translate3d(-50%,-50%,0)}to{opacity:0;transform:translate3d(-50%,-70%,0)}}@keyframes uppy-Dashboard-slideUpFadeOut--small{0%{opacity:1;transform:translateZ(0)}to{opacity:0;transform:translate3d(0,-20%,0)}}.uppy-Dashboard--modal{z-index:1001}.uppy-Dashboard--modal[aria-hidden=true]{display:none}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeIn .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeOut .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard-isFixed{height:100vh;overflow:hidden}.uppy-Dashboard--modal .uppy-Dashboard-overlay{background-color:#00000080;inset:0;position:fixed;z-index:1001}.uppy-Dashboard-inner{background-color:#f4f4f4;border:1px solid #eaeaea;border-radius:5px;max-height:100%;max-width:100%;outline:none;position:relative}.uppy-size--md .uppy-Dashboard-inner{min-height:auto}@media only screen and (min-width:820px){.uppy-Dashboard-inner{height:500px;width:650px}}.uppy-Dashboard--modal .uppy-Dashboard-inner{z-index:1002}[data-uppy-theme=dark] .uppy-Dashboard-inner{background-color:#1f1f1f}.uppy-Dashboard--isDisabled .uppy-Dashboard-inner{cursor:not-allowed}.uppy-Dashboard-innerWrap{border-radius:5px;display:flex;flex-direction:column;height:100%;opacity:0;overflow:hidden;position:relative}.uppy-Dashboard--isInnerWrapVisible .uppy-Dashboard-innerWrap{opacity:1}.uppy-Dashboard--isDisabled .uppy-Dashboard-innerWrap{cursor:not-allowed;filter:grayscale(100%);opacity:.6;-webkit-user-select:none;-moz-user-select:none;user-select:none}.uppy-Dashboard--isDisabled .uppy-ProviderIconBg{fill:#9f9f9f}.uppy-Dashboard--isDisabled [aria-disabled],.uppy-Dashboard--isDisabled [disabled]{cursor:not-allowed;pointer-events:none}.uppy-Dashboard--modal .uppy-Dashboard-inner{border:none;inset:35px 15px 15px;position:fixed}@media only screen and (min-width:820px){.uppy-Dashboard--modal .uppy-Dashboard-inner{box-shadow:0 5px 15px 4px #00000026;left:50%;right:auto;top:50%;transform:translate(-50%,-50%)}}.uppy-Dashboard-close{color:#ffffffe6;cursor:pointer;display:block;font-size:27px;inset-inline-end:-2px;position:absolute;top:-33px;z-index:1005}.uppy-Dashboard-close:focus{outline:none}.uppy-Dashboard-close::-moz-focus-inner{border:0}.uppy-Dashboard-close:focus{color:#6eabf2}@media only screen and (min-width:820px){.uppy-Dashboard-close{font-size:35px;inset-inline-end:-35px;top:-10px}}.uppy-Dashboard-serviceMsg{background-color:#fffbf7;border-bottom:1px solid #edd4b9;border-top:1px solid #edd4b9;font-size:12px;font-weight:500;line-height:1.3;padding:12px 0;position:relative;top:-1px;z-index:1004}.uppy-size--md .uppy-Dashboard-serviceMsg{font-size:14px;line-height:1.4}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg{background-color:#1f1f1f;border-bottom:1px solid #333;border-top:1px solid #333;color:#eaeaea}.uppy-Dashboard-serviceMsg-title{display:block;line-height:1;margin-bottom:4px;padding-left:42px}.uppy-Dashboard-serviceMsg-text{padding:0 15px}.uppy-Dashboard-serviceMsg-actionBtn{color:#1269cf;font-size:inherit;font-weight:inherit;vertical-align:initial}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg-actionBtn{color:#02baf2e6}.uppy-Dashboard-serviceMsg-icon{left:15px;position:absolute;top:10px}.uppy-Dashboard-AddFiles{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;position:relative;text-align:center}[data-uppy-drag-drop-supported=true] .uppy-Dashboard-AddFiles{border:1px dashed #dfdfdf;border-radius:3px;height:calc(100% - 14px);margin:7px}.uppy-Dashboard-AddFilesPanel .uppy-Dashboard-AddFiles{border:none;height:calc(100% - 54px)}.uppy-Dashboard--modal .uppy-Dashboard-AddFiles{border-color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles{border-color:#757575}.uppy-Dashboard-AddFiles-info{display:none;margin-top:auto;padding-bottom:15px;padding-top:15px}.uppy-size--height-md .uppy-Dashboard-AddFiles-info{display:block}.uppy-size--md .uppy-Dashboard-AddFiles-info{bottom:25px;left:0;padding-bottom:0;padding-top:30px;position:absolute;right:0}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-info{margin-top:0}.uppy-Dashboard-browse{color:#1269cf;cursor:pointer}.uppy-Dashboard-browse:focus{outline:none}.uppy-Dashboard-browse::-moz-focus-inner{border:0}.uppy-Dashboard-browse:focus,.uppy-Dashboard-browse:hover{border-bottom:1px solid #1269cf}[data-uppy-theme=dark] .uppy-Dashboard-browse{color:#02baf2e6}[data-uppy-theme=dark] .uppy-Dashboard-browse:focus,[data-uppy-theme=dark] .uppy-Dashboard-browse:hover{border-bottom:1px solid #02baf2}.uppy-Dashboard-browseBtn{display:block;font-size:14px;font-weight:500;margin-bottom:5px;margin-top:8px;width:100%}.uppy-size--md .uppy-Dashboard-browseBtn{font-size:15px;margin:15px auto;padding:13px 44px;width:auto}.uppy-Dashboard-AddFiles-list{display:flex;flex:1;flex-direction:column;margin-top:2px;overflow-y:auto;padding:2px 0;width:100%;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-AddFiles-list{flex:none;flex-direction:row;flex-wrap:wrap;justify-content:center;margin-top:15px;max-width:600px;overflow-y:visible;padding-top:0}.uppy-DashboardTab{border-bottom:1px solid #eaeaea;text-align:center;width:100%}[data-uppy-theme=dark] .uppy-DashboardTab{border-bottom:1px solid #333}.uppy-size--md .uppy-DashboardTab{border-bottom:none;display:inline-block;margin-bottom:10px;width:auto}.uppy-DashboardTab-btn{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:initial;color:#525252;cursor:pointer;flex-direction:row;height:100%;justify-content:left;padding:12px 15px;width:100%}.uppy-DashboardTab-btn:focus{outline:none}.uppy-size--md .uppy-DashboardTab-btn{border-radius:5px;flex-direction:column;margin-inline-end:1px;padding:10px 3px;width:86px}[data-uppy-theme=dark] .uppy-DashboardTab-btn{color:#eaeaea}.uppy-DashboardTab-btn::-moz-focus-inner{border:0}.uppy-DashboardTab-btn:hover{background-color:#e9ecef}[data-uppy-theme=dark] .uppy-DashboardTab-btn:hover{background-color:#333}.uppy-DashboardTab-btn:active,.uppy-DashboardTab-btn:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardTab-btn:active,[data-uppy-theme=dark] .uppy-DashboardTab-btn:focus{background-color:#525252}.uppy-DashboardTab-btn svg{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;transition:transform .15s ease-in-out;vertical-align:text-top}.uppy-DashboardTab-inner{align-items:center;background-color:#fff;border-radius:8px;box-shadow:0 1px 1px #0000001a,0 1px 2px #0000001a,0 2px 3px #00000005;display:flex;height:32px;justify-content:center;margin-inline-end:10px;width:32px}.uppy-size--md .uppy-DashboardTab-inner{margin-inline-end:0}[data-uppy-theme=dark] .uppy-DashboardTab-inner{background-color:#323232;box-shadow:0 1px 1px #0003,0 1px 2px #0003,0 2px 3px #00000014}.uppy-DashboardTab-name{font-size:14px;font-weight:400}.uppy-size--md .uppy-DashboardTab-name{font-size:12px;line-height:15px;margin-bottom:0;margin-top:8px}.uppy-DashboardTab-iconMyDevice{color:#1269cf}[data-uppy-theme=dark] .uppy-DashboardTab-iconMyDevice{color:#02baf2}.uppy-DashboardTab-iconBox{color:#0061d5}[data-uppy-theme=dark] .uppy-DashboardTab-iconBox{color:#eaeaea}.uppy-DashboardTab-iconDropbox{color:#0061fe}[data-uppy-theme=dark] .uppy-DashboardTab-iconDropbox{color:#eaeaea}.uppy-DashboardTab-iconUnsplash{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconUnsplash{color:#eaeaea}.uppy-DashboardTab-iconWebdav{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconWebdav{color:#eaeaea}.uppy-DashboardTab-iconScreenRec{color:#2c3e50}[data-uppy-theme=dark] .uppy-DashboardTab-iconScreenRec{color:#eaeaea}.uppy-DashboardTab-iconAudio{color:#8030a3}[data-uppy-theme=dark] .uppy-DashboardTab-iconAudio{color:#bf6ee3}.uppy-Dashboard-input{height:.1px;opacity:0;overflow:hidden;position:absolute;width:.1px;z-index:-1}.uppy-DashboardContent-bar{align-items:center;background-color:#fafafa;border-bottom:1px solid #eaeaea;display:flex;flex-shrink:0;height:40px;justify-content:space-between;padding:0 10px;position:relative;width:100%;z-index:1004}.uppy-size--md .uppy-DashboardContent-bar{height:50px;padding:0 15px}[data-uppy-theme=dark] .uppy-DashboardContent-bar{background-color:#1f1f1f;border-bottom:1px solid #333}.uppy-DashboardContent-title{font-size:12px;font-weight:500;left:0;line-height:40px;margin:auto;max-width:170px;overflow-x:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0;white-space:nowrap;width:100%}.uppy-size--md .uppy-DashboardContent-title{font-size:14px;line-height:50px;max-width:300px}[data-uppy-theme=dark] .uppy-DashboardContent-title{color:#eaeaea}.uppy-DashboardContent-back,.uppy-DashboardContent-save{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-size:12px;font-weight:400;line-height:1;margin:0;margin-inline-start:-6px;padding:7px 6px}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{outline:none}.uppy-DashboardContent-back::-moz-focus-inner,.uppy-DashboardContent-save::-moz-focus-inner{border:0}.uppy-DashboardContent-back:hover,.uppy-DashboardContent-save:hover{color:#0e51a0}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-back:focus,[data-uppy-theme=dark] .uppy-DashboardContent-save:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-back,.uppy-size--md .uppy-DashboardContent-save{font-size:14px}[data-uppy-theme=dark] .uppy-DashboardContent-back,[data-uppy-theme=dark] .uppy-DashboardContent-save{color:#02baf2}.uppy-DashboardContent-addMore{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:500;height:29px;line-height:1;margin:0;margin-inline-end:-5px;padding:7px 8px;width:29px}.uppy-DashboardContent-addMore:focus{outline:none}.uppy-DashboardContent-addMore::-moz-focus-inner{border:0}.uppy-DashboardContent-addMore:hover{color:#0e51a0}.uppy-DashboardContent-addMore:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-addMore:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-addMore{font-size:14px;height:auto;margin-inline-end:-8px;width:auto}[data-uppy-theme=dark] .uppy-DashboardContent-addMore{color:#02baf2}.uppy-DashboardContent-addMore svg{margin-inline-end:4px;vertical-align:initial}.uppy-size--md .uppy-DashboardContent-addMore svg{height:11px;width:11px}.uppy-DashboardContent-addMoreCaption{display:none}.uppy-size--md .uppy-DashboardContent-addMoreCaption{display:inline}.uppy-DashboardContent-panel{background-color:#f5f5f5;flex:1}.uppy-Dashboard-AddFilesPanel,.uppy-DashboardContent-panel{border-radius:5px;display:flex;flex-direction:column;inset:0;overflow:hidden;position:absolute;z-index:1005}.uppy-Dashboard-AddFilesPanel{background:#fafafa;background:linear-gradient(0deg,#fafafa 35%,#fafafad9);box-shadow:0 0 10px 5px #00000026}[data-uppy-theme=dark] .uppy-Dashboard-AddFilesPanel{background-color:#333;background-image:linear-gradient(0deg,#1f1f1f 35%,#1f1f1fd9)}.uppy-Dashboard--isAddFilesPanelVisible .uppy-Dashboard-files{filter:blur(2px)}.uppy-Dashboard-progress{bottom:0;height:12%;left:0;position:absolute;width:100%}.uppy-Dashboard-progressBarContainer.is-active{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1004}.uppy-Dashboard-filesContainer{flex:1;margin:0;overflow-y:hidden;position:relative}.uppy-Dashboard-filesContainer:after{clear:both;content:"";display:table}.uppy-Dashboard-files{flex:1;margin:0;overflow-y:auto;padding:0 0 10px;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-files{padding-top:10px}.uppy-Dashboard--singleFile .uppy-Dashboard-filesInner{align-items:center;display:flex;height:100%;justify-content:center}.uppy-Dashboard-dropFilesHereHint{align-items:center;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%231269CF' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;border:1px dashed #1269cf;border-radius:3px;color:#757575;display:flex;font-size:16px;justify-content:center;inset:7px;padding-top:90px;position:absolute;text-align:center;visibility:hidden;z-index:2000}[data-uppy-theme=dark] .uppy-Dashboard-dropFilesHereHint{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%2302BAF2' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");border-color:#02baf2;color:#bbb}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-dropFilesHereHint{pointer-events:none;visibility:visible}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-files,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-progressindicators,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-serviceMsg,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-DashboardContent-bar{opacity:.15}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-AddFiles{opacity:.03}.uppy-Dashboard-AddFiles-title{color:#000;font-size:17px;font-weight:500;line-height:1.35;margin-bottom:5px;margin-top:15px;padding:0 15px;text-align:inline-start;width:100%}.uppy-size--md .uppy-Dashboard-AddFiles-title{font-size:21px;font-weight:400;margin-top:5px;max-width:480px;padding:0 35px;text-align:center}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-title{text-align:center}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title{color:#eaeaea}.uppy-Dashboard-AddFiles-title button{font-weight:500}.uppy-size--md .uppy-Dashboard-AddFiles-title button{font-weight:400}.uppy-Dashboard-note{color:#757575;font-size:14px;line-height:1.25;margin:auto;max-width:350px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Dashboard-note{line-height:1.35;max-width:600px}[data-uppy-theme=dark] .uppy-Dashboard-note{color:#cfcfcf}a.uppy-Dashboard-poweredBy{color:#939393;display:inline-block;font-size:11px;margin-top:8px;text-align:center;text-decoration:none}.uppy-Dashboard-poweredByIcon{margin-left:1px;margin-right:1px;opacity:.9;position:relative;top:1px;vertical-align:text-top;fill:none;stroke:#939393}.uppy-Dashboard-Item-previewIcon{height:25px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:25px;z-index:100}.uppy-size--md .uppy-Dashboard-Item-previewIcon{height:38px;width:38px}.uppy-Dashboard-Item-previewIcon svg{height:100%;width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIcon{height:100%;max-height:60%;max-width:60%;width:100%}.uppy-Dashboard-Item-previewIconWrap{height:76px;max-height:75%;position:relative}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIconWrap{height:100%;width:100%}.uppy-Dashboard-Item-previewIconBg{filter:drop-shadow(rgba(0,0,0,.1) 0 1px 1px);height:100%;width:100%}.uppy-Dashboard-upload{height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-upload{height:60px;width:60px}.uppy-Dashboard-upload .uppy-c-icon{position:relative;top:1px;width:50%}.uppy-Dashboard-uploadCount{background-color:#1bb240;border-radius:50%;color:#fff;font-size:8px;height:16px;inset-inline-end:-12px;line-height:16px;position:absolute;top:-12px;width:16px}.uppy-size--md .uppy-Dashboard-uploadCount{font-size:9px;height:18px;line-height:18px;width:18px}.uppy-Dashboard-inner{border:none!important;background:transparent!important}.uppy-Dashboard-innerWrap{border-radius:.5rem;overflow:hidden}.uppy-Dashboard-AddFiles{border:2px dashed hsl(var(--border))!important;border-radius:.5rem!important;background:hsl(var(--muted) / .3)!important;transition:all .2s ease}.uppy-Dashboard-AddFiles:hover{border-color:hsl(var(--primary))!important;background:hsl(var(--muted) / .5)!important}.uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important;font-weight:500!important}.uppy-Dashboard-AddFiles-info{color:hsl(var(--muted-foreground))!important}.uppy-Dashboard-browse{color:hsl(var(--primary))!important;font-weight:500!important}.uppy-Dashboard-browse:hover{text-decoration:underline!important}.uppy-Dashboard-files{background:transparent!important}.uppy-Dashboard-Item{border-bottom-color:hsl(var(--border))!important}.uppy-Dashboard-Item-name{color:hsl(var(--foreground))!important}.uppy-Dashboard-Item-status{color:hsl(var(--muted-foreground))!important}.uppy-StatusBar{background:hsl(var(--muted))!important;border-top:1px solid hsl(var(--border))!important}.uppy-StatusBar-progress{background:hsl(var(--primary))!important}.uppy-StatusBar-content{color:hsl(var(--foreground))!important}.uppy-StatusBar-actionBtn--upload{background:hsl(var(--primary))!important;color:hsl(var(--primary-foreground))!important;border-radius:.375rem!important;font-weight:500!important;padding:.5rem 1rem!important}.uppy-StatusBar-actionBtn--upload:hover{background:hsl(var(--primary) / .9)!important}.uppy-Dashboard-note{color:hsl(var(--muted-foreground))!important;font-size:.75rem!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles,.dark .uppy-Dashboard-AddFiles{background:hsl(var(--muted) / .2)!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title,.dark .uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important}[data-uppy-theme=dark] .uppy-StatusBar,.dark .uppy-StatusBar{background:hsl(var(--muted) / .5)!important}.uppy-Dashboard{font-family:inherit!important}.uppy-Dashboard-Item-preview{border-radius:.375rem!important;overflow:hidden}.uppy-Dashboard-Item-action--remove{color:hsl(var(--destructive))!important}.uppy-Dashboard-Item-action--remove:hover{opacity:.8}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{color:hsl(var(--success, 142 76% 36%))!important}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progress{color:hsl(var(--destructive))!important}.uppy-Dashboard-files::-webkit-scrollbar{width:6px}.uppy-Dashboard-files::-webkit-scrollbar-track{background:transparent}.uppy-Dashboard-files::-webkit-scrollbar-thumb{background:hsl(var(--muted-foreground) / .3);border-radius:3px}.uppy-Dashboard-files::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5)}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/assets/markdown-kUhwkcQP.js b/webui/dist/assets/markdown-CKA5gBQ9.js similarity index 99% rename from webui/dist/assets/markdown-kUhwkcQP.js rename to webui/dist/assets/markdown-CKA5gBQ9.js index 1d787d15..1d7c44dc 100644 --- a/webui/dist/assets/markdown-kUhwkcQP.js +++ b/webui/dist/assets/markdown-CKA5gBQ9.js @@ -1,4 +1,4 @@ -import{j as gn}from"./router-Bz250laD.js";import{g as Oa}from"./react-vendor-BmxF9s7Q.js";function ni(e){const t=[],r=String(e||"");let n=r.indexOf(","),i=0,a=!1;for(;!a;){n===-1&&(n=r.length,a=!0);const l=r.slice(i,n).trim();(l||!a)&&t.push(l),i=n+1,n=r.indexOf(",",i)}return t}function Js(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const eo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,to=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ro={};function ii(e,t){return(ro.jsx?to:eo).test(e)}const no=/[ \t\n\f\r]/g;function io(e){return typeof e=="object"?e.type==="text"?ai(e.value):!1:ai(e)}function ai(e){return e.replace(no,"")===""}class Sr{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Sr.prototype.normal={};Sr.prototype.property={};Sr.prototype.space=void 0;function qa(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Sr(r,n,t)}function yr(e){return e.toLowerCase()}class He{constructor(t,r){this.attribute=r,this.property=t}}He.prototype.attribute="";He.prototype.booleanish=!1;He.prototype.boolean=!1;He.prototype.commaOrSpaceSeparated=!1;He.prototype.commaSeparated=!1;He.prototype.defined=!1;He.prototype.mustUseProperty=!1;He.prototype.number=!1;He.prototype.overloadedBoolean=!1;He.prototype.property="";He.prototype.spaceSeparated=!1;He.prototype.space=void 0;let ao=0;const te=qt(),Ae=qt(),Kn=qt(),R=qt(),pe=qt(),Kt=qt(),Ue=qt();function qt(){return 2**++ao}const Zn=Object.freeze(Object.defineProperty({__proto__:null,boolean:te,booleanish:Ae,commaOrSpaceSeparated:Ue,commaSeparated:Kt,number:R,overloadedBoolean:Kn,spaceSeparated:pe},Symbol.toStringTag,{value:"Module"})),vn=Object.keys(Zn);class v0 extends He{constructor(t,r,n,i){let a=-1;if(super(t,r),li(this,"space",i),typeof n=="number")for(;++a4&&r.slice(0,4)==="data"&&co.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(si,mo);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!si.test(a)){let l=a.replace(uo,ho);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=v0}return new i(n,t)}function ho(e){return"-"+e.toLowerCase()}function mo(e){return e.charAt(1).toUpperCase()}const Wa=qa([Ha,lo,$a,Ua,_a],"html"),tn=qa([Ha,so,$a,Ua,_a],"svg");function oi(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function fo(e){return e.join(" ").trim()}var Gt={},yn,ui;function po(){if(ui)return yn;ui=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,s=/^\s+|\s+$/g,o=` +import{j as gn}from"./router-9vIXuQkh.js";import{g as Oa}from"./react-vendor-BmxF9s7Q.js";function ni(e){const t=[],r=String(e||"");let n=r.indexOf(","),i=0,a=!1;for(;!a;){n===-1&&(n=r.length,a=!0);const l=r.slice(i,n).trim();(l||!a)&&t.push(l),i=n+1,n=r.indexOf(",",i)}return t}function Js(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const eo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,to=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ro={};function ii(e,t){return(ro.jsx?to:eo).test(e)}const no=/[ \t\n\f\r]/g;function io(e){return typeof e=="object"?e.type==="text"?ai(e.value):!1:ai(e)}function ai(e){return e.replace(no,"")===""}class Sr{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Sr.prototype.normal={};Sr.prototype.property={};Sr.prototype.space=void 0;function qa(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Sr(r,n,t)}function yr(e){return e.toLowerCase()}class He{constructor(t,r){this.attribute=r,this.property=t}}He.prototype.attribute="";He.prototype.booleanish=!1;He.prototype.boolean=!1;He.prototype.commaOrSpaceSeparated=!1;He.prototype.commaSeparated=!1;He.prototype.defined=!1;He.prototype.mustUseProperty=!1;He.prototype.number=!1;He.prototype.overloadedBoolean=!1;He.prototype.property="";He.prototype.spaceSeparated=!1;He.prototype.space=void 0;let ao=0;const te=qt(),Ae=qt(),Kn=qt(),R=qt(),pe=qt(),Kt=qt(),Ue=qt();function qt(){return 2**++ao}const Zn=Object.freeze(Object.defineProperty({__proto__:null,boolean:te,booleanish:Ae,commaOrSpaceSeparated:Ue,commaSeparated:Kt,number:R,overloadedBoolean:Kn,spaceSeparated:pe},Symbol.toStringTag,{value:"Module"})),vn=Object.keys(Zn);class v0 extends He{constructor(t,r,n,i){let a=-1;if(super(t,r),li(this,"space",i),typeof n=="number")for(;++a4&&r.slice(0,4)==="data"&&co.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(si,mo);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!si.test(a)){let l=a.replace(uo,ho);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=v0}return new i(n,t)}function ho(e){return"-"+e.toLowerCase()}function mo(e){return e.charAt(1).toUpperCase()}const Wa=qa([Ha,lo,$a,Ua,_a],"html"),tn=qa([Ha,so,$a,Ua,_a],"svg");function oi(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function fo(e){return e.join(" ").trim()}var Gt={},yn,ui;function po(){if(ui)return yn;ui=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,s=/^\s+|\s+$/g,o=` `,u="/",h="*",m="",d="comment",p="declaration";function y(M,S){if(typeof M!="string")throw new TypeError("First argument must be a string");if(!M)return[];S=S||{};var z=1,I=1;function V(Y){var q=Y.match(t);q&&(z+=q.length);var ae=Y.lastIndexOf(o);I=~ae?Y.length-ae:I+Y.length}function O(){var Y={line:z,column:I};return function(q){return q.position=new E(Y),U(),q}}function E(Y){this.start=Y,this.end={line:z,column:I},this.source=S.source}E.prototype.content=M;function G(Y){var q=new Error(S.source+":"+z+":"+I+": "+Y);if(q.reason=Y,q.filename=S.source,q.line=z,q.column=I,q.source=M,!S.silent)throw q}function K(Y){var q=Y.exec(M);if(q){var ae=q[0];return V(ae),M=M.slice(ae.length),q}}function U(){K(r)}function D(Y){var q;for(Y=Y||[];q=$();)q!==!1&&Y.push(q);return Y}function $(){var Y=O();if(!(u!=M.charAt(0)||h!=M.charAt(1))){for(var q=2;m!=M.charAt(q)&&(h!=M.charAt(q)||u!=M.charAt(q+1));)++q;if(q+=2,m===M.charAt(q-1))return G("End of comment missing");var ae=M.slice(2,q-2);return I+=2,V(ae),M=M.slice(q),I+=2,Y({type:d,comment:ae})}}function j(){var Y=O(),q=K(n);if(q){if($(),!K(i))return G("property missing ':'");var ae=K(a),fe=Y({type:p,property:w(q[0].replace(e,m)),value:ae?w(ae[0].replace(e,m)):m});return K(l),fe}}function ie(){var Y=[];D(Y);for(var q;q=j();)q!==!1&&(Y.push(q),D(Y));return Y}return U(),ie()}function w(M){return M?M.replace(s,m):m}return yn=y,yn}var ci;function go(){if(ci)return Gt;ci=1;var e=Gt&&Gt.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.default=r;const t=e(po());function r(n,i){let a=null;if(!n||typeof n!="string")return a;const l=(0,t.default)(n),s=typeof i=="function";return l.forEach(o=>{if(o.type!=="declaration")return;const{property:u,value:h}=o;s?i(u,h,o):h&&(a=a||{},a[u]=h)}),a}return Gt}var ur={},hi;function vo(){if(hi)return ur;hi=1,Object.defineProperty(ur,"__esModule",{value:!0}),ur.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||r.test(u)||e.test(u)},l=function(u,h){return h.toUpperCase()},s=function(u,h){return"".concat(h,"-")},o=function(u,h){return h===void 0&&(h={}),a(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,s):u=u.replace(n,s),u.replace(t,l))};return ur.camelCase=o,ur}var cr,mi;function yo(){if(mi)return cr;mi=1;var e=cr&&cr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(go()),r=vo();function n(i,a){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(s,o){s&&o&&(l[(0,r.camelCase)(s,a)]=o)}),l}return n.default=n,cr=n,cr}var bo=yo();const xo=Oa(bo),Ya=Xa("end"),y0=Xa("start");function Xa(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function wo(e){const t=y0(e),r=Ya(e);if(t&&r)return{start:t,end:r}}function pr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?fi(e.position):"start"in e||"end"in e?fi(e):"line"in e||"column"in e?Qn(e):""}function Qn(e){return pi(e&&e.line)+":"+pi(e&&e.column)}function fi(e){return Qn(e&&e.start)+"-"+Qn(e&&e.end)}function pi(e){return e&&typeof e=="number"?e:1}class Ee extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},l=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof t=="string"?i=t:!a.cause&&t&&(l=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof n=="string"){const o=n.indexOf(":");o===-1?a.ruleId=n:(a.source=n.slice(0,o),a.ruleId=n.slice(o+1))}if(!a.place&&a.ancestors&&a.ancestors){const o=a.ancestors[a.ancestors.length-1];o&&(a.place=o.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=pr(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ee.prototype.file="";Ee.prototype.name="";Ee.prototype.reason="";Ee.prototype.message="";Ee.prototype.stack="";Ee.prototype.column=void 0;Ee.prototype.line=void 0;Ee.prototype.ancestors=void 0;Ee.prototype.cause=void 0;Ee.prototype.fatal=void 0;Ee.prototype.place=void 0;Ee.prototype.ruleId=void 0;Ee.prototype.source=void 0;const b0={}.hasOwnProperty,ko=new Map,So=/[A-Z]/g,Ao=new Set(["table","tbody","thead","tfoot","tr"]),To=new Set(["td","th"]),Ka="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zo(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=Fo(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=No(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?tn:Wa,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Za(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Za(e,t,r){if(t.type==="element")return Mo(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Co(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Do(e,t,r);if(t.type==="mdxjsEsm")return Eo(e,t);if(t.type==="root")return Io(e,t,r);if(t.type==="text")return Bo(e,t)}function Mo(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=tn,e.schema=i),e.ancestors.push(t);const a=Ja(e,t.tagName,!1),l=Lo(e,t);let s=w0(e,t);return Ao.has(t.tagName)&&(s=s.filter(function(o){return typeof o=="string"?!io(o):!0})),Qa(e,l,a,t),x0(l,s),e.ancestors.pop(),e.schema=n,e.create(t,a,l,r)}function Co(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}br(e,t.position)}function Eo(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);br(e,t.position)}function Do(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=tn,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:Ja(e,t.name,!0),l=Ro(e,t),s=w0(e,t);return Qa(e,l,a,t),x0(l,s),e.ancestors.pop(),e.schema=n,e.create(t,a,l,r)}function Io(e,t,r){const n={};return x0(n,w0(e,t)),e.create(t,e.Fragment,n,r)}function Bo(e,t){return t.value}function Qa(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function x0(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function No(e,t,r){return n;function n(i,a,l,s){const u=Array.isArray(l.children)?r:t;return s?u(a,l,s):u(a,l)}}function Fo(e,t){return r;function r(n,i,a,l){const s=Array.isArray(a.children),o=y0(n);return t(i,a,l,s,{columnNumber:o?o.column-1:void 0,fileName:e,lineNumber:o?o.line:void 0},void 0)}}function Lo(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&b0.call(t.properties,i)){const a=Po(e,i,t.properties[i]);if(a){const[l,s]=a;e.tableCellAlignToStyle&&l==="align"&&typeof s=="string"&&To.has(t.tagName)?n=s:r[l]=s}}if(n){const a=r.style||(r.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function Ro(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const a=n.data.estree.body[0];a.type;const l=a.expression;l.type;const s=l.properties[0];s.type,Object.assign(r,e.evaluater.evaluateExpression(s.argument))}else br(e,t.position);else{const i=n.name;let a;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const s=n.value.data.estree.body[0];s.type,a=e.evaluater.evaluateExpression(s.expression)}else br(e,t.position);else a=n.value===null?!0:n.value;r[i]=a}return r}function w0(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:ko;for(;++ni?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)l=Array.from(n),l.unshift(t,r),e.splice(...l);else for(r&&e.splice(t,r);a0?(Ge(e,e.length,0,t),e):t}const vi={}.hasOwnProperty;function tl(e){const t={};let r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function it(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ne=It(/[A-Za-z]/),Ce=It(/[\dA-Za-z]/),Go=It(/[#-'*+\--9=?A-Z^-~]/);function Gr(e){return e!==null&&(e<32||e===127)}const Jn=It(/\d/),Wo=It(/[\dA-Fa-f]/),Yo=It(/[!-/:-@[-`{-~]/);function X(e){return e!==null&&e<-2}function he(e){return e!==null&&(e<0||e===32)}function le(e){return e===-2||e===-1||e===32}const rn=It(new RegExp("\\p{P}|\\p{S}","u")),Ot=It(/\s/);function It(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function tr(e){const t=[];let r=-1,n=0,i=0;for(;++r55295&&a<57344){const s=e.charCodeAt(r+1);a<56320&&s>56319&&s<57344?(l=String.fromCharCode(a,s),i=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(n,r),encodeURIComponent(l)),n=r+i+1,l=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function ne(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(o){return le(o)?(e.enter(r),s(o)):t(o)}function s(o){return le(o)&&a++l))return;const G=t.events.length;let K=G,U,D;for(;K--;)if(t.events[K][0]==="exit"&&t.events[K][1].type==="chunkFlow"){if(U){D=t.events[K][1].end;break}U=!0}for(S(n),E=G;EI;){const O=r[V];t.containerState=O[1],O[0].exit.call(t,e)}r.length=I}function z(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Jo(e,t,r){return ne(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qt(e){if(e===null||he(e)||Ot(e))return 1;if(rn(e))return 2}function nn(e,t,r){const n=[];let i=-1;for(;++i1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const m={...e[n][1].end},d={...e[r][1].start};bi(m,-o),bi(d,o),l={type:o>1?"strongSequence":"emphasisSequence",start:m,end:{...e[n][1].end}},s={type:o>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:d},a={type:o>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:o>1?"strong":"emphasis",start:{...l.start},end:{...s.end}},e[n][1].end={...l.start},e[r][1].start={...s.end},u=[],e[n][1].end.offset-e[n][1].start.offset&&(u=Ke(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=Ke(u,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",a,t]]),u=Ke(u,nn(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),u=Ke(u,[["exit",a,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,u=Ke(u,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,Ge(e,n-1,r-n+3,u),r=n+u.length-h-2;break}}for(r=-1;++r0&&le(E)?ne(e,z,"linePrefix",a+1)(E):z(E)}function z(E){return E===null||X(E)?e.check(xi,w,V)(E):(e.enter("codeFlowValue"),I(E))}function I(E){return E===null||X(E)?(e.exit("codeFlowValue"),z(E)):(e.consume(E),I)}function V(E){return e.exit("codeFenced"),t(E)}function O(E,G,K){let U=0;return D;function D(q){return E.enter("lineEnding"),E.consume(q),E.exit("lineEnding"),$}function $(q){return E.enter("codeFencedFence"),le(q)?ne(E,j,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):j(q)}function j(q){return q===s?(E.enter("codeFencedFenceSequence"),ie(q)):K(q)}function ie(q){return q===s?(U++,E.consume(q),ie):U>=l?(E.exit("codeFencedFenceSequence"),le(q)?ne(E,Y,"whitespace")(q):Y(q)):K(q)}function Y(q){return q===null||X(q)?(E.exit("codeFencedFence"),G(q)):K(q)}}}function hu(e,t,r){const n=this;return i;function i(l){return l===null?r(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return n.parser.lazy[n.now().line]?r(l):t(l)}}const xn={name:"codeIndented",tokenize:fu},mu={partial:!0,tokenize:pu};function fu(e,t,r){const n=this;return i;function i(u){return e.enter("codeIndented"),ne(e,a,"linePrefix",5)(u)}function a(u){const h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(u):r(u)}function l(u){return u===null?o(u):X(u)?e.attempt(mu,l,o)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||X(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),s)}function o(u){return e.exit("codeIndented"),t(u)}}function pu(e,t,r){const n=this;return i;function i(l){return n.parser.lazy[n.now().line]?r(l):X(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):ne(e,a,"linePrefix",5)(l)}function a(l){const s=n.events[n.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(l):X(l)?i(l):r(l)}}const du={name:"codeText",previous:vu,resolve:gu,tokenize:yu};function gu(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&hr(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),hr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),hr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(l):e.interrupt(n.parser.constructs.flow,r,t)(l)}}function sl(e,t,r,n,i,a,l,s,o){const u=o||Number.POSITIVE_INFINITY;let h=0;return m;function m(S){return S===60?(e.enter(n),e.enter(i),e.enter(a),e.consume(S),e.exit(a),d):S===null||S===32||S===41||Gr(S)?r(S):(e.enter(n),e.enter(l),e.enter(s),e.enter("chunkString",{contentType:"string"}),w(S))}function d(S){return S===62?(e.enter(a),e.consume(S),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===62?(e.exit("chunkString"),e.exit(s),d(S)):S===null||S===60||X(S)?r(S):(e.consume(S),S===92?y:p)}function y(S){return S===60||S===62||S===92?(e.consume(S),p):p(S)}function w(S){return!h&&(S===null||S===41||he(S))?(e.exit("chunkString"),e.exit(s),e.exit(l),e.exit(n),t(S)):h999||p===null||p===91||p===93&&!o||p===94&&!s&&"_hiddenFootnoteSupport"in l.parser.constructs?r(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(n),t):X(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||X(p)||s++>999?(e.exit("chunkString"),h(p)):(e.consume(p),o||(o=!le(p)),p===92?d:m)}function d(p){return p===91||p===92||p===93?(e.consume(p),s++,m):m(p)}}function ul(e,t,r,n,i,a){let l;return s;function s(d){return d===34||d===39||d===40?(e.enter(n),e.enter(i),e.consume(d),e.exit(i),l=d===40?41:d,o):r(d)}function o(d){return d===l?(e.enter(i),e.consume(d),e.exit(i),e.exit(n),t):(e.enter(a),u(d))}function u(d){return d===l?(e.exit(a),o(l)):d===null?r(d):X(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===l||d===null||X(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?m:h)}function m(d){return d===l||d===92?(e.consume(d),h):h(d)}}function dr(e,t){let r;return n;function n(i){return X(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):le(i)?ne(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const zu={name:"definition",tokenize:Cu},Mu={partial:!0,tokenize:Eu};function Cu(e,t,r){const n=this;let i;return a;function a(p){return e.enter("definition"),l(p)}function l(p){return ol.call(n,e,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=it(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),o):r(p)}function o(p){return he(p)?dr(e,u)(p):u(p)}function u(p){return sl(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(Mu,m,m)(p)}function m(p){return le(p)?ne(e,d,"whitespace")(p):d(p)}function d(p){return p===null||X(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function Eu(e,t,r){return n;function n(s){return he(s)?dr(e,i)(s):r(s)}function i(s){return ul(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return le(s)?ne(e,l,"whitespace")(s):l(s)}function l(s){return s===null||X(s)?t(s):r(s)}}const Du={name:"hardBreakEscape",tokenize:Iu};function Iu(e,t,r){return n;function n(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return X(a)?(e.exit("hardBreakEscape"),t(a)):r(a)}}const Bu={name:"headingAtx",resolve:Nu,tokenize:Fu};function Nu(e,t){let r=e.length-2,n=3,i,a;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},a={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Ge(e,n,r-n+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Fu(e,t,r){let n=0;return i;function i(h){return e.enter("atxHeading"),a(h)}function a(h){return e.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&n++<6?(e.consume(h),l):h===null||he(h)?(e.exit("atxHeadingSequence"),s(h)):r(h)}function s(h){return h===35?(e.enter("atxHeadingSequence"),o(h)):h===null||X(h)?(e.exit("atxHeading"),t(h)):le(h)?ne(e,s,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function o(h){return h===35?(e.consume(h),o):(e.exit("atxHeadingSequence"),s(h))}function u(h){return h===null||h===35||he(h)?(e.exit("atxHeadingText"),s(h)):(e.consume(h),u)}}const Lu=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ki=["pre","script","style","textarea"],Ru={concrete:!0,name:"htmlFlow",resolveTo:qu,tokenize:Hu},Pu={partial:!0,tokenize:ju},Ou={partial:!0,tokenize:Vu};function qu(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Hu(e,t,r){const n=this;let i,a,l,s,o;return u;function u(A){return h(A)}function h(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),m}function m(A){return A===33?(e.consume(A),d):A===47?(e.consume(A),a=!0,w):A===63?(e.consume(A),i=3,n.interrupt?t:k):Ne(A)?(e.consume(A),l=String.fromCharCode(A),M):r(A)}function d(A){return A===45?(e.consume(A),i=2,p):A===91?(e.consume(A),i=5,s=0,y):Ne(A)?(e.consume(A),i=4,n.interrupt?t:k):r(A)}function p(A){return A===45?(e.consume(A),n.interrupt?t:k):r(A)}function y(A){const De="CDATA[";return A===De.charCodeAt(s++)?(e.consume(A),s===De.length?n.interrupt?t:j:y):r(A)}function w(A){return Ne(A)?(e.consume(A),l=String.fromCharCode(A),M):r(A)}function M(A){if(A===null||A===47||A===62||he(A)){const De=A===47,Re=l.toLowerCase();return!De&&!a&&ki.includes(Re)?(i=1,n.interrupt?t(A):j(A)):Lu.includes(l.toLowerCase())?(i=6,De?(e.consume(A),S):n.interrupt?t(A):j(A)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(A):a?z(A):I(A))}return A===45||Ce(A)?(e.consume(A),l+=String.fromCharCode(A),M):r(A)}function S(A){return A===62?(e.consume(A),n.interrupt?t:j):r(A)}function z(A){return le(A)?(e.consume(A),z):D(A)}function I(A){return A===47?(e.consume(A),D):A===58||A===95||Ne(A)?(e.consume(A),V):le(A)?(e.consume(A),I):D(A)}function V(A){return A===45||A===46||A===58||A===95||Ce(A)?(e.consume(A),V):O(A)}function O(A){return A===61?(e.consume(A),E):le(A)?(e.consume(A),O):I(A)}function E(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),o=A,G):le(A)?(e.consume(A),E):K(A)}function G(A){return A===o?(e.consume(A),o=null,U):A===null||X(A)?r(A):(e.consume(A),G)}function K(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||he(A)?O(A):(e.consume(A),K)}function U(A){return A===47||A===62||le(A)?I(A):r(A)}function D(A){return A===62?(e.consume(A),$):r(A)}function $(A){return A===null||X(A)?j(A):le(A)?(e.consume(A),$):r(A)}function j(A){return A===45&&i===2?(e.consume(A),ae):A===60&&i===1?(e.consume(A),fe):A===62&&i===4?(e.consume(A),ke):A===63&&i===3?(e.consume(A),k):A===93&&i===5?(e.consume(A),je):X(A)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Pu,be,ie)(A)):A===null||X(A)?(e.exit("htmlFlowData"),ie(A)):(e.consume(A),j)}function ie(A){return e.check(Ou,Y,be)(A)}function Y(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),q}function q(A){return A===null||X(A)?ie(A):(e.enter("htmlFlowData"),j(A))}function ae(A){return A===45?(e.consume(A),k):j(A)}function fe(A){return A===47?(e.consume(A),l="",Me):j(A)}function Me(A){if(A===62){const De=l.toLowerCase();return ki.includes(De)?(e.consume(A),ke):j(A)}return Ne(A)&&l.length<8?(e.consume(A),l+=String.fromCharCode(A),Me):j(A)}function je(A){return A===93?(e.consume(A),k):j(A)}function k(A){return A===62?(e.consume(A),ke):A===45&&i===2?(e.consume(A),k):j(A)}function ke(A){return A===null||X(A)?(e.exit("htmlFlowData"),be(A)):(e.consume(A),ke)}function be(A){return e.exit("htmlFlow"),t(A)}}function Vu(e,t,r){const n=this;return i;function i(l){return X(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):r(l)}function a(l){return n.parser.lazy[n.now().line]?r(l):t(l)}}function ju(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ar,t,r)}}const $u={name:"htmlText",tokenize:Uu};function Uu(e,t,r){const n=this;let i,a,l;return s;function s(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),o}function o(k){return k===33?(e.consume(k),u):k===47?(e.consume(k),O):k===63?(e.consume(k),I):Ne(k)?(e.consume(k),K):r(k)}function u(k){return k===45?(e.consume(k),h):k===91?(e.consume(k),a=0,y):Ne(k)?(e.consume(k),z):r(k)}function h(k){return k===45?(e.consume(k),p):r(k)}function m(k){return k===null?r(k):k===45?(e.consume(k),d):X(k)?(l=m,fe(k)):(e.consume(k),m)}function d(k){return k===45?(e.consume(k),p):m(k)}function p(k){return k===62?ae(k):k===45?d(k):m(k)}function y(k){const ke="CDATA[";return k===ke.charCodeAt(a++)?(e.consume(k),a===ke.length?w:y):r(k)}function w(k){return k===null?r(k):k===93?(e.consume(k),M):X(k)?(l=w,fe(k)):(e.consume(k),w)}function M(k){return k===93?(e.consume(k),S):w(k)}function S(k){return k===62?ae(k):k===93?(e.consume(k),S):w(k)}function z(k){return k===null||k===62?ae(k):X(k)?(l=z,fe(k)):(e.consume(k),z)}function I(k){return k===null?r(k):k===63?(e.consume(k),V):X(k)?(l=I,fe(k)):(e.consume(k),I)}function V(k){return k===62?ae(k):I(k)}function O(k){return Ne(k)?(e.consume(k),E):r(k)}function E(k){return k===45||Ce(k)?(e.consume(k),E):G(k)}function G(k){return X(k)?(l=G,fe(k)):le(k)?(e.consume(k),G):ae(k)}function K(k){return k===45||Ce(k)?(e.consume(k),K):k===47||k===62||he(k)?U(k):r(k)}function U(k){return k===47?(e.consume(k),ae):k===58||k===95||Ne(k)?(e.consume(k),D):X(k)?(l=U,fe(k)):le(k)?(e.consume(k),U):ae(k)}function D(k){return k===45||k===46||k===58||k===95||Ce(k)?(e.consume(k),D):$(k)}function $(k){return k===61?(e.consume(k),j):X(k)?(l=$,fe(k)):le(k)?(e.consume(k),$):U(k)}function j(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),i=k,ie):X(k)?(l=j,fe(k)):le(k)?(e.consume(k),j):(e.consume(k),Y)}function ie(k){return k===i?(e.consume(k),i=void 0,q):k===null?r(k):X(k)?(l=ie,fe(k)):(e.consume(k),ie)}function Y(k){return k===null||k===34||k===39||k===60||k===61||k===96?r(k):k===47||k===62||he(k)?U(k):(e.consume(k),Y)}function q(k){return k===47||k===62||he(k)?U(k):r(k)}function ae(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):r(k)}function fe(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),Me}function Me(k){return le(k)?ne(e,je,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):je(k)}function je(k){return e.enter("htmlTextData"),l(k)}}const A0={name:"labelEnd",resolveAll:Yu,resolveTo:Xu,tokenize:Ku},_u={tokenize:Zu},Gu={tokenize:Qu},Wu={tokenize:Ju};function Yu(e){let t=-1;const r=[];for(;++t=3&&(u===null||X(u))?(e.exit("thematicBreak"),t(u)):r(u)}function o(u){return u===i?(e.consume(u),n++,o):(e.exit("thematicBreakSequence"),le(u)?ne(e,s,"whitespace")(u):s(u))}}const Pe={continuation:{tokenize:u1},exit:h1,name:"list",tokenize:o1},l1={partial:!0,tokenize:m1},s1={partial:!0,tokenize:c1};function o1(e,t,r){const n=this,i=n.events[n.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return s;function s(p){const y=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Jn(p)){if(n.containerState.type||(n.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check($r,r,u)(p):u(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),o(p)}return r(p)}function o(p){return Jn(p)&&++l<10?(e.consume(p),o):(!n.interrupt||l<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):r(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(Ar,n.interrupt?r:h,e.attempt(l1,d,m))}function h(p){return n.containerState.initialBlankLine=!0,a++,d(p)}function m(p){return le(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),d):r(p)}function d(p){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function u1(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(Ar,i,a);function i(s){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ne(e,t,"listItemIndent",n.containerState.size+1)(s)}function a(s){return n.containerState.furtherBlankLines||!le(s)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,l(s)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(s1,t,l)(s))}function l(s){return n.containerState._closeFlow=!0,n.interrupt=void 0,ne(e,e.attempt(Pe,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function c1(e,t,r){const n=this;return ne(e,i,"listItemIndent",n.containerState.size+1);function i(a){const l=n.events[n.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===n.containerState.size?t(a):r(a)}}function h1(e){e.exit(this.containerState.type)}function m1(e,t,r){const n=this;return ne(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const l=n.events[n.events.length-1];return!le(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):r(a)}}const Si={name:"setextUnderline",resolveTo:f1,tokenize:p1};function f1(e,t){let r=e.length,n,i,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);const l={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",l,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end={...e[a][1].end}):e[n][1]=l,e.push(["exit",l,t]),e}function p1(e,t,r){const n=this;let i;return a;function a(u){let h=n.events.length,m;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){m=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||m)?(e.enter("setextHeadingLine"),i=u,l(u)):r(u)}function l(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),le(u)?ne(e,o,"lineSuffix")(u):o(u))}function o(u){return u===null||X(u)?(e.exit("setextHeadingLine"),t(u)):r(u)}}const d1={tokenize:g1};function g1(e){const t=this,r=e.attempt(Ar,n,e.attempt(this.parser.constructs.flowInitial,i,ne(e,e.attempt(this.parser.constructs.flow,i,e.attempt(wu,i)),"linePrefix")));return r;function n(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const v1={resolveAll:hl()},y1=cl("string"),b1=cl("text");function cl(e){return{resolveAll:hl(e==="text"?x1:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],a=r.attempt(i,l,s);return l;function l(h){return u(h)?a(h):s(h)}function s(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),o}function o(h){return u(h)?(r.exit("data"),a(h)):(r.consume(h),o)}function u(h){if(h===null)return!0;const m=i[h];let d=-1;if(m)for(;++d-1){const s=l[0];typeof s=="string"?l[0]=s.slice(n):l.shift()}a>0&&l.push(e[i].slice(0,a))}return l}function N1(e,t){let r=-1;const n=[];let i;for(;++r0){const rt=ee.tokenStack[ee.tokenStack.length-1];(rt[1]||Ti).call(ee,void 0,rt[0])}for(H.position={start:At(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:At(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce=0;)c=dn(e,t,n,r,u+1,i+1,s),c>f&&(u===o?c*=jn:ts.test(e.charAt(u-1))?(c*=Ji,p=e.slice(o,u-1).match(ns),p&&o>0&&(c*=Math.pow(Zt,p.length))):rs.test(e.charAt(u-1))?(c*=Zi,h=e.slice(o,u-1).match(Nr),h&&o>0&&(c*=Math.pow(Zt,h.length))):(c*=Xi,o>0&&(c*=Math.pow(Zt,u-o))),e.charAt(u)!==t.charAt(i)&&(c*=Qi)),(cc&&(c=d*Kt)),c>f&&(f=c),u=n.indexOf(l,u+1);return s[a]=f,f}function Bn(e){return e.toLowerCase().replace(Nr," ")}function os(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,dn(e,t,Bn(e),Bn(t),0,0,{})}var is=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Be=is.reduce((e,t)=>{const n=fi(`Primitive.${t}`),r=b.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),yi.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),at='[cmdk-group=""]',Jt='[cmdk-group-items=""]',ss='[cmdk-group-heading=""]',Dr='[cmdk-item=""]',Ln=`${Dr}:not([aria-disabled="true"])`,pn="cmdk-item-select",Ve="data-value",as=(e,t,n)=>os(e,t,n),Ir=b.createContext(void 0),bt=()=>b.useContext(Ir),Wr=b.createContext(void 0),On=()=>b.useContext(Wr),Rr=b.createContext(void 0),Ar=b.forwardRef((e,t)=>{let n=Ke(()=>{var k,R;return{search:"",value:(R=(k=e.value)!=null?k:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ke(()=>new Set),o=Ke(()=>new Map),i=Ke(()=>new Map),s=Ke(()=>new Set),a=_r(e),{label:l,children:u,value:f,onValueChange:c,filter:d,shouldFilter:p,loop:h,disablePointerSelection:v=!1,vimBindings:S=!0,...y}=e,m=Ze(),E=Ze(),M=Ze(),C=b.useRef(null),O=gs();ze(()=>{if(f!==void 0){let k=f.trim();n.current.value=k,D.emit()}},[f]),ze(()=>{O(6,fe)},[]);let D=b.useMemo(()=>({subscribe:k=>(s.current.add(k),()=>s.current.delete(k)),snapshot:()=>n.current,setState:(k,R,B)=>{var W,U,V,ne;if(!Object.is(n.current[k],R)){if(n.current[k]=R,k==="search")ue(),$(),O(1,oe);else if(k==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Q=document.getElementById(M);Q?Q.focus():(W=document.getElementById(m))==null||W.focus()}if(O(7,()=>{var Q;n.current.selectedItemId=(Q=X())==null?void 0:Q.id,D.emit()}),B||O(5,fe),((U=a.current)==null?void 0:U.value)!==void 0){let Q=R??"";(ne=(V=a.current).onValueChange)==null||ne.call(V,Q);return}}D.emit()}},emit:()=>{s.current.forEach(k=>k())}}),[]),j=b.useMemo(()=>({value:(k,R,B)=>{var W;R!==((W=i.current.get(k))==null?void 0:W.value)&&(i.current.set(k,{value:R,keywords:B}),n.current.filtered.items.set(k,Z(R,B)),O(2,()=>{$(),D.emit()}))},item:(k,R)=>(r.current.add(k),R&&(o.current.has(R)?o.current.get(R).add(k):o.current.set(R,new Set([k]))),O(3,()=>{ue(),$(),n.current.value||oe(),D.emit()}),()=>{i.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let B=X();O(4,()=>{ue(),B?.getAttribute("id")===k&&oe(),D.emit()})}),group:k=>(o.current.has(k)||o.current.set(k,new Set),()=>{i.current.delete(k),o.current.delete(k)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:m,inputId:M,labelId:E,listInnerRef:C}),[]);function Z(k,R){var B,W;let U=(W=(B=a.current)==null?void 0:B.filter)!=null?W:as;return k?U(k,n.current.search,R):0}function $(){if(!n.current.search||a.current.shouldFilter===!1)return;let k=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(W=>{let U=o.current.get(W),V=0;U.forEach(ne=>{let Q=k.get(ne);V=Math.max(Q,V)}),R.push([W,V])});let B=C.current;de().sort((W,U)=>{var V,ne;let Q=W.getAttribute("id"),xe=U.getAttribute("id");return((V=k.get(xe))!=null?V:0)-((ne=k.get(Q))!=null?ne:0)}).forEach(W=>{let U=W.closest(Jt);U?U.appendChild(W.parentElement===U?W:W.closest(`${Jt} > *`)):B.appendChild(W.parentElement===B?W:W.closest(`${Jt} > *`))}),R.sort((W,U)=>U[1]-W[1]).forEach(W=>{var U;let V=(U=C.current)==null?void 0:U.querySelector(`${at}[${Ve}="${encodeURIComponent(W[0])}"]`);V?.parentElement.appendChild(V)})}function oe(){let k=de().find(B=>B.getAttribute("aria-disabled")!=="true"),R=k?.getAttribute(Ve);D.setState("value",R||void 0)}function ue(){var k,R,B,W;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let U=0;for(let V of r.current){let ne=(R=(k=i.current.get(V))==null?void 0:k.value)!=null?R:"",Q=(W=(B=i.current.get(V))==null?void 0:B.keywords)!=null?W:[],xe=Z(ne,Q);n.current.filtered.items.set(V,xe),xe>0&&U++}for(let[V,ne]of o.current)for(let Q of ne)if(n.current.filtered.items.get(Q)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=U}function fe(){var k,R,B;let W=X();W&&(((k=W.parentElement)==null?void 0:k.firstChild)===W&&((B=(R=W.closest(at))==null?void 0:R.querySelector(ss))==null||B.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function X(){var k;return(k=C.current)==null?void 0:k.querySelector(`${Dr}[aria-selected="true"]`)}function de(){var k;return Array.from(((k=C.current)==null?void 0:k.querySelectorAll(Ln))||[])}function Ae(k){let R=de()[k];R&&D.setState("value",R.getAttribute(Ve))}function Le(k){var R;let B=X(),W=de(),U=W.findIndex(ne=>ne===B),V=W[U+k];(R=a.current)!=null&&R.loop&&(V=U+k<0?W[W.length-1]:U+k===W.length?W[0]:W[U+k]),V&&D.setState("value",V.getAttribute(Ve))}function qe(k){let R=X(),B=R?.closest(at),W;for(;B&&!W;)B=k>0?ys(B,at):vs(B,at),W=B?.querySelector(Ln);W?D.setState("value",W.getAttribute(Ve)):Le(k)}let ie=()=>Ae(de().length-1),se=k=>{k.preventDefault(),k.metaKey?ie():k.altKey?qe(1):Le(1)},pe=k=>{k.preventDefault(),k.metaKey?Ae(0):k.altKey?qe(-1):Le(-1)};return b.createElement(Be.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:k=>{var R;(R=y.onKeyDown)==null||R.call(y,k);let B=k.nativeEvent.isComposing||k.keyCode===229;if(!(k.defaultPrevented||B))switch(k.key){case"n":case"j":{S&&k.ctrlKey&&se(k);break}case"ArrowDown":{se(k);break}case"p":case"k":{S&&k.ctrlKey&&pe(k);break}case"ArrowUp":{pe(k);break}case"Home":{k.preventDefault(),Ae(0);break}case"End":{k.preventDefault(),ie();break}case"Enter":{k.preventDefault();let W=X();if(W){let U=new Event(pn);W.dispatchEvent(U)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:ws},l),jt(e,k=>b.createElement(Wr.Provider,{value:D},b.createElement(Ir.Provider,{value:j},k))))}),ls=b.forwardRef((e,t)=>{var n,r;let o=Ze(),i=b.useRef(null),s=b.useContext(Rr),a=bt(),l=_r(e),u=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:s?.forceMount;ze(()=>{if(!u)return a.item(o,s?.id)},[u]);let f=Fr(o,i,[e.value,e.children,i],e.keywords),c=On(),d=Fe(O=>O.value&&O.value===f.current),p=Fe(O=>u||a.filter()===!1?!0:O.search?O.filtered.items.get(o)>0:!0);b.useEffect(()=>{let O=i.current;if(!(!O||e.disabled))return O.addEventListener(pn,h),()=>O.removeEventListener(pn,h)},[p,e.onSelect,e.disabled]);function h(){var O,D;v(),(D=(O=l.current).onSelect)==null||D.call(O,f.current)}function v(){c.setState("value",f.current,!0)}if(!p)return null;let{disabled:S,value:y,onSelect:m,forceMount:E,keywords:M,...C}=e;return b.createElement(Be.div,{ref:mt(i,t),...C,id:o,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!d,"data-disabled":!!S,"data-selected":!!d,onPointerMove:S||a.getDisablePointerSelection()?void 0:v,onClick:S?void 0:h},e.children)}),cs=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,s=Ze(),a=b.useRef(null),l=b.useRef(null),u=Ze(),f=bt(),c=Fe(p=>o||f.filter()===!1?!0:p.search?p.filtered.groups.has(s):!0);ze(()=>f.group(s),[]),Fr(s,a,[e.value,e.heading,l]);let d=b.useMemo(()=>({id:s,forceMount:o}),[o]);return b.createElement(Be.div,{ref:mt(a,t),...i,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),jt(e,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Rr.Provider,{value:d},p))))}),us=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=b.useRef(null),i=Fe(s=>!s.search);return!n&&!i?null:b.createElement(Be.div,{ref:mt(o,t),...r,"cmdk-separator":"",role:"separator"})}),fs=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=On(),s=Fe(u=>u.search),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(Be.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:o?e.value:s,onChange:u=>{o||i.setState("search",u.target.value),n?.(u.target.value)}})}),ds=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=b.useRef(null),s=b.useRef(null),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{if(s.current&&i.current){let u=s.current,f=i.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let p=u.offsetHeight;f.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(u),()=>{cancelAnimationFrame(c),d.unobserve(u)}}},[]),b.createElement(Be.div,{ref:mt(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},jt(e,u=>b.createElement("div",{ref:mt(s,l.listInnerRef),"cmdk-list-sizer":""},u)))}),ps=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:s,...a}=e;return b.createElement(di,{open:n,onOpenChange:r},b.createElement(pi,{container:s},b.createElement(hi,{"cmdk-overlay":"",className:o}),b.createElement(mi,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(Ar,{ref:t,...a}))))}),hs=b.forwardRef((e,t)=>Fe(n=>n.filtered.count===0)?b.createElement(Be.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ms=b.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return b.createElement(Be.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},jt(e,s=>b.createElement("div",{"aria-hidden":!0},s)))}),nf=Object.assign(Ar,{List:ds,Item:ls,Input:fs,Group:cs,Separator:us,Dialog:ps,Empty:hs,Loading:ms});function ys(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function vs(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function _r(e){let t=b.useRef(e);return ze(()=>{t.current=e}),t}var ze=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Ke(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Fe(e){let t=On(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function Fr(e,t,n,r=[]){let o=b.useRef(),i=bt();return ze(()=>{var s;let a=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),l=r.map(u=>u.trim());i.value(e,a,l),(s=t.current)==null||s.setAttribute(Ve,a),o.current=a}),o}var gs=()=>{let[e,t]=b.useState(),n=Ke(()=>new Map);return ze(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function bs(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function jt({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(bs(t),{ref:t.ref},n(t.props.children)):n(t)}var ws={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function jr(e){return t=>typeof t===e}var Os=jr("function"),Ss=e=>e===null,$n=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Hn=e=>!Es(e)&&!Ss(e)&&(Os(e)||typeof e=="object"),Es=jr("undefined");function ks(e,t){const{length:n}=e;if(n!==t.length)return!1;for(let r=n;r--!==0;)if(!re(e[r],t[r]))return!1;return!0}function Cs(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function Ts(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!re(n[1],t.get(n[0])))return!1;return!0}function Ms(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function re(e,t){if(e===t)return!0;if(e&&Hn(e)&&t&&Hn(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return ks(e,t);if(e instanceof Map&&t instanceof Map)return Ts(e,t);if(e instanceof Set&&t instanceof Set)return Ms(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Cs(e,t);if($n(e)&&$n(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(let o=n.length;o--!==0;){const i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!re(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}var Ps=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],xs=["bigint","boolean","null","number","string","symbol","undefined"];function Bt(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Ns(t))return t}function be(e){return t=>Bt(t)===e}function Ns(e){return Ps.includes(e)}function tt(e){return t=>typeof t===e}function Ds(e){return xs.includes(e)}var Is=["innerHTML","ownerDocument","style","attributes","nodeValue"];function P(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(P.array(e))return"Array";if(P.plainFunction(e))return"Function";const t=Bt(e);return t||"Object"}P.array=Array.isArray;P.arrayOf=(e,t)=>!P.array(e)&&!P.function(t)?!1:e.every(n=>t(n));P.asyncGeneratorFunction=e=>Bt(e)==="AsyncGeneratorFunction";P.asyncFunction=be("AsyncFunction");P.bigint=tt("bigint");P.boolean=e=>e===!0||e===!1;P.date=be("Date");P.defined=e=>!P.undefined(e);P.domElement=e=>P.object(e)&&!P.plainObject(e)&&e.nodeType===1&&P.string(e.nodeName)&&Is.every(t=>t in e);P.empty=e=>P.string(e)&&e.length===0||P.array(e)&&e.length===0||P.object(e)&&!P.map(e)&&!P.set(e)&&Object.keys(e).length===0||P.set(e)&&e.size===0||P.map(e)&&e.size===0;P.error=be("Error");P.function=tt("function");P.generator=e=>P.iterable(e)&&P.function(e.next)&&P.function(e.throw);P.generatorFunction=be("GeneratorFunction");P.instanceOf=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype;P.iterable=e=>!P.nullOrUndefined(e)&&P.function(e[Symbol.iterator]);P.map=be("Map");P.nan=e=>Number.isNaN(e);P.null=e=>e===null;P.nullOrUndefined=e=>P.null(e)||P.undefined(e);P.number=e=>tt("number")(e)&&!P.nan(e);P.numericString=e=>P.string(e)&&e.length>0&&!Number.isNaN(Number(e));P.object=e=>!P.nullOrUndefined(e)&&(P.function(e)||typeof e=="object");P.oneOf=(e,t)=>P.array(e)?e.indexOf(t)>-1:!1;P.plainFunction=be("Function");P.plainObject=e=>{if(Bt(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};P.primitive=e=>P.null(e)||Ds(typeof e);P.promise=be("Promise");P.propertyOf=(e,t,n)=>{if(!P.object(e)||!t)return!1;const r=e[t];return P.function(n)?n(r):P.defined(r)};P.regexp=be("RegExp");P.set=be("Set");P.string=tt("string");P.symbol=tt("symbol");P.undefined=tt("undefined");P.weakMap=be("WeakMap");P.weakSet=be("WeakSet");var x=P;function Ws(...e){return e.every(t=>x.string(t)||x.array(t)||x.plainObject(t))}function Rs(e,t,n){return Br(e,t)?[e,t].every(x.array)?!e.some(Gn(n))&&t.some(Gn(n)):[e,t].every(x.plainObject)?!Object.entries(e).some(qn(n))&&Object.entries(t).some(qn(n)):t===n:!1}function zn(e,t,n){const{actual:r,key:o,previous:i,type:s}=n,a=Ce(e,o),l=Ce(t,o);let u=[a,l].every(x.number)&&(s==="increased"?al);return x.undefined(r)||(u=u&&l===r),x.undefined(i)||(u=u&&a===i),u}function Un(e,t,n){const{key:r,type:o,value:i}=n,s=Ce(e,r),a=Ce(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!x.nullOrUndefined(i)){if(x.defined(l)){if(x.array(l)||x.plainObject(l))return Rs(l,u,i)}else return re(u,i);return!1}return[s,a].every(x.array)?!u.every(Sn(l)):[s,a].every(x.plainObject)?As(Object.keys(l),Object.keys(u)):![s,a].every(f=>x.primitive(f)&&x.defined(f))&&(o==="added"?!x.defined(s)&&x.defined(a):x.defined(s)&&!x.defined(a))}function Yn(e,t,{key:n}={}){let r=Ce(e,n),o=Ce(t,n);if(!Br(r,o))throw new TypeError("Inputs have different types");if(!Ws(r,o))throw new TypeError("Inputs don't have length");return[r,o].every(x.plainObject)&&(r=Object.keys(r),o=Object.keys(o)),[r,o]}function qn(e){return([t,n])=>x.array(e)?re(e,n)||e.some(r=>re(r,n)||x.array(n)&&Sn(n)(r)):x.plainObject(e)&&e[t]?!!e[t]&&re(e[t],n):re(e,n)}function As(e,t){return t.some(n=>!e.includes(n))}function Gn(e){return t=>x.array(e)?e.some(n=>re(n,t)||x.array(t)&&Sn(t)(n)):re(e,t)}function lt(e,t){return x.array(e)?e.some(n=>re(n,t)):re(e,t)}function Sn(e){return t=>e.some(n=>re(n,t))}function Br(...e){return e.every(x.array)||e.every(x.number)||e.every(x.plainObject)||e.every(x.string)}function Ce(e,t){return x.plainObject(e)||x.array(e)?x.string(t)?t.split(".").reduce((r,o)=>r&&r[o],e):x.number(t)?e[t]:e:e}function Rt(e,t){if([e,t].some(x.nullOrUndefined))throw new Error("Missing required parameters");if(![e,t].every(f=>x.plainObject(f)||x.array(f)))throw new Error("Expected plain objects or array");return{added:(f,c)=>{try{return Un(e,t,{key:f,type:"added",value:c})}catch{return!1}},changed:(f,c,d)=>{try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(c),S=x.defined(d);if(v||S){const y=S?lt(d,p):!lt(c,p),m=lt(c,h);return y&&m}return[p,h].every(x.array)||[p,h].every(x.plainObject)?!re(p,h):p!==h}catch{return!1}},changedFrom:(f,c,d)=>{if(!x.defined(f))return!1;try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(d);return lt(c,p)&&(v?lt(d,h):!v)}catch{return!1}},decreased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"decreased"})}catch{return!1}},emptied:f=>{try{const[c,d]=Yn(e,t,{key:f});return!!c.length&&!d.length}catch{return!1}},filled:f=>{try{const[c,d]=Yn(e,t,{key:f});return!c.length&&!!d.length}catch{return!1}},increased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"increased"})}catch{return!1}},removed:(f,c)=>{try{return Un(e,t,{key:f,type:"removed",value:c})}catch{return!1}}}}var Xt,Vn;function _s(){if(Vn)return Xt;Vn=1;var e=new Error("Element already at target scroll position"),t=new Error("Scroll cancelled"),n=Math.min,r=Date.now;Xt={left:o("scrollLeft"),top:o("scrollTop")};function o(a){return function(u,f,c,d){c=c||{},typeof c=="function"&&(d=c,c={}),typeof d!="function"&&(d=s);var p=r(),h=u[a],v=c.ease||i,S=isNaN(c.duration)?350:+c.duration,y=!1;return h===f?d(e,u[a]):requestAnimationFrame(E),m;function m(){y=!0}function E(M){if(y)return d(t,u[a]);var C=r(),O=n(1,(C-p)/S),D=v(O);u[a]=D*(f-h)+h,O<1?requestAnimationFrame(E):requestAnimationFrame(function(){d(null,u[a])})}}}function i(a){return .5*(1-Math.cos(Math.PI*a))}function s(){}return Xt}var Fs=_s();const js=gt(Fs);var It={exports:{}},Bs=It.exports,Kn;function Ls(){return Kn||(Kn=1,(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Bs,function(){function t(r){var o=getComputedStyle(r,null).getPropertyValue("overflow");return o.indexOf("scroll")>-1||o.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var o=r.parentNode;o.parentNode;){if(t(o))return o;o=o.parentNode}return document.scrollingElement||document.documentElement}}return n})})(It)),It.exports}var $s=Ls();const Lr=gt($s);var Qt,Zn;function Hs(){if(Zn)return Qt;Zn=1;var e=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},t=function(r,o){return r+n(o)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(t,""):e(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,Qt=n,Qt}var zs=Hs();const Jn=gt(zs);var en,Xn;function Us(){if(Xn)return en;Xn=1;var e=function(m){return t(m)&&!n(m)};function t(y){return!!y&&typeof y=="object"}function n(y){var m=Object.prototype.toString.call(y);return m==="[object RegExp]"||m==="[object Date]"||i(y)}var r=typeof Symbol=="function"&&Symbol.for,o=r?Symbol.for("react.element"):60103;function i(y){return y.$$typeof===o}function s(y){return Array.isArray(y)?[]:{}}function a(y,m){return m.clone!==!1&&m.isMergeableObject(y)?v(s(y),y,m):y}function l(y,m,E){return y.concat(m).map(function(M){return a(M,E)})}function u(y,m){if(!m.customMerge)return v;var E=m.customMerge(y);return typeof E=="function"?E:v}function f(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(m){return Object.propertyIsEnumerable.call(y,m)}):[]}function c(y){return Object.keys(y).concat(f(y))}function d(y,m){try{return m in y}catch{return!1}}function p(y,m){return d(y,m)&&!(Object.hasOwnProperty.call(y,m)&&Object.propertyIsEnumerable.call(y,m))}function h(y,m,E){var M={};return E.isMergeableObject(y)&&c(y).forEach(function(C){M[C]=a(y[C],E)}),c(m).forEach(function(C){p(y,C)||(d(y,C)&&E.isMergeableObject(m[C])?M[C]=u(C,E)(y[C],m[C],E):M[C]=a(m[C],E))}),M}function v(y,m,E){E=E||{},E.arrayMerge=E.arrayMerge||l,E.isMergeableObject=E.isMergeableObject||e,E.cloneUnlessOtherwiseSpecified=a;var M=Array.isArray(m),C=Array.isArray(y),O=M===C;return O?M?E.arrayMerge(y,m,E):h(y,m,E):a(m,E)}v.all=function(m,E){if(!Array.isArray(m))throw new Error("first argument should be an array");return m.reduce(function(M,C){return v(M,C,E)},{})};var S=v;return en=S,en}var Ys=Us();const ve=gt(Ys);var tn={exports:{}},nn,Qn;function qs(){if(Qn)return nn;Qn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return nn=e,nn}var rn,er;function Gs(){if(er)return rn;er=1;var e=qs();function t(){}function n(){}return n.resetWarningCache=t,rn=function(){function r(s,a,l,u,f,c){if(c!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},rn}var tr;function Vs(){return tr||(tr=1,tn.exports=Gs()()),tn.exports}var Ks=Vs();const T=gt(Ks);var wt=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",Zs=(function(){for(var e=["Edge","Trident","Firefox"],t=0;t=0)return 1;return 0})();function Js(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}function Xs(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},Zs))}}var Qs=wt&&window.Promise,ea=Qs?Js:Xs;function $r(e){var t={};return e&&t.toString.call(e)==="[object Function]"}function Ye(e,t){if(e.nodeType!==1)return[];var n=e.ownerDocument.defaultView,r=n.getComputedStyle(e,null);return t?r[t]:r}function En(e){return e.nodeName==="HTML"?e:e.parentNode||e.host}function Ot(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=Ye(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:Ot(En(e))}function Hr(e){return e&&e.referenceNode?e.referenceNode:e}var nr=wt&&!!(window.MSInputMethodContext&&document.documentMode),rr=wt&&/MSIE 10/.test(navigator.userAgent);function nt(e){return e===11?nr:e===10?rr:nr||rr}function Je(e){if(!e)return document.documentElement;for(var t=nt(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?e?e.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&Ye(n,"position")==="static"?Je(n):n}function ta(e){var t=e.nodeName;return t==="BODY"?!1:t==="HTML"||Je(e.firstElementChild)===e}function hn(e){return e.parentNode!==null?hn(e.parentNode):e}function At(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var s=i.commonAncestorContainer;if(e!==s&&t!==s||r.contains(o))return ta(s)?s:Je(s);var a=hn(e);return a.host?At(a.host,t):At(e,hn(t).host)}function Xe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=t==="top"?"scrollTop":"scrollLeft",r=e.nodeName;if(r==="BODY"||r==="HTML"){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function na(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=Xe(t,"top"),o=Xe(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function or(e,t){var n=t==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(e["border"+n+"Width"])+parseFloat(e["border"+r+"Width"])}function ir(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],nt(10)?parseInt(n["offset"+e])+parseInt(r["margin"+(e==="Height"?"Top":"Left")])+parseInt(r["margin"+(e==="Height"?"Bottom":"Right")]):0)}function zr(e){var t=e.body,n=e.documentElement,r=nt(10)&&getComputedStyle(n);return{height:ir("Height",t,n,r),width:ir("Width",t,n,r)}}var ra=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},oa=(function(){function e(t,n){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=nt(10),o=t.nodeName==="HTML",i=mn(e),s=mn(t),a=Ot(e),l=Ye(t),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(s.top=Math.max(s.top,0),s.left=Math.max(s.left,0));var c=je({top:i.top-s.top-u,left:i.left-s.left-f,width:i.width,height:i.height});if(c.marginTop=0,c.marginLeft=0,!r&&o){var d=parseFloat(l.marginTop),p=parseFloat(l.marginLeft);c.top-=u-d,c.bottom-=u-d,c.left-=f-p,c.right-=f-p,c.marginTop=d,c.marginLeft=p}return(r&&!n?t.contains(a):t===a&&a.nodeName!=="BODY")&&(c=na(c,t)),c}function ia(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.ownerDocument.documentElement,r=kn(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),s=t?0:Xe(n),a=t?0:Xe(n,"left"),l={top:s-r.top+r.marginTop,left:a-r.left+r.marginLeft,width:o,height:i};return je(l)}function Ur(e){var t=e.nodeName;if(t==="BODY"||t==="HTML")return!1;if(Ye(e,"position")==="fixed")return!0;var n=En(e);return n?Ur(n):!1}function Yr(e){if(!e||!e.parentElement||nt())return document.documentElement;for(var t=e.parentElement;t&&Ye(t,"transform")==="none";)t=t.parentElement;return t||document.documentElement}function Cn(e,t,n,r){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},s=o?Yr(e):At(e,Hr(t));if(r==="viewport")i=ia(s,o);else{var a=void 0;r==="scrollParent"?(a=Ot(En(t)),a.nodeName==="BODY"&&(a=e.ownerDocument.documentElement)):r==="window"?a=e.ownerDocument.documentElement:a=r;var l=kn(a,s,o);if(a.nodeName==="HTML"&&!Ur(s)){var u=zr(e.ownerDocument),f=u.height,c=u.width;i.top+=l.top-l.marginTop,i.bottom=f+l.top,i.left+=l.left-l.marginLeft,i.right=c+l.left}else i=l}n=n||0;var d=typeof n=="number";return i.left+=d?n:n.left||0,i.top+=d?n:n.top||0,i.right-=d?n:n.right||0,i.bottom-=d?n:n.bottom||0,i}function sa(e){var t=e.width,n=e.height;return t*n}function qr(e,t,n,r,o){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(e.indexOf("auto")===-1)return e;var s=Cn(n,r,i,o),a={top:{width:s.width,height:t.top-s.top},right:{width:s.right-t.right,height:s.height},bottom:{width:s.width,height:s.bottom-t.bottom},left:{width:t.left-s.left,height:s.height}},l=Object.keys(a).map(function(d){return he({key:d},a[d],{area:sa(a[d])})}).sort(function(d,p){return p.area-d.area}),u=l.filter(function(d){var p=d.width,h=d.height;return p>=n.clientWidth&&h>=n.clientHeight}),f=u.length>0?u[0].key:l[0].key,c=e.split("-")[1];return f+(c?"-"+c:"")}function Gr(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o=r?Yr(t):At(t,Hr(n));return kn(n,o,r)}function Vr(e){var t=e.ownerDocument.defaultView,n=t.getComputedStyle(e),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),o=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:e.offsetWidth+o,height:e.offsetHeight+r};return i}function _t(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(n){return t[n]})}function Kr(e,t,n){n=n.split("-")[0];var r=Vr(e),o={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,s=i?"top":"left",a=i?"left":"top",l=i?"height":"width",u=i?"width":"height";return o[s]=t[s]+t[l]/2-r[l]/2,n===a?o[a]=t[a]-r[u]:o[a]=t[_t(a)],o}function St(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function aa(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(o){return o[t]===n});var r=St(e,function(o){return o[t]===n});return e.indexOf(r)}function Zr(e,t,n){var r=n===void 0?e:e.slice(0,aa(e,"name",n));return r.forEach(function(o){o.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=o.function||o.fn;o.enabled&&$r(i)&&(t.offsets.popper=je(t.offsets.popper),t.offsets.reference=je(t.offsets.reference),t=i(t,o))}),t}function la(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=Gr(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=qr(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=Kr(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=Zr(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function Jr(e,t){return e.some(function(n){var r=n.name,o=n.enabled;return o&&r===t})}function Tn(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),r=0;rs[p]&&(e.offsets.popper[c]+=a[c]+h-s[p]),e.offsets.popper=je(e.offsets.popper);var v=a[c]+a[u]/2-h/2,S=Ye(e.instance.popper),y=parseFloat(S["margin"+f]),m=parseFloat(S["border"+f+"Width"]),E=v-e.offsets.popper[c]-y-m;return E=Math.max(Math.min(s[u]-h,E),0),e.arrowElement=r,e.offsets.arrow=(n={},Qe(n,c,Math.round(E)),Qe(n,d,""),n),e}function Oa(e){return e==="end"?"start":e==="start"?"end":e}var to=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],on=to.slice(3);function sr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=on.indexOf(e),r=on.slice(n+1).concat(on.slice(0,n));return t?r.reverse():r}var sn={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function Sa(e,t){if(Jr(e.instance.modifiers,"inner")||e.flipped&&e.placement===e.originalPlacement)return e;var n=Cn(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),r=e.placement.split("-")[0],o=_t(r),i=e.placement.split("-")[1]||"",s=[];switch(t.behavior){case sn.FLIP:s=[r,o];break;case sn.CLOCKWISE:s=sr(r);break;case sn.COUNTERCLOCKWISE:s=sr(r,!0);break;default:s=t.behavior}return s.forEach(function(a,l){if(r!==a||s.length===l+1)return e;r=e.placement.split("-")[0],o=_t(r);var u=e.offsets.popper,f=e.offsets.reference,c=Math.floor,d=r==="left"&&c(u.right)>c(f.left)||r==="right"&&c(u.left)c(f.top)||r==="bottom"&&c(u.top)c(n.right),v=c(u.top)c(n.bottom),y=r==="left"&&p||r==="right"&&h||r==="top"&&v||r==="bottom"&&S,m=["top","bottom"].indexOf(r)!==-1,E=!!t.flipVariations&&(m&&i==="start"&&p||m&&i==="end"&&h||!m&&i==="start"&&v||!m&&i==="end"&&S),M=!!t.flipVariationsByContent&&(m&&i==="start"&&h||m&&i==="end"&&p||!m&&i==="start"&&S||!m&&i==="end"&&v),C=E||M;(d||y||C)&&(e.flipped=!0,(d||y)&&(r=s[l+1]),C&&(i=Oa(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=he({},e.offsets.popper,Kr(e.instance.popper,e.offsets.reference,e.placement)),e=Zr(e.instance.modifiers,e,"flip"))}),e}function Ea(e){var t=e.offsets,n=t.popper,r=t.reference,o=e.placement.split("-")[0],i=Math.floor,s=["top","bottom"].indexOf(o)!==-1,a=s?"right":"bottom",l=s?"left":"top",u=s?"width":"height";return n[a]i(r[a])&&(e.offsets.popper[l]=i(r[a])),e}function ka(e,t,n,r){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+o[1],s=o[2];if(!i)return e;if(s.indexOf("%")===0){var a=void 0;switch(s){case"%p":a=n;break;case"%":case"%r":default:a=r}var l=je(a);return l[t]/100*i}else if(s==="vh"||s==="vw"){var u=void 0;return s==="vh"?u=Math.max(document.documentElement.clientHeight,window.innerHeight||0):u=Math.max(document.documentElement.clientWidth,window.innerWidth||0),u/100*i}else return i}function Ca(e,t,n,r){var o=[0,0],i=["right","left"].indexOf(r)!==-1,s=e.split(/(\+|\-)/).map(function(f){return f.trim()}),a=s.indexOf(St(s,function(f){return f.search(/,|\s/)!==-1}));s[a]&&s[a].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=a!==-1?[s.slice(0,a).concat([s[a].split(l)[0]]),[s[a].split(l)[1]].concat(s.slice(a+1))]:[s];return u=u.map(function(f,c){var d=(c===1?!i:i)?"height":"width",p=!1;return f.reduce(function(h,v){return h[h.length-1]===""&&["+","-"].indexOf(v)!==-1?(h[h.length-1]=v,p=!0,h):p?(h[h.length-1]+=v,p=!1,h):h.concat(v)},[]).map(function(h){return ka(h,d,t,n)})}),u.forEach(function(f,c){f.forEach(function(d,p){Mn(d)&&(o[c]+=d*(f[p-1]==="-"?-1:1))})}),o}function Ta(e,t){var n=t.offset,r=e.placement,o=e.offsets,i=o.popper,s=o.reference,a=r.split("-")[0],l=void 0;return Mn(+n)?l=[+n,0]:l=Ca(n,i,s,a),a==="left"?(i.top+=l[0],i.left-=l[1]):a==="right"?(i.top+=l[0],i.left+=l[1]):a==="top"?(i.left+=l[0],i.top-=l[1]):a==="bottom"&&(i.left+=l[0],i.top+=l[1]),e.popper=i,e}function Ma(e,t){var n=t.boundariesElement||Je(e.instance.popper);e.instance.reference===n&&(n=Je(n));var r=Tn("transform"),o=e.instance.popper.style,i=o.top,s=o.left,a=o[r];o.top="",o.left="",o[r]="";var l=Cn(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=s,o[r]=a,t.boundaries=l;var u=t.priority,f=e.offsets.popper,c={primary:function(p){var h=f[p];return f[p]l[p]&&!t.escapeWithReference&&(v=Math.min(f[h],l[p]-(p==="right"?f.width:f.height))),Qe({},h,v)}};return u.forEach(function(d){var p=["left","top"].indexOf(d)!==-1?"primary":"secondary";f=he({},f,c[p](d))}),e.offsets.popper=f,e}function Pa(e){var t=e.placement,n=t.split("-")[0],r=t.split("-")[1];if(r){var o=e.offsets,i=o.reference,s=o.popper,a=["bottom","top"].indexOf(n)!==-1,l=a?"left":"top",u=a?"width":"height",f={start:Qe({},l,i[l]),end:Qe({},l,i[l]+i[u]-s[u])};e.offsets.popper=he({},s,f[r])}return e}function xa(e){if(!eo(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=St(e.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.right2&&arguments[2]!==void 0?arguments[2]:{};ra(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=ea(this.update.bind(this)),this.options=he({},e.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t&&t.jquery?t[0]:t,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(he({},e.Defaults.modifiers,o.modifiers)).forEach(function(s){r.options.modifiers[s]=he({},e.Defaults.modifiers[s]||{},o.modifiers?o.modifiers[s]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(s){return he({name:s},r.options.modifiers[s])}).sort(function(s,a){return s.order-a.order}),this.modifiers.forEach(function(s){s.enabled&&$r(s.onLoad)&&s.onLoad(r.reference,r.popper,r.options,s,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return oa(e,[{key:"update",value:function(){return la.call(this)}},{key:"destroy",value:function(){return ca.call(this)}},{key:"enableEventListeners",value:function(){return fa.call(this)}},{key:"disableEventListeners",value:function(){return pa.call(this)}}]),e})();yt.Utils=(typeof window<"u"?window:global).PopperUtils;yt.placements=to;yt.Defaults=Ia;var Wa=["innerHTML","ownerDocument","style","attributes","nodeValue"],Ra=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Aa=["bigint","boolean","null","number","string","symbol","undefined"];function Lt(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(_a(t))return t}function we(e){return function(t){return Lt(t)===e}}function _a(e){return Ra.includes(e)}function rt(e){return function(t){return typeof t===e}}function Fa(e){return Aa.includes(e)}function g(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(g.array(e))return"Array";if(g.plainFunction(e))return"Function";var t=Lt(e);return t||"Object"}g.array=Array.isArray;g.arrayOf=function(e,t){return!g.array(e)&&!g.function(t)?!1:e.every(function(n){return t(n)})};g.asyncGeneratorFunction=function(e){return Lt(e)==="AsyncGeneratorFunction"};g.asyncFunction=we("AsyncFunction");g.bigint=rt("bigint");g.boolean=function(e){return e===!0||e===!1};g.date=we("Date");g.defined=function(e){return!g.undefined(e)};g.domElement=function(e){return g.object(e)&&!g.plainObject(e)&&e.nodeType===1&&g.string(e.nodeName)&&Wa.every(function(t){return t in e})};g.empty=function(e){return g.string(e)&&e.length===0||g.array(e)&&e.length===0||g.object(e)&&!g.map(e)&&!g.set(e)&&Object.keys(e).length===0||g.set(e)&&e.size===0||g.map(e)&&e.size===0};g.error=we("Error");g.function=rt("function");g.generator=function(e){return g.iterable(e)&&g.function(e.next)&&g.function(e.throw)};g.generatorFunction=we("GeneratorFunction");g.instanceOf=function(e,t){return!e||!t?!1:Object.getPrototypeOf(e)===t.prototype};g.iterable=function(e){return!g.nullOrUndefined(e)&&g.function(e[Symbol.iterator])};g.map=we("Map");g.nan=function(e){return Number.isNaN(e)};g.null=function(e){return e===null};g.nullOrUndefined=function(e){return g.null(e)||g.undefined(e)};g.number=function(e){return rt("number")(e)&&!g.nan(e)};g.numericString=function(e){return g.string(e)&&e.length>0&&!Number.isNaN(Number(e))};g.object=function(e){return!g.nullOrUndefined(e)&&(g.function(e)||typeof e=="object")};g.oneOf=function(e,t){return g.array(e)?e.indexOf(t)>-1:!1};g.plainFunction=we("Function");g.plainObject=function(e){if(Lt(e)!=="Object")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};g.primitive=function(e){return g.null(e)||Fa(typeof e)};g.promise=we("Promise");g.propertyOf=function(e,t,n){if(!g.object(e)||!t)return!1;var r=e[t];return g.function(n)?n(r):g.defined(r)};g.regexp=we("RegExp");g.set=we("Set");g.string=rt("string");g.symbol=rt("symbol");g.undefined=rt("undefined");g.weakMap=we("WeakMap");g.weakSet=we("WeakSet");function no(e){return function(t){return typeof t===e}}var ja=no("function"),Ba=function(e){return e===null},ar=function(e){return Object.prototype.toString.call(e).slice(8,-1)==="RegExp"},lr=function(e){return!La(e)&&!Ba(e)&&(ja(e)||typeof e=="object")},La=no("undefined"),vn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function $a(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=n;r--!==0;)if(!ae(e[r],t[r]))return!1;return!0}function Ha(e,t){if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e.buffer),r=new DataView(t.buffer),o=e.byteLength;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function za(e,t){var n,r,o,i;if(e.size!==t.size)return!1;try{for(var s=vn(e.entries()),a=s.next();!a.done;a=s.next()){var l=a.value;if(!t.has(l[0]))return!1}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}try{for(var u=vn(e.entries()),f=u.next();!f.done;f=u.next()){var l=f.value;if(!ae(l[1],t.get(l[0])))return!1}}catch(c){o={error:c}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}return!0}function Ua(e,t){var n,r;if(e.size!==t.size)return!1;try{for(var o=vn(e.entries()),i=o.next();!i.done;i=o.next()){var s=i.value;if(!t.has(s[0]))return!1}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!0}function ae(e,t){if(e===t)return!0;if(e&&lr(e)&&t&&lr(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return $a(e,t);if(e instanceof Map&&t instanceof Map)return za(e,t);if(e instanceof Set&&t instanceof Set)return Ua(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Ha(e,t);if(ar(e)&&ar(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(var o=n.length;o--!==0;){var i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!ae(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}function Ya(){for(var e=[],t=0;tl);return g.undefined(r)||(u=u&&l===r),g.undefined(i)||(u=u&&a===i),u}function ur(e,t,n){var r=n.key,o=n.type,i=n.value,s=Te(e,r),a=Te(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!g.nullOrUndefined(i)){if(g.defined(l)){if(g.array(l)||g.plainObject(l))return qa(l,u,i)}else return ae(u,i);return!1}return[s,a].every(g.array)?!u.every(Pn(l)):[s,a].every(g.plainObject)?Ga(Object.keys(l),Object.keys(u)):![s,a].every(function(f){return g.primitive(f)&&g.defined(f)})&&(o==="added"?!g.defined(s)&&g.defined(a):g.defined(s)&&!g.defined(a))}function fr(e,t,n){var r=n===void 0?{}:n,o=r.key,i=Te(e,o),s=Te(t,o);if(!ro(i,s))throw new TypeError("Inputs have different types");if(!Ya(i,s))throw new TypeError("Inputs don't have length");return[i,s].every(g.plainObject)&&(i=Object.keys(i),s=Object.keys(s)),[i,s]}function dr(e){return function(t){var n=t[0],r=t[1];return g.array(e)?ae(e,r)||e.some(function(o){return ae(o,r)||g.array(r)&&Pn(r)(o)}):g.plainObject(e)&&e[n]?!!e[n]&&ae(e[n],r):ae(e,r)}}function Ga(e,t){return t.some(function(n){return!e.includes(n)})}function pr(e){return function(t){return g.array(e)?e.some(function(n){return ae(n,t)||g.array(t)&&Pn(t)(n)}):ae(e,t)}}function ct(e,t){return g.array(e)?e.some(function(n){return ae(n,t)}):ae(e,t)}function Pn(e){return function(t){return e.some(function(n){return ae(n,t)})}}function ro(){for(var e=[],t=0;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ja(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function oo(e,t){if(e==null)return{};var n=Ja(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xa(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ne(e)}function Tt(e){var t=Za();return function(){var r=Ft(e),o;if(t){var i=Ft(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Xa(this,o)}}function Qa(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function io(e){var t=Qa(e,"string");return typeof t=="symbol"?t:String(t)}var el={flip:{padding:20},preventOverflow:{padding:10}},tl="The typeValidator argument must be a function with the signature function(props, propName, componentName).",nl="The error message is optional, but must be a string if provided.";function rl(e,t,n,r){return typeof e=="boolean"?e:typeof e=="function"?e(t,n,r):e?!!e:!1}function ol(e,t){return Object.hasOwnProperty.call(e,t)}function il(e,t,n,r){return new Error("Required ".concat(e[t]," `").concat(t,"` was not specified in `").concat(n,"`."))}function sl(e,t){if(typeof e!="function")throw new TypeError(tl);if(t&&typeof t!="string")throw new TypeError(nl)}function mr(e,t,n){return sl(e,n),function(r,o,i){for(var s=arguments.length,a=new Array(s>3?s-3:0),l=3;l3&&arguments[3]!==void 0?arguments[3]:!1;e.addEventListener(t,n,r)}function ll(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;e.removeEventListener(t,n,r)}function cl(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o;o=function(s){n(s),ll(e,t,o)},al(e,t,o,r)}function yr(){}var so=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"componentDidMount",value:function(){Ee()&&(this.node||this.appendNode(),ut||this.renderPortal())}},{key:"componentDidUpdate",value:function(){Ee()&&(ut||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!Ee()||!this.node||(ut||Nt.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var o=this.props,i=o.id,s=o.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),s&&(this.node.style.zIndex=s),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!Ee())return null;var o=this.props,i=o.children,s=o.setRef;if(this.node||this.appendNode(),ut)return Nt.createPortal(i,this.node);var a=Nt.unstable_renderSubtreeIntoContainer(this,i.length>1?w.createElement("div",null,i):i[0],this.node);return s(a),null}},{key:"renderReact16",value:function(){var o=this.props,i=o.hasChildren,s=o.placement,a=o.target;return i?this.renderPortal():a||s==="center"?this.renderPortal():null}},{key:"render",value:function(){return ut?this.renderReact16():null}}]),n})(w.Component);te(so,"propTypes",{children:T.oneOfType([T.element,T.array]),hasChildren:T.bool,id:T.oneOfType([T.string,T.number]),placement:T.string,setRef:T.func.isRequired,target:T.oneOfType([T.object,T.string]),zIndex:T.number});var ao=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"parentStyle",get:function(){var o=this.props,i=o.placement,s=o.styles,a=s.arrow.length,l={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(l.bottom=0,l.left=0,l.right=0,l.height=a):i.startsWith("bottom")?(l.left=0,l.right=0,l.top=0,l.height=a):i.startsWith("left")?(l.right=0,l.top=0,l.bottom=0):i.startsWith("right")&&(l.left=0,l.top=0),l}},{key:"render",value:function(){var o=this.props,i=o.placement,s=o.setArrowRef,a=o.styles,l=a.arrow,u=l.color,f=l.display,c=l.length,d=l.margin,p=l.position,h=l.spread,v={display:f,position:p},S,y=h,m=c;return i.startsWith("top")?(S="0,0 ".concat(y/2,",").concat(m," ").concat(y,",0"),v.bottom=0,v.marginLeft=d,v.marginRight=d):i.startsWith("bottom")?(S="".concat(y,",").concat(m," ").concat(y/2,",0 0,").concat(m),v.top=0,v.marginLeft=d,v.marginRight=d):i.startsWith("left")?(m=h,y=c,S="0,0 ".concat(y,",").concat(m/2," 0,").concat(m),v.right=0,v.marginTop=d,v.marginBottom=d):i.startsWith("right")&&(m=h,y=c,S="".concat(y,",").concat(m," ").concat(y,",0 0,").concat(m/2),v.left=0,v.marginTop=d,v.marginBottom=d),w.createElement("div",{className:"__floater__arrow",style:this.parentStyle},w.createElement("span",{ref:s,style:v},w.createElement("svg",{width:y,height:m,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},w.createElement("polygon",{points:S,fill:u}))))}}]),n})(w.Component);te(ao,"propTypes",{placement:T.string.isRequired,setArrowRef:T.func.isRequired,styles:T.object.isRequired});var ul=["color","height","width"];function lo(e){var t=e.handleClick,n=e.styles,r=n.color,o=n.height,i=n.width,s=oo(n,ul);return w.createElement("button",{"aria-label":"close",onClick:t,style:s,type:"button"},w.createElement("svg",{width:"".concat(i,"px"),height:"".concat(o,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}lo.propTypes={handleClick:T.func.isRequired,styles:T.object.isRequired};function co(e){var t=e.content,n=e.footer,r=e.handleClick,o=e.open,i=e.positionWrapper,s=e.showCloseButton,a=e.title,l=e.styles,u={content:w.isValidElement(t)?t:w.createElement("div",{className:"__floater__content",style:l.content},t)};return a&&(u.title=w.isValidElement(a)?a:w.createElement("div",{className:"__floater__title",style:l.title},a)),n&&(u.footer=w.isValidElement(n)?n:w.createElement("div",{className:"__floater__footer",style:l.footer},n)),(s||i)&&!g.boolean(o)&&(u.close=w.createElement(lo,{styles:l.close,handleClick:r})),w.createElement("div",{className:"__floater__container",style:l.container},u.close,u.title,u.content,u.footer)}co.propTypes={content:T.node.isRequired,footer:T.node,handleClick:T.func.isRequired,open:T.bool,positionWrapper:T.bool.isRequired,showCloseButton:T.bool.isRequired,styles:T.object.isRequired,title:T.node};var uo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"style",get:function(){var o=this.props,i=o.disableAnimation,s=o.component,a=o.placement,l=o.hideArrow,u=o.status,f=o.styles,c=f.arrow.length,d=f.floater,p=f.floaterCentered,h=f.floaterClosing,v=f.floaterOpening,S=f.floaterWithAnimation,y=f.floaterWithComponent,m={};return l||(a.startsWith("top")?m.padding="0 0 ".concat(c,"px"):a.startsWith("bottom")?m.padding="".concat(c,"px 0 0"):a.startsWith("left")?m.padding="0 ".concat(c,"px 0 0"):a.startsWith("right")&&(m.padding="0 0 0 ".concat(c,"px"))),[z.OPENING,z.OPEN].indexOf(u)!==-1&&(m=K(K({},m),v)),u===z.CLOSING&&(m=K(K({},m),h)),u===z.OPEN&&!i&&(m=K(K({},m),S)),a==="center"&&(m=K(K({},m),p)),s&&(m=K(K({},m),y)),K(K({},d),m)}},{key:"render",value:function(){var o=this.props,i=o.component,s=o.handleClick,a=o.hideArrow,l=o.setFloaterRef,u=o.status,f={},c=["__floater"];return i?w.isValidElement(i)?f.content=w.cloneElement(i,{closeFn:s}):f.content=i({closeFn:s}):f.content=w.createElement(co,this.props),u===z.OPEN&&c.push("__floater__open"),a||(f.arrow=w.createElement(ao,this.props)),w.createElement("div",{ref:l,className:c.join(" "),style:this.style},w.createElement("div",{className:"__floater__body"},f.content,f.arrow))}}]),n})(w.Component);te(uo,"propTypes",{component:T.oneOfType([T.func,T.element]),content:T.node,disableAnimation:T.bool.isRequired,footer:T.node,handleClick:T.func.isRequired,hideArrow:T.bool.isRequired,open:T.bool,placement:T.string.isRequired,positionWrapper:T.bool.isRequired,setArrowRef:T.func.isRequired,setFloaterRef:T.func.isRequired,showCloseButton:T.bool,status:T.string.isRequired,styles:T.object.isRequired,title:T.node});var fo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"render",value:function(){var o=this.props,i=o.children,s=o.handleClick,a=o.handleMouseEnter,l=o.handleMouseLeave,u=o.setChildRef,f=o.setWrapperRef,c=o.style,d=o.styles,p;if(i)if(w.Children.count(i)===1)if(!w.isValidElement(i))p=w.createElement("span",null,i);else{var h=g.function(i.type)?"innerRef":"ref";p=w.cloneElement(w.Children.only(i),te({},h,u))}else p=i;return p?w.createElement("span",{ref:f,style:K(K({},d),c),onClick:s,onMouseEnter:a,onMouseLeave:l},p):null}}]),n})(w.Component);te(fo,"propTypes",{children:T.node,handleClick:T.func.isRequired,handleMouseEnter:T.func.isRequired,handleMouseLeave:T.func.isRequired,setChildRef:T.func.isRequired,setWrapperRef:T.func.isRequired,style:T.object,styles:T.object.isRequired});var fl={zIndex:100};function dl(e){var t=ve(fl,e.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:t.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:t.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:t}}var pl=["arrow","flip","offset"],hl=["position","top","right","bottom","left"],xn=(function(e){Ct(n,e);var t=Tt(n);function n(r){var o;return Et(this,n),o=t.call(this,r),te(Ne(o),"setArrowRef",function(i){o.arrowRef=i}),te(Ne(o),"setChildRef",function(i){o.childRef=i}),te(Ne(o),"setFloaterRef",function(i){o.floaterRef=i}),te(Ne(o),"setWrapperRef",function(i){o.wrapperRef=i}),te(Ne(o),"handleTransitionEnd",function(){var i=o.state.status,s=o.props.callback;o.wrapperPopper&&o.wrapperPopper.instance.update(),o.setState({status:i===z.OPENING?z.OPEN:z.IDLE},function(){var a=o.state.status;s(a===z.OPEN?"open":"close",o.props)})}),te(Ne(o),"handleClick",function(){var i=o.props,s=i.event,a=i.open;if(!g.boolean(a)){var l=o.state,u=l.positionWrapper,f=l.status;(o.event==="click"||o.event==="hover"&&u)&&(xt({title:"click",data:[{event:s,status:f===z.OPEN?"closing":"opening"}],debug:o.debug}),o.toggle())}}),te(Ne(o),"handleMouseEnter",function(){var i=o.props,s=i.event,a=i.open;if(!(g.boolean(a)||an())){var l=o.state.status;o.event==="hover"&&l===z.IDLE&&(xt({title:"mouseEnter",data:[{key:"originalEvent",value:s}],debug:o.debug}),clearTimeout(o.eventDelayTimeout),o.toggle())}}),te(Ne(o),"handleMouseLeave",function(){var i=o.props,s=i.event,a=i.eventDelay,l=i.open;if(!(g.boolean(l)||an())){var u=o.state,f=u.status,c=u.positionWrapper;o.event==="hover"&&(xt({title:"mouseLeave",data:[{key:"originalEvent",value:s}],debug:o.debug}),a?[z.OPENING,z.OPEN].indexOf(f)!==-1&&!c&&!o.eventDelayTimeout&&(o.eventDelayTimeout=setTimeout(function(){delete o.eventDelayTimeout,o.toggle()},a*1e3)):o.toggle(z.IDLE))}}),o.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:z.INIT,statusWrapper:z.INIT},o._isMounted=!1,o.hasMounted=!1,Ee()&&window.addEventListener("load",function(){o.popper&&o.popper.instance.update(),o.wrapperPopper&&o.wrapperPopper.instance.update()}),o}return kt(n,[{key:"componentDidMount",value:function(){if(Ee()){var o=this.state.positionWrapper,i=this.props,s=i.children,a=i.open,l=i.target;this._isMounted=!0,xt({title:"init",data:{hasChildren:!!s,hasTarget:!!l,isControlled:g.boolean(a),positionWrapper:o,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!s&&l&&g.boolean(a)}}},{key:"componentDidUpdate",value:function(o,i){if(Ee()){var s=this.props,a=s.autoOpen,l=s.open,u=s.target,f=s.wrapperOptions,c=Va(i,this.state),d=c.changedFrom,p=c.changed;if(o.open!==l){var h;g.boolean(l)&&(h=l?z.OPENING:z.CLOSING),this.toggle(h)}(o.wrapperOptions.position!==f.position||o.target!==u)&&this.changeWrapperPosition(this.props),p("status",z.IDLE)&&l?this.toggle(z.OPEN):d("status",z.INIT,z.IDLE)&&a&&this.toggle(z.OPEN),this.popper&&p("status",z.OPENING)&&this.popper.instance.update(),this.floaterRef&&(p("status",z.OPENING)||p("status",z.CLOSING))&&cl(this.floaterRef,"transitionend",this.handleTransitionEnd),p("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){Ee()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,s=this.state.positionWrapper,a=this.props,l=a.disableFlip,u=a.getPopper,f=a.hideArrow,c=a.offset,d=a.placement,p=a.wrapperOptions,h=d==="top"||d==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(d==="center")this.setState({status:z.IDLE});else if(i&&this.floaterRef){var v=this.options,S=v.arrow,y=v.flip,m=v.offset,E=oo(v,pl);new yt(i,this.floaterRef,{placement:d,modifiers:K({arrow:K({enabled:!f,element:this.arrowRef},S),flip:K({enabled:!l,behavior:h},y),offset:K({offset:"0, ".concat(c,"px")},m)},E),onCreate:function(O){var D;if(o.popper=O,!((D=o.floaterRef)!==null&&D!==void 0&&D.isConnected)){o.setState({needsUpdate:!0});return}u(O,"floater"),o._isMounted&&o.setState({currentPlacement:O.placement,status:z.IDLE}),d!==O.placement&&setTimeout(function(){O.instance.update()},1)},onUpdate:function(O){o.popper=O;var D=o.state.currentPlacement;o._isMounted&&O.placement!==D&&o.setState({currentPlacement:O.placement})}})}if(s){var M=g.undefined(p.offset)?0:p.offset;new yt(this.target,this.wrapperRef,{placement:p.placement||d,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(M,"px")},flip:{enabled:!1}},onCreate:function(O){o.wrapperPopper=O,o._isMounted&&o.setState({statusWrapper:z.IDLE}),u(O,"wrapper"),d!==O.placement&&setTimeout(function(){O.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var o=this;this.floaterRefInterval=setInterval(function(){var i;(i=o.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(o.floaterRefInterval),o.setState({needsUpdate:!1}),o.initPopper())},50)}},{key:"changeWrapperPosition",value:function(o){var i=o.target,s=o.wrapperOptions;this.setState({positionWrapper:s.position&&!!i})}},{key:"toggle",value:function(o){var i=this.state.status,s=i===z.OPEN?z.CLOSING:z.OPENING;g.undefined(o)||(s=o),this.setState({status:s})}},{key:"debug",get:function(){var o=this.props.debug;return o||Ee()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var o=this.props,i=o.disableHoverToClick,s=o.event;return s==="hover"&&an()&&!i?"click":s}},{key:"options",get:function(){var o=this.props.options;return ve(el,o||{})}},{key:"styles",get:function(){var o=this,i=this.state,s=i.status,a=i.positionWrapper,l=i.statusWrapper,u=this.props.styles,f=ve(dl(u),u);if(a){var c;[z.IDLE].indexOf(s)===-1||[z.IDLE].indexOf(l)===-1?c=f.wrapperPosition:c=this.wrapperPopper.styles,f.wrapper=K(K({},f.wrapper),c)}if(this.target){var d=window.getComputedStyle(this.target);this.wrapperStyles?f.wrapper=K(K({},f.wrapper),this.wrapperStyles):["relative","static"].indexOf(d.position)===-1&&(this.wrapperStyles={},a||(hl.forEach(function(p){o.wrapperStyles[p]=d[p]}),f.wrapper=K(K({},f.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return f}},{key:"target",get:function(){if(!Ee())return null;var o=this.props.target;return o?g.domElement(o)?o:document.querySelector(o):this.childRef||this.wrapperRef}},{key:"render",value:function(){var o=this.state,i=o.currentPlacement,s=o.positionWrapper,a=o.status,l=this.props,u=l.children,f=l.component,c=l.content,d=l.disableAnimation,p=l.footer,h=l.hideArrow,v=l.id,S=l.open,y=l.showCloseButton,m=l.style,E=l.target,M=l.title,C=w.createElement(fo,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:m,styles:this.styles.wrapper},u),O={};return s?O.wrapperInPortal=C:O.wrapperAsChildren=C,w.createElement("span",null,w.createElement(so,{hasChildren:!!u,id:v,placement:i,setRef:this.setFloaterRef,target:E,zIndex:this.styles.options.zIndex},w.createElement(uo,{component:f,content:c,disableAnimation:d,footer:p,handleClick:this.handleClick,hideArrow:h||i==="center",open:S,placement:i,positionWrapper:s,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:y,status:a,styles:this.styles,title:M}),O.wrapperInPortal),O.wrapperAsChildren)}}]),n})(w.Component);te(xn,"propTypes",{autoOpen:T.bool,callback:T.func,children:T.node,component:mr(T.oneOfType([T.func,T.element]),function(e){return!e.content}),content:mr(T.node,function(e){return!e.component}),debug:T.bool,disableAnimation:T.bool,disableFlip:T.bool,disableHoverToClick:T.bool,event:T.oneOf(["hover","click"]),eventDelay:T.number,footer:T.node,getPopper:T.func,hideArrow:T.bool,id:T.oneOfType([T.string,T.number]),offset:T.number,open:T.bool,options:T.object,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:T.bool,style:T.object,styles:T.object,target:T.oneOfType([T.object,T.string]),title:T.node,wrapperOptions:T.shape({offset:T.number,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:T.bool})});te(xn,"defaultProps",{autoOpen:!1,callback:yr,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:yr,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var ml=Object.defineProperty,yl=(e,t,n)=>t in e?ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t,n)=>yl(e,typeof t!="symbol"?t+"":t,n),q={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},ye={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},A={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},L={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function _e(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function po(e){return e?e.getBoundingClientRect():null}function vl(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,s)=>i-s),o=Math.floor(r.length/2);return r.length%2===0?(r[o-1]+r[o])/2:r[o]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function De(e){if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function gl(e){return!e||e.nodeType!==1?null:getComputedStyle(e)}function vt(e,t,n){if(!e)return $e();const r=Lr(e);if(r){if(r.isSameNode($e()))return n?document:$e();if(!(r.scrollHeight>r.offsetHeight)&&!t)return r.style.overflow="initial",$e()}return r}function $t(e,t){if(!e)return!1;const n=vt(e,t);return n?!n.isSameNode($e()):!1}function bl(e){return e.offsetParent!==document.body}function et(e,t="fixed"){if(!e||!(e instanceof HTMLElement))return!1;const{nodeName:n}=e,r=gl(e);return n==="BODY"||n==="HTML"?!1:r&&r.position===t?!0:e.parentNode?et(e.parentNode,t):!1}function wl(e){var t;if(!e)return!1;let n=e;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:o}=getComputedStyle(n);if(r==="none"||o==="hidden")return!1}n=(t=n.parentElement)!=null?t:null}return!0}function Ol(e,t,n){var r,o,i;const s=po(e),a=vt(e,n),l=$t(e,n),u=et(e);let f=0,c=(r=s?.top)!=null?r:0;if(l&&u){const d=(o=e?.offsetTop)!=null?o:0,p=(i=a?.scrollTop)!=null?i:0;c=d-p}else a instanceof HTMLElement&&(f=a.scrollTop,!l&&!et(e)&&(c+=f),a.isSameNode($e())||(c+=$e().scrollTop));return Math.floor(c-t)}function Sl(e,t,n){var r;if(!e)return 0;const{offsetTop:o=0,scrollTop:i=0}=(r=Lr(e))!=null?r:{};let s=e.getBoundingClientRect().top+i;o&&($t(e,n)||bl(e))&&(s-=o);const a=Math.floor(s-t);return a<0?0:a}function $e(){var e;return(e=document.scrollingElement)!=null?e:document.documentElement}function El(e,t){const{duration:n,element:r}=t;return new Promise((o,i)=>{const{scrollTop:s}=r,a=e>s?e-s:s-e;js.top(r,e,{duration:a<100?50:n},l=>l&&l.message!=="Element already at target scroll position"?i(l):o())})}var ft=Dt.createPortal!==void 0;function ho(e=navigator.userAgent){let t=e;return typeof window>"u"?t="node":document.documentMode?t="ie":/Edge/.test(e)?t="edge":window.opera||e.includes(" OPR/")?t="opera":typeof window.InstallTrigger<"u"?t="firefox":window.chrome?t="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(e)&&(t="safari"),t}function Wt(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function ke(e,t={}){const{defaultValue:n,step:r,steps:o}=t;let i=Jn(e);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&o&&(i=i.replace("{step}",r.toString()).replace("{steps}",o.toString()));else if(b.isValidElement(e)&&!Object.values(e.props).length&&Wt(e.type)==="function"){const s=e.type({});i=ke(s,t)}else i=Jn(n);return i}function kl(e,t){return!x.plainObject(e)||!x.array(t)?!1:Object.keys(e).every(n=>t.includes(n))}function Cl(e){const t=/^#?([\da-f])([\da-f])([\da-f])$/i,n=e.replace(t,(o,i,s,a)=>i+i+s+s+a+a),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function vr(e){return e.disableBeacon||e.placement==="center"}function gr(){return!["chrome","safari","firefox","opera"].includes(ho())}function Ue({data:e,debug:t=!1,title:n,warn:r=!1}){const o=r?console.warn||console.error:console.log;t&&(n&&e?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(e)?e.forEach(i=>{x.plainObject(i)&&i.key?o.apply(console,[i.key,i.value]):o.apply(console,[i])}):o.apply(console,[e]),console.groupEnd()):console.error("Missing title or data props"))}function Tl(e){return Object.keys(e)}function mo(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function Ml(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function bn(e,t,n){const r=i=>i.replace("{step}",String(t)).replace("{steps}",String(n));if(Wt(e)==="string")return r(e);if(!b.isValidElement(e))return e;const{children:o}=e.props;if(Wt(o)==="string"&&o.includes("{step}"))return b.cloneElement(e,{children:r(o)});if(Array.isArray(o))return b.cloneElement(e,{children:o.map(i=>typeof i=="string"?r(i):bn(i,t,n))});if(Wt(e.type)==="function"&&!Object.values(e.props).length){const i=e.type({});return bn(i,t,n)}return e}function Pl(e){const{isFirstStep:t,lifecycle:n,previousLifecycle:r,scrollToFirstStep:o,step:i,target:s}=e;return!i.disableScrolling&&(!t||o||n===A.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!et(s))&&r!==n&&[A.BEACON,A.TOOLTIP].includes(n)}var xl={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},yo={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Nl={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:yo,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},Dl={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},Il={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},dt={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},br={borderRadius:4,position:"absolute"};function Wl(e,t){var n,r,o,i,s;const{floaterProps:a,styles:l}=e,u=ve((n=t.floaterProps)!=null?n:{},a??{}),f=ve(l??{},(r=t.styles)!=null?r:{}),c=ve(Il,f.options||{}),d=t.placement==="center"||t.disableBeacon;let{width:p}=c;window.innerWidth>480&&(p=380),"width"in c&&(p=typeof c.width=="number"&&window.innerWidthvo(n,t)):(Ue({title:"validateSteps",data:"steps must be an array",warn:!0,debug:t}),!1)}var go={action:"init",controlled:!1,index:0,lifecycle:A.INIT,origin:null,size:0,status:L.IDLE},Or=Tl(mo(go,"controlled","size")),Al=class{constructor(e){N(this,"beaconPopper"),N(this,"tooltipPopper"),N(this,"data",new Map),N(this,"listener"),N(this,"store",new Map),N(this,"addListener",o=>{this.listener=o}),N(this,"setSteps",o=>{const{size:i,status:s}=this.getState(),a={size:o.length,status:s};this.data.set("steps",o),s===L.WAITING&&!i&&o.length&&(a.status=L.RUNNING),this.setState(a)}),N(this,"getPopper",o=>o==="beacon"?this.beaconPopper:this.tooltipPopper),N(this,"setPopper",(o,i)=>{o==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),N(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),N(this,"close",(o=null)=>{const{index:i,status:s}=this.getState();s===L.RUNNING&&this.setState({...this.getNextState({action:q.CLOSE,index:i+1,origin:o})})}),N(this,"go",o=>{const{controlled:i,status:s}=this.getState();if(i||s!==L.RUNNING)return;const a=this.getSteps()[o];this.setState({...this.getNextState({action:q.GO,index:o}),status:a?s:L.FINISHED})}),N(this,"info",()=>this.getState()),N(this,"next",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState(this.getNextState({action:q.NEXT,index:o+1}))}),N(this,"open",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({...this.getNextState({action:q.UPDATE,lifecycle:A.TOOLTIP})})}),N(this,"prev",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState({...this.getNextState({action:q.PREV,index:o-1})})}),N(this,"reset",(o=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:q.RESET,index:0}),status:o?L.RUNNING:L.READY})}),N(this,"skip",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({action:q.SKIP,lifecycle:A.INIT,status:L.SKIPPED})}),N(this,"start",o=>{const{index:i,size:s}=this.getState();this.setState({...this.getNextState({action:q.START,index:x.number(o)?o:i},!0),status:s?L.RUNNING:L.WAITING})}),N(this,"stop",(o=!1)=>{const{index:i,status:s}=this.getState();[L.FINISHED,L.SKIPPED].includes(s)||this.setState({...this.getNextState({action:q.STOP,index:i+(o?1:0)}),status:L.PAUSED})}),N(this,"update",o=>{var i,s;if(!kl(o,Or))throw new Error(`State is not valid. Valid keys: ${Or.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...o,action:(i=o.action)!=null?i:q.UPDATE,origin:(s=o.origin)!=null?s:null},!0)})});const{continuous:t=!1,stepIndex:n,steps:r=[]}=e??{};this.setState({action:q.INIT,controlled:x.number(n),continuous:t,index:x.number(n)?n:0,lifecycle:A.INIT,origin:null,status:r.length?L.READY:L.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...go}}getNextState(e,t=!1){var n,r,o,i,s;const{action:a,controlled:l,index:u,size:f,status:c}=this.getState(),d=x.number(e.index)?e.index:u,p=l&&!t?u:Math.min(Math.max(d,0),f);return{action:(n=e.action)!=null?n:a,controlled:l,index:p,lifecycle:(r=e.lifecycle)!=null?r:A.INIT,origin:(o=e.origin)!=null?o:null,size:(i=e.size)!=null?i:f,status:p===f?L.FINISHED:(s=e.status)!=null?s:c}}getSteps(){const e=this.data.get("steps");return Array.isArray(e)?e:[]}hasUpdatedState(e){const t=JSON.stringify(e),n=JSON.stringify(this.getState());return t!==n}setState(e,t=!1){const n=this.getState(),{action:r,index:o,lifecycle:i,origin:s=null,size:a,status:l}={...n,...e};this.store.set("action",r),this.store.set("index",o),this.store.set("lifecycle",i),this.store.set("origin",s),this.store.set("size",a),this.store.set("status",l),t&&(this.store.set("controlled",e.controlled),this.store.set("continuous",e.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function _l(e){return new Al(e)}function Fl({styles:e}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:e})}var jl=Fl,Bl=class extends b.Component{constructor(){super(...arguments),N(this,"isActive",!1),N(this,"resizeTimeout"),N(this,"scrollTimeout"),N(this,"scrollParent"),N(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),N(this,"hideSpotlight",()=>{const{continuous:e,disableOverlay:t,lifecycle:n}=this.props,r=[A.INIT,A.BEACON,A.COMPLETE,A.ERROR];return t||(e?r.includes(n):n!==A.TOOLTIP)}),N(this,"handleMouseMove",e=>{const{mouseOverSpotlight:t}=this.state,{height:n,left:r,position:o,top:i,width:s}=this.spotlightStyles,a=o==="fixed"?e.clientY:e.pageY,l=o==="fixed"?e.clientX:e.pageX,u=a>=i&&a<=i+n,c=l>=r&&l<=r+s&&u;c!==t&&this.updateState({mouseOverSpotlight:c})}),N(this,"handleScroll",()=>{const{target:e}=this.props,t=De(e);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else et(t,"sticky")&&this.updateState({})}),N(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:e,disableScrolling:t,disableScrollParentFix:n=!1,target:r}=this.props,o=De(r);this.scrollParent=vt(o??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(e){var t;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:o,target:i}=this.props,{changed:s}=Rt(e,this.props);if(s("target")||s("disableScrollParentFix")){const a=De(i);this.scrollParent=vt(a??document.body,n,!0)}s("lifecycle",A.TOOLTIP)&&((t=this.scrollParent)==null||t.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:a}=this.state;a||this.updateState({showSpotlight:!0})},100)),(s("spotlightClicks")||s("disableOverlay")||s("lifecycle"))&&(o&&r===A.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==A.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var e;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(e=this.scrollParent)==null||e.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:e}=this.state,{disableOverlayClose:t,placement:n,styles:r}=this.props;let o=r.overlay;return gr()&&(o=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:t?"default":"pointer",height:vl(),pointerEvents:e?"none":"auto",...o}}get spotlightStyles(){var e,t,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:o=!1,spotlightClicks:i,spotlightPadding:s=0,styles:a,target:l}=this.props,u=De(l),f=po(u),c=et(u),d=Ol(u,s,o);return{...gr()?a.spotlightLegacy:a.spotlight,height:Math.round(((e=f?.height)!=null?e:0)+s*2),left:Math.round(((t=f?.left)!=null?t:0)-s),opacity:r?1:0,pointerEvents:i?"none":"auto",position:c?"fixed":"absolute",top:d,transition:"opacity 0.2s",width:Math.round(((n=f?.width)!=null?n:0)+s*2)}}updateState(e){this.isActive&&this.setState(t=>({...t,...e}))}render(){const{showSpotlight:e}=this.state,{onClickOverlay:t,placement:n}=this.props,{hideSpotlight:r,overlayStyles:o,spotlightStyles:i}=this;if(r())return null;let s=n!=="center"&&e&&b.createElement(jl,{styles:i});if(ho()==="safari"){const{mixBlendMode:a,zIndex:l,...u}=o;s=b.createElement("div",{style:{...u}},s),delete o.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:t,role:"presentation",style:o},s)}},Ll=class extends b.Component{constructor(){super(...arguments),N(this,"node",null)}componentDidMount(){const{id:e}=this.props;_e()&&(this.node=document.createElement("div"),this.node.id=e,document.body.appendChild(this.node),ft||this.renderReact15())}componentDidUpdate(){_e()&&(ft||this.renderReact15())}componentWillUnmount(){!_e()||!this.node||(ft||Dt.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!_e())return;const{children:e}=this.props;this.node&&Dt.unstable_renderSubtreeIntoContainer(this,e,this.node)}renderReact16(){if(!_e()||!ft)return null;const{children:e}=this.props;return this.node?Dt.createPortal(e,this.node):null}render(){return ft?this.renderReact16():null}},$l=class{constructor(e,t){if(N(this,"element"),N(this,"options"),N(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),N(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,o=n.nodeName.toLowerCase();return(r.test(o)&&!n.getAttribute("disabled")||o==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),N(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),N(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),N(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:o}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!o&&i+1===r.length?i=0:o&&i===0?i=r.length-1:i+=o?-1:1,r[i].focus()}),N(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,o=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&o.getPropertyValue("overflow")!=="visible"||o.getPropertyValue("display")==="none"}),N(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),N(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),N(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),N(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(e instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=e,this.options=t,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},Hl=class extends b.Component{constructor(e){if(super(e),N(this,"beacon",null),N(this,"setBeaconRef",o=>{this.beacon=o}),e.beaconComponent)return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",e.nonce&&n.setAttribute("nonce",e.nonce),n.appendChild(document.createTextNode(` +import{k as fi,u as Ze,R as di,o as pi,O as hi,C as mi,r as mt}from"./radix-core-BdJoVJLV.js";import{r as b,j as yi,R as w,c as Nt,b as Dt}from"./router-9vIXuQkh.js";import{g as gt}from"./react-vendor-BmxF9s7Q.js";import{b as Vt,i as vi,a as ot,d as it,e as gi,f as st,g as pt,h as bi,j as wi,k as Oi,l as Si,m as Ei,n as ki,o as Ci,p as Ti,q as Mi,r as Pi,s as xi,t as Ni,u as Di,v as Ii,w as Wi,x as Ri,y as Ai,z as _i,A as Fi,B as ji,C as Bi,D as Li,E as $i,F as Hi,G as zi,H as Ui,I as Yi,J as qi,K as Gi,L as Vi,M as Ki}from"./utils-BqoaXoQ1.js";var jn=1,Zi=.9,Ji=.8,Xi=.17,Kt=.1,Zt=.999,Qi=.9999,es=.99,ts=/[\\\/_+.#"@\[\(\{&]/,ns=/[\\\/_+.#"@\[\(\{&]/g,rs=/[\s-]/,Nr=/[\s-]/g;function dn(e,t,n,r,o,i,s){if(i===t.length)return o===e.length?jn:es;var a=`${o},${i}`;if(s[a]!==void 0)return s[a];for(var l=r.charAt(i),u=n.indexOf(l,o),f=0,c,d,p,h;u>=0;)c=dn(e,t,n,r,u+1,i+1,s),c>f&&(u===o?c*=jn:ts.test(e.charAt(u-1))?(c*=Ji,p=e.slice(o,u-1).match(ns),p&&o>0&&(c*=Math.pow(Zt,p.length))):rs.test(e.charAt(u-1))?(c*=Zi,h=e.slice(o,u-1).match(Nr),h&&o>0&&(c*=Math.pow(Zt,h.length))):(c*=Xi,o>0&&(c*=Math.pow(Zt,u-o))),e.charAt(u)!==t.charAt(i)&&(c*=Qi)),(cc&&(c=d*Kt)),c>f&&(f=c),u=n.indexOf(l,u+1);return s[a]=f,f}function Bn(e){return e.toLowerCase().replace(Nr," ")}function os(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,dn(e,t,Bn(e),Bn(t),0,0,{})}var is=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Be=is.reduce((e,t)=>{const n=fi(`Primitive.${t}`),r=b.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),yi.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),at='[cmdk-group=""]',Jt='[cmdk-group-items=""]',ss='[cmdk-group-heading=""]',Dr='[cmdk-item=""]',Ln=`${Dr}:not([aria-disabled="true"])`,pn="cmdk-item-select",Ve="data-value",as=(e,t,n)=>os(e,t,n),Ir=b.createContext(void 0),bt=()=>b.useContext(Ir),Wr=b.createContext(void 0),On=()=>b.useContext(Wr),Rr=b.createContext(void 0),Ar=b.forwardRef((e,t)=>{let n=Ke(()=>{var k,R;return{search:"",value:(R=(k=e.value)!=null?k:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ke(()=>new Set),o=Ke(()=>new Map),i=Ke(()=>new Map),s=Ke(()=>new Set),a=_r(e),{label:l,children:u,value:f,onValueChange:c,filter:d,shouldFilter:p,loop:h,disablePointerSelection:v=!1,vimBindings:S=!0,...y}=e,m=Ze(),E=Ze(),M=Ze(),C=b.useRef(null),O=gs();ze(()=>{if(f!==void 0){let k=f.trim();n.current.value=k,D.emit()}},[f]),ze(()=>{O(6,fe)},[]);let D=b.useMemo(()=>({subscribe:k=>(s.current.add(k),()=>s.current.delete(k)),snapshot:()=>n.current,setState:(k,R,B)=>{var W,U,V,ne;if(!Object.is(n.current[k],R)){if(n.current[k]=R,k==="search")ue(),$(),O(1,oe);else if(k==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Q=document.getElementById(M);Q?Q.focus():(W=document.getElementById(m))==null||W.focus()}if(O(7,()=>{var Q;n.current.selectedItemId=(Q=X())==null?void 0:Q.id,D.emit()}),B||O(5,fe),((U=a.current)==null?void 0:U.value)!==void 0){let Q=R??"";(ne=(V=a.current).onValueChange)==null||ne.call(V,Q);return}}D.emit()}},emit:()=>{s.current.forEach(k=>k())}}),[]),j=b.useMemo(()=>({value:(k,R,B)=>{var W;R!==((W=i.current.get(k))==null?void 0:W.value)&&(i.current.set(k,{value:R,keywords:B}),n.current.filtered.items.set(k,Z(R,B)),O(2,()=>{$(),D.emit()}))},item:(k,R)=>(r.current.add(k),R&&(o.current.has(R)?o.current.get(R).add(k):o.current.set(R,new Set([k]))),O(3,()=>{ue(),$(),n.current.value||oe(),D.emit()}),()=>{i.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let B=X();O(4,()=>{ue(),B?.getAttribute("id")===k&&oe(),D.emit()})}),group:k=>(o.current.has(k)||o.current.set(k,new Set),()=>{i.current.delete(k),o.current.delete(k)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:m,inputId:M,labelId:E,listInnerRef:C}),[]);function Z(k,R){var B,W;let U=(W=(B=a.current)==null?void 0:B.filter)!=null?W:as;return k?U(k,n.current.search,R):0}function $(){if(!n.current.search||a.current.shouldFilter===!1)return;let k=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(W=>{let U=o.current.get(W),V=0;U.forEach(ne=>{let Q=k.get(ne);V=Math.max(Q,V)}),R.push([W,V])});let B=C.current;de().sort((W,U)=>{var V,ne;let Q=W.getAttribute("id"),xe=U.getAttribute("id");return((V=k.get(xe))!=null?V:0)-((ne=k.get(Q))!=null?ne:0)}).forEach(W=>{let U=W.closest(Jt);U?U.appendChild(W.parentElement===U?W:W.closest(`${Jt} > *`)):B.appendChild(W.parentElement===B?W:W.closest(`${Jt} > *`))}),R.sort((W,U)=>U[1]-W[1]).forEach(W=>{var U;let V=(U=C.current)==null?void 0:U.querySelector(`${at}[${Ve}="${encodeURIComponent(W[0])}"]`);V?.parentElement.appendChild(V)})}function oe(){let k=de().find(B=>B.getAttribute("aria-disabled")!=="true"),R=k?.getAttribute(Ve);D.setState("value",R||void 0)}function ue(){var k,R,B,W;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let U=0;for(let V of r.current){let ne=(R=(k=i.current.get(V))==null?void 0:k.value)!=null?R:"",Q=(W=(B=i.current.get(V))==null?void 0:B.keywords)!=null?W:[],xe=Z(ne,Q);n.current.filtered.items.set(V,xe),xe>0&&U++}for(let[V,ne]of o.current)for(let Q of ne)if(n.current.filtered.items.get(Q)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=U}function fe(){var k,R,B;let W=X();W&&(((k=W.parentElement)==null?void 0:k.firstChild)===W&&((B=(R=W.closest(at))==null?void 0:R.querySelector(ss))==null||B.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function X(){var k;return(k=C.current)==null?void 0:k.querySelector(`${Dr}[aria-selected="true"]`)}function de(){var k;return Array.from(((k=C.current)==null?void 0:k.querySelectorAll(Ln))||[])}function Ae(k){let R=de()[k];R&&D.setState("value",R.getAttribute(Ve))}function Le(k){var R;let B=X(),W=de(),U=W.findIndex(ne=>ne===B),V=W[U+k];(R=a.current)!=null&&R.loop&&(V=U+k<0?W[W.length-1]:U+k===W.length?W[0]:W[U+k]),V&&D.setState("value",V.getAttribute(Ve))}function qe(k){let R=X(),B=R?.closest(at),W;for(;B&&!W;)B=k>0?ys(B,at):vs(B,at),W=B?.querySelector(Ln);W?D.setState("value",W.getAttribute(Ve)):Le(k)}let ie=()=>Ae(de().length-1),se=k=>{k.preventDefault(),k.metaKey?ie():k.altKey?qe(1):Le(1)},pe=k=>{k.preventDefault(),k.metaKey?Ae(0):k.altKey?qe(-1):Le(-1)};return b.createElement(Be.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:k=>{var R;(R=y.onKeyDown)==null||R.call(y,k);let B=k.nativeEvent.isComposing||k.keyCode===229;if(!(k.defaultPrevented||B))switch(k.key){case"n":case"j":{S&&k.ctrlKey&&se(k);break}case"ArrowDown":{se(k);break}case"p":case"k":{S&&k.ctrlKey&&pe(k);break}case"ArrowUp":{pe(k);break}case"Home":{k.preventDefault(),Ae(0);break}case"End":{k.preventDefault(),ie();break}case"Enter":{k.preventDefault();let W=X();if(W){let U=new Event(pn);W.dispatchEvent(U)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:ws},l),jt(e,k=>b.createElement(Wr.Provider,{value:D},b.createElement(Ir.Provider,{value:j},k))))}),ls=b.forwardRef((e,t)=>{var n,r;let o=Ze(),i=b.useRef(null),s=b.useContext(Rr),a=bt(),l=_r(e),u=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:s?.forceMount;ze(()=>{if(!u)return a.item(o,s?.id)},[u]);let f=Fr(o,i,[e.value,e.children,i],e.keywords),c=On(),d=Fe(O=>O.value&&O.value===f.current),p=Fe(O=>u||a.filter()===!1?!0:O.search?O.filtered.items.get(o)>0:!0);b.useEffect(()=>{let O=i.current;if(!(!O||e.disabled))return O.addEventListener(pn,h),()=>O.removeEventListener(pn,h)},[p,e.onSelect,e.disabled]);function h(){var O,D;v(),(D=(O=l.current).onSelect)==null||D.call(O,f.current)}function v(){c.setState("value",f.current,!0)}if(!p)return null;let{disabled:S,value:y,onSelect:m,forceMount:E,keywords:M,...C}=e;return b.createElement(Be.div,{ref:mt(i,t),...C,id:o,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!d,"data-disabled":!!S,"data-selected":!!d,onPointerMove:S||a.getDisablePointerSelection()?void 0:v,onClick:S?void 0:h},e.children)}),cs=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,s=Ze(),a=b.useRef(null),l=b.useRef(null),u=Ze(),f=bt(),c=Fe(p=>o||f.filter()===!1?!0:p.search?p.filtered.groups.has(s):!0);ze(()=>f.group(s),[]),Fr(s,a,[e.value,e.heading,l]);let d=b.useMemo(()=>({id:s,forceMount:o}),[o]);return b.createElement(Be.div,{ref:mt(a,t),...i,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),jt(e,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Rr.Provider,{value:d},p))))}),us=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=b.useRef(null),i=Fe(s=>!s.search);return!n&&!i?null:b.createElement(Be.div,{ref:mt(o,t),...r,"cmdk-separator":"",role:"separator"})}),fs=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=On(),s=Fe(u=>u.search),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(Be.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:o?e.value:s,onChange:u=>{o||i.setState("search",u.target.value),n?.(u.target.value)}})}),ds=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=b.useRef(null),s=b.useRef(null),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{if(s.current&&i.current){let u=s.current,f=i.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let p=u.offsetHeight;f.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(u),()=>{cancelAnimationFrame(c),d.unobserve(u)}}},[]),b.createElement(Be.div,{ref:mt(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},jt(e,u=>b.createElement("div",{ref:mt(s,l.listInnerRef),"cmdk-list-sizer":""},u)))}),ps=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:s,...a}=e;return b.createElement(di,{open:n,onOpenChange:r},b.createElement(pi,{container:s},b.createElement(hi,{"cmdk-overlay":"",className:o}),b.createElement(mi,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(Ar,{ref:t,...a}))))}),hs=b.forwardRef((e,t)=>Fe(n=>n.filtered.count===0)?b.createElement(Be.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ms=b.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return b.createElement(Be.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},jt(e,s=>b.createElement("div",{"aria-hidden":!0},s)))}),nf=Object.assign(Ar,{List:ds,Item:ls,Input:fs,Group:cs,Separator:us,Dialog:ps,Empty:hs,Loading:ms});function ys(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function vs(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function _r(e){let t=b.useRef(e);return ze(()=>{t.current=e}),t}var ze=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Ke(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Fe(e){let t=On(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function Fr(e,t,n,r=[]){let o=b.useRef(),i=bt();return ze(()=>{var s;let a=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),l=r.map(u=>u.trim());i.value(e,a,l),(s=t.current)==null||s.setAttribute(Ve,a),o.current=a}),o}var gs=()=>{let[e,t]=b.useState(),n=Ke(()=>new Map);return ze(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function bs(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function jt({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(bs(t),{ref:t.ref},n(t.props.children)):n(t)}var ws={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function jr(e){return t=>typeof t===e}var Os=jr("function"),Ss=e=>e===null,$n=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Hn=e=>!Es(e)&&!Ss(e)&&(Os(e)||typeof e=="object"),Es=jr("undefined");function ks(e,t){const{length:n}=e;if(n!==t.length)return!1;for(let r=n;r--!==0;)if(!re(e[r],t[r]))return!1;return!0}function Cs(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function Ts(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!re(n[1],t.get(n[0])))return!1;return!0}function Ms(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function re(e,t){if(e===t)return!0;if(e&&Hn(e)&&t&&Hn(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return ks(e,t);if(e instanceof Map&&t instanceof Map)return Ts(e,t);if(e instanceof Set&&t instanceof Set)return Ms(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Cs(e,t);if($n(e)&&$n(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(let o=n.length;o--!==0;){const i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!re(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}var Ps=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],xs=["bigint","boolean","null","number","string","symbol","undefined"];function Bt(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Ns(t))return t}function be(e){return t=>Bt(t)===e}function Ns(e){return Ps.includes(e)}function tt(e){return t=>typeof t===e}function Ds(e){return xs.includes(e)}var Is=["innerHTML","ownerDocument","style","attributes","nodeValue"];function P(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(P.array(e))return"Array";if(P.plainFunction(e))return"Function";const t=Bt(e);return t||"Object"}P.array=Array.isArray;P.arrayOf=(e,t)=>!P.array(e)&&!P.function(t)?!1:e.every(n=>t(n));P.asyncGeneratorFunction=e=>Bt(e)==="AsyncGeneratorFunction";P.asyncFunction=be("AsyncFunction");P.bigint=tt("bigint");P.boolean=e=>e===!0||e===!1;P.date=be("Date");P.defined=e=>!P.undefined(e);P.domElement=e=>P.object(e)&&!P.plainObject(e)&&e.nodeType===1&&P.string(e.nodeName)&&Is.every(t=>t in e);P.empty=e=>P.string(e)&&e.length===0||P.array(e)&&e.length===0||P.object(e)&&!P.map(e)&&!P.set(e)&&Object.keys(e).length===0||P.set(e)&&e.size===0||P.map(e)&&e.size===0;P.error=be("Error");P.function=tt("function");P.generator=e=>P.iterable(e)&&P.function(e.next)&&P.function(e.throw);P.generatorFunction=be("GeneratorFunction");P.instanceOf=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype;P.iterable=e=>!P.nullOrUndefined(e)&&P.function(e[Symbol.iterator]);P.map=be("Map");P.nan=e=>Number.isNaN(e);P.null=e=>e===null;P.nullOrUndefined=e=>P.null(e)||P.undefined(e);P.number=e=>tt("number")(e)&&!P.nan(e);P.numericString=e=>P.string(e)&&e.length>0&&!Number.isNaN(Number(e));P.object=e=>!P.nullOrUndefined(e)&&(P.function(e)||typeof e=="object");P.oneOf=(e,t)=>P.array(e)?e.indexOf(t)>-1:!1;P.plainFunction=be("Function");P.plainObject=e=>{if(Bt(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};P.primitive=e=>P.null(e)||Ds(typeof e);P.promise=be("Promise");P.propertyOf=(e,t,n)=>{if(!P.object(e)||!t)return!1;const r=e[t];return P.function(n)?n(r):P.defined(r)};P.regexp=be("RegExp");P.set=be("Set");P.string=tt("string");P.symbol=tt("symbol");P.undefined=tt("undefined");P.weakMap=be("WeakMap");P.weakSet=be("WeakSet");var x=P;function Ws(...e){return e.every(t=>x.string(t)||x.array(t)||x.plainObject(t))}function Rs(e,t,n){return Br(e,t)?[e,t].every(x.array)?!e.some(Gn(n))&&t.some(Gn(n)):[e,t].every(x.plainObject)?!Object.entries(e).some(qn(n))&&Object.entries(t).some(qn(n)):t===n:!1}function zn(e,t,n){const{actual:r,key:o,previous:i,type:s}=n,a=Ce(e,o),l=Ce(t,o);let u=[a,l].every(x.number)&&(s==="increased"?al);return x.undefined(r)||(u=u&&l===r),x.undefined(i)||(u=u&&a===i),u}function Un(e,t,n){const{key:r,type:o,value:i}=n,s=Ce(e,r),a=Ce(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!x.nullOrUndefined(i)){if(x.defined(l)){if(x.array(l)||x.plainObject(l))return Rs(l,u,i)}else return re(u,i);return!1}return[s,a].every(x.array)?!u.every(Sn(l)):[s,a].every(x.plainObject)?As(Object.keys(l),Object.keys(u)):![s,a].every(f=>x.primitive(f)&&x.defined(f))&&(o==="added"?!x.defined(s)&&x.defined(a):x.defined(s)&&!x.defined(a))}function Yn(e,t,{key:n}={}){let r=Ce(e,n),o=Ce(t,n);if(!Br(r,o))throw new TypeError("Inputs have different types");if(!Ws(r,o))throw new TypeError("Inputs don't have length");return[r,o].every(x.plainObject)&&(r=Object.keys(r),o=Object.keys(o)),[r,o]}function qn(e){return([t,n])=>x.array(e)?re(e,n)||e.some(r=>re(r,n)||x.array(n)&&Sn(n)(r)):x.plainObject(e)&&e[t]?!!e[t]&&re(e[t],n):re(e,n)}function As(e,t){return t.some(n=>!e.includes(n))}function Gn(e){return t=>x.array(e)?e.some(n=>re(n,t)||x.array(t)&&Sn(t)(n)):re(e,t)}function lt(e,t){return x.array(e)?e.some(n=>re(n,t)):re(e,t)}function Sn(e){return t=>e.some(n=>re(n,t))}function Br(...e){return e.every(x.array)||e.every(x.number)||e.every(x.plainObject)||e.every(x.string)}function Ce(e,t){return x.plainObject(e)||x.array(e)?x.string(t)?t.split(".").reduce((r,o)=>r&&r[o],e):x.number(t)?e[t]:e:e}function Rt(e,t){if([e,t].some(x.nullOrUndefined))throw new Error("Missing required parameters");if(![e,t].every(f=>x.plainObject(f)||x.array(f)))throw new Error("Expected plain objects or array");return{added:(f,c)=>{try{return Un(e,t,{key:f,type:"added",value:c})}catch{return!1}},changed:(f,c,d)=>{try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(c),S=x.defined(d);if(v||S){const y=S?lt(d,p):!lt(c,p),m=lt(c,h);return y&&m}return[p,h].every(x.array)||[p,h].every(x.plainObject)?!re(p,h):p!==h}catch{return!1}},changedFrom:(f,c,d)=>{if(!x.defined(f))return!1;try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(d);return lt(c,p)&&(v?lt(d,h):!v)}catch{return!1}},decreased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"decreased"})}catch{return!1}},emptied:f=>{try{const[c,d]=Yn(e,t,{key:f});return!!c.length&&!d.length}catch{return!1}},filled:f=>{try{const[c,d]=Yn(e,t,{key:f});return!c.length&&!!d.length}catch{return!1}},increased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"increased"})}catch{return!1}},removed:(f,c)=>{try{return Un(e,t,{key:f,type:"removed",value:c})}catch{return!1}}}}var Xt,Vn;function _s(){if(Vn)return Xt;Vn=1;var e=new Error("Element already at target scroll position"),t=new Error("Scroll cancelled"),n=Math.min,r=Date.now;Xt={left:o("scrollLeft"),top:o("scrollTop")};function o(a){return function(u,f,c,d){c=c||{},typeof c=="function"&&(d=c,c={}),typeof d!="function"&&(d=s);var p=r(),h=u[a],v=c.ease||i,S=isNaN(c.duration)?350:+c.duration,y=!1;return h===f?d(e,u[a]):requestAnimationFrame(E),m;function m(){y=!0}function E(M){if(y)return d(t,u[a]);var C=r(),O=n(1,(C-p)/S),D=v(O);u[a]=D*(f-h)+h,O<1?requestAnimationFrame(E):requestAnimationFrame(function(){d(null,u[a])})}}}function i(a){return .5*(1-Math.cos(Math.PI*a))}function s(){}return Xt}var Fs=_s();const js=gt(Fs);var It={exports:{}},Bs=It.exports,Kn;function Ls(){return Kn||(Kn=1,(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Bs,function(){function t(r){var o=getComputedStyle(r,null).getPropertyValue("overflow");return o.indexOf("scroll")>-1||o.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var o=r.parentNode;o.parentNode;){if(t(o))return o;o=o.parentNode}return document.scrollingElement||document.documentElement}}return n})})(It)),It.exports}var $s=Ls();const Lr=gt($s);var Qt,Zn;function Hs(){if(Zn)return Qt;Zn=1;var e=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},t=function(r,o){return r+n(o)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(t,""):e(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,Qt=n,Qt}var zs=Hs();const Jn=gt(zs);var en,Xn;function Us(){if(Xn)return en;Xn=1;var e=function(m){return t(m)&&!n(m)};function t(y){return!!y&&typeof y=="object"}function n(y){var m=Object.prototype.toString.call(y);return m==="[object RegExp]"||m==="[object Date]"||i(y)}var r=typeof Symbol=="function"&&Symbol.for,o=r?Symbol.for("react.element"):60103;function i(y){return y.$$typeof===o}function s(y){return Array.isArray(y)?[]:{}}function a(y,m){return m.clone!==!1&&m.isMergeableObject(y)?v(s(y),y,m):y}function l(y,m,E){return y.concat(m).map(function(M){return a(M,E)})}function u(y,m){if(!m.customMerge)return v;var E=m.customMerge(y);return typeof E=="function"?E:v}function f(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(m){return Object.propertyIsEnumerable.call(y,m)}):[]}function c(y){return Object.keys(y).concat(f(y))}function d(y,m){try{return m in y}catch{return!1}}function p(y,m){return d(y,m)&&!(Object.hasOwnProperty.call(y,m)&&Object.propertyIsEnumerable.call(y,m))}function h(y,m,E){var M={};return E.isMergeableObject(y)&&c(y).forEach(function(C){M[C]=a(y[C],E)}),c(m).forEach(function(C){p(y,C)||(d(y,C)&&E.isMergeableObject(m[C])?M[C]=u(C,E)(y[C],m[C],E):M[C]=a(m[C],E))}),M}function v(y,m,E){E=E||{},E.arrayMerge=E.arrayMerge||l,E.isMergeableObject=E.isMergeableObject||e,E.cloneUnlessOtherwiseSpecified=a;var M=Array.isArray(m),C=Array.isArray(y),O=M===C;return O?M?E.arrayMerge(y,m,E):h(y,m,E):a(m,E)}v.all=function(m,E){if(!Array.isArray(m))throw new Error("first argument should be an array");return m.reduce(function(M,C){return v(M,C,E)},{})};var S=v;return en=S,en}var Ys=Us();const ve=gt(Ys);var tn={exports:{}},nn,Qn;function qs(){if(Qn)return nn;Qn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return nn=e,nn}var rn,er;function Gs(){if(er)return rn;er=1;var e=qs();function t(){}function n(){}return n.resetWarningCache=t,rn=function(){function r(s,a,l,u,f,c){if(c!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},rn}var tr;function Vs(){return tr||(tr=1,tn.exports=Gs()()),tn.exports}var Ks=Vs();const T=gt(Ks);var wt=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",Zs=(function(){for(var e=["Edge","Trident","Firefox"],t=0;t=0)return 1;return 0})();function Js(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}function Xs(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},Zs))}}var Qs=wt&&window.Promise,ea=Qs?Js:Xs;function $r(e){var t={};return e&&t.toString.call(e)==="[object Function]"}function Ye(e,t){if(e.nodeType!==1)return[];var n=e.ownerDocument.defaultView,r=n.getComputedStyle(e,null);return t?r[t]:r}function En(e){return e.nodeName==="HTML"?e:e.parentNode||e.host}function Ot(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=Ye(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:Ot(En(e))}function Hr(e){return e&&e.referenceNode?e.referenceNode:e}var nr=wt&&!!(window.MSInputMethodContext&&document.documentMode),rr=wt&&/MSIE 10/.test(navigator.userAgent);function nt(e){return e===11?nr:e===10?rr:nr||rr}function Je(e){if(!e)return document.documentElement;for(var t=nt(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?e?e.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&Ye(n,"position")==="static"?Je(n):n}function ta(e){var t=e.nodeName;return t==="BODY"?!1:t==="HTML"||Je(e.firstElementChild)===e}function hn(e){return e.parentNode!==null?hn(e.parentNode):e}function At(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var s=i.commonAncestorContainer;if(e!==s&&t!==s||r.contains(o))return ta(s)?s:Je(s);var a=hn(e);return a.host?At(a.host,t):At(e,hn(t).host)}function Xe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=t==="top"?"scrollTop":"scrollLeft",r=e.nodeName;if(r==="BODY"||r==="HTML"){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function na(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=Xe(t,"top"),o=Xe(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function or(e,t){var n=t==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(e["border"+n+"Width"])+parseFloat(e["border"+r+"Width"])}function ir(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],nt(10)?parseInt(n["offset"+e])+parseInt(r["margin"+(e==="Height"?"Top":"Left")])+parseInt(r["margin"+(e==="Height"?"Bottom":"Right")]):0)}function zr(e){var t=e.body,n=e.documentElement,r=nt(10)&&getComputedStyle(n);return{height:ir("Height",t,n,r),width:ir("Width",t,n,r)}}var ra=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},oa=(function(){function e(t,n){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=nt(10),o=t.nodeName==="HTML",i=mn(e),s=mn(t),a=Ot(e),l=Ye(t),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(s.top=Math.max(s.top,0),s.left=Math.max(s.left,0));var c=je({top:i.top-s.top-u,left:i.left-s.left-f,width:i.width,height:i.height});if(c.marginTop=0,c.marginLeft=0,!r&&o){var d=parseFloat(l.marginTop),p=parseFloat(l.marginLeft);c.top-=u-d,c.bottom-=u-d,c.left-=f-p,c.right-=f-p,c.marginTop=d,c.marginLeft=p}return(r&&!n?t.contains(a):t===a&&a.nodeName!=="BODY")&&(c=na(c,t)),c}function ia(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.ownerDocument.documentElement,r=kn(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),s=t?0:Xe(n),a=t?0:Xe(n,"left"),l={top:s-r.top+r.marginTop,left:a-r.left+r.marginLeft,width:o,height:i};return je(l)}function Ur(e){var t=e.nodeName;if(t==="BODY"||t==="HTML")return!1;if(Ye(e,"position")==="fixed")return!0;var n=En(e);return n?Ur(n):!1}function Yr(e){if(!e||!e.parentElement||nt())return document.documentElement;for(var t=e.parentElement;t&&Ye(t,"transform")==="none";)t=t.parentElement;return t||document.documentElement}function Cn(e,t,n,r){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},s=o?Yr(e):At(e,Hr(t));if(r==="viewport")i=ia(s,o);else{var a=void 0;r==="scrollParent"?(a=Ot(En(t)),a.nodeName==="BODY"&&(a=e.ownerDocument.documentElement)):r==="window"?a=e.ownerDocument.documentElement:a=r;var l=kn(a,s,o);if(a.nodeName==="HTML"&&!Ur(s)){var u=zr(e.ownerDocument),f=u.height,c=u.width;i.top+=l.top-l.marginTop,i.bottom=f+l.top,i.left+=l.left-l.marginLeft,i.right=c+l.left}else i=l}n=n||0;var d=typeof n=="number";return i.left+=d?n:n.left||0,i.top+=d?n:n.top||0,i.right-=d?n:n.right||0,i.bottom-=d?n:n.bottom||0,i}function sa(e){var t=e.width,n=e.height;return t*n}function qr(e,t,n,r,o){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(e.indexOf("auto")===-1)return e;var s=Cn(n,r,i,o),a={top:{width:s.width,height:t.top-s.top},right:{width:s.right-t.right,height:s.height},bottom:{width:s.width,height:s.bottom-t.bottom},left:{width:t.left-s.left,height:s.height}},l=Object.keys(a).map(function(d){return he({key:d},a[d],{area:sa(a[d])})}).sort(function(d,p){return p.area-d.area}),u=l.filter(function(d){var p=d.width,h=d.height;return p>=n.clientWidth&&h>=n.clientHeight}),f=u.length>0?u[0].key:l[0].key,c=e.split("-")[1];return f+(c?"-"+c:"")}function Gr(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o=r?Yr(t):At(t,Hr(n));return kn(n,o,r)}function Vr(e){var t=e.ownerDocument.defaultView,n=t.getComputedStyle(e),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),o=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:e.offsetWidth+o,height:e.offsetHeight+r};return i}function _t(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(n){return t[n]})}function Kr(e,t,n){n=n.split("-")[0];var r=Vr(e),o={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,s=i?"top":"left",a=i?"left":"top",l=i?"height":"width",u=i?"width":"height";return o[s]=t[s]+t[l]/2-r[l]/2,n===a?o[a]=t[a]-r[u]:o[a]=t[_t(a)],o}function St(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function aa(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(o){return o[t]===n});var r=St(e,function(o){return o[t]===n});return e.indexOf(r)}function Zr(e,t,n){var r=n===void 0?e:e.slice(0,aa(e,"name",n));return r.forEach(function(o){o.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=o.function||o.fn;o.enabled&&$r(i)&&(t.offsets.popper=je(t.offsets.popper),t.offsets.reference=je(t.offsets.reference),t=i(t,o))}),t}function la(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=Gr(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=qr(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=Kr(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=Zr(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function Jr(e,t){return e.some(function(n){var r=n.name,o=n.enabled;return o&&r===t})}function Tn(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),r=0;rs[p]&&(e.offsets.popper[c]+=a[c]+h-s[p]),e.offsets.popper=je(e.offsets.popper);var v=a[c]+a[u]/2-h/2,S=Ye(e.instance.popper),y=parseFloat(S["margin"+f]),m=parseFloat(S["border"+f+"Width"]),E=v-e.offsets.popper[c]-y-m;return E=Math.max(Math.min(s[u]-h,E),0),e.arrowElement=r,e.offsets.arrow=(n={},Qe(n,c,Math.round(E)),Qe(n,d,""),n),e}function Oa(e){return e==="end"?"start":e==="start"?"end":e}var to=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],on=to.slice(3);function sr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=on.indexOf(e),r=on.slice(n+1).concat(on.slice(0,n));return t?r.reverse():r}var sn={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function Sa(e,t){if(Jr(e.instance.modifiers,"inner")||e.flipped&&e.placement===e.originalPlacement)return e;var n=Cn(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),r=e.placement.split("-")[0],o=_t(r),i=e.placement.split("-")[1]||"",s=[];switch(t.behavior){case sn.FLIP:s=[r,o];break;case sn.CLOCKWISE:s=sr(r);break;case sn.COUNTERCLOCKWISE:s=sr(r,!0);break;default:s=t.behavior}return s.forEach(function(a,l){if(r!==a||s.length===l+1)return e;r=e.placement.split("-")[0],o=_t(r);var u=e.offsets.popper,f=e.offsets.reference,c=Math.floor,d=r==="left"&&c(u.right)>c(f.left)||r==="right"&&c(u.left)c(f.top)||r==="bottom"&&c(u.top)c(n.right),v=c(u.top)c(n.bottom),y=r==="left"&&p||r==="right"&&h||r==="top"&&v||r==="bottom"&&S,m=["top","bottom"].indexOf(r)!==-1,E=!!t.flipVariations&&(m&&i==="start"&&p||m&&i==="end"&&h||!m&&i==="start"&&v||!m&&i==="end"&&S),M=!!t.flipVariationsByContent&&(m&&i==="start"&&h||m&&i==="end"&&p||!m&&i==="start"&&S||!m&&i==="end"&&v),C=E||M;(d||y||C)&&(e.flipped=!0,(d||y)&&(r=s[l+1]),C&&(i=Oa(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=he({},e.offsets.popper,Kr(e.instance.popper,e.offsets.reference,e.placement)),e=Zr(e.instance.modifiers,e,"flip"))}),e}function Ea(e){var t=e.offsets,n=t.popper,r=t.reference,o=e.placement.split("-")[0],i=Math.floor,s=["top","bottom"].indexOf(o)!==-1,a=s?"right":"bottom",l=s?"left":"top",u=s?"width":"height";return n[a]i(r[a])&&(e.offsets.popper[l]=i(r[a])),e}function ka(e,t,n,r){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+o[1],s=o[2];if(!i)return e;if(s.indexOf("%")===0){var a=void 0;switch(s){case"%p":a=n;break;case"%":case"%r":default:a=r}var l=je(a);return l[t]/100*i}else if(s==="vh"||s==="vw"){var u=void 0;return s==="vh"?u=Math.max(document.documentElement.clientHeight,window.innerHeight||0):u=Math.max(document.documentElement.clientWidth,window.innerWidth||0),u/100*i}else return i}function Ca(e,t,n,r){var o=[0,0],i=["right","left"].indexOf(r)!==-1,s=e.split(/(\+|\-)/).map(function(f){return f.trim()}),a=s.indexOf(St(s,function(f){return f.search(/,|\s/)!==-1}));s[a]&&s[a].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=a!==-1?[s.slice(0,a).concat([s[a].split(l)[0]]),[s[a].split(l)[1]].concat(s.slice(a+1))]:[s];return u=u.map(function(f,c){var d=(c===1?!i:i)?"height":"width",p=!1;return f.reduce(function(h,v){return h[h.length-1]===""&&["+","-"].indexOf(v)!==-1?(h[h.length-1]=v,p=!0,h):p?(h[h.length-1]+=v,p=!1,h):h.concat(v)},[]).map(function(h){return ka(h,d,t,n)})}),u.forEach(function(f,c){f.forEach(function(d,p){Mn(d)&&(o[c]+=d*(f[p-1]==="-"?-1:1))})}),o}function Ta(e,t){var n=t.offset,r=e.placement,o=e.offsets,i=o.popper,s=o.reference,a=r.split("-")[0],l=void 0;return Mn(+n)?l=[+n,0]:l=Ca(n,i,s,a),a==="left"?(i.top+=l[0],i.left-=l[1]):a==="right"?(i.top+=l[0],i.left+=l[1]):a==="top"?(i.left+=l[0],i.top-=l[1]):a==="bottom"&&(i.left+=l[0],i.top+=l[1]),e.popper=i,e}function Ma(e,t){var n=t.boundariesElement||Je(e.instance.popper);e.instance.reference===n&&(n=Je(n));var r=Tn("transform"),o=e.instance.popper.style,i=o.top,s=o.left,a=o[r];o.top="",o.left="",o[r]="";var l=Cn(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=s,o[r]=a,t.boundaries=l;var u=t.priority,f=e.offsets.popper,c={primary:function(p){var h=f[p];return f[p]l[p]&&!t.escapeWithReference&&(v=Math.min(f[h],l[p]-(p==="right"?f.width:f.height))),Qe({},h,v)}};return u.forEach(function(d){var p=["left","top"].indexOf(d)!==-1?"primary":"secondary";f=he({},f,c[p](d))}),e.offsets.popper=f,e}function Pa(e){var t=e.placement,n=t.split("-")[0],r=t.split("-")[1];if(r){var o=e.offsets,i=o.reference,s=o.popper,a=["bottom","top"].indexOf(n)!==-1,l=a?"left":"top",u=a?"width":"height",f={start:Qe({},l,i[l]),end:Qe({},l,i[l]+i[u]-s[u])};e.offsets.popper=he({},s,f[r])}return e}function xa(e){if(!eo(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=St(e.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.right2&&arguments[2]!==void 0?arguments[2]:{};ra(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=ea(this.update.bind(this)),this.options=he({},e.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t&&t.jquery?t[0]:t,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(he({},e.Defaults.modifiers,o.modifiers)).forEach(function(s){r.options.modifiers[s]=he({},e.Defaults.modifiers[s]||{},o.modifiers?o.modifiers[s]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(s){return he({name:s},r.options.modifiers[s])}).sort(function(s,a){return s.order-a.order}),this.modifiers.forEach(function(s){s.enabled&&$r(s.onLoad)&&s.onLoad(r.reference,r.popper,r.options,s,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return oa(e,[{key:"update",value:function(){return la.call(this)}},{key:"destroy",value:function(){return ca.call(this)}},{key:"enableEventListeners",value:function(){return fa.call(this)}},{key:"disableEventListeners",value:function(){return pa.call(this)}}]),e})();yt.Utils=(typeof window<"u"?window:global).PopperUtils;yt.placements=to;yt.Defaults=Ia;var Wa=["innerHTML","ownerDocument","style","attributes","nodeValue"],Ra=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Aa=["bigint","boolean","null","number","string","symbol","undefined"];function Lt(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(_a(t))return t}function we(e){return function(t){return Lt(t)===e}}function _a(e){return Ra.includes(e)}function rt(e){return function(t){return typeof t===e}}function Fa(e){return Aa.includes(e)}function g(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(g.array(e))return"Array";if(g.plainFunction(e))return"Function";var t=Lt(e);return t||"Object"}g.array=Array.isArray;g.arrayOf=function(e,t){return!g.array(e)&&!g.function(t)?!1:e.every(function(n){return t(n)})};g.asyncGeneratorFunction=function(e){return Lt(e)==="AsyncGeneratorFunction"};g.asyncFunction=we("AsyncFunction");g.bigint=rt("bigint");g.boolean=function(e){return e===!0||e===!1};g.date=we("Date");g.defined=function(e){return!g.undefined(e)};g.domElement=function(e){return g.object(e)&&!g.plainObject(e)&&e.nodeType===1&&g.string(e.nodeName)&&Wa.every(function(t){return t in e})};g.empty=function(e){return g.string(e)&&e.length===0||g.array(e)&&e.length===0||g.object(e)&&!g.map(e)&&!g.set(e)&&Object.keys(e).length===0||g.set(e)&&e.size===0||g.map(e)&&e.size===0};g.error=we("Error");g.function=rt("function");g.generator=function(e){return g.iterable(e)&&g.function(e.next)&&g.function(e.throw)};g.generatorFunction=we("GeneratorFunction");g.instanceOf=function(e,t){return!e||!t?!1:Object.getPrototypeOf(e)===t.prototype};g.iterable=function(e){return!g.nullOrUndefined(e)&&g.function(e[Symbol.iterator])};g.map=we("Map");g.nan=function(e){return Number.isNaN(e)};g.null=function(e){return e===null};g.nullOrUndefined=function(e){return g.null(e)||g.undefined(e)};g.number=function(e){return rt("number")(e)&&!g.nan(e)};g.numericString=function(e){return g.string(e)&&e.length>0&&!Number.isNaN(Number(e))};g.object=function(e){return!g.nullOrUndefined(e)&&(g.function(e)||typeof e=="object")};g.oneOf=function(e,t){return g.array(e)?e.indexOf(t)>-1:!1};g.plainFunction=we("Function");g.plainObject=function(e){if(Lt(e)!=="Object")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};g.primitive=function(e){return g.null(e)||Fa(typeof e)};g.promise=we("Promise");g.propertyOf=function(e,t,n){if(!g.object(e)||!t)return!1;var r=e[t];return g.function(n)?n(r):g.defined(r)};g.regexp=we("RegExp");g.set=we("Set");g.string=rt("string");g.symbol=rt("symbol");g.undefined=rt("undefined");g.weakMap=we("WeakMap");g.weakSet=we("WeakSet");function no(e){return function(t){return typeof t===e}}var ja=no("function"),Ba=function(e){return e===null},ar=function(e){return Object.prototype.toString.call(e).slice(8,-1)==="RegExp"},lr=function(e){return!La(e)&&!Ba(e)&&(ja(e)||typeof e=="object")},La=no("undefined"),vn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function $a(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=n;r--!==0;)if(!ae(e[r],t[r]))return!1;return!0}function Ha(e,t){if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e.buffer),r=new DataView(t.buffer),o=e.byteLength;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function za(e,t){var n,r,o,i;if(e.size!==t.size)return!1;try{for(var s=vn(e.entries()),a=s.next();!a.done;a=s.next()){var l=a.value;if(!t.has(l[0]))return!1}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}try{for(var u=vn(e.entries()),f=u.next();!f.done;f=u.next()){var l=f.value;if(!ae(l[1],t.get(l[0])))return!1}}catch(c){o={error:c}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}return!0}function Ua(e,t){var n,r;if(e.size!==t.size)return!1;try{for(var o=vn(e.entries()),i=o.next();!i.done;i=o.next()){var s=i.value;if(!t.has(s[0]))return!1}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!0}function ae(e,t){if(e===t)return!0;if(e&&lr(e)&&t&&lr(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return $a(e,t);if(e instanceof Map&&t instanceof Map)return za(e,t);if(e instanceof Set&&t instanceof Set)return Ua(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Ha(e,t);if(ar(e)&&ar(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(var o=n.length;o--!==0;){var i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!ae(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}function Ya(){for(var e=[],t=0;tl);return g.undefined(r)||(u=u&&l===r),g.undefined(i)||(u=u&&a===i),u}function ur(e,t,n){var r=n.key,o=n.type,i=n.value,s=Te(e,r),a=Te(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!g.nullOrUndefined(i)){if(g.defined(l)){if(g.array(l)||g.plainObject(l))return qa(l,u,i)}else return ae(u,i);return!1}return[s,a].every(g.array)?!u.every(Pn(l)):[s,a].every(g.plainObject)?Ga(Object.keys(l),Object.keys(u)):![s,a].every(function(f){return g.primitive(f)&&g.defined(f)})&&(o==="added"?!g.defined(s)&&g.defined(a):g.defined(s)&&!g.defined(a))}function fr(e,t,n){var r=n===void 0?{}:n,o=r.key,i=Te(e,o),s=Te(t,o);if(!ro(i,s))throw new TypeError("Inputs have different types");if(!Ya(i,s))throw new TypeError("Inputs don't have length");return[i,s].every(g.plainObject)&&(i=Object.keys(i),s=Object.keys(s)),[i,s]}function dr(e){return function(t){var n=t[0],r=t[1];return g.array(e)?ae(e,r)||e.some(function(o){return ae(o,r)||g.array(r)&&Pn(r)(o)}):g.plainObject(e)&&e[n]?!!e[n]&&ae(e[n],r):ae(e,r)}}function Ga(e,t){return t.some(function(n){return!e.includes(n)})}function pr(e){return function(t){return g.array(e)?e.some(function(n){return ae(n,t)||g.array(t)&&Pn(t)(n)}):ae(e,t)}}function ct(e,t){return g.array(e)?e.some(function(n){return ae(n,t)}):ae(e,t)}function Pn(e){return function(t){return e.some(function(n){return ae(n,t)})}}function ro(){for(var e=[],t=0;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ja(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function oo(e,t){if(e==null)return{};var n=Ja(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xa(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ne(e)}function Tt(e){var t=Za();return function(){var r=Ft(e),o;if(t){var i=Ft(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Xa(this,o)}}function Qa(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function io(e){var t=Qa(e,"string");return typeof t=="symbol"?t:String(t)}var el={flip:{padding:20},preventOverflow:{padding:10}},tl="The typeValidator argument must be a function with the signature function(props, propName, componentName).",nl="The error message is optional, but must be a string if provided.";function rl(e,t,n,r){return typeof e=="boolean"?e:typeof e=="function"?e(t,n,r):e?!!e:!1}function ol(e,t){return Object.hasOwnProperty.call(e,t)}function il(e,t,n,r){return new Error("Required ".concat(e[t]," `").concat(t,"` was not specified in `").concat(n,"`."))}function sl(e,t){if(typeof e!="function")throw new TypeError(tl);if(t&&typeof t!="string")throw new TypeError(nl)}function mr(e,t,n){return sl(e,n),function(r,o,i){for(var s=arguments.length,a=new Array(s>3?s-3:0),l=3;l3&&arguments[3]!==void 0?arguments[3]:!1;e.addEventListener(t,n,r)}function ll(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;e.removeEventListener(t,n,r)}function cl(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o;o=function(s){n(s),ll(e,t,o)},al(e,t,o,r)}function yr(){}var so=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"componentDidMount",value:function(){Ee()&&(this.node||this.appendNode(),ut||this.renderPortal())}},{key:"componentDidUpdate",value:function(){Ee()&&(ut||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!Ee()||!this.node||(ut||Nt.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var o=this.props,i=o.id,s=o.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),s&&(this.node.style.zIndex=s),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!Ee())return null;var o=this.props,i=o.children,s=o.setRef;if(this.node||this.appendNode(),ut)return Nt.createPortal(i,this.node);var a=Nt.unstable_renderSubtreeIntoContainer(this,i.length>1?w.createElement("div",null,i):i[0],this.node);return s(a),null}},{key:"renderReact16",value:function(){var o=this.props,i=o.hasChildren,s=o.placement,a=o.target;return i?this.renderPortal():a||s==="center"?this.renderPortal():null}},{key:"render",value:function(){return ut?this.renderReact16():null}}]),n})(w.Component);te(so,"propTypes",{children:T.oneOfType([T.element,T.array]),hasChildren:T.bool,id:T.oneOfType([T.string,T.number]),placement:T.string,setRef:T.func.isRequired,target:T.oneOfType([T.object,T.string]),zIndex:T.number});var ao=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"parentStyle",get:function(){var o=this.props,i=o.placement,s=o.styles,a=s.arrow.length,l={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(l.bottom=0,l.left=0,l.right=0,l.height=a):i.startsWith("bottom")?(l.left=0,l.right=0,l.top=0,l.height=a):i.startsWith("left")?(l.right=0,l.top=0,l.bottom=0):i.startsWith("right")&&(l.left=0,l.top=0),l}},{key:"render",value:function(){var o=this.props,i=o.placement,s=o.setArrowRef,a=o.styles,l=a.arrow,u=l.color,f=l.display,c=l.length,d=l.margin,p=l.position,h=l.spread,v={display:f,position:p},S,y=h,m=c;return i.startsWith("top")?(S="0,0 ".concat(y/2,",").concat(m," ").concat(y,",0"),v.bottom=0,v.marginLeft=d,v.marginRight=d):i.startsWith("bottom")?(S="".concat(y,",").concat(m," ").concat(y/2,",0 0,").concat(m),v.top=0,v.marginLeft=d,v.marginRight=d):i.startsWith("left")?(m=h,y=c,S="0,0 ".concat(y,",").concat(m/2," 0,").concat(m),v.right=0,v.marginTop=d,v.marginBottom=d):i.startsWith("right")&&(m=h,y=c,S="".concat(y,",").concat(m," ").concat(y,",0 0,").concat(m/2),v.left=0,v.marginTop=d,v.marginBottom=d),w.createElement("div",{className:"__floater__arrow",style:this.parentStyle},w.createElement("span",{ref:s,style:v},w.createElement("svg",{width:y,height:m,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},w.createElement("polygon",{points:S,fill:u}))))}}]),n})(w.Component);te(ao,"propTypes",{placement:T.string.isRequired,setArrowRef:T.func.isRequired,styles:T.object.isRequired});var ul=["color","height","width"];function lo(e){var t=e.handleClick,n=e.styles,r=n.color,o=n.height,i=n.width,s=oo(n,ul);return w.createElement("button",{"aria-label":"close",onClick:t,style:s,type:"button"},w.createElement("svg",{width:"".concat(i,"px"),height:"".concat(o,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}lo.propTypes={handleClick:T.func.isRequired,styles:T.object.isRequired};function co(e){var t=e.content,n=e.footer,r=e.handleClick,o=e.open,i=e.positionWrapper,s=e.showCloseButton,a=e.title,l=e.styles,u={content:w.isValidElement(t)?t:w.createElement("div",{className:"__floater__content",style:l.content},t)};return a&&(u.title=w.isValidElement(a)?a:w.createElement("div",{className:"__floater__title",style:l.title},a)),n&&(u.footer=w.isValidElement(n)?n:w.createElement("div",{className:"__floater__footer",style:l.footer},n)),(s||i)&&!g.boolean(o)&&(u.close=w.createElement(lo,{styles:l.close,handleClick:r})),w.createElement("div",{className:"__floater__container",style:l.container},u.close,u.title,u.content,u.footer)}co.propTypes={content:T.node.isRequired,footer:T.node,handleClick:T.func.isRequired,open:T.bool,positionWrapper:T.bool.isRequired,showCloseButton:T.bool.isRequired,styles:T.object.isRequired,title:T.node};var uo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"style",get:function(){var o=this.props,i=o.disableAnimation,s=o.component,a=o.placement,l=o.hideArrow,u=o.status,f=o.styles,c=f.arrow.length,d=f.floater,p=f.floaterCentered,h=f.floaterClosing,v=f.floaterOpening,S=f.floaterWithAnimation,y=f.floaterWithComponent,m={};return l||(a.startsWith("top")?m.padding="0 0 ".concat(c,"px"):a.startsWith("bottom")?m.padding="".concat(c,"px 0 0"):a.startsWith("left")?m.padding="0 ".concat(c,"px 0 0"):a.startsWith("right")&&(m.padding="0 0 0 ".concat(c,"px"))),[z.OPENING,z.OPEN].indexOf(u)!==-1&&(m=K(K({},m),v)),u===z.CLOSING&&(m=K(K({},m),h)),u===z.OPEN&&!i&&(m=K(K({},m),S)),a==="center"&&(m=K(K({},m),p)),s&&(m=K(K({},m),y)),K(K({},d),m)}},{key:"render",value:function(){var o=this.props,i=o.component,s=o.handleClick,a=o.hideArrow,l=o.setFloaterRef,u=o.status,f={},c=["__floater"];return i?w.isValidElement(i)?f.content=w.cloneElement(i,{closeFn:s}):f.content=i({closeFn:s}):f.content=w.createElement(co,this.props),u===z.OPEN&&c.push("__floater__open"),a||(f.arrow=w.createElement(ao,this.props)),w.createElement("div",{ref:l,className:c.join(" "),style:this.style},w.createElement("div",{className:"__floater__body"},f.content,f.arrow))}}]),n})(w.Component);te(uo,"propTypes",{component:T.oneOfType([T.func,T.element]),content:T.node,disableAnimation:T.bool.isRequired,footer:T.node,handleClick:T.func.isRequired,hideArrow:T.bool.isRequired,open:T.bool,placement:T.string.isRequired,positionWrapper:T.bool.isRequired,setArrowRef:T.func.isRequired,setFloaterRef:T.func.isRequired,showCloseButton:T.bool,status:T.string.isRequired,styles:T.object.isRequired,title:T.node});var fo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"render",value:function(){var o=this.props,i=o.children,s=o.handleClick,a=o.handleMouseEnter,l=o.handleMouseLeave,u=o.setChildRef,f=o.setWrapperRef,c=o.style,d=o.styles,p;if(i)if(w.Children.count(i)===1)if(!w.isValidElement(i))p=w.createElement("span",null,i);else{var h=g.function(i.type)?"innerRef":"ref";p=w.cloneElement(w.Children.only(i),te({},h,u))}else p=i;return p?w.createElement("span",{ref:f,style:K(K({},d),c),onClick:s,onMouseEnter:a,onMouseLeave:l},p):null}}]),n})(w.Component);te(fo,"propTypes",{children:T.node,handleClick:T.func.isRequired,handleMouseEnter:T.func.isRequired,handleMouseLeave:T.func.isRequired,setChildRef:T.func.isRequired,setWrapperRef:T.func.isRequired,style:T.object,styles:T.object.isRequired});var fl={zIndex:100};function dl(e){var t=ve(fl,e.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:t.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:t.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:t}}var pl=["arrow","flip","offset"],hl=["position","top","right","bottom","left"],xn=(function(e){Ct(n,e);var t=Tt(n);function n(r){var o;return Et(this,n),o=t.call(this,r),te(Ne(o),"setArrowRef",function(i){o.arrowRef=i}),te(Ne(o),"setChildRef",function(i){o.childRef=i}),te(Ne(o),"setFloaterRef",function(i){o.floaterRef=i}),te(Ne(o),"setWrapperRef",function(i){o.wrapperRef=i}),te(Ne(o),"handleTransitionEnd",function(){var i=o.state.status,s=o.props.callback;o.wrapperPopper&&o.wrapperPopper.instance.update(),o.setState({status:i===z.OPENING?z.OPEN:z.IDLE},function(){var a=o.state.status;s(a===z.OPEN?"open":"close",o.props)})}),te(Ne(o),"handleClick",function(){var i=o.props,s=i.event,a=i.open;if(!g.boolean(a)){var l=o.state,u=l.positionWrapper,f=l.status;(o.event==="click"||o.event==="hover"&&u)&&(xt({title:"click",data:[{event:s,status:f===z.OPEN?"closing":"opening"}],debug:o.debug}),o.toggle())}}),te(Ne(o),"handleMouseEnter",function(){var i=o.props,s=i.event,a=i.open;if(!(g.boolean(a)||an())){var l=o.state.status;o.event==="hover"&&l===z.IDLE&&(xt({title:"mouseEnter",data:[{key:"originalEvent",value:s}],debug:o.debug}),clearTimeout(o.eventDelayTimeout),o.toggle())}}),te(Ne(o),"handleMouseLeave",function(){var i=o.props,s=i.event,a=i.eventDelay,l=i.open;if(!(g.boolean(l)||an())){var u=o.state,f=u.status,c=u.positionWrapper;o.event==="hover"&&(xt({title:"mouseLeave",data:[{key:"originalEvent",value:s}],debug:o.debug}),a?[z.OPENING,z.OPEN].indexOf(f)!==-1&&!c&&!o.eventDelayTimeout&&(o.eventDelayTimeout=setTimeout(function(){delete o.eventDelayTimeout,o.toggle()},a*1e3)):o.toggle(z.IDLE))}}),o.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:z.INIT,statusWrapper:z.INIT},o._isMounted=!1,o.hasMounted=!1,Ee()&&window.addEventListener("load",function(){o.popper&&o.popper.instance.update(),o.wrapperPopper&&o.wrapperPopper.instance.update()}),o}return kt(n,[{key:"componentDidMount",value:function(){if(Ee()){var o=this.state.positionWrapper,i=this.props,s=i.children,a=i.open,l=i.target;this._isMounted=!0,xt({title:"init",data:{hasChildren:!!s,hasTarget:!!l,isControlled:g.boolean(a),positionWrapper:o,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!s&&l&&g.boolean(a)}}},{key:"componentDidUpdate",value:function(o,i){if(Ee()){var s=this.props,a=s.autoOpen,l=s.open,u=s.target,f=s.wrapperOptions,c=Va(i,this.state),d=c.changedFrom,p=c.changed;if(o.open!==l){var h;g.boolean(l)&&(h=l?z.OPENING:z.CLOSING),this.toggle(h)}(o.wrapperOptions.position!==f.position||o.target!==u)&&this.changeWrapperPosition(this.props),p("status",z.IDLE)&&l?this.toggle(z.OPEN):d("status",z.INIT,z.IDLE)&&a&&this.toggle(z.OPEN),this.popper&&p("status",z.OPENING)&&this.popper.instance.update(),this.floaterRef&&(p("status",z.OPENING)||p("status",z.CLOSING))&&cl(this.floaterRef,"transitionend",this.handleTransitionEnd),p("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){Ee()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,s=this.state.positionWrapper,a=this.props,l=a.disableFlip,u=a.getPopper,f=a.hideArrow,c=a.offset,d=a.placement,p=a.wrapperOptions,h=d==="top"||d==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(d==="center")this.setState({status:z.IDLE});else if(i&&this.floaterRef){var v=this.options,S=v.arrow,y=v.flip,m=v.offset,E=oo(v,pl);new yt(i,this.floaterRef,{placement:d,modifiers:K({arrow:K({enabled:!f,element:this.arrowRef},S),flip:K({enabled:!l,behavior:h},y),offset:K({offset:"0, ".concat(c,"px")},m)},E),onCreate:function(O){var D;if(o.popper=O,!((D=o.floaterRef)!==null&&D!==void 0&&D.isConnected)){o.setState({needsUpdate:!0});return}u(O,"floater"),o._isMounted&&o.setState({currentPlacement:O.placement,status:z.IDLE}),d!==O.placement&&setTimeout(function(){O.instance.update()},1)},onUpdate:function(O){o.popper=O;var D=o.state.currentPlacement;o._isMounted&&O.placement!==D&&o.setState({currentPlacement:O.placement})}})}if(s){var M=g.undefined(p.offset)?0:p.offset;new yt(this.target,this.wrapperRef,{placement:p.placement||d,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(M,"px")},flip:{enabled:!1}},onCreate:function(O){o.wrapperPopper=O,o._isMounted&&o.setState({statusWrapper:z.IDLE}),u(O,"wrapper"),d!==O.placement&&setTimeout(function(){O.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var o=this;this.floaterRefInterval=setInterval(function(){var i;(i=o.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(o.floaterRefInterval),o.setState({needsUpdate:!1}),o.initPopper())},50)}},{key:"changeWrapperPosition",value:function(o){var i=o.target,s=o.wrapperOptions;this.setState({positionWrapper:s.position&&!!i})}},{key:"toggle",value:function(o){var i=this.state.status,s=i===z.OPEN?z.CLOSING:z.OPENING;g.undefined(o)||(s=o),this.setState({status:s})}},{key:"debug",get:function(){var o=this.props.debug;return o||Ee()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var o=this.props,i=o.disableHoverToClick,s=o.event;return s==="hover"&&an()&&!i?"click":s}},{key:"options",get:function(){var o=this.props.options;return ve(el,o||{})}},{key:"styles",get:function(){var o=this,i=this.state,s=i.status,a=i.positionWrapper,l=i.statusWrapper,u=this.props.styles,f=ve(dl(u),u);if(a){var c;[z.IDLE].indexOf(s)===-1||[z.IDLE].indexOf(l)===-1?c=f.wrapperPosition:c=this.wrapperPopper.styles,f.wrapper=K(K({},f.wrapper),c)}if(this.target){var d=window.getComputedStyle(this.target);this.wrapperStyles?f.wrapper=K(K({},f.wrapper),this.wrapperStyles):["relative","static"].indexOf(d.position)===-1&&(this.wrapperStyles={},a||(hl.forEach(function(p){o.wrapperStyles[p]=d[p]}),f.wrapper=K(K({},f.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return f}},{key:"target",get:function(){if(!Ee())return null;var o=this.props.target;return o?g.domElement(o)?o:document.querySelector(o):this.childRef||this.wrapperRef}},{key:"render",value:function(){var o=this.state,i=o.currentPlacement,s=o.positionWrapper,a=o.status,l=this.props,u=l.children,f=l.component,c=l.content,d=l.disableAnimation,p=l.footer,h=l.hideArrow,v=l.id,S=l.open,y=l.showCloseButton,m=l.style,E=l.target,M=l.title,C=w.createElement(fo,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:m,styles:this.styles.wrapper},u),O={};return s?O.wrapperInPortal=C:O.wrapperAsChildren=C,w.createElement("span",null,w.createElement(so,{hasChildren:!!u,id:v,placement:i,setRef:this.setFloaterRef,target:E,zIndex:this.styles.options.zIndex},w.createElement(uo,{component:f,content:c,disableAnimation:d,footer:p,handleClick:this.handleClick,hideArrow:h||i==="center",open:S,placement:i,positionWrapper:s,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:y,status:a,styles:this.styles,title:M}),O.wrapperInPortal),O.wrapperAsChildren)}}]),n})(w.Component);te(xn,"propTypes",{autoOpen:T.bool,callback:T.func,children:T.node,component:mr(T.oneOfType([T.func,T.element]),function(e){return!e.content}),content:mr(T.node,function(e){return!e.component}),debug:T.bool,disableAnimation:T.bool,disableFlip:T.bool,disableHoverToClick:T.bool,event:T.oneOf(["hover","click"]),eventDelay:T.number,footer:T.node,getPopper:T.func,hideArrow:T.bool,id:T.oneOfType([T.string,T.number]),offset:T.number,open:T.bool,options:T.object,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:T.bool,style:T.object,styles:T.object,target:T.oneOfType([T.object,T.string]),title:T.node,wrapperOptions:T.shape({offset:T.number,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:T.bool})});te(xn,"defaultProps",{autoOpen:!1,callback:yr,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:yr,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var ml=Object.defineProperty,yl=(e,t,n)=>t in e?ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t,n)=>yl(e,typeof t!="symbol"?t+"":t,n),q={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},ye={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},A={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},L={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function _e(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function po(e){return e?e.getBoundingClientRect():null}function vl(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,s)=>i-s),o=Math.floor(r.length/2);return r.length%2===0?(r[o-1]+r[o])/2:r[o]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function De(e){if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function gl(e){return!e||e.nodeType!==1?null:getComputedStyle(e)}function vt(e,t,n){if(!e)return $e();const r=Lr(e);if(r){if(r.isSameNode($e()))return n?document:$e();if(!(r.scrollHeight>r.offsetHeight)&&!t)return r.style.overflow="initial",$e()}return r}function $t(e,t){if(!e)return!1;const n=vt(e,t);return n?!n.isSameNode($e()):!1}function bl(e){return e.offsetParent!==document.body}function et(e,t="fixed"){if(!e||!(e instanceof HTMLElement))return!1;const{nodeName:n}=e,r=gl(e);return n==="BODY"||n==="HTML"?!1:r&&r.position===t?!0:e.parentNode?et(e.parentNode,t):!1}function wl(e){var t;if(!e)return!1;let n=e;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:o}=getComputedStyle(n);if(r==="none"||o==="hidden")return!1}n=(t=n.parentElement)!=null?t:null}return!0}function Ol(e,t,n){var r,o,i;const s=po(e),a=vt(e,n),l=$t(e,n),u=et(e);let f=0,c=(r=s?.top)!=null?r:0;if(l&&u){const d=(o=e?.offsetTop)!=null?o:0,p=(i=a?.scrollTop)!=null?i:0;c=d-p}else a instanceof HTMLElement&&(f=a.scrollTop,!l&&!et(e)&&(c+=f),a.isSameNode($e())||(c+=$e().scrollTop));return Math.floor(c-t)}function Sl(e,t,n){var r;if(!e)return 0;const{offsetTop:o=0,scrollTop:i=0}=(r=Lr(e))!=null?r:{};let s=e.getBoundingClientRect().top+i;o&&($t(e,n)||bl(e))&&(s-=o);const a=Math.floor(s-t);return a<0?0:a}function $e(){var e;return(e=document.scrollingElement)!=null?e:document.documentElement}function El(e,t){const{duration:n,element:r}=t;return new Promise((o,i)=>{const{scrollTop:s}=r,a=e>s?e-s:s-e;js.top(r,e,{duration:a<100?50:n},l=>l&&l.message!=="Element already at target scroll position"?i(l):o())})}var ft=Dt.createPortal!==void 0;function ho(e=navigator.userAgent){let t=e;return typeof window>"u"?t="node":document.documentMode?t="ie":/Edge/.test(e)?t="edge":window.opera||e.includes(" OPR/")?t="opera":typeof window.InstallTrigger<"u"?t="firefox":window.chrome?t="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(e)&&(t="safari"),t}function Wt(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function ke(e,t={}){const{defaultValue:n,step:r,steps:o}=t;let i=Jn(e);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&o&&(i=i.replace("{step}",r.toString()).replace("{steps}",o.toString()));else if(b.isValidElement(e)&&!Object.values(e.props).length&&Wt(e.type)==="function"){const s=e.type({});i=ke(s,t)}else i=Jn(n);return i}function kl(e,t){return!x.plainObject(e)||!x.array(t)?!1:Object.keys(e).every(n=>t.includes(n))}function Cl(e){const t=/^#?([\da-f])([\da-f])([\da-f])$/i,n=e.replace(t,(o,i,s,a)=>i+i+s+s+a+a),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function vr(e){return e.disableBeacon||e.placement==="center"}function gr(){return!["chrome","safari","firefox","opera"].includes(ho())}function Ue({data:e,debug:t=!1,title:n,warn:r=!1}){const o=r?console.warn||console.error:console.log;t&&(n&&e?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(e)?e.forEach(i=>{x.plainObject(i)&&i.key?o.apply(console,[i.key,i.value]):o.apply(console,[i])}):o.apply(console,[e]),console.groupEnd()):console.error("Missing title or data props"))}function Tl(e){return Object.keys(e)}function mo(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function Ml(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function bn(e,t,n){const r=i=>i.replace("{step}",String(t)).replace("{steps}",String(n));if(Wt(e)==="string")return r(e);if(!b.isValidElement(e))return e;const{children:o}=e.props;if(Wt(o)==="string"&&o.includes("{step}"))return b.cloneElement(e,{children:r(o)});if(Array.isArray(o))return b.cloneElement(e,{children:o.map(i=>typeof i=="string"?r(i):bn(i,t,n))});if(Wt(e.type)==="function"&&!Object.values(e.props).length){const i=e.type({});return bn(i,t,n)}return e}function Pl(e){const{isFirstStep:t,lifecycle:n,previousLifecycle:r,scrollToFirstStep:o,step:i,target:s}=e;return!i.disableScrolling&&(!t||o||n===A.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!et(s))&&r!==n&&[A.BEACON,A.TOOLTIP].includes(n)}var xl={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},yo={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Nl={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:yo,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},Dl={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},Il={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},dt={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},br={borderRadius:4,position:"absolute"};function Wl(e,t){var n,r,o,i,s;const{floaterProps:a,styles:l}=e,u=ve((n=t.floaterProps)!=null?n:{},a??{}),f=ve(l??{},(r=t.styles)!=null?r:{}),c=ve(Il,f.options||{}),d=t.placement==="center"||t.disableBeacon;let{width:p}=c;window.innerWidth>480&&(p=380),"width"in c&&(p=typeof c.width=="number"&&window.innerWidthvo(n,t)):(Ue({title:"validateSteps",data:"steps must be an array",warn:!0,debug:t}),!1)}var go={action:"init",controlled:!1,index:0,lifecycle:A.INIT,origin:null,size:0,status:L.IDLE},Or=Tl(mo(go,"controlled","size")),Al=class{constructor(e){N(this,"beaconPopper"),N(this,"tooltipPopper"),N(this,"data",new Map),N(this,"listener"),N(this,"store",new Map),N(this,"addListener",o=>{this.listener=o}),N(this,"setSteps",o=>{const{size:i,status:s}=this.getState(),a={size:o.length,status:s};this.data.set("steps",o),s===L.WAITING&&!i&&o.length&&(a.status=L.RUNNING),this.setState(a)}),N(this,"getPopper",o=>o==="beacon"?this.beaconPopper:this.tooltipPopper),N(this,"setPopper",(o,i)=>{o==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),N(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),N(this,"close",(o=null)=>{const{index:i,status:s}=this.getState();s===L.RUNNING&&this.setState({...this.getNextState({action:q.CLOSE,index:i+1,origin:o})})}),N(this,"go",o=>{const{controlled:i,status:s}=this.getState();if(i||s!==L.RUNNING)return;const a=this.getSteps()[o];this.setState({...this.getNextState({action:q.GO,index:o}),status:a?s:L.FINISHED})}),N(this,"info",()=>this.getState()),N(this,"next",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState(this.getNextState({action:q.NEXT,index:o+1}))}),N(this,"open",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({...this.getNextState({action:q.UPDATE,lifecycle:A.TOOLTIP})})}),N(this,"prev",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState({...this.getNextState({action:q.PREV,index:o-1})})}),N(this,"reset",(o=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:q.RESET,index:0}),status:o?L.RUNNING:L.READY})}),N(this,"skip",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({action:q.SKIP,lifecycle:A.INIT,status:L.SKIPPED})}),N(this,"start",o=>{const{index:i,size:s}=this.getState();this.setState({...this.getNextState({action:q.START,index:x.number(o)?o:i},!0),status:s?L.RUNNING:L.WAITING})}),N(this,"stop",(o=!1)=>{const{index:i,status:s}=this.getState();[L.FINISHED,L.SKIPPED].includes(s)||this.setState({...this.getNextState({action:q.STOP,index:i+(o?1:0)}),status:L.PAUSED})}),N(this,"update",o=>{var i,s;if(!kl(o,Or))throw new Error(`State is not valid. Valid keys: ${Or.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...o,action:(i=o.action)!=null?i:q.UPDATE,origin:(s=o.origin)!=null?s:null},!0)})});const{continuous:t=!1,stepIndex:n,steps:r=[]}=e??{};this.setState({action:q.INIT,controlled:x.number(n),continuous:t,index:x.number(n)?n:0,lifecycle:A.INIT,origin:null,status:r.length?L.READY:L.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...go}}getNextState(e,t=!1){var n,r,o,i,s;const{action:a,controlled:l,index:u,size:f,status:c}=this.getState(),d=x.number(e.index)?e.index:u,p=l&&!t?u:Math.min(Math.max(d,0),f);return{action:(n=e.action)!=null?n:a,controlled:l,index:p,lifecycle:(r=e.lifecycle)!=null?r:A.INIT,origin:(o=e.origin)!=null?o:null,size:(i=e.size)!=null?i:f,status:p===f?L.FINISHED:(s=e.status)!=null?s:c}}getSteps(){const e=this.data.get("steps");return Array.isArray(e)?e:[]}hasUpdatedState(e){const t=JSON.stringify(e),n=JSON.stringify(this.getState());return t!==n}setState(e,t=!1){const n=this.getState(),{action:r,index:o,lifecycle:i,origin:s=null,size:a,status:l}={...n,...e};this.store.set("action",r),this.store.set("index",o),this.store.set("lifecycle",i),this.store.set("origin",s),this.store.set("size",a),this.store.set("status",l),t&&(this.store.set("controlled",e.controlled),this.store.set("continuous",e.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function _l(e){return new Al(e)}function Fl({styles:e}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:e})}var jl=Fl,Bl=class extends b.Component{constructor(){super(...arguments),N(this,"isActive",!1),N(this,"resizeTimeout"),N(this,"scrollTimeout"),N(this,"scrollParent"),N(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),N(this,"hideSpotlight",()=>{const{continuous:e,disableOverlay:t,lifecycle:n}=this.props,r=[A.INIT,A.BEACON,A.COMPLETE,A.ERROR];return t||(e?r.includes(n):n!==A.TOOLTIP)}),N(this,"handleMouseMove",e=>{const{mouseOverSpotlight:t}=this.state,{height:n,left:r,position:o,top:i,width:s}=this.spotlightStyles,a=o==="fixed"?e.clientY:e.pageY,l=o==="fixed"?e.clientX:e.pageX,u=a>=i&&a<=i+n,c=l>=r&&l<=r+s&&u;c!==t&&this.updateState({mouseOverSpotlight:c})}),N(this,"handleScroll",()=>{const{target:e}=this.props,t=De(e);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else et(t,"sticky")&&this.updateState({})}),N(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:e,disableScrolling:t,disableScrollParentFix:n=!1,target:r}=this.props,o=De(r);this.scrollParent=vt(o??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(e){var t;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:o,target:i}=this.props,{changed:s}=Rt(e,this.props);if(s("target")||s("disableScrollParentFix")){const a=De(i);this.scrollParent=vt(a??document.body,n,!0)}s("lifecycle",A.TOOLTIP)&&((t=this.scrollParent)==null||t.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:a}=this.state;a||this.updateState({showSpotlight:!0})},100)),(s("spotlightClicks")||s("disableOverlay")||s("lifecycle"))&&(o&&r===A.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==A.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var e;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(e=this.scrollParent)==null||e.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:e}=this.state,{disableOverlayClose:t,placement:n,styles:r}=this.props;let o=r.overlay;return gr()&&(o=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:t?"default":"pointer",height:vl(),pointerEvents:e?"none":"auto",...o}}get spotlightStyles(){var e,t,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:o=!1,spotlightClicks:i,spotlightPadding:s=0,styles:a,target:l}=this.props,u=De(l),f=po(u),c=et(u),d=Ol(u,s,o);return{...gr()?a.spotlightLegacy:a.spotlight,height:Math.round(((e=f?.height)!=null?e:0)+s*2),left:Math.round(((t=f?.left)!=null?t:0)-s),opacity:r?1:0,pointerEvents:i?"none":"auto",position:c?"fixed":"absolute",top:d,transition:"opacity 0.2s",width:Math.round(((n=f?.width)!=null?n:0)+s*2)}}updateState(e){this.isActive&&this.setState(t=>({...t,...e}))}render(){const{showSpotlight:e}=this.state,{onClickOverlay:t,placement:n}=this.props,{hideSpotlight:r,overlayStyles:o,spotlightStyles:i}=this;if(r())return null;let s=n!=="center"&&e&&b.createElement(jl,{styles:i});if(ho()==="safari"){const{mixBlendMode:a,zIndex:l,...u}=o;s=b.createElement("div",{style:{...u}},s),delete o.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:t,role:"presentation",style:o},s)}},Ll=class extends b.Component{constructor(){super(...arguments),N(this,"node",null)}componentDidMount(){const{id:e}=this.props;_e()&&(this.node=document.createElement("div"),this.node.id=e,document.body.appendChild(this.node),ft||this.renderReact15())}componentDidUpdate(){_e()&&(ft||this.renderReact15())}componentWillUnmount(){!_e()||!this.node||(ft||Dt.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!_e())return;const{children:e}=this.props;this.node&&Dt.unstable_renderSubtreeIntoContainer(this,e,this.node)}renderReact16(){if(!_e()||!ft)return null;const{children:e}=this.props;return this.node?Dt.createPortal(e,this.node):null}render(){return ft?this.renderReact16():null}},$l=class{constructor(e,t){if(N(this,"element"),N(this,"options"),N(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),N(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,o=n.nodeName.toLowerCase();return(r.test(o)&&!n.getAttribute("disabled")||o==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),N(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),N(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),N(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:o}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!o&&i+1===r.length?i=0:o&&i===0?i=r.length-1:i+=o?-1:1,r[i].focus()}),N(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,o=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&o.getPropertyValue("overflow")!=="visible"||o.getPropertyValue("display")==="none"}),N(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),N(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),N(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),N(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(e instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=e,this.options=t,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},Hl=class extends b.Component{constructor(e){if(super(e),N(this,"beacon",null),N(this,"setBeaconRef",o=>{this.beacon=o}),e.beaconComponent)return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",e.nonce&&n.setAttribute("nonce",e.nonce),n.appendChild(document.createTextNode(` @keyframes joyride-beacon-inner { 20% { opacity: 0.9; diff --git a/webui/dist/assets/radix-core-C_kRl1e_.js b/webui/dist/assets/radix-core-BdJoVJLV.js similarity index 99% rename from webui/dist/assets/radix-core-C_kRl1e_.js rename to webui/dist/assets/radix-core-BdJoVJLV.js index c0f8d5a2..6390eb41 100644 --- a/webui/dist/assets/radix-core-C_kRl1e_.js +++ b/webui/dist/assets/radix-core-BdJoVJLV.js @@ -1,4 +1,4 @@ -import{r as i,j as v,R as Ee,a as sn,b as Ye,c as ds}from"./router-Bz250laD.js";function N(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function fs(e,t){const n=i.createContext(t),o=s=>{const{children:a,...c}=s,l=i.useMemo(()=>c,Object.values(c));return v.jsx(n.Provider,{value:l,children:a})};o.displayName=e+"Provider";function r(s){const a=i.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Oe(e,t=[]){let n=[];function o(s,a){const c=i.createContext(a),l=n.length;n=[...n,a];const u=p=>{const{scope:y,children:h,...x}=p,d=y?.[e]?.[l]||c,m=i.useMemo(()=>x,Object.values(x));return v.jsx(d.Provider,{value:m,children:h})};u.displayName=s+"Provider";function f(p,y){const h=y?.[e]?.[l]||c,x=i.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,f]}const r=()=>{const s=n.map(a=>i.createContext(a));return function(c){const l=c?.[e]||s;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[o,ps(r,...t)]}function ps(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((c,{useScope:l,scopeName:u})=>{const p=l(s)[`__scope${u}`];return{...c,...p}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Pn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $e(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Pn(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(vs);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function ms(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=ys(r),c=gs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hs=Symbol("radix.slottable");function vs(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hs}function gs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function eo(e){const t=e+"CollectionProvider",[n,o]=Oe(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=d=>{const{scope:m,children:w}=d,g=Ee.useRef(null),C=Ee.useRef(new Map).current;return v.jsx(r,{scope:m,itemMap:C,collectionRef:g,children:w})};a.displayName=t;const c=e+"CollectionSlot",l=An(c),u=Ee.forwardRef((d,m)=>{const{scope:w,children:g}=d,C=s(c,w),b=B(m,C.collectionRef);return v.jsx(l,{ref:b,children:g})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",y=An(f),h=Ee.forwardRef((d,m)=>{const{scope:w,children:g,...C}=d,b=Ee.useRef(null),E=B(m,b),R=s(f,w);return Ee.useEffect(()=>(R.itemMap.set(b,{ref:b,...C}),()=>void R.itemMap.delete(b))),v.jsx(y,{[p]:"",ref:E,children:g})});h.displayName=f;function x(d){const m=s(e+"CollectionConsumer",d);return Ee.useCallback(()=>{const g=m.collectionRef.current;if(!g)return[];const C=Array.from(g.querySelectorAll(`[${p}]`));return Array.from(m.itemMap.values()).sort((R,S)=>C.indexOf(R.ref.current)-C.indexOf(S.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:h},x,o]}var z=globalThis?.document?i.useLayoutEffect:()=>{},ws=sn[" useId ".trim().toString()]||(()=>{}),xs=0;function Se(e){const[t,n]=i.useState(ws());return z(()=>{n(o=>o??String(xs++))},[e]),t?`radix-${t}`:""}function Cs(e){const t=bs(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Ss);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function bs(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Rs(r),c=Ts(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Es=Symbol("radix.slottable");function Ss(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Es}function Ts(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ps=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=Ps.reduce((e,t)=>{const n=Cs(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function to(e,t){e&&Ye.flushSync(()=>e.dispatchEvent(t))}function ee(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>t.current?.(...n),[])}var As=sn[" useInsertionEffect ".trim().toString()]||z;function ke({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Os({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:r;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const p=f.current;p!==c&&console.warn(`${o} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,o])}const u=i.useCallback(f=>{if(c){const p=Is(f)?f(e):f;p!==e&&a.current?.(p)}else s(f)},[c,e,s,a]);return[l,u]}function Os({defaultProp:e,onChange:t}){const[n,o]=i.useState(e),r=i.useRef(n),s=i.useRef(t);return As(()=>{s.current=t},[t]),i.useEffect(()=>{r.current!==n&&(s.current?.(n),r.current=n)},[n,r]),[n,o,s]}function Is(e){return typeof e=="function"}var Ns=i.createContext(void 0);function _s(e){const t=i.useContext(Ns);return e||t||"ltr"}function Ds(e,t){return i.useReducer((n,o)=>t[n][o]??n,e)}var ye=e=>{const{present:t,children:n}=e,o=Ms(t),r=typeof n=="function"?n({present:o.isPresent}):i.Children.only(n),s=B(o.ref,Ls(r));return typeof n=="function"||o.isPresent?i.cloneElement(r,{ref:s}):null};ye.displayName="Presence";function Ms(e){const[t,n]=i.useState(),o=i.useRef(null),r=i.useRef(e),s=i.useRef("none"),a=e?"mounted":"unmounted",[c,l]=Ds(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=Je(o.current);s.current=c==="mounted"?u:"none"},[c]),z(()=>{const u=o.current,f=r.current;if(f!==e){const y=s.current,h=Je(u);e?l("MOUNT"):h==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&y!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),z(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,p=h=>{const d=Je(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&d&&(l("ANIMATION_END"),!r.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},y=h=>{h.target===t&&(s.current=Je(o.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function Je(e){return e?.animationName||"none"}function Ls(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function On(e,[t,n]){return Math.min(n,Math.max(t,e))}var ks=Symbol.for("react.lazy"),lt=sn[" use ".trim().toString()];function js(e){return typeof e=="object"&&e!==null&&"then"in e}function no(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ks&&"_payload"in e&&js(e._payload)}function oo(e){const t=Fs(e),n=i.forwardRef((o,r)=>{let{children:s,...a}=o;no(s)&&typeof lt=="function"&&(s=lt(s._payload));const c=i.Children.toArray(s),l=c.find(Ws);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ul=oo("Slot");function Fs(e){const t=i.forwardRef((n,o)=>{let{children:r,...s}=n;if(no(r)&&typeof lt=="function"&&(r=lt(r._payload)),i.isValidElement(r)){const a=Vs(r),c=Bs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $s=Symbol("radix.slottable");function Ws(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$s}function Bs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Vs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ro(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function so(e){const[t,n]=i.useState(void 0);return z(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,c;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,c=u.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Hs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Us=Hs.reduce((e,t)=>{const n=oo(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Ks="Label",io=i.forwardRef((e,t)=>v.jsx(Us.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));io.displayName=Ks;var Kl=io;function zs(e,t=globalThis?.document){const n=ee(e);i.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Ys="DismissableLayer",Ut="dismissableLayer.update",Xs="dismissableLayer.pointerDownOutside",Gs="dismissableLayer.focusOutside",In,ao=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xe=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...l}=e,u=i.useContext(ao),[f,p]=i.useState(null),y=f?.ownerDocument??globalThis?.document,[,h]=i.useState({}),x=B(t,S=>p(S)),d=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=d.indexOf(m),g=f?d.indexOf(f):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,b=g>=w,E=Zs(S=>{const O=S.target,M=[...u.branches].some(L=>L.contains(O));!b||M||(r?.(S),a?.(S),S.defaultPrevented||c?.())},y),R=Qs(S=>{const O=S.target;[...u.branches].some(L=>L.contains(O))||(s?.(S),a?.(S),S.defaultPrevented||c?.())},y);return zs(S=>{g===u.layers.size-1&&(o?.(S),!S.defaultPrevented&&c&&(S.preventDefault(),c()))},y),i.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(In=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Nn(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=In)}},[f,y,n,u]),i.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Nn())},[f,u]),i.useEffect(()=>{const S=()=>h({});return document.addEventListener(Ut,S),()=>document.removeEventListener(Ut,S)},[]),v.jsx(D.div,{...l,ref:x,style:{pointerEvents:C?b?"auto":"none":void 0,...e.style},onFocusCapture:N(e.onFocusCapture,R.onFocusCapture),onBlurCapture:N(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,E.onPointerDownCapture)})});Xe.displayName=Ys;var qs="DismissableLayerBranch",co=i.forwardRef((e,t)=>{const n=i.useContext(ao),o=i.useRef(null),r=B(t,o);return i.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(D.div,{...e,ref:r})});co.displayName=qs;function Zs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!o.current){let l=function(){lo(Xs,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Qs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1);return i.useEffect(()=>{const r=s=>{s.target&&!o.current&&lo(Gs,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Nn(){const e=new CustomEvent(Ut);document.dispatchEvent(e)}function lo(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var Js=Xe,ei=co,Mt="focusScope.autoFocusOnMount",Lt="focusScope.autoFocusOnUnmount",_n={bubbles:!1,cancelable:!0},ti="FocusScope",an=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[c,l]=i.useState(null),u=ee(r),f=ee(s),p=i.useRef(null),y=B(t,d=>l(d)),h=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(o){let d=function(C){if(h.paused||!c)return;const b=C.target;c.contains(b)?p.current=b:me(p.current,{select:!0})},m=function(C){if(h.paused||!c)return;const b=C.relatedTarget;b!==null&&(c.contains(b)||me(p.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&me(c)};document.addEventListener("focusin",d),document.addEventListener("focusout",m);const g=new MutationObserver(w);return c&&g.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",m),g.disconnect()}}},[o,c,h.paused]),i.useEffect(()=>{if(c){Mn.add(h);const d=document.activeElement;if(!c.contains(d)){const w=new CustomEvent(Mt,_n);c.addEventListener(Mt,u),c.dispatchEvent(w),w.defaultPrevented||(ni(ai(uo(c)),{select:!0}),document.activeElement===d&&me(c))}return()=>{c.removeEventListener(Mt,u),setTimeout(()=>{const w=new CustomEvent(Lt,_n);c.addEventListener(Lt,f),c.dispatchEvent(w),w.defaultPrevented||me(d??document.body,{select:!0}),c.removeEventListener(Lt,f),Mn.remove(h)},0)}}},[c,u,f,h]);const x=i.useCallback(d=>{if(!n&&!o||h.paused)return;const m=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,w=document.activeElement;if(m&&w){const g=d.currentTarget,[C,b]=oi(g);C&&b?!d.shiftKey&&w===b?(d.preventDefault(),n&&me(C,{select:!0})):d.shiftKey&&w===C&&(d.preventDefault(),n&&me(b,{select:!0})):w===g&&d.preventDefault()}},[n,o,h.paused]);return v.jsx(D.div,{tabIndex:-1,...a,ref:y,onKeyDown:x})});an.displayName=ti;function ni(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(me(o,{select:t}),document.activeElement!==n)return}function oi(e){const t=uo(e),n=Dn(t,e),o=Dn(t.reverse(),e);return[n,o]}function uo(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dn(e,t){for(const n of e)if(!ri(n,{upTo:t}))return n}function ri(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function si(e){return e instanceof HTMLInputElement&&"select"in e}function me(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&si(e)&&t&&e.select()}}var Mn=ii();function ii(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ln(e,t),e.unshift(t)},remove(t){e=Ln(e,t),e[0]?.resume()}}}function Ln(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function ai(e){return e.filter(t=>t.tagName!=="A")}var ci="Portal",Ge=i.forwardRef((e,t)=>{const{container:n,...o}=e,[r,s]=i.useState(!1);z(()=>s(!0),[]);const a=n||r&&globalThis?.document?.body;return a?ds.createPortal(v.jsx(D.div,{...o,ref:t}),a):null});Ge.displayName=ci;var kt=0;function fo(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kn()),document.body.insertAdjacentElement("beforeend",e[1]??kn()),kt++,()=>{kt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kt--}},[])}function kn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var se=function(){return se=Object.assign||function(t){for(var n,o=1,r=arguments.length;o"u")return Ti;var t=Ri(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Ai=vo(),Me="data-scroll-locked",Oi=function(e,t,n,o){var r=e.left,s=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),` +import{r as i,j as v,R as Ee,a as sn,b as Ye,c as ds}from"./router-9vIXuQkh.js";function N(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function fs(e,t){const n=i.createContext(t),o=s=>{const{children:a,...c}=s,l=i.useMemo(()=>c,Object.values(c));return v.jsx(n.Provider,{value:l,children:a})};o.displayName=e+"Provider";function r(s){const a=i.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Oe(e,t=[]){let n=[];function o(s,a){const c=i.createContext(a),l=n.length;n=[...n,a];const u=p=>{const{scope:y,children:h,...x}=p,d=y?.[e]?.[l]||c,m=i.useMemo(()=>x,Object.values(x));return v.jsx(d.Provider,{value:m,children:h})};u.displayName=s+"Provider";function f(p,y){const h=y?.[e]?.[l]||c,x=i.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,f]}const r=()=>{const s=n.map(a=>i.createContext(a));return function(c){const l=c?.[e]||s;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[o,ps(r,...t)]}function ps(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((c,{useScope:l,scopeName:u})=>{const p=l(s)[`__scope${u}`];return{...c,...p}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Pn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $e(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Pn(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(vs);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function ms(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=ys(r),c=gs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hs=Symbol("radix.slottable");function vs(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hs}function gs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function eo(e){const t=e+"CollectionProvider",[n,o]=Oe(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=d=>{const{scope:m,children:w}=d,g=Ee.useRef(null),C=Ee.useRef(new Map).current;return v.jsx(r,{scope:m,itemMap:C,collectionRef:g,children:w})};a.displayName=t;const c=e+"CollectionSlot",l=An(c),u=Ee.forwardRef((d,m)=>{const{scope:w,children:g}=d,C=s(c,w),b=B(m,C.collectionRef);return v.jsx(l,{ref:b,children:g})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",y=An(f),h=Ee.forwardRef((d,m)=>{const{scope:w,children:g,...C}=d,b=Ee.useRef(null),E=B(m,b),R=s(f,w);return Ee.useEffect(()=>(R.itemMap.set(b,{ref:b,...C}),()=>void R.itemMap.delete(b))),v.jsx(y,{[p]:"",ref:E,children:g})});h.displayName=f;function x(d){const m=s(e+"CollectionConsumer",d);return Ee.useCallback(()=>{const g=m.collectionRef.current;if(!g)return[];const C=Array.from(g.querySelectorAll(`[${p}]`));return Array.from(m.itemMap.values()).sort((R,S)=>C.indexOf(R.ref.current)-C.indexOf(S.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:h},x,o]}var z=globalThis?.document?i.useLayoutEffect:()=>{},ws=sn[" useId ".trim().toString()]||(()=>{}),xs=0;function Se(e){const[t,n]=i.useState(ws());return z(()=>{n(o=>o??String(xs++))},[e]),t?`radix-${t}`:""}function Cs(e){const t=bs(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Ss);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function bs(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Rs(r),c=Ts(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Es=Symbol("radix.slottable");function Ss(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Es}function Ts(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ps=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=Ps.reduce((e,t)=>{const n=Cs(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function to(e,t){e&&Ye.flushSync(()=>e.dispatchEvent(t))}function ee(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>t.current?.(...n),[])}var As=sn[" useInsertionEffect ".trim().toString()]||z;function ke({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Os({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:r;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const p=f.current;p!==c&&console.warn(`${o} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,o])}const u=i.useCallback(f=>{if(c){const p=Is(f)?f(e):f;p!==e&&a.current?.(p)}else s(f)},[c,e,s,a]);return[l,u]}function Os({defaultProp:e,onChange:t}){const[n,o]=i.useState(e),r=i.useRef(n),s=i.useRef(t);return As(()=>{s.current=t},[t]),i.useEffect(()=>{r.current!==n&&(s.current?.(n),r.current=n)},[n,r]),[n,o,s]}function Is(e){return typeof e=="function"}var Ns=i.createContext(void 0);function _s(e){const t=i.useContext(Ns);return e||t||"ltr"}function Ds(e,t){return i.useReducer((n,o)=>t[n][o]??n,e)}var ye=e=>{const{present:t,children:n}=e,o=Ms(t),r=typeof n=="function"?n({present:o.isPresent}):i.Children.only(n),s=B(o.ref,Ls(r));return typeof n=="function"||o.isPresent?i.cloneElement(r,{ref:s}):null};ye.displayName="Presence";function Ms(e){const[t,n]=i.useState(),o=i.useRef(null),r=i.useRef(e),s=i.useRef("none"),a=e?"mounted":"unmounted",[c,l]=Ds(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=Je(o.current);s.current=c==="mounted"?u:"none"},[c]),z(()=>{const u=o.current,f=r.current;if(f!==e){const y=s.current,h=Je(u);e?l("MOUNT"):h==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&y!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),z(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,p=h=>{const d=Je(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&d&&(l("ANIMATION_END"),!r.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},y=h=>{h.target===t&&(s.current=Je(o.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function Je(e){return e?.animationName||"none"}function Ls(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function On(e,[t,n]){return Math.min(n,Math.max(t,e))}var ks=Symbol.for("react.lazy"),lt=sn[" use ".trim().toString()];function js(e){return typeof e=="object"&&e!==null&&"then"in e}function no(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ks&&"_payload"in e&&js(e._payload)}function oo(e){const t=Fs(e),n=i.forwardRef((o,r)=>{let{children:s,...a}=o;no(s)&&typeof lt=="function"&&(s=lt(s._payload));const c=i.Children.toArray(s),l=c.find(Ws);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ul=oo("Slot");function Fs(e){const t=i.forwardRef((n,o)=>{let{children:r,...s}=n;if(no(r)&&typeof lt=="function"&&(r=lt(r._payload)),i.isValidElement(r)){const a=Vs(r),c=Bs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $s=Symbol("radix.slottable");function Ws(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$s}function Bs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Vs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ro(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function so(e){const[t,n]=i.useState(void 0);return z(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,c;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,c=u.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Hs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Us=Hs.reduce((e,t)=>{const n=oo(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Ks="Label",io=i.forwardRef((e,t)=>v.jsx(Us.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));io.displayName=Ks;var Kl=io;function zs(e,t=globalThis?.document){const n=ee(e);i.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Ys="DismissableLayer",Ut="dismissableLayer.update",Xs="dismissableLayer.pointerDownOutside",Gs="dismissableLayer.focusOutside",In,ao=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xe=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...l}=e,u=i.useContext(ao),[f,p]=i.useState(null),y=f?.ownerDocument??globalThis?.document,[,h]=i.useState({}),x=B(t,S=>p(S)),d=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=d.indexOf(m),g=f?d.indexOf(f):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,b=g>=w,E=Zs(S=>{const O=S.target,M=[...u.branches].some(L=>L.contains(O));!b||M||(r?.(S),a?.(S),S.defaultPrevented||c?.())},y),R=Qs(S=>{const O=S.target;[...u.branches].some(L=>L.contains(O))||(s?.(S),a?.(S),S.defaultPrevented||c?.())},y);return zs(S=>{g===u.layers.size-1&&(o?.(S),!S.defaultPrevented&&c&&(S.preventDefault(),c()))},y),i.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(In=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Nn(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=In)}},[f,y,n,u]),i.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Nn())},[f,u]),i.useEffect(()=>{const S=()=>h({});return document.addEventListener(Ut,S),()=>document.removeEventListener(Ut,S)},[]),v.jsx(D.div,{...l,ref:x,style:{pointerEvents:C?b?"auto":"none":void 0,...e.style},onFocusCapture:N(e.onFocusCapture,R.onFocusCapture),onBlurCapture:N(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,E.onPointerDownCapture)})});Xe.displayName=Ys;var qs="DismissableLayerBranch",co=i.forwardRef((e,t)=>{const n=i.useContext(ao),o=i.useRef(null),r=B(t,o);return i.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(D.div,{...e,ref:r})});co.displayName=qs;function Zs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!o.current){let l=function(){lo(Xs,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Qs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1);return i.useEffect(()=>{const r=s=>{s.target&&!o.current&&lo(Gs,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Nn(){const e=new CustomEvent(Ut);document.dispatchEvent(e)}function lo(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var Js=Xe,ei=co,Mt="focusScope.autoFocusOnMount",Lt="focusScope.autoFocusOnUnmount",_n={bubbles:!1,cancelable:!0},ti="FocusScope",an=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[c,l]=i.useState(null),u=ee(r),f=ee(s),p=i.useRef(null),y=B(t,d=>l(d)),h=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(o){let d=function(C){if(h.paused||!c)return;const b=C.target;c.contains(b)?p.current=b:me(p.current,{select:!0})},m=function(C){if(h.paused||!c)return;const b=C.relatedTarget;b!==null&&(c.contains(b)||me(p.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&me(c)};document.addEventListener("focusin",d),document.addEventListener("focusout",m);const g=new MutationObserver(w);return c&&g.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",m),g.disconnect()}}},[o,c,h.paused]),i.useEffect(()=>{if(c){Mn.add(h);const d=document.activeElement;if(!c.contains(d)){const w=new CustomEvent(Mt,_n);c.addEventListener(Mt,u),c.dispatchEvent(w),w.defaultPrevented||(ni(ai(uo(c)),{select:!0}),document.activeElement===d&&me(c))}return()=>{c.removeEventListener(Mt,u),setTimeout(()=>{const w=new CustomEvent(Lt,_n);c.addEventListener(Lt,f),c.dispatchEvent(w),w.defaultPrevented||me(d??document.body,{select:!0}),c.removeEventListener(Lt,f),Mn.remove(h)},0)}}},[c,u,f,h]);const x=i.useCallback(d=>{if(!n&&!o||h.paused)return;const m=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,w=document.activeElement;if(m&&w){const g=d.currentTarget,[C,b]=oi(g);C&&b?!d.shiftKey&&w===b?(d.preventDefault(),n&&me(C,{select:!0})):d.shiftKey&&w===C&&(d.preventDefault(),n&&me(b,{select:!0})):w===g&&d.preventDefault()}},[n,o,h.paused]);return v.jsx(D.div,{tabIndex:-1,...a,ref:y,onKeyDown:x})});an.displayName=ti;function ni(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(me(o,{select:t}),document.activeElement!==n)return}function oi(e){const t=uo(e),n=Dn(t,e),o=Dn(t.reverse(),e);return[n,o]}function uo(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dn(e,t){for(const n of e)if(!ri(n,{upTo:t}))return n}function ri(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function si(e){return e instanceof HTMLInputElement&&"select"in e}function me(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&si(e)&&t&&e.select()}}var Mn=ii();function ii(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ln(e,t),e.unshift(t)},remove(t){e=Ln(e,t),e[0]?.resume()}}}function Ln(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function ai(e){return e.filter(t=>t.tagName!=="A")}var ci="Portal",Ge=i.forwardRef((e,t)=>{const{container:n,...o}=e,[r,s]=i.useState(!1);z(()=>s(!0),[]);const a=n||r&&globalThis?.document?.body;return a?ds.createPortal(v.jsx(D.div,{...o,ref:t}),a):null});Ge.displayName=ci;var kt=0;function fo(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kn()),document.body.insertAdjacentElement("beforeend",e[1]??kn()),kt++,()=>{kt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kt--}},[])}function kn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var se=function(){return se=Object.assign||function(t){for(var n,o=1,r=arguments.length;o"u")return Ti;var t=Ri(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Ai=vo(),Me="data-scroll-locked",Oi=function(e,t,n,o){var r=e.left,s=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),` .`.concat(ui,` { overflow: hidden `).concat(o,`; padding-right: `).concat(c,"px ").concat(o,`; diff --git a/webui/dist/assets/radix-extra-Dp24oM_w.js b/webui/dist/assets/radix-extra-CTMrA3du.js similarity index 99% rename from webui/dist/assets/radix-extra-Dp24oM_w.js rename to webui/dist/assets/radix-extra-CTMrA3du.js index 29ec637b..083183b4 100644 --- a/webui/dist/assets/radix-extra-Dp24oM_w.js +++ b/webui/dist/assets/radix-extra-CTMrA3du.js @@ -1,4 +1,4 @@ -import{r as s,j as u,d as jr}from"./router-Bz250laD.js";import{c as G,a as Be,u as Ce,P as E,b,d as T,e as de,f as re,g as B,h as $,i as ce,j as Ke,k as Ge,l as xt,m as Ct,n as wt,O as Or,o as Lr,W as Fr,C as kr,T as $r,D as Vr,p as Pt,R as Br,q as Kr,r as He,s as Rt,t as we,v as Et,w as _t,x as yt,F as At,y as Tt,z as Mt,A as It,B as Ue,E as Dt,G as Gr}from"./radix-core-C_kRl1e_.js";var Oe="rovingFocusGroup.onEntryFocus",Hr={bubbles:!1,cancelable:!0},fe="RovingFocusGroup",[Le,Nt,Ur]=Be(fe),[Wr,Pe]=G(fe,[Ur]),[zr,Yr]=Wr(fe),jt=s.forwardRef((e,t)=>u.jsx(Le.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Le.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Xr,{...e,ref:t})})}));jt.displayName=fe;var Xr=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:r,loop:n=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:p,preventScrollOnEntryFocus:f=!1,...d}=e,v=s.useRef(null),m=T(t,v),h=de(a),[x,g]=re({prop:i,defaultProp:c??null,onChange:l,caller:fe}),[S,R]=s.useState(!1),w=B(p),P=Nt(o),I=s.useRef(!1),[j,D]=s.useState(0);return s.useEffect(()=>{const M=v.current;if(M)return M.addEventListener(Oe,w),()=>M.removeEventListener(Oe,w)},[w]),u.jsx(zr,{scope:o,orientation:r,dir:h,loop:n,currentTabStopId:x,onItemFocus:s.useCallback(M=>g(M),[g]),onItemShiftTab:s.useCallback(()=>R(!0),[]),onFocusableItemAdd:s.useCallback(()=>D(M=>M+1),[]),onFocusableItemRemove:s.useCallback(()=>D(M=>M-1),[]),children:u.jsx(E.div,{tabIndex:S||j===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:b(e.onMouseDown,()=>{I.current=!0}),onFocus:b(e.onFocus,M=>{const _=!I.current;if(M.target===M.currentTarget&&_&&!S){const A=new CustomEvent(Oe,Hr);if(M.currentTarget.dispatchEvent(A),!A.defaultPrevented){const y=P().filter(N=>N.focusable),O=y.find(N=>N.active),U=y.find(N=>N.id===x),X=[O,U,...y].filter(Boolean).map(N=>N.ref.current);Ft(X,f)}}I.current=!1}),onBlur:b(e.onBlur,()=>R(!1))})})}),Ot="RovingFocusGroupItem",Lt=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:r=!0,active:n=!1,tabStopId:a,children:i,...c}=e,l=Ce(),p=a||l,f=Yr(Ot,o),d=f.currentTabStopId===p,v=Nt(o),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:x}=f;return s.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),u.jsx(Le.ItemSlot,{scope:o,id:p,focusable:r,active:n,children:u.jsx(E.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:b(e.onMouseDown,g=>{r?f.onItemFocus(p):g.preventDefault()}),onFocus:b(e.onFocus,()=>f.onItemFocus(p)),onKeyDown:b(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){f.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const S=Jr(g,f.orientation,f.dir);if(S!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=v().filter(P=>P.focusable).map(P=>P.ref.current);if(S==="last")w.reverse();else if(S==="prev"||S==="next"){S==="prev"&&w.reverse();const P=w.indexOf(g.currentTarget);w=f.loop?Qr(w,P+1):w.slice(P+1)}setTimeout(()=>Ft(w))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:x!=null}):i})})});Lt.displayName=Ot;var qr={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Zr(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Jr(e,t,o){const r=Zr(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return qr[r]}function Ft(e,t=!1){const o=document.activeElement;for(const r of e)if(r===o||(r.focus({preventScroll:t}),document.activeElement!==o))return}function Qr(e,t){return e.map((o,r)=>e[(t+r)%e.length])}var kt=jt,$t=Lt,Re="Tabs",[en]=G(Re,[Pe]),Vt=Pe(),[tn,We]=en(Re),Bt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,onValueChange:n,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:l="automatic",...p}=e,f=de(c),[d,v]=re({prop:r,onChange:n,defaultProp:a??"",caller:Re});return u.jsx(tn,{scope:o,baseId:Ce(),value:d,onValueChange:v,orientation:i,dir:f,activationMode:l,children:u.jsx(E.div,{dir:f,"data-orientation":i,...p,ref:t})})});Bt.displayName=Re;var Kt="TabsList",Gt=s.forwardRef((e,t)=>{const{__scopeTabs:o,loop:r=!0,...n}=e,a=We(Kt,o),i=Vt(o);return u.jsx(kt,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:u.jsx(E.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:t})})});Gt.displayName=Kt;var Ht="TabsTrigger",Ut=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,disabled:n=!1,...a}=e,i=We(Ht,o),c=Vt(o),l=Yt(i.baseId,r),p=Xt(i.baseId,r),f=r===i.value;return u.jsx($t,{asChild:!0,...c,focusable:!n,active:f,children:u.jsx(E.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":p,"data-state":f?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:l,...a,ref:t,onMouseDown:b(e.onMouseDown,d=>{!n&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:b(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:b(e.onFocus,()=>{const d=i.activationMode!=="manual";!f&&!n&&d&&i.onValueChange(r)})})})});Ut.displayName=Ht;var Wt="TabsContent",zt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,forceMount:n,children:a,...i}=e,c=We(Wt,o),l=Yt(c.baseId,r),p=Xt(c.baseId,r),f=r===c.value,d=s.useRef(f);return s.useEffect(()=>{const v=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(v)},[]),u.jsx($,{present:n||f,children:({present:v})=>u.jsx(E.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!v,id:p,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:v&&a})})});zt.displayName=Wt;function Yt(e,t){return`${e}-trigger-${t}`}function Xt(e,t){return`${e}-content-${t}`}var hs=Bt,gs=Gt,Ss=Ut,bs=zt;function on(e,t){return s.useReducer((o,r)=>t[o][r]??o,e)}var ze="ScrollArea",[qt]=G(ze),[rn,V]=qt(ze),Zt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,type:r="hover",dir:n,scrollHideDelay:a=600,...i}=e,[c,l]=s.useState(null),[p,f]=s.useState(null),[d,v]=s.useState(null),[m,h]=s.useState(null),[x,g]=s.useState(null),[S,R]=s.useState(0),[w,P]=s.useState(0),[I,j]=s.useState(!1),[D,M]=s.useState(!1),_=T(t,y=>l(y)),A=de(n);return u.jsx(rn,{scope:o,type:r,dir:A,scrollHideDelay:a,scrollArea:c,viewport:p,onViewportChange:f,content:d,onContentChange:v,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:I,onScrollbarXEnabledChange:j,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:D,onScrollbarYEnabledChange:M,onCornerWidthChange:R,onCornerHeightChange:P,children:u.jsx(E.div,{dir:A,...i,ref:_,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});Zt.displayName=ze;var Jt="ScrollAreaViewport",Qt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,children:r,nonce:n,...a}=e,i=V(Jt,o),c=s.useRef(null),l=T(t,c,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),u.jsx(E.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Qt.displayName=Jt;var K="ScrollAreaScrollbar",nn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=n,c=e.orientation==="horizontal";return s.useEffect(()=>(c?a(!0):i(!0),()=>{c?a(!1):i(!1)}),[c,a,i]),n.type==="hover"?u.jsx(an,{...r,ref:t,forceMount:o}):n.type==="scroll"?u.jsx(sn,{...r,ref:t,forceMount:o}):n.type==="auto"?u.jsx(eo,{...r,ref:t,forceMount:o}):n.type==="always"?u.jsx(Ye,{...r,ref:t}):null});nn.displayName=K;var an=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),[a,i]=s.useState(!1);return s.useEffect(()=>{const c=n.scrollArea;let l=0;if(c){const p=()=>{window.clearTimeout(l),i(!0)},f=()=>{l=window.setTimeout(()=>i(!1),n.scrollHideDelay)};return c.addEventListener("pointerenter",p),c.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",p),c.removeEventListener("pointerleave",f)}}},[n.scrollArea,n.scrollHideDelay]),u.jsx($,{present:o||a,children:u.jsx(eo,{"data-state":a?"visible":"hidden",...r,ref:t})})}),sn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),a=e.orientation==="horizontal",i=_e(()=>l("SCROLL_END"),100),[c,l]=on("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>l("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,n.scrollHideDelay,l]),s.useEffect(()=>{const p=n.viewport,f=a?"scrollLeft":"scrollTop";if(p){let d=p[f];const v=()=>{const m=p[f];d!==m&&(l("SCROLL"),i()),d=m};return p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[n.viewport,a,l,i]),u.jsx($,{present:o||c!=="hidden",children:u.jsx(Ye,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:b(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:b(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),eo=s.forwardRef((e,t)=>{const o=V(K,e.__scopeScrollArea),{forceMount:r,...n}=e,[a,i]=s.useState(!1),c=e.orientation==="horizontal",l=_e(()=>{if(o.viewport){const p=o.viewport.offsetWidth{const{orientation:o="vertical",...r}=e,n=V(K,e.__scopeScrollArea),a=s.useRef(null),i=s.useRef(0),[c,l]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=no(c.viewport,c.content),f={...r,sizes:c,onSizesChange:l,hasThumb:p>0&&p<1,onThumbChange:v=>a.current=v,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:v=>i.current=v};function d(v,m){return vn(v,i.current,c,m)}return o==="horizontal"?u.jsx(cn,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollLeft,m=vt(v,c,n.dir);a.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollLeft=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollLeft=d(v,n.dir))}}):o==="vertical"?u.jsx(ln,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollTop,m=vt(v,c);a.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollTop=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollTop=d(v))}}):null}),cn=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarXChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"horizontal",...n,ref:p,sizes:o,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollLeft+f.deltaX;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ge(i.paddingLeft),paddingEnd:ge(i.paddingRight)}})}})}),ln=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarYChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"vertical",...n,ref:p,sizes:o,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollTop+f.deltaY;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ge(i.paddingTop),paddingEnd:ge(i.paddingBottom)}})}})}),[un,to]=qt(K),oo=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,sizes:r,hasThumb:n,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:p,onWheelScroll:f,onResize:d,...v}=e,m=V(K,o),[h,x]=s.useState(null),g=T(t,_=>x(_)),S=s.useRef(null),R=s.useRef(""),w=m.viewport,P=r.content-r.viewport,I=B(f),j=B(l),D=_e(d,10);function M(_){if(S.current){const A=_.clientX-S.current.left,y=_.clientY-S.current.top;p({x:A,y})}}return s.useEffect(()=>{const _=A=>{const y=A.target;h?.contains(y)&&I(A,P)};return document.addEventListener("wheel",_,{passive:!1}),()=>document.removeEventListener("wheel",_,{passive:!1})},[w,h,P,I]),s.useEffect(j,[r,j]),te(h,D),te(m.content,D),u.jsx(un,{scope:o,scrollbar:h,hasThumb:n,onThumbChange:B(a),onThumbPointerUp:B(i),onThumbPositionChange:j,onThumbPointerDown:B(c),children:u.jsx(E.div,{...v,ref:g,style:{position:"absolute",...v.style},onPointerDown:b(e.onPointerDown,_=>{_.button===0&&(_.target.setPointerCapture(_.pointerId),S.current=h.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),M(_))}),onPointerMove:b(e.onPointerMove,M),onPointerUp:b(e.onPointerUp,_=>{const A=_.target;A.hasPointerCapture(_.pointerId)&&A.releasePointerCapture(_.pointerId),document.body.style.webkitUserSelect=R.current,m.viewport&&(m.viewport.style.scrollBehavior=""),S.current=null})})})}),he="ScrollAreaThumb",dn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=to(he,e.__scopeScrollArea);return u.jsx($,{present:o||n.hasThumb,children:u.jsx(fn,{ref:t,...r})})}),fn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,style:r,...n}=e,a=V(he,o),i=to(he,o),{onThumbPositionChange:c}=i,l=T(t,d=>i.onThumbChange(d)),p=s.useRef(void 0),f=_e(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const d=a.viewport;if(d){const v=()=>{if(f(),!p.current){const m=mn(d,c);p.current=m,c()}};return c(),d.addEventListener("scroll",v),()=>d.removeEventListener("scroll",v)}},[a.viewport,f,c]),u.jsx(E.div,{"data-state":i.hasThumb?"visible":"hidden",...n,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:b(e.onPointerDownCapture,d=>{const m=d.target.getBoundingClientRect(),h=d.clientX-m.left,x=d.clientY-m.top;i.onThumbPointerDown({x:h,y:x})}),onPointerUp:b(e.onPointerUp,i.onThumbPointerUp)})});dn.displayName=he;var Xe="ScrollAreaCorner",ro=s.forwardRef((e,t)=>{const o=V(Xe,e.__scopeScrollArea),r=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&r?u.jsx(pn,{...e,ref:t}):null});ro.displayName=Xe;var pn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,...r}=e,n=V(Xe,o),[a,i]=s.useState(0),[c,l]=s.useState(0),p=!!(a&&c);return te(n.scrollbarX,()=>{const f=n.scrollbarX?.offsetHeight||0;n.onCornerHeightChange(f),l(f)}),te(n.scrollbarY,()=>{const f=n.scrollbarY?.offsetWidth||0;n.onCornerWidthChange(f),i(f)}),p?u.jsx(E.div,{...r,ref:t,style:{width:a,height:c,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ge(e){return e?parseInt(e,10):0}function no(e,t){const o=e/t;return isNaN(o)?0:o}function Ee(e){const t=no(e.viewport,e.content),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-o)*t;return Math.max(r,18)}function vn(e,t,o,r="ltr"){const n=Ee(o),a=n/2,i=t||a,c=n-i,l=o.scrollbar.paddingStart+i,p=o.scrollbar.size-o.scrollbar.paddingEnd-c,f=o.content-o.viewport,d=r==="ltr"?[0,f]:[f*-1,0];return ao([l,p],d)(e)}function vt(e,t,o="ltr"){const r=Ee(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-n,i=t.content-t.viewport,c=a-r,l=o==="ltr"?[0,i]:[i*-1,0],p=Ke(e,l);return ao([0,i],[0,c])(p)}function ao(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(o-e[0])}}function so(e,t){return e>0&&e{})=>{let o={left:e.scrollLeft,top:e.scrollTop},r=0;return(function n(){const a={left:e.scrollLeft,top:e.scrollTop},i=o.left!==a.left,c=o.top!==a.top;(i||c)&&t(),o=a,r=window.requestAnimationFrame(n)})(),()=>window.cancelAnimationFrame(r)};function _e(e,t){const o=B(e),r=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(r.current),[]),s.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(o,t)},[o,t])}function te(e,t){const o=B(t);ce(()=>{let r=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(o)});return n.observe(e),()=>{window.cancelAnimationFrame(r),n.unobserve(e)}}},[e,o])}var xs=Zt,Cs=Qt,ws=ro;function hn(e,t=[]){let o=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const l=o.length;o=[...o,i];const p=d=>{const{scope:v,children:m,...h}=d,x=v?.[e]?.[l]||c,g=s.useMemo(()=>h,Object.values(h));return u.jsx(x.Provider,{value:g,children:m})};p.displayName=a+"Provider";function f(d,v){const m=v?.[e]?.[l]||c,h=s.useContext(m);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[p,f]}const n=()=>{const a=o.map(i=>s.createContext(i));return function(c){const l=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return n.scopeName=e,[r,gn(n,...t)]}function gn(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const r=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(a){const i=r.reduce((c,{useScope:l,scopeName:p})=>{const d=l(a)[`__scope${p}`];return{...c,...d}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return o.scopeName=t.scopeName,o}var Sn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],io=Sn.reduce((e,t)=>{const o=Ge(`Primitive.${t}`),r=s.forwardRef((n,a)=>{const{asChild:i,...c}=n,l=i?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),qe="Progress",Ze=100,[bn]=hn(qe),[xn,Cn]=bn(qe),co=s.forwardRef((e,t)=>{const{__scopeProgress:o,value:r=null,max:n,getValueLabel:a=wn,...i}=e;(n||n===0)&&!mt(n)&&console.error(Pn(`${n}`,"Progress"));const c=mt(n)?n:Ze;r!==null&&!ht(r,c)&&console.error(Rn(`${r}`,"Progress"));const l=ht(r,c)?r:null,p=Se(l)?a(l,c):void 0;return u.jsx(xn,{scope:o,value:l,max:c,children:u.jsx(io.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":Se(l)?l:void 0,"aria-valuetext":p,role:"progressbar","data-state":fo(l,c),"data-value":l??void 0,"data-max":c,...i,ref:t})})});co.displayName=qe;var lo="ProgressIndicator",uo=s.forwardRef((e,t)=>{const{__scopeProgress:o,...r}=e,n=Cn(lo,o);return u.jsx(io.div,{"data-state":fo(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...r,ref:t})});uo.displayName=lo;function wn(e,t){return`${Math.round(e/t*100)}%`}function fo(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Se(e){return typeof e=="number"}function mt(e){return Se(e)&&!isNaN(e)&&e>0}function ht(e,t){return Se(e)&&!isNaN(e)&&e<=t&&e>=0}function Pn(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ze}\`.`}function Rn(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: +import{r as s,j as u,d as jr}from"./router-9vIXuQkh.js";import{c as G,a as Be,u as Ce,P as E,b,d as T,e as de,f as re,g as B,h as $,i as ce,j as Ke,k as Ge,l as xt,m as Ct,n as wt,O as Or,o as Lr,W as Fr,C as kr,T as $r,D as Vr,p as Pt,R as Br,q as Kr,r as He,s as Rt,t as we,v as Et,w as _t,x as yt,F as At,y as Tt,z as Mt,A as It,B as Ue,E as Dt,G as Gr}from"./radix-core-BdJoVJLV.js";var Oe="rovingFocusGroup.onEntryFocus",Hr={bubbles:!1,cancelable:!0},fe="RovingFocusGroup",[Le,Nt,Ur]=Be(fe),[Wr,Pe]=G(fe,[Ur]),[zr,Yr]=Wr(fe),jt=s.forwardRef((e,t)=>u.jsx(Le.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Le.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Xr,{...e,ref:t})})}));jt.displayName=fe;var Xr=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:r,loop:n=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:p,preventScrollOnEntryFocus:f=!1,...d}=e,v=s.useRef(null),m=T(t,v),h=de(a),[x,g]=re({prop:i,defaultProp:c??null,onChange:l,caller:fe}),[S,R]=s.useState(!1),w=B(p),P=Nt(o),I=s.useRef(!1),[j,D]=s.useState(0);return s.useEffect(()=>{const M=v.current;if(M)return M.addEventListener(Oe,w),()=>M.removeEventListener(Oe,w)},[w]),u.jsx(zr,{scope:o,orientation:r,dir:h,loop:n,currentTabStopId:x,onItemFocus:s.useCallback(M=>g(M),[g]),onItemShiftTab:s.useCallback(()=>R(!0),[]),onFocusableItemAdd:s.useCallback(()=>D(M=>M+1),[]),onFocusableItemRemove:s.useCallback(()=>D(M=>M-1),[]),children:u.jsx(E.div,{tabIndex:S||j===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:b(e.onMouseDown,()=>{I.current=!0}),onFocus:b(e.onFocus,M=>{const _=!I.current;if(M.target===M.currentTarget&&_&&!S){const A=new CustomEvent(Oe,Hr);if(M.currentTarget.dispatchEvent(A),!A.defaultPrevented){const y=P().filter(N=>N.focusable),O=y.find(N=>N.active),U=y.find(N=>N.id===x),X=[O,U,...y].filter(Boolean).map(N=>N.ref.current);Ft(X,f)}}I.current=!1}),onBlur:b(e.onBlur,()=>R(!1))})})}),Ot="RovingFocusGroupItem",Lt=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:r=!0,active:n=!1,tabStopId:a,children:i,...c}=e,l=Ce(),p=a||l,f=Yr(Ot,o),d=f.currentTabStopId===p,v=Nt(o),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:x}=f;return s.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),u.jsx(Le.ItemSlot,{scope:o,id:p,focusable:r,active:n,children:u.jsx(E.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:b(e.onMouseDown,g=>{r?f.onItemFocus(p):g.preventDefault()}),onFocus:b(e.onFocus,()=>f.onItemFocus(p)),onKeyDown:b(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){f.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const S=Jr(g,f.orientation,f.dir);if(S!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=v().filter(P=>P.focusable).map(P=>P.ref.current);if(S==="last")w.reverse();else if(S==="prev"||S==="next"){S==="prev"&&w.reverse();const P=w.indexOf(g.currentTarget);w=f.loop?Qr(w,P+1):w.slice(P+1)}setTimeout(()=>Ft(w))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:x!=null}):i})})});Lt.displayName=Ot;var qr={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Zr(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Jr(e,t,o){const r=Zr(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return qr[r]}function Ft(e,t=!1){const o=document.activeElement;for(const r of e)if(r===o||(r.focus({preventScroll:t}),document.activeElement!==o))return}function Qr(e,t){return e.map((o,r)=>e[(t+r)%e.length])}var kt=jt,$t=Lt,Re="Tabs",[en]=G(Re,[Pe]),Vt=Pe(),[tn,We]=en(Re),Bt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,onValueChange:n,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:l="automatic",...p}=e,f=de(c),[d,v]=re({prop:r,onChange:n,defaultProp:a??"",caller:Re});return u.jsx(tn,{scope:o,baseId:Ce(),value:d,onValueChange:v,orientation:i,dir:f,activationMode:l,children:u.jsx(E.div,{dir:f,"data-orientation":i,...p,ref:t})})});Bt.displayName=Re;var Kt="TabsList",Gt=s.forwardRef((e,t)=>{const{__scopeTabs:o,loop:r=!0,...n}=e,a=We(Kt,o),i=Vt(o);return u.jsx(kt,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:u.jsx(E.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:t})})});Gt.displayName=Kt;var Ht="TabsTrigger",Ut=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,disabled:n=!1,...a}=e,i=We(Ht,o),c=Vt(o),l=Yt(i.baseId,r),p=Xt(i.baseId,r),f=r===i.value;return u.jsx($t,{asChild:!0,...c,focusable:!n,active:f,children:u.jsx(E.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":p,"data-state":f?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:l,...a,ref:t,onMouseDown:b(e.onMouseDown,d=>{!n&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:b(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:b(e.onFocus,()=>{const d=i.activationMode!=="manual";!f&&!n&&d&&i.onValueChange(r)})})})});Ut.displayName=Ht;var Wt="TabsContent",zt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,forceMount:n,children:a,...i}=e,c=We(Wt,o),l=Yt(c.baseId,r),p=Xt(c.baseId,r),f=r===c.value,d=s.useRef(f);return s.useEffect(()=>{const v=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(v)},[]),u.jsx($,{present:n||f,children:({present:v})=>u.jsx(E.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!v,id:p,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:v&&a})})});zt.displayName=Wt;function Yt(e,t){return`${e}-trigger-${t}`}function Xt(e,t){return`${e}-content-${t}`}var hs=Bt,gs=Gt,Ss=Ut,bs=zt;function on(e,t){return s.useReducer((o,r)=>t[o][r]??o,e)}var ze="ScrollArea",[qt]=G(ze),[rn,V]=qt(ze),Zt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,type:r="hover",dir:n,scrollHideDelay:a=600,...i}=e,[c,l]=s.useState(null),[p,f]=s.useState(null),[d,v]=s.useState(null),[m,h]=s.useState(null),[x,g]=s.useState(null),[S,R]=s.useState(0),[w,P]=s.useState(0),[I,j]=s.useState(!1),[D,M]=s.useState(!1),_=T(t,y=>l(y)),A=de(n);return u.jsx(rn,{scope:o,type:r,dir:A,scrollHideDelay:a,scrollArea:c,viewport:p,onViewportChange:f,content:d,onContentChange:v,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:I,onScrollbarXEnabledChange:j,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:D,onScrollbarYEnabledChange:M,onCornerWidthChange:R,onCornerHeightChange:P,children:u.jsx(E.div,{dir:A,...i,ref:_,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});Zt.displayName=ze;var Jt="ScrollAreaViewport",Qt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,children:r,nonce:n,...a}=e,i=V(Jt,o),c=s.useRef(null),l=T(t,c,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),u.jsx(E.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Qt.displayName=Jt;var K="ScrollAreaScrollbar",nn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=n,c=e.orientation==="horizontal";return s.useEffect(()=>(c?a(!0):i(!0),()=>{c?a(!1):i(!1)}),[c,a,i]),n.type==="hover"?u.jsx(an,{...r,ref:t,forceMount:o}):n.type==="scroll"?u.jsx(sn,{...r,ref:t,forceMount:o}):n.type==="auto"?u.jsx(eo,{...r,ref:t,forceMount:o}):n.type==="always"?u.jsx(Ye,{...r,ref:t}):null});nn.displayName=K;var an=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),[a,i]=s.useState(!1);return s.useEffect(()=>{const c=n.scrollArea;let l=0;if(c){const p=()=>{window.clearTimeout(l),i(!0)},f=()=>{l=window.setTimeout(()=>i(!1),n.scrollHideDelay)};return c.addEventListener("pointerenter",p),c.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",p),c.removeEventListener("pointerleave",f)}}},[n.scrollArea,n.scrollHideDelay]),u.jsx($,{present:o||a,children:u.jsx(eo,{"data-state":a?"visible":"hidden",...r,ref:t})})}),sn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),a=e.orientation==="horizontal",i=_e(()=>l("SCROLL_END"),100),[c,l]=on("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>l("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,n.scrollHideDelay,l]),s.useEffect(()=>{const p=n.viewport,f=a?"scrollLeft":"scrollTop";if(p){let d=p[f];const v=()=>{const m=p[f];d!==m&&(l("SCROLL"),i()),d=m};return p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[n.viewport,a,l,i]),u.jsx($,{present:o||c!=="hidden",children:u.jsx(Ye,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:b(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:b(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),eo=s.forwardRef((e,t)=>{const o=V(K,e.__scopeScrollArea),{forceMount:r,...n}=e,[a,i]=s.useState(!1),c=e.orientation==="horizontal",l=_e(()=>{if(o.viewport){const p=o.viewport.offsetWidth{const{orientation:o="vertical",...r}=e,n=V(K,e.__scopeScrollArea),a=s.useRef(null),i=s.useRef(0),[c,l]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=no(c.viewport,c.content),f={...r,sizes:c,onSizesChange:l,hasThumb:p>0&&p<1,onThumbChange:v=>a.current=v,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:v=>i.current=v};function d(v,m){return vn(v,i.current,c,m)}return o==="horizontal"?u.jsx(cn,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollLeft,m=vt(v,c,n.dir);a.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollLeft=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollLeft=d(v,n.dir))}}):o==="vertical"?u.jsx(ln,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollTop,m=vt(v,c);a.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollTop=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollTop=d(v))}}):null}),cn=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarXChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"horizontal",...n,ref:p,sizes:o,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollLeft+f.deltaX;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ge(i.paddingLeft),paddingEnd:ge(i.paddingRight)}})}})}),ln=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarYChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"vertical",...n,ref:p,sizes:o,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollTop+f.deltaY;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ge(i.paddingTop),paddingEnd:ge(i.paddingBottom)}})}})}),[un,to]=qt(K),oo=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,sizes:r,hasThumb:n,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:p,onWheelScroll:f,onResize:d,...v}=e,m=V(K,o),[h,x]=s.useState(null),g=T(t,_=>x(_)),S=s.useRef(null),R=s.useRef(""),w=m.viewport,P=r.content-r.viewport,I=B(f),j=B(l),D=_e(d,10);function M(_){if(S.current){const A=_.clientX-S.current.left,y=_.clientY-S.current.top;p({x:A,y})}}return s.useEffect(()=>{const _=A=>{const y=A.target;h?.contains(y)&&I(A,P)};return document.addEventListener("wheel",_,{passive:!1}),()=>document.removeEventListener("wheel",_,{passive:!1})},[w,h,P,I]),s.useEffect(j,[r,j]),te(h,D),te(m.content,D),u.jsx(un,{scope:o,scrollbar:h,hasThumb:n,onThumbChange:B(a),onThumbPointerUp:B(i),onThumbPositionChange:j,onThumbPointerDown:B(c),children:u.jsx(E.div,{...v,ref:g,style:{position:"absolute",...v.style},onPointerDown:b(e.onPointerDown,_=>{_.button===0&&(_.target.setPointerCapture(_.pointerId),S.current=h.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),M(_))}),onPointerMove:b(e.onPointerMove,M),onPointerUp:b(e.onPointerUp,_=>{const A=_.target;A.hasPointerCapture(_.pointerId)&&A.releasePointerCapture(_.pointerId),document.body.style.webkitUserSelect=R.current,m.viewport&&(m.viewport.style.scrollBehavior=""),S.current=null})})})}),he="ScrollAreaThumb",dn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=to(he,e.__scopeScrollArea);return u.jsx($,{present:o||n.hasThumb,children:u.jsx(fn,{ref:t,...r})})}),fn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,style:r,...n}=e,a=V(he,o),i=to(he,o),{onThumbPositionChange:c}=i,l=T(t,d=>i.onThumbChange(d)),p=s.useRef(void 0),f=_e(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const d=a.viewport;if(d){const v=()=>{if(f(),!p.current){const m=mn(d,c);p.current=m,c()}};return c(),d.addEventListener("scroll",v),()=>d.removeEventListener("scroll",v)}},[a.viewport,f,c]),u.jsx(E.div,{"data-state":i.hasThumb?"visible":"hidden",...n,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:b(e.onPointerDownCapture,d=>{const m=d.target.getBoundingClientRect(),h=d.clientX-m.left,x=d.clientY-m.top;i.onThumbPointerDown({x:h,y:x})}),onPointerUp:b(e.onPointerUp,i.onThumbPointerUp)})});dn.displayName=he;var Xe="ScrollAreaCorner",ro=s.forwardRef((e,t)=>{const o=V(Xe,e.__scopeScrollArea),r=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&r?u.jsx(pn,{...e,ref:t}):null});ro.displayName=Xe;var pn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,...r}=e,n=V(Xe,o),[a,i]=s.useState(0),[c,l]=s.useState(0),p=!!(a&&c);return te(n.scrollbarX,()=>{const f=n.scrollbarX?.offsetHeight||0;n.onCornerHeightChange(f),l(f)}),te(n.scrollbarY,()=>{const f=n.scrollbarY?.offsetWidth||0;n.onCornerWidthChange(f),i(f)}),p?u.jsx(E.div,{...r,ref:t,style:{width:a,height:c,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ge(e){return e?parseInt(e,10):0}function no(e,t){const o=e/t;return isNaN(o)?0:o}function Ee(e){const t=no(e.viewport,e.content),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-o)*t;return Math.max(r,18)}function vn(e,t,o,r="ltr"){const n=Ee(o),a=n/2,i=t||a,c=n-i,l=o.scrollbar.paddingStart+i,p=o.scrollbar.size-o.scrollbar.paddingEnd-c,f=o.content-o.viewport,d=r==="ltr"?[0,f]:[f*-1,0];return ao([l,p],d)(e)}function vt(e,t,o="ltr"){const r=Ee(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-n,i=t.content-t.viewport,c=a-r,l=o==="ltr"?[0,i]:[i*-1,0],p=Ke(e,l);return ao([0,i],[0,c])(p)}function ao(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(o-e[0])}}function so(e,t){return e>0&&e{})=>{let o={left:e.scrollLeft,top:e.scrollTop},r=0;return(function n(){const a={left:e.scrollLeft,top:e.scrollTop},i=o.left!==a.left,c=o.top!==a.top;(i||c)&&t(),o=a,r=window.requestAnimationFrame(n)})(),()=>window.cancelAnimationFrame(r)};function _e(e,t){const o=B(e),r=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(r.current),[]),s.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(o,t)},[o,t])}function te(e,t){const o=B(t);ce(()=>{let r=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(o)});return n.observe(e),()=>{window.cancelAnimationFrame(r),n.unobserve(e)}}},[e,o])}var xs=Zt,Cs=Qt,ws=ro;function hn(e,t=[]){let o=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const l=o.length;o=[...o,i];const p=d=>{const{scope:v,children:m,...h}=d,x=v?.[e]?.[l]||c,g=s.useMemo(()=>h,Object.values(h));return u.jsx(x.Provider,{value:g,children:m})};p.displayName=a+"Provider";function f(d,v){const m=v?.[e]?.[l]||c,h=s.useContext(m);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[p,f]}const n=()=>{const a=o.map(i=>s.createContext(i));return function(c){const l=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return n.scopeName=e,[r,gn(n,...t)]}function gn(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const r=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(a){const i=r.reduce((c,{useScope:l,scopeName:p})=>{const d=l(a)[`__scope${p}`];return{...c,...d}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return o.scopeName=t.scopeName,o}var Sn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],io=Sn.reduce((e,t)=>{const o=Ge(`Primitive.${t}`),r=s.forwardRef((n,a)=>{const{asChild:i,...c}=n,l=i?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),qe="Progress",Ze=100,[bn]=hn(qe),[xn,Cn]=bn(qe),co=s.forwardRef((e,t)=>{const{__scopeProgress:o,value:r=null,max:n,getValueLabel:a=wn,...i}=e;(n||n===0)&&!mt(n)&&console.error(Pn(`${n}`,"Progress"));const c=mt(n)?n:Ze;r!==null&&!ht(r,c)&&console.error(Rn(`${r}`,"Progress"));const l=ht(r,c)?r:null,p=Se(l)?a(l,c):void 0;return u.jsx(xn,{scope:o,value:l,max:c,children:u.jsx(io.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":Se(l)?l:void 0,"aria-valuetext":p,role:"progressbar","data-state":fo(l,c),"data-value":l??void 0,"data-max":c,...i,ref:t})})});co.displayName=qe;var lo="ProgressIndicator",uo=s.forwardRef((e,t)=>{const{__scopeProgress:o,...r}=e,n=Cn(lo,o);return u.jsx(io.div,{"data-state":fo(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...r,ref:t})});uo.displayName=lo;function wn(e,t){return`${Math.round(e/t*100)}%`}function fo(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Se(e){return typeof e=="number"}function mt(e){return Se(e)&&!isNaN(e)&&e>0}function ht(e,t){return Se(e)&&!isNaN(e)&&e<=t&&e>=0}function Pn(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ze}\`.`}function Rn(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${Ze} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. diff --git a/webui/dist/assets/reactflow-DLoXAt4c.js b/webui/dist/assets/reactflow-DtsZHOR4.js similarity index 99% rename from webui/dist/assets/reactflow-DLoXAt4c.js rename to webui/dist/assets/reactflow-DtsZHOR4.js index ef5f8568..dbf46732 100644 --- a/webui/dist/assets/reactflow-DLoXAt4c.js +++ b/webui/dist/assets/reactflow-DtsZHOR4.js @@ -1,2 +1,2 @@ -import{u as hm,R as L,r as k}from"./router-Bz250laD.js";import{i as pm,a as vc,b as vm,c as gc,d as gm,e as ym,f as mm}from"./charts-DbiuC1q1.js";import{c as Xt}from"./react-vendor-BmxF9s7Q.js";var Ur,yc;function qe(){if(yc)return Ur;yc=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Ur=e,Ur}var jr,mc;function gv(){if(mc)return jr;mc=1;var e=typeof Xt=="object"&&Xt&&Xt.Object===Object&&Xt;return jr=e,jr}var Kr,_c;function Me(){if(_c)return Kr;_c=1;var e=gv(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Kr=r,Kr}var Yr,bc;function _m(){if(bc)return Yr;bc=1;var e=Me(),t=function(){return e.Date.now()};return Yr=t,Yr}var Wr,wc;function bm(){if(wc)return Wr;wc=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Wr=t,Wr}var Zr,Ec;function wm(){if(Ec)return Zr;Ec=1;var e=bm(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Zr=r,Zr}var Xr,xc;function Et(){if(xc)return Xr;xc=1;var e=Me(),t=e.Symbol;return Xr=t,Xr}var Jr,Sc;function Em(){if(Sc)return Jr;Sc=1;var e=Et(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=r.call(o,i),u=o[i];try{o[i]=void 0;var l=!0}catch{}var c=n.call(o);return l&&(s?o[i]=u:delete o[i]),c}return Jr=a,Jr}var Qr,qc;function xm(){if(qc)return Qr;qc=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Qr=r,Qr}var en,Rc;function st(){if(Rc)return en;Rc=1;var e=Et(),t=Em(),r=xm(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):r(s)}return en=o,en}var tn,Cc;function Le(){if(Cc)return tn;Cc=1;function e(t){return t!=null&&typeof t=="object"}return tn=e,tn}var rn,Ac;function xt(){if(Ac)return rn;Ac=1;var e=st(),t=Le(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return rn=n,rn}var nn,Nc;function Sm(){if(Nc)return nn;Nc=1;var e=wm(),t=qe(),r=xt(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return n;if(t(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=t(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=e(l);var f=a.test(l);return f||o.test(l)?s(l.slice(2),f?2:8):i.test(l)?n:+l}return nn=u,nn}function pe(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,n;r{let t;const r=new Set,n=(c,f)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(_=>_(t,h))}},i=()=>t,u={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{(qm?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},l=t=e(n,i,u);return u},Rm=e=>e?Ic(e):Ic,{useDebugValue:Cm}=L,{useSyncExternalStoreWithSelector:Am}=hm,Nm=e=>e;function yv(e,t=Nm,r){const n=Am(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Cm(n),n}const Tc=(e,t)=>{const r=Rm(e),n=(i,a=t)=>yv(r,i,a);return Object.assign(n,r),n},Im=(e,t)=>e?Tc(e,t):Tc;function he(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,i]of e)if(!Object.is(i,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}var Tm={value:()=>{}};function yr(){for(var e=0,t=arguments.length,r={},n;e=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}ir.prototype=yr.prototype={constructor:ir,on:function(e,t){var r=this._,n=Mm(e+"",r),i,a=-1,o=n.length;if(arguments.length<2){for(;++a0)for(var r=new Array(i),n=0,i,a;n=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Pc.hasOwnProperty(t)?{space:Pc[t],local:e}:e}function Om(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===mu&&t.documentElement.namespaceURI===mu?t.createElement(e):t.createElementNS(r,e)}}function km(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mv(e){var t=mr(e);return(t.local?km:Om)(t)}function Dm(){}function Tu(e){return e==null?Dm:function(){return this.querySelector(e)}}function Lm(e){typeof e!="function"&&(e=Tu(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i=b&&(b=y+1);!(E=v[b])&&++b<_;);m._next=E||null}}return o=new Ee(o,n),o._enter=s,o._exit=u,o}function n_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function i_(){return new Ee(this._exit||this._groups.map(Ev),this._parents)}function a_(e,t,r){var n=this.enter(),i=this,a=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}function o_(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=new Array(i),u=0;u=0;)(o=n[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function u_(e){e||(e=c_);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),a=0;at?1:e>=t?0:NaN}function l_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function f_(){return Array.from(this)}function d_(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?x_:typeof t=="function"?q_:S_)(e,t,r??"")):_t(this.node(),e)}function _t(e,t){return e.style.getPropertyValue(t)||xv(e).getComputedStyle(e,null).getPropertyValue(t)}function C_(e){return function(){delete this[e]}}function A_(e,t){return function(){this[e]=t}}function N_(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function I_(e,t){return arguments.length>1?this.each((t==null?C_:typeof t=="function"?N_:A_)(e,t)):this.node()[e]}function Sv(e){return e.trim().split(/^|\s+/)}function Mu(e){return e.classList||new qv(e)}function qv(e){this._node=e,this._names=Sv(e.getAttribute("class")||"")}qv.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Rv(e,t){for(var r=Mu(e),n=-1,i=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function ib(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,a;r()=>e;function _u(e,{sourceEvent:t,subject:r,target:n,identifier:i,active:a,x:o,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}_u.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pb(e){return!e.ctrlKey&&!e.button}function vb(){return this.parentNode}function gb(e,t){return t??{x:e.x,y:e.y}}function yb(){return navigator.maxTouchPoints||"ontouchstart"in this}function mb(){var e=pb,t=vb,r=gb,n=yb,i={},a=yr("start","drag","end"),o=0,s,u,l,c,f=0;function d(m){m.on("mousedown.drag",h).filter(n).on("touchstart.drag",v).on("touchmove.drag",p,hb).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(m,E){if(!(c||!e.call(this,m,E))){var x=b(this,t.call(this,m,E),m,E,"mouse");x&&(xe(m.view).on("mousemove.drag",_,zt).on("mouseup.drag",g,zt),Iv(m.view),an(m),l=!1,s=m.clientX,u=m.clientY,x("start",m))}}function _(m){if(yt(m),!l){var E=m.clientX-s,x=m.clientY-u;l=E*E+x*x>f}i.mouse("drag",m)}function g(m){xe(m.view).on("mousemove.drag mouseup.drag",null),Tv(m.view,l),yt(m),i.mouse("end",m)}function v(m,E){if(e.call(this,m,E)){var x=m.changedTouches,S=t.call(this,m,E),N=x.length,q,A;for(q=0;q=0&&e._call.call(void 0,t),e=e._next;--bt}function Oc(){at=(lr=Bt.now())+_r,bt=Pt=0;try{bb()}finally{bt=0,Eb(),at=0}}function wb(){var e=Bt.now(),t=e-lr;t>Mv&&(_r-=t,lr=e)}function Eb(){for(var e,t=cr,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:cr=r);Ot=e,bu(n)}function bu(e){if(!bt){Pt&&(Pt=clearTimeout(Pt));var t=e-at;t>24?(e<1/0&&(Pt=setTimeout(Oc,e-Bt.now()-_r)),At&&(At=clearInterval(At))):(At||(lr=Bt.now(),At=setInterval(wb,Mv)),bt=1,Pv(Oc))}}function kc(e,t,r){var n=new fr;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var xb=yr("start","end","cancel","interrupt"),Sb=[],kv=0,Dc=1,wu=2,ar=3,Lc=4,Eu=5,or=6;function br(e,t,r,n,i,a){var o=e.__transition;if(!o)e.__transition={};else if(r in o)return;qb(e,r,{name:t,index:n,group:i,on:xb,tween:Sb,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:kv})}function Ou(e,t){var r=Pe(e,t);if(r.state>kv)throw new Error("too late; already scheduled");return r}function Fe(e,t){var r=Pe(e,t);if(r.state>ar)throw new Error("too late; already running");return r}function Pe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function qb(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=Ov(a,0,r.time);function a(l){r.state=Dc,r.timer.restart(o,r.delay,r.time),r.delay<=l&&o(l-r.delay)}function o(l){var c,f,d,h;if(r.state!==Dc)return u();for(c in n)if(h=n[c],h.name===r.name){if(h.state===ar)return kc(o);h.state===Lc?(h.state=or,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[c]):+cwu&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function t0(e,t,r){var n,i,a=e0(t)?Ou:Fe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}function r0(e,t){var r=this._id;return arguments.length<2?Pe(this.node(),r).on.on(e):this.each(t0(r,e,t))}function n0(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function i0(){return this.on("end.remove",n0(this._id))}function a0(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Tu(e));for(var n=this._groups,i=n.length,a=new Array(i),o=0;o()=>e;function I0(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function $e(e,t,r){this.k=e,this.x=t,this.y=r}$e.prototype={constructor:$e,scale:function(e){return e===1?this:new $e(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $e(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ge=new $e(1,0,0);$e.prototype;function on(e){e.stopImmediatePropagation()}function Nt(e){e.preventDefault(),e.stopImmediatePropagation()}function T0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function M0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fc(){return this.__zoom||Ge}function P0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function O0(){return navigator.maxTouchPoints||"ontouchstart"in this}function k0(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],o=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function zv(){var e=T0,t=M0,r=k0,n=P0,i=O0,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,u=mm,l=yr("start","zoom","end"),c,f,d,h=500,_=150,g=0,v=10;function p(w){w.property("__zoom",Fc).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(w,T,C,z){var H=w.selection?w.selection():w;H.property("__zoom",Fc),w!==H?E(w,T,C,z):H.interrupt().each(function(){x(this,arguments).event(z).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},p.scaleBy=function(w,T,C,z){p.scaleTo(w,function(){var H=this.__zoom.k,M=typeof T=="function"?T.apply(this,arguments):T;return H*M},C,z)},p.scaleTo=function(w,T,C,z){p.transform(w,function(){var H=t.apply(this,arguments),M=this.__zoom,B=C==null?m(H):typeof C=="function"?C.apply(this,arguments):C,G=M.invert(B),V=typeof T=="function"?T.apply(this,arguments):T;return r(b(y(M,V),B,G),H,o)},C,z)},p.translateBy=function(w,T,C,z){p.transform(w,function(){return r(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),o)},null,z)},p.translateTo=function(w,T,C,z,H){p.transform(w,function(){var M=t.apply(this,arguments),B=this.__zoom,G=z==null?m(M):typeof z=="function"?z.apply(this,arguments):z;return r(Ge.translate(G[0],G[1]).scale(B.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof C=="function"?-C.apply(this,arguments):-C),M,o)},z,H)};function y(w,T){return T=Math.max(a[0],Math.min(a[1],T)),T===w.k?w:new $e(T,w.x,w.y)}function b(w,T,C){var z=T[0]-C[0]*w.k,H=T[1]-C[1]*w.k;return z===w.x&&H===w.y?w:new $e(w.k,z,H)}function m(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function E(w,T,C,z){w.on("start.zoom",function(){x(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(z).end()}).tween("zoom",function(){var H=this,M=arguments,B=x(H,M).event(z),G=t.apply(H,M),V=C==null?m(G):typeof C=="function"?C.apply(H,M):C,U=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),R=H.__zoom,P=typeof T=="function"?T.apply(H,M):T,F=u(R.invert(V).concat(U/R.k),P.invert(V).concat(U/P.k));return function($){if($===1)$=P;else{var j=F($),W=U/j[2];$=new $e(W,V[0]-j[0]*W,V[1]-j[1]*W)}B.zoom(null,$)}})}function x(w,T,C){return!C&&w.__zooming||new S(w,T)}function S(w,T){this.that=w,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,T),this.taps=0}S.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,T){return this.mouse&&w!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var T=xe(this.that).datum();l.call(w,this.that,new I0(w,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:l}),T)}};function N(w,...T){if(!e.apply(this,arguments))return;var C=x(this,T).event(w),z=this.__zoom,H=Math.max(a[0],Math.min(a[1],z.k*Math.pow(2,n.apply(this,arguments)))),M=Ne(w);if(C.wheel)(C.mouse[0][0]!==M[0]||C.mouse[0][1]!==M[1])&&(C.mouse[1]=z.invert(C.mouse[0]=M)),clearTimeout(C.wheel);else{if(z.k===H)return;C.mouse=[M,z.invert(M)],sr(this),C.start()}Nt(w),C.wheel=setTimeout(B,_),C.zoom("mouse",r(b(y(z,H),C.mouse[0],C.mouse[1]),C.extent,o));function B(){C.wheel=null,C.end()}}function q(w,...T){if(d||!e.apply(this,arguments))return;var C=w.currentTarget,z=x(this,T,!0).event(w),H=xe(w.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",U,!0),M=Ne(w,C),B=w.clientX,G=w.clientY;Iv(w.view),on(w),z.mouse=[M,this.__zoom.invert(M)],sr(this),z.start();function V(R){if(Nt(R),!z.moved){var P=R.clientX-B,F=R.clientY-G;z.moved=P*P+F*F>g}z.event(R).zoom("mouse",r(b(z.that.__zoom,z.mouse[0]=Ne(R,C),z.mouse[1]),z.extent,o))}function U(R){H.on("mousemove.zoom mouseup.zoom",null),Tv(R.view,z.moved),Nt(R),z.event(R).end()}}function A(w,...T){if(e.apply(this,arguments)){var C=this.__zoom,z=Ne(w.changedTouches?w.changedTouches[0]:w,this),H=C.invert(z),M=C.k*(w.shiftKey?.5:2),B=r(b(y(C,M),z,H),t.apply(this,T),o);Nt(w),s>0?xe(this).transition().duration(s).call(E,B,z,w):xe(this).call(p.transform,B,z,w)}}function I(w,...T){if(e.apply(this,arguments)){var C=w.touches,z=C.length,H=x(this,T,w.changedTouches.length===z).event(w),M,B,G,V;for(on(w),B=0;B"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},Bv=Ue.error001();function ne(e,t){const r=k.useContext(wr);if(r===null)throw new Error(Bv);return yv(r,e,t)}const fe=()=>{const e=k.useContext(wr);if(e===null)throw new Error(Bv);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},L0=e=>e.userSelectionActive?"none":"all";function Du({position:e,children:t,className:r,style:n,...i}){const a=ne(L0),o=`${e}`.split("-");return L.createElement("div",{className:pe(["react-flow__panel",r,...o]),style:{...n,pointerEvents:a},...i},t)}function F0({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:L.createElement(Du,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},L.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const z0=({x:e,y:t,label:r,labelStyle:n={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:u,className:l,...c})=>{const f=k.useRef(null),[d,h]=k.useState({x:0,y:0,width:0,height:0}),_=pe(["react-flow__edge-textwrapper",l]);return k.useEffect(()=>{if(f.current){const g=f.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[r]),typeof r>"u"||!r?null:L.createElement("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:_,visibility:d.width?"visible":"hidden",...c},i&&L.createElement("rect",{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:s,ry:s}),L.createElement("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:f,style:n},r),u)};var B0=k.memo(z0);const Lu=e=>({width:e.offsetWidth,height:e.offsetHeight}),wt=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),Fu=(e={x:0,y:0},t)=>({x:wt(e.x,t[0][0],t[1][0]),y:wt(e.y,t[0][1],t[1][1])}),zc=(e,t,r)=>er?-wt(Math.abs(e-r),1,50)/50:0,Hv=(e,t)=>{const r=zc(e.x,35,t.width-35)*20,n=zc(e.y,35,t.height-35)*20;return[r,n]},$v=e=>e.getRootNode?.()||window?.document,Gv=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Ht=({x:e,y:t,width:r,height:n})=>({x:e,y:t,x2:e+r,y2:t+n}),Vv=({x:e,y:t,x2:r,y2:n})=>({x:e,y:t,width:r-e,height:n-t}),Bc=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),H0=(e,t)=>Vv(Gv(Ht(e),Ht(t))),xu=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*n)},$0=e=>Se(e.width)&&Se(e.height)&&Se(e.x)&&Se(e.y),Se=e=>!isNaN(e)&&isFinite(e),se=Symbol.for("internals"),Uv=["Enter"," ","Escape"],G0=(e,t)=>{},V0=e=>"nativeEvent"in e;function Su(e){const r=(V0(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r?.nodeName)||r?.hasAttribute("contenteditable")||!!r?.closest(".nokey")}const jv=e=>"clientX"in e,Je=(e,t)=>{const r=jv(e),n=r?e.clientX:e.touches?.[0].clientX,i=r?e.clientY:e.touches?.[0].clientY;return{x:n-(t?.left??0),y:i-(t?.top??0)}},dr=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,Ut=({id:e,path:t,labelX:r,labelY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h=20})=>L.createElement(L.Fragment,null,L.createElement("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:d}),h&&L.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Se(r)&&Se(n)?L.createElement(B0,{x:r,y:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l}):null);Ut.displayName="BaseEdge";function It(e,t,r){return r===void 0?r:n=>{const i=t().edges.find(a=>a.id===e);i&&r(n,{...i})}}function Kv({sourceX:e,sourceY:t,targetX:r,targetY:n}){const i=Math.abs(r-e)/2,a=r{const[v,p,y]=Wv({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a});return L.createElement(Ut,{path:v,labelX:p,labelY:y,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:g})});zu.displayName="SimpleBezierEdge";const $c={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}},U0=({source:e,sourcePosition:t=J.Bottom,target:r})=>t===J.Left||t===J.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function j0({source:e,sourcePosition:t=J.Bottom,target:r,targetPosition:n=J.Top,center:i,offset:a}){const o=$c[t],s=$c[n],u={x:e.x+o.x*a,y:e.y+o.y*a},l={x:r.x+s.x*a,y:r.y+s.y*a},c=U0({source:u,sourcePosition:t,target:l}),f=c.x!==0?"x":"y",d=c[f];let h=[],_,g;const v={x:0,y:0},p={x:0,y:0},[y,b,m,E]=Kv({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(o[f]*s[f]===-1){_=i.x??y,g=i.y??b;const S=[{x:_,y:u.y},{x:_,y:l.y}],N=[{x:u.x,y:g},{x:l.x,y:g}];o[f]===d?h=f==="x"?S:N:h=f==="x"?N:S}else{const S=[{x:u.x,y:l.y}],N=[{x:l.x,y:u.y}];if(f==="x"?h=o.x===d?N:S:h=o.y===d?S:N,t===n){const O=Math.abs(e[f]-r[f]);if(O<=a){const w=Math.min(a-1,a-O);o[f]===d?v[f]=(u[f]>e[f]?-1:1)*w:p[f]=(l[f]>r[f]?-1:1)*w}}if(t!==n){const O=f==="x"?"y":"x",w=o[f]===s[O],T=u[O]>l[O],C=u[O]=D?(_=(q.x+A.x)/2,g=h[0].y):(_=h[0].x,g=(q.y+A.y)/2)}return[[e,{x:u.x+v.x,y:u.y+v.y},...h,{x:l.x+p.x,y:l.y+p.y},r],_,g,m,E]}function K0(e,t,r,n){const i=Math.min(Gc(e,t)/2,Gc(t,r)/2,n),{x:a,y:o}=t;if(e.x===a&&a===r.x||e.y===o&&o===r.y)return`L${a} ${o}`;if(e.y===o){const l=e.x{let b="";return y>0&&y{const[p,y,b]=qu({sourceX:e,sourceY:t,sourcePosition:f,targetX:r,targetY:n,targetPosition:d,borderRadius:g?.borderRadius,offset:g?.offset});return L.createElement(Ut,{path:p,labelX:y,labelY:b,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:h,markerStart:_,interactionWidth:v})});Er.displayName="SmoothStepEdge";const Bu=k.memo(e=>L.createElement(Er,{...e,pathOptions:k.useMemo(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));Bu.displayName="StepEdge";function Y0({sourceX:e,sourceY:t,targetX:r,targetY:n}){const[i,a,o,s]=Kv({sourceX:e,sourceY:t,targetX:r,targetY:n});return[`M ${e},${t}L ${r},${n}`,i,a,o,s]}const Hu=k.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})=>{const[_,g,v]=Y0({sourceX:e,sourceY:t,targetX:r,targetY:n});return L.createElement(Ut,{path:_,labelX:g,labelY:v,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})});Hu.displayName="StraightEdge";function er(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Vc({pos:e,x1:t,y1:r,x2:n,y2:i,c:a}){switch(e){case J.Left:return[t-er(t-n,a),r];case J.Right:return[t+er(n-t,a),r];case J.Top:return[t,r-er(r-i,a)];case J.Bottom:return[t,r+er(i-r,a)]}}function Zv({sourceX:e,sourceY:t,sourcePosition:r=J.Bottom,targetX:n,targetY:i,targetPosition:a=J.Top,curvature:o=.25}){const[s,u]=Vc({pos:r,x1:e,y1:t,x2:n,y2:i,c:o}),[l,c]=Vc({pos:a,x1:n,y1:i,x2:e,y2:t,c:o}),[f,d,h,_]=Yv({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:s,sourceControlY:u,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${u} ${l},${c} ${n},${i}`,f,d,h,_]}const pr=k.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,sourcePosition:i=J.Bottom,targetPosition:a=J.Top,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,pathOptions:g,interactionWidth:v})=>{const[p,y,b]=Zv({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a,curvature:g?.curvature});return L.createElement(Ut,{path:p,labelX:y,labelY:b,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:v})});pr.displayName="BezierEdge";const $u=k.createContext(null),W0=$u.Provider;$u.Consumer;const Z0=()=>k.useContext($u),X0=e=>"id"in e&&"source"in e&&"target"in e,J0=({source:e,sourceHandle:t,target:r,targetHandle:n})=>`reactflow__edge-${e}${t||""}-${r}${n||""}`,Ru=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`,Q0=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),ew=(e,t)=>{if(!e.source||!e.target)return t;let r;return X0(e)?r={...e}:r={...e,id:J0(e)},Q0(r,t)?t:t.concat(r)},Cu=({x:e,y:t},[r,n,i],a,[o,s])=>{const u={x:(e-r)/i,y:(t-n)/i};return a?{x:o*Math.round(u.x/o),y:s*Math.round(u.y/s)}:u},Xv=({x:e,y:t},[r,n,i])=>({x:e*i+r,y:t*i+n}),it=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*t[0],n=(e.height??0)*t[1],i={x:e.position.x-r,y:e.position.y-n};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-n}:i}},xr=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((n,i)=>{const{x:a,y:o}=it(i,t).positionAbsolute;return Gv(n,Ht({x:a,y:o,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Vv(r)},Jv=(e,t,[r,n,i]=[0,0,1],a=!1,o=!1,s=[0,0])=>{const u={x:(t.x-r)/i,y:(t.y-n)/i,width:t.width/i,height:t.height/i},l=[];return e.forEach(c=>{const{width:f,height:d,selectable:h=!0,hidden:_=!1}=c;if(o&&!h||_)return!1;const{positionAbsolute:g}=it(c,s),v={x:g.x,y:g.y,width:f||0,height:d||0},p=xu(u,v),y=typeof f>"u"||typeof d>"u"||f===null||d===null,b=a&&p>0,m=(f||0)*(d||0);(y||b||p>=m||c.dragging)&&l.push(c)}),l},Qv=(e,t)=>{const r=e.map(n=>n.id);return t.filter(n=>r.includes(n.source)||r.includes(n.target))},eg=(e,t,r,n,i,a=.1)=>{const o=t/(e.width*(1+a)),s=r/(e.height*(1+a)),u=Math.min(o,s),l=wt(u,n,i),c=e.x+e.width/2,f=e.y+e.height/2,d=t/2-c*l,h=r/2-f*l;return{x:d,y:h,zoom:l}},rt=(e,t=0)=>e.transition().duration(t);function Uc(e,t,r,n){return(t[r]||[]).reduce((i,a)=>(`${e.id}-${a.id}-${r}`!==n&&i.push({id:a.id||null,type:r,nodeId:e.id,x:(e.positionAbsolute?.x??0)+a.x+a.width/2,y:(e.positionAbsolute?.y??0)+a.y+a.height/2}),i),[])}function tw(e,t,r,n,i,a){const{x:o,y:s}=Je(e),l=t.elementsFromPoint(o,s).find(_=>_.classList.contains("react-flow__handle"));if(l){const _=l.getAttribute("data-nodeid");if(_){const g=Gu(void 0,l),v=l.getAttribute("data-handleid"),p=a({nodeId:_,id:v,type:g});if(p){const y=i.find(b=>b.nodeId===_&&b.type===g&&b.id===v);return{handle:{id:v,type:g,nodeId:_,x:y?.x||r.x,y:y?.y||r.y},validHandleResult:p}}}}let c=[],f=1/0;if(i.forEach(_=>{const g=Math.sqrt((_.x-r.x)**2+(_.y-r.y)**2);if(g<=n){const v=a(_);g<=f&&(g_.isValid),h=c.some(({handle:_})=>_.type==="target");return c.find(({handle:_,validHandleResult:g})=>h?_.type==="target":d?g.isValid:!0)||c[0]}const rw={source:null,target:null,sourceHandle:null,targetHandle:null},tg=()=>({handleDomNode:null,isValid:!1,connection:rw,endHandle:null});function rg(e,t,r,n,i,a,o){const s=i==="target",u=o.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),l={...tg(),handleDomNode:u};if(u){const c=Gu(void 0,u),f=u.getAttribute("data-nodeid"),d=u.getAttribute("data-handleid"),h=u.classList.contains("connectable"),_=u.classList.contains("connectableend"),g={source:s?f:r,sourceHandle:s?d:n,target:s?r:f,targetHandle:s?n:d};l.connection=g,h&&_&&(t===ot.Strict?s&&c==="source"||!s&&c==="target":f!==r||d!==n)&&(l.endHandle={nodeId:f,handleId:d,type:c},l.isValid=a(g))}return l}function nw({nodes:e,nodeId:t,handleId:r,handleType:n}){return e.reduce((i,a)=>{if(a[se]){const{handleBounds:o}=a[se];let s=[],u=[];o&&(s=Uc(a,o,"source",`${t}-${r}-${n}`),u=Uc(a,o,"target",`${t}-${r}-${n}`)),i.push(...s,...u)}return i},[])}function Gu(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function sn(e){e?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function iw(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function ng({event:e,handleId:t,nodeId:r,onConnect:n,isTarget:i,getState:a,setState:o,isValidConnection:s,edgeUpdaterType:u,onReconnectEnd:l}){const c=$v(e.target),{connectionMode:f,domNode:d,autoPanOnConnect:h,connectionRadius:_,onConnectStart:g,panBy:v,getNodes:p,cancelConnection:y}=a();let b=0,m;const{x:E,y:x}=Je(e),S=c?.elementFromPoint(E,x),N=Gu(u,S),q=d?.getBoundingClientRect();if(!q||!N)return;let A,I=Je(e,q),D=!1,O=null,w=!1,T=null;const C=nw({nodes:p(),nodeId:r,handleId:t,handleType:N}),z=()=>{if(!h)return;const[B,G]=Hv(I,q);v({x:B,y:G}),b=requestAnimationFrame(z)};o({connectionPosition:I,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:N,connectionStartHandle:{nodeId:r,handleId:t,type:N},connectionEndHandle:null}),g?.(e,{nodeId:r,handleId:t,handleType:N});function H(B){const{transform:G}=a();I=Je(B,q);const{handle:V,validHandleResult:U}=tw(B,c,Cu(I,G,!1,[1,1]),_,C,R=>rg(R,f,r,t,i?"target":"source",s,c));if(m=V,D||(z(),D=!0),T=U.handleDomNode,O=U.connection,w=U.isValid,o({connectionPosition:m&&w?Xv({x:m.x,y:m.y},G):I,connectionStatus:iw(!!m,w),connectionEndHandle:U.endHandle}),!m&&!w&&!T)return sn(A);O.source!==O.target&&T&&(sn(A),A=T,T.classList.add("connecting","react-flow__handle-connecting"),T.classList.toggle("valid",w),T.classList.toggle("react-flow__handle-valid",w))}function M(B){(m||T)&&O&&w&&n?.(O),a().onConnectEnd?.(B),u&&l?.(B),sn(A),y(),cancelAnimationFrame(b),D=!1,w=!1,O=null,T=null,c.removeEventListener("mousemove",H),c.removeEventListener("mouseup",M),c.removeEventListener("touchmove",H),c.removeEventListener("touchend",M)}c.addEventListener("mousemove",H),c.addEventListener("mouseup",M),c.addEventListener("touchmove",H),c.addEventListener("touchend",M)}const jc=()=>!0,aw=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),ow=(e,t,r)=>n=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:o}=n;return{connecting:i?.nodeId===e&&i?.handleId===t&&i?.type===r||a?.nodeId===e&&a?.handleId===t&&a?.type===r,clickConnecting:o?.nodeId===e&&o?.handleId===t&&o?.type===r}},ig=k.forwardRef(({type:e="source",position:t=J.Top,isValidConnection:r,isConnectable:n=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:u,className:l,onMouseDown:c,onTouchStart:f,...d},h)=>{const _=o||null,g=e==="target",v=fe(),p=Z0(),{connectOnClick:y,noPanClassName:b}=ne(aw,he),{connecting:m,clickConnecting:E}=ne(ow(p,_,e),he);p||v.getState().onError?.("010",Ue.error010());const x=q=>{const{defaultEdgeOptions:A,onConnect:I,hasDefaultEdges:D}=v.getState(),O={...A,...q};if(D){const{edges:w,setEdges:T}=v.getState();T(ew(O,w))}I?.(O),s?.(O)},S=q=>{if(!p)return;const A=jv(q);i&&(A&&q.button===0||!A)&&ng({event:q,handleId:_,nodeId:p,onConnect:x,isTarget:g,getState:v.getState,setState:v.setState,isValidConnection:r||v.getState().isValidConnection||jc}),A?c?.(q):f?.(q)},N=q=>{const{onClickConnectStart:A,onClickConnectEnd:I,connectionClickStartHandle:D,connectionMode:O,isValidConnection:w}=v.getState();if(!p||!D&&!i)return;if(!D){A?.(q,{nodeId:p,handleId:_,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:p,type:e,handleId:_}});return}const T=$v(q.target),C=r||w||jc,{connection:z,isValid:H}=rg({nodeId:p,id:_,type:e},O,D.nodeId,D.handleId||null,D.type,C,T);H&&x(z),I?.(q),v.setState({connectionClickStartHandle:null})};return L.createElement("div",{"data-handleid":_,"data-nodeid":p,"data-handlepos":t,"data-id":`${p}-${_}-${e}`,className:pe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,l,{source:!g,target:g,connectable:n,connectablestart:i,connectableend:a,connecting:E,connectionindicator:n&&(i&&!m||a&&m)}]),onMouseDown:S,onTouchStart:S,onClick:y?N:void 0,ref:h,...d},u)});ig.displayName="Handle";var vr=k.memo(ig);const ag=({data:e,isConnectable:t,targetPosition:r=J.Top,sourcePosition:n=J.Bottom})=>L.createElement(L.Fragment,null,L.createElement(vr,{type:"target",position:r,isConnectable:t}),e?.label,L.createElement(vr,{type:"source",position:n,isConnectable:t}));ag.displayName="DefaultNode";var Au=k.memo(ag);const og=({data:e,isConnectable:t,sourcePosition:r=J.Bottom})=>L.createElement(L.Fragment,null,e?.label,L.createElement(vr,{type:"source",position:r,isConnectable:t}));og.displayName="InputNode";var sg=k.memo(og);const ug=({data:e,isConnectable:t,targetPosition:r=J.Top})=>L.createElement(L.Fragment,null,L.createElement(vr,{type:"target",position:r,isConnectable:t}),e?.label);ug.displayName="OutputNode";var cg=k.memo(ug);const Vu=()=>null;Vu.displayName="GroupNode";const sw=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),tr=e=>e.id;function uw(e,t){return he(e.selectedNodes.map(tr),t.selectedNodes.map(tr))&&he(e.selectedEdges.map(tr),t.selectedEdges.map(tr))}const lg=k.memo(({onSelectionChange:e})=>{const t=fe(),{selectedNodes:r,selectedEdges:n}=ne(sw,uw);return k.useEffect(()=>{const i={nodes:r,edges:n};e?.(i),t.getState().onSelectionChange.forEach(a=>a(i))},[r,n,e]),null});lg.displayName="SelectionListener";const cw=e=>!!e.onSelectionChange;function lw({onSelectionChange:e}){const t=ne(cw);return e||t?L.createElement(lg,{onSelectionChange:e}):null}const fw=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function dt(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Q(e,t,r){k.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const dw=({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:i,onConnectStart:a,onConnectEnd:o,onClickConnectStart:s,onClickConnectEnd:u,nodesDraggable:l,nodesConnectable:c,nodesFocusable:f,edgesFocusable:d,edgesUpdatable:h,elevateNodesOnSelect:_,minZoom:g,maxZoom:v,nodeExtent:p,onNodesChange:y,onEdgesChange:b,elementsSelectable:m,connectionMode:E,snapGrid:x,snapToGrid:S,translateExtent:N,connectOnClick:q,defaultEdgeOptions:A,fitView:I,fitViewOptions:D,onNodesDelete:O,onEdgesDelete:w,onNodeDrag:T,onNodeDragStart:C,onNodeDragStop:z,onSelectionDrag:H,onSelectionDragStart:M,onSelectionDragStop:B,noPanClassName:G,nodeOrigin:V,rfId:U,autoPanOnConnect:R,autoPanOnNodeDrag:P,onError:F,connectionRadius:$,isValidConnection:j,nodeDragThreshold:W})=>{const{setNodes:Z,setEdges:te,setDefaultNodesAndEdges:ie,setMinZoom:re,setMaxZoom:ee,setTranslateExtent:X,setNodeExtent:ue,reset:K}=ne(fw,he),Y=fe();return k.useEffect(()=>{const oe=n?.map(Ce=>({...Ce,...A}));return ie(r,oe),()=>{K()}},[]),Q("defaultEdgeOptions",A,Y.setState),Q("connectionMode",E,Y.setState),Q("onConnect",i,Y.setState),Q("onConnectStart",a,Y.setState),Q("onConnectEnd",o,Y.setState),Q("onClickConnectStart",s,Y.setState),Q("onClickConnectEnd",u,Y.setState),Q("nodesDraggable",l,Y.setState),Q("nodesConnectable",c,Y.setState),Q("nodesFocusable",f,Y.setState),Q("edgesFocusable",d,Y.setState),Q("edgesUpdatable",h,Y.setState),Q("elementsSelectable",m,Y.setState),Q("elevateNodesOnSelect",_,Y.setState),Q("snapToGrid",S,Y.setState),Q("snapGrid",x,Y.setState),Q("onNodesChange",y,Y.setState),Q("onEdgesChange",b,Y.setState),Q("connectOnClick",q,Y.setState),Q("fitViewOnInit",I,Y.setState),Q("fitViewOnInitOptions",D,Y.setState),Q("onNodesDelete",O,Y.setState),Q("onEdgesDelete",w,Y.setState),Q("onNodeDrag",T,Y.setState),Q("onNodeDragStart",C,Y.setState),Q("onNodeDragStop",z,Y.setState),Q("onSelectionDrag",H,Y.setState),Q("onSelectionDragStart",M,Y.setState),Q("onSelectionDragStop",B,Y.setState),Q("noPanClassName",G,Y.setState),Q("nodeOrigin",V,Y.setState),Q("rfId",U,Y.setState),Q("autoPanOnConnect",R,Y.setState),Q("autoPanOnNodeDrag",P,Y.setState),Q("onError",F,Y.setState),Q("connectionRadius",$,Y.setState),Q("isValidConnection",j,Y.setState),Q("nodeDragThreshold",W,Y.setState),dt(e,Z),dt(t,te),dt(g,re),dt(v,ee),dt(N,X),dt(p,ue),null},Kc={display:"none"},hw={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},fg="react-flow__node-desc",dg="react-flow__edge-desc",pw="react-flow__aria-live",vw=e=>e.ariaLiveMessage;function gw({rfId:e}){const t=ne(vw);return L.createElement("div",{id:`${pw}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:hw},t)}function yw({rfId:e,disableKeyboardA11y:t}){return L.createElement(L.Fragment,null,L.createElement("div",{id:`${fg}-${e}`,style:Kc},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),L.createElement("div",{id:`${dg}-${e}`,style:Kc},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&L.createElement(gw,{rfId:e}))}var Gt=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,n]=k.useState(!1),i=k.useRef(!1),a=k.useRef(new Set([])),[o,s]=k.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),c=l.reduce((f,d)=>f.concat(...d),[]);return[l,c]}return[[],[]]},[e]);return k.useEffect(()=>{const u=typeof document<"u"?document:null,l=t?.target||u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Su(h))return!1;const g=Wc(h.code,s);a.current.add(h[g]),Yc(o,a.current,!1)&&(h.preventDefault(),n(!0))},f=h=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Su(h))return!1;const g=Wc(h.code,s);Yc(o,a.current,!0)?(n(!1),a.current.clear()):a.current.delete(h[g]),h.key==="Meta"&&a.current.clear(),i.current=!1},d=()=>{a.current.clear(),n(!1)};return l?.addEventListener("keydown",c),l?.addEventListener("keyup",f),window.addEventListener("blur",d),()=>{l?.removeEventListener("keydown",c),l?.removeEventListener("keyup",f),window.removeEventListener("blur",d)}}},[e,n]),r};function Yc(e,t,r){return e.filter(n=>r||n.length===t.size).some(n=>n.every(i=>t.has(i)))}function Wc(e,t){return t.includes(e)?"code":"key"}function hg(e,t,r,n){const i=e.parentNode||e.parentId;if(!i)return r;const a=t.get(i),o=it(a,n);return hg(a,t,{x:(r.x??0)+o.x,y:(r.y??0)+o.y,z:(a[se]?.z??0)>(r.z??0)?a[se]?.z??0:r.z??0},n)}function pg(e,t,r){e.forEach(n=>{const i=n.parentNode||n.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||r?.[n.id]){const{x:a,y:o,z:s}=hg(n,e,{...n.position,z:n[se]?.z??0},t);n.positionAbsolute={x:a,y:o},n[se].z=s,r?.[n.id]&&(n[se].isParent=!0)}})}function un(e,t,r,n){const i=new Map,a={},o=n?1e3:0;return e.forEach(s=>{const u=(Se(s.zIndex)?s.zIndex:0)+(s.selected?o:0),l=t.get(s.id),c={...s,positionAbsolute:{x:s.position.x,y:s.position.y}},f=s.parentNode||s.parentId;f&&(a[f]=!0);const d=l?.type&&l?.type!==s.type;Object.defineProperty(c,se,{enumerable:!1,value:{handleBounds:d?void 0:l?.[se]?.handleBounds,z:u}}),i.set(s.id,c)}),pg(i,r,a),i}function vg(e,t={}){const{getNodes:r,width:n,height:i,minZoom:a,maxZoom:o,d3Zoom:s,d3Selection:u,fitViewOnInitDone:l,fitViewOnInit:c,nodeOrigin:f}=e(),d=t.initial&&!l&&c;if(s&&u&&(d||!t.initial)){const _=r().filter(v=>{const p=t.includeHiddenNodes?v.width&&v.height:!v.hidden;return t.nodes?.length?p&&t.nodes.some(y=>y.id===v.id):p}),g=_.every(v=>v.width&&v.height);if(_.length>0&&g){const v=xr(_,f),{x:p,y,zoom:b}=eg(v,n,i,t.minZoom??a,t.maxZoom??o,t.padding??.1),m=Ge.translate(p,y).scale(b);return typeof t.duration=="number"&&t.duration>0?s.transform(rt(u,t.duration),m):s.transform(u,m),!0}}return!1}function mw(e,t){return e.forEach(r=>{const n=t.get(r.id);n&&t.set(n.id,{...n,[se]:n[se],selected:r.selected})}),new Map(t)}function _w(e,t){return t.map(r=>{const n=e.find(i=>i.id===r.id);return n&&(r.selected=n.selected),r})}function rr({changedNodes:e,changedEdges:t,get:r,set:n}){const{nodeInternals:i,edges:a,onNodesChange:o,onEdgesChange:s,hasDefaultNodes:u,hasDefaultEdges:l}=r();e?.length&&(u&&n({nodeInternals:mw(e,i)}),o?.(e)),t?.length&&(l&&n({edges:_w(t,a)}),s?.(t))}const ht=()=>{},bw={zoomIn:ht,zoomOut:ht,zoomTo:ht,getZoom:()=>1,setViewport:ht,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ht,fitBounds:ht,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},ww=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Ew=()=>{const e=fe(),{d3Zoom:t,d3Selection:r}=ne(ww,he);return k.useMemo(()=>r&&t?{zoomIn:i=>t.scaleBy(rt(r,i?.duration),1.2),zoomOut:i=>t.scaleBy(rt(r,i?.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(rt(r,a?.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[o,s,u]=e.getState().transform,l=Ge.translate(i.x??o,i.y??s).scale(i.zoom??u);t.transform(rt(r,a?.duration),l)},getViewport:()=>{const[i,a,o]=e.getState().transform;return{x:i,y:a,zoom:o}},fitView:i=>vg(e.getState,i),setCenter:(i,a,o)=>{const{width:s,height:u,maxZoom:l}=e.getState(),c=typeof o?.zoom<"u"?o.zoom:l,f=s/2-i*c,d=u/2-a*c,h=Ge.translate(f,d).scale(c);t.transform(rt(r,o?.duration),h)},fitBounds:(i,a)=>{const{width:o,height:s,minZoom:u,maxZoom:l}=e.getState(),{x:c,y:f,zoom:d}=eg(i,o,s,u,l,a?.padding??.1),h=Ge.translate(c,f).scale(d);t.transform(rt(r,a?.duration),h)},project:i=>{const{transform:a,snapToGrid:o,snapGrid:s}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Cu(i,a,o,s)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:o,snapGrid:s,domNode:u}=e.getState();if(!u)return i;const{x:l,y:c}=u.getBoundingClientRect(),f={x:i.x-l,y:i.y-c};return Cu(f,a,o,s)},flowToScreenPosition:i=>{const{transform:a,domNode:o}=e.getState();if(!o)return i;const{x:s,y:u}=o.getBoundingClientRect(),l=Xv(i,a);return{x:l.x+s,y:l.y+u}},viewportInitialized:!0}:bw,[t,r])};function Uu(){const e=Ew(),t=fe(),r=k.useCallback(()=>t.getState().getNodes().map(g=>({...g})),[]),n=k.useCallback(g=>t.getState().nodeInternals.get(g),[]),i=k.useCallback(()=>{const{edges:g=[]}=t.getState();return g.map(v=>({...v}))},[]),a=k.useCallback(g=>{const{edges:v=[]}=t.getState();return v.find(p=>p.id===g)},[]),o=k.useCallback(g=>{const{getNodes:v,setNodes:p,hasDefaultNodes:y,onNodesChange:b}=t.getState(),m=v(),E=typeof g=="function"?g(m):g;if(y)p(E);else if(b){const x=E.length===0?m.map(S=>({type:"remove",id:S.id})):E.map(S=>({item:S,type:"reset"}));b(x)}},[]),s=k.useCallback(g=>{const{edges:v=[],setEdges:p,hasDefaultEdges:y,onEdgesChange:b}=t.getState(),m=typeof g=="function"?g(v):g;if(y)p(m);else if(b){const E=m.length===0?v.map(x=>({type:"remove",id:x.id})):m.map(x=>({item:x,type:"reset"}));b(E)}},[]),u=k.useCallback(g=>{const v=Array.isArray(g)?g:[g],{getNodes:p,setNodes:y,hasDefaultNodes:b,onNodesChange:m}=t.getState();if(b){const x=[...p(),...v];y(x)}else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),l=k.useCallback(g=>{const v=Array.isArray(g)?g:[g],{edges:p=[],setEdges:y,hasDefaultEdges:b,onEdgesChange:m}=t.getState();if(b)y([...p,...v]);else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),c=k.useCallback(()=>{const{getNodes:g,edges:v=[],transform:p}=t.getState(),[y,b,m]=p;return{nodes:g().map(E=>({...E})),edges:v.map(E=>({...E})),viewport:{x:y,y:b,zoom:m}}},[]),f=k.useCallback(({nodes:g,edges:v})=>{const{nodeInternals:p,getNodes:y,edges:b,hasDefaultNodes:m,hasDefaultEdges:E,onNodesDelete:x,onEdgesDelete:S,onNodesChange:N,onEdgesChange:q}=t.getState(),A=(g||[]).map(T=>T.id),I=(v||[]).map(T=>T.id),D=y().reduce((T,C)=>{const z=C.parentNode||C.parentId,H=!A.includes(C.id)&&z&&T.find(B=>B.id===z);return(typeof C.deletable=="boolean"?C.deletable:!0)&&(A.includes(C.id)||H)&&T.push(C),T},[]),O=b.filter(T=>typeof T.deletable=="boolean"?T.deletable:!0),w=O.filter(T=>I.includes(T.id));if(D||w){const T=Qv(D,O),C=[...w,...T],z=C.reduce((H,M)=>(H.includes(M.id)||H.push(M.id),H),[]);if((E||m)&&(E&&t.setState({edges:b.filter(H=>!z.includes(H.id))}),m&&(D.forEach(H=>{p.delete(H.id)}),t.setState({nodeInternals:new Map(p)}))),z.length>0&&(S?.(C),q&&q(z.map(H=>({id:H,type:"remove"})))),D.length>0&&(x?.(D),N)){const H=D.map(M=>({id:M.id,type:"remove"}));N(H)}}},[]),d=k.useCallback(g=>{const v=$0(g),p=v?null:t.getState().nodeInternals.get(g.id);return!v&&!p?[null,null,v]:[v?g:Bc(p),p,v]},[]),h=k.useCallback((g,v=!0,p)=>{const[y,b,m]=d(g);return y?(p||t.getState().getNodes()).filter(E=>{if(!m&&(E.id===b.id||!E.positionAbsolute))return!1;const x=Bc(E),S=xu(x,y);return v&&S>0||S>=y.width*y.height}):[]},[]),_=k.useCallback((g,v,p=!0)=>{const[y]=d(g);if(!y)return!1;const b=xu(y,v);return p&&b>0||b>=y.width*y.height},[]);return k.useMemo(()=>({...e,getNodes:r,getNode:n,getEdges:i,getEdge:a,setNodes:o,setEdges:s,addNodes:u,addEdges:l,toObject:c,deleteElements:f,getIntersectingNodes:h,isNodeIntersecting:_}),[e,r,n,i,a,o,s,u,l,c,f,h,_])}const xw={actInsideInputWithModifier:!1};var Sw=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=fe(),{deleteElements:n}=Uu(),i=Gt(e,xw),a=Gt(t);k.useEffect(()=>{if(i){const{edges:o,getNodes:s}=r.getState(),u=s().filter(c=>c.selected),l=o.filter(c=>c.selected);n({nodes:u,edges:l}),r.setState({nodesSelectionActive:!1})}},[i]),k.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])};function qw(e){const t=fe();k.useEffect(()=>{let r;const n=()=>{if(!e.current)return;const i=Lu(e.current);(i.height===0||i.width===0)&&t.getState().onError?.("004",Ue.error004()),t.setState({width:i.width||500,height:i.height||500})};return n(),window.addEventListener("resize",n),e.current&&(r=new ResizeObserver(()=>n()),r.observe(e.current)),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}},[])}const ju={position:"absolute",width:"100%",height:"100%",top:0,left:0},Rw=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,nr=e=>({x:e.x,y:e.y,zoom:e.k}),pt=(e,t)=>e.target.closest(`.${t}`),Zc=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xc=e=>{const t=e.ctrlKey&&dr()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Cw=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Aw=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:n,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:u=nt.Free,zoomOnDoubleClick:l=!0,elementsSelectable:c,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:_,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:p=!0,children:y,noWheelClassName:b,noPanClassName:m})=>{const E=k.useRef(),x=fe(),S=k.useRef(!1),N=k.useRef(!1),q=k.useRef(null),A=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:D,d3ZoomHandler:O,userSelectionActive:w}=ne(Cw,he),T=Gt(v),C=k.useRef(0),z=k.useRef(!1),H=k.useRef();return qw(q),k.useEffect(()=>{if(q.current){const M=q.current.getBoundingClientRect(),B=zv().scaleExtent([_,g]).translateExtent(h),G=xe(q.current).call(B),V=Ge.translate(d.x,d.y).scale(wt(d.zoom,_,g)),U=[[0,0],[M.width,M.height]],R=B.constrain()(V,U,h);B.transform(G,R),B.wheelDelta(Xc),x.setState({d3Zoom:B,d3Selection:G,d3ZoomHandler:G.on("wheel.zoom"),transform:[R.x,R.y,R.k],domNode:q.current.closest(".react-flow")})}},[]),k.useEffect(()=>{D&&I&&(o&&!T&&!w?D.on("wheel.zoom",M=>{if(pt(M,b))return!1;M.preventDefault(),M.stopImmediatePropagation();const B=D.property("__zoom").k||1;if(M.ctrlKey&&a){const j=Ne(M),W=Xc(M),Z=B*Math.pow(2,W);I.scaleTo(D,Z,j,M);return}const G=M.deltaMode===1?20:1;let V=u===nt.Vertical?0:M.deltaX*G,U=u===nt.Horizontal?0:M.deltaY*G;!dr()&&M.shiftKey&&u!==nt.Vertical&&(V=M.deltaY*G,U=0),I.translateBy(D,-(V/B)*s,-(U/B)*s,{internal:!0});const R=nr(D.property("__zoom")),{onViewportChangeStart:P,onViewportChange:F,onViewportChangeEnd:$}=x.getState();clearTimeout(H.current),z.current||(z.current=!0,t?.(M,R),P?.(R)),z.current&&(e?.(M,R),F?.(R),H.current=setTimeout(()=>{r?.(M,R),$?.(R),z.current=!1},150))},{passive:!1}):typeof O<"u"&&D.on("wheel.zoom",function(M,B){if(!p&&M.type==="wheel"&&!M.ctrlKey||pt(M,b))return null;M.preventDefault(),O.call(this,M,B)},{passive:!1}))},[w,o,u,D,I,O,T,a,p,b,t,e,r]),k.useEffect(()=>{I&&I.on("start",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;C.current=M.sourceEvent?.button;const{onViewportChangeStart:B}=x.getState(),G=nr(M.transform);S.current=!0,A.current=G,M.sourceEvent?.type==="mousedown"&&x.setState({paneDragging:!0}),B?.(G),t?.(M.sourceEvent,G)})},[I,t]),k.useEffect(()=>{I&&(w&&!S.current?I.on("zoom",null):w||I.on("zoom",M=>{const{onViewportChange:B}=x.getState();if(x.setState({transform:[M.transform.x,M.transform.y,M.transform.k]}),N.current=!!(n&&Zc(f,C.current??0)),(e||B)&&!M.sourceEvent?.internal){const G=nr(M.transform);B?.(G),e?.(M.sourceEvent,G)}}))},[w,I,e,f,n]),k.useEffect(()=>{I&&I.on("end",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=x.getState();if(S.current=!1,x.setState({paneDragging:!1}),n&&Zc(f,C.current??0)&&!N.current&&n(M.sourceEvent),N.current=!1,(r||B)&&Rw(A.current,M.transform)){const G=nr(M.transform);A.current=G,clearTimeout(E.current),E.current=setTimeout(()=>{B?.(G),r?.(M.sourceEvent,G)},o?150:0)}})},[I,o,f,r,n]),k.useEffect(()=>{I&&I.filter(M=>{const B=T||i,G=a&&M.ctrlKey;if((f===!0||Array.isArray(f)&&f.includes(1))&&M.button===1&&M.type==="mousedown"&&(pt(M,"react-flow__node")||pt(M,"react-flow__edge")))return!0;if(!f&&!B&&!o&&!l&&!a||w||!l&&M.type==="dblclick"||pt(M,b)&&M.type==="wheel"||pt(M,m)&&(M.type!=="wheel"||o&&M.type==="wheel"&&!T)||!a&&M.ctrlKey&&M.type==="wheel"||!B&&!o&&!G&&M.type==="wheel"||!f&&(M.type==="mousedown"||M.type==="touchstart")||Array.isArray(f)&&!f.includes(M.button)&&M.type==="mousedown")return!1;const V=Array.isArray(f)&&f.includes(M.button)||!M.button||M.button<=1;return(!M.ctrlKey||M.type==="wheel")&&V})},[w,I,i,a,o,l,f,c,T]),L.createElement("div",{className:"react-flow__renderer",ref:q,style:ju},y)},Nw=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Iw(){const{userSelectionActive:e,userSelectionRect:t}=ne(Nw,he);return e&&t?L.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Jc(e,t){const r=t.parentNode||t.parentId,n=e.find(i=>i.id===r);if(n){const i=t.position.x+t.width-n.width,a=t.position.y+t.height-n.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,i>0&&(n.style.width+=i),a>0&&(n.style.height+=a),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function gg(e,t){if(e.some(n=>n.type==="reset"))return e.filter(n=>n.type==="reset").map(n=>n.item);const r=e.filter(n=>n.type==="add").map(n=>n.item);return t.reduce((n,i)=>{const a=e.filter(s=>s.id===i.id);if(a.length===0)return n.push(i),n;const o={...i};for(const s of a)if(s)switch(s.type){case"select":{o.selected=s.selected;break}case"position":{typeof s.position<"u"&&(o.position=s.position),typeof s.positionAbsolute<"u"&&(o.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(o.dragging=s.dragging),o.expandParent&&Jc(n,o);break}case"dimensions":{typeof s.dimensions<"u"&&(o.width=s.dimensions.width,o.height=s.dimensions.height),typeof s.updateStyle<"u"&&(o.style={...o.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(o.resizing=s.resizing),o.expandParent&&Jc(n,o);break}case"remove":return n}return n.push(o),n},r)}function yg(e,t){return gg(e,t)}function Tw(e,t){return gg(e,t)}const Ze=(e,t)=>({id:e,type:"select",selected:t});function gt(e,t){return e.reduce((r,n)=>{const i=t.includes(n.id);return!n.selected&&i?(n.selected=!0,r.push(Ze(n.id,!0))):n.selected&&!i&&(n.selected=!1,r.push(Ze(n.id,!1))),r},[])}const cn=(e,t)=>r=>{r.target===t.current&&e?.(r)},Mw=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),mg=k.memo(({isSelecting:e,selectionMode:t=$t.Full,panOnDrag:r,onSelectionStart:n,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:o,onPaneScroll:s,onPaneMouseEnter:u,onPaneMouseMove:l,onPaneMouseLeave:c,children:f})=>{const d=k.useRef(null),h=fe(),_=k.useRef(0),g=k.useRef(0),v=k.useRef(),{userSelectionActive:p,elementsSelectable:y,dragging:b}=ne(Mw,he),m=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},E=O=>{a?.(O),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},x=O=>{if(Array.isArray(r)&&r?.includes(2)){O.preventDefault();return}o?.(O)},S=s?O=>s(O):void 0,N=O=>{const{resetSelectedElements:w,domNode:T}=h.getState();if(v.current=T?.getBoundingClientRect(),!y||!e||O.button!==0||O.target!==d.current||!v.current)return;const{x:C,y:z}=Je(O,v.current);w(),h.setState({userSelectionRect:{width:0,height:0,startX:C,startY:z,x:C,y:z}}),n?.(O)},q=O=>{const{userSelectionRect:w,nodeInternals:T,edges:C,transform:z,onNodesChange:H,onEdgesChange:M,nodeOrigin:B,getNodes:G}=h.getState();if(!e||!v.current||!w)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Je(O,v.current),U=w.startX??0,R=w.startY??0,P={...w,x:V.xZ.id),W=$.map(Z=>Z.id);if(_.current!==W.length){_.current=W.length;const Z=gt(F,W);Z.length&&H?.(Z)}if(g.current!==j.length){g.current=j.length;const Z=gt(C,j);Z.length&&M?.(Z)}h.setState({userSelectionRect:P})},A=O=>{if(O.button!==0)return;const{userSelectionRect:w}=h.getState();!p&&w&&O.target===d.current&&E?.(O),h.setState({nodesSelectionActive:_.current>0}),m(),i?.(O)},I=O=>{p&&(h.setState({nodesSelectionActive:_.current>0}),i?.(O)),m()},D=y&&(e||p);return L.createElement("div",{className:pe(["react-flow__pane",{dragging:b,selection:e}]),onClick:D?void 0:cn(E,d),onContextMenu:cn(x,d),onWheel:cn(S,d),onMouseEnter:D?void 0:u,onMouseDown:D?N:void 0,onMouseMove:D?q:l,onMouseUp:D?A:void 0,onMouseLeave:D?I:c,ref:d,style:ju},f,L.createElement(Iw,null))});mg.displayName="Pane";function _g(e,t){const r=e.parentNode||e.parentId;if(!r)return!1;const n=t.get(r);return n?n.selected?!0:_g(n,t):!1}function Qc(e,t,r){let n=e;do{if(n?.matches(t))return!0;if(n===r.current)return!1;n=n.parentElement}while(n);return!1}function Pw(e,t,r,n){return Array.from(e.values()).filter(i=>(i.selected||i.id===n)&&(!i.parentNode||i.parentId||!_g(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>({id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:r.x-(i.positionAbsolute?.x??0),y:r.y-(i.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}))}function Ow(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function bg(e,t,r,n,i=[0,0],a){const o=Ow(e,e.extent||n);let s=o;const u=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(u&&e.width&&e.height){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=f&&Se(d)&&Se(h)&&Se(f.width)&&Se(f.height)?[[d+e.width*i[0],h+e.height*i[1]],[d+f.width-e.width+e.width*i[0],h+f.height-e.height+e.height*i[1]]]:s}else a?.("005",Ue.error005()),s=o;else if(e.extent&&u&&e.extent!=="parent"){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+h],[e.extent[1][0]+d,e.extent[1][1]+h]]}let l={x:0,y:0};if(u){const f=r.get(u);l=it(f,i).positionAbsolute}const c=s&&s!=="parent"?Fu(t,s):t;return{position:{x:c.x-l.x,y:c.y-l.y},positionAbsolute:c}}function ln({nodeId:e,dragItems:t,nodeInternals:r}){const n=t.map(i=>({...r.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?n.find(i=>i.id===e):n[0],n]}const el=(e,t,r,n)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),o=t.getBoundingClientRect(),s={x:o.width*n[0],y:o.height*n[1]};return a.map(u=>{const l=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),position:u.getAttribute("data-handlepos"),x:(l.left-o.left-s.x)/r,y:(l.top-o.top-s.y)/r,...Lu(u)}})};function Tt(e,t,r){return r===void 0?r:n=>{const i=t().nodeInternals.get(e);i&&r(n,{...i})}}function Nu({id:e,store:t,unselect:r=!1,nodeRef:n}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeInternals:s,onError:u}=t.getState(),l=s.get(e);if(!l){u?.("012",Ue.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(r||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>n?.current?.blur())):i([e])}function kw(){const e=fe();return k.useCallback(({sourceEvent:r})=>{const{transform:n,snapGrid:i,snapToGrid:a}=e.getState(),o=r.touches?r.touches[0].clientX:r.clientX,s=r.touches?r.touches[0].clientY:r.clientY,u={x:(o-n[0])/n[2],y:(s-n[1])/n[2]};return{xSnapped:a?i[0]*Math.round(u.x/i[0]):u.x,ySnapped:a?i[1]*Math.round(u.y/i[1]):u.y,...u}},[])}function fn(e){return(t,r,n)=>e?.(t,n)}function wg({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:n,nodeId:i,isSelectable:a,selectNodesOnDrag:o}){const s=fe(),[u,l]=k.useState(!1),c=k.useRef([]),f=k.useRef({x:null,y:null}),d=k.useRef(0),h=k.useRef(null),_=k.useRef({x:0,y:0}),g=k.useRef(null),v=k.useRef(!1),p=k.useRef(!1),y=k.useRef(!1),b=kw();return k.useEffect(()=>{if(e?.current){const m=xe(e.current),E=({x:N,y:q})=>{const{nodeInternals:A,onNodeDrag:I,onSelectionDrag:D,updateNodePositions:O,nodeExtent:w,snapGrid:T,snapToGrid:C,nodeOrigin:z,onError:H}=s.getState();f.current={x:N,y:q};let M=!1,B={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&w){const V=xr(c.current,z);B=Ht(V)}if(c.current=c.current.map(V=>{const U={x:N-V.distance.x,y:q-V.distance.y};C&&(U.x=T[0]*Math.round(U.x/T[0]),U.y=T[1]*Math.round(U.y/T[1]));const R=[[w[0][0],w[0][1]],[w[1][0],w[1][1]]];c.current.length>1&&w&&!V.extent&&(R[0][0]=V.positionAbsolute.x-B.x+w[0][0],R[1][0]=V.positionAbsolute.x+(V.width??0)-B.x2+w[1][0],R[0][1]=V.positionAbsolute.y-B.y+w[0][1],R[1][1]=V.positionAbsolute.y+(V.height??0)-B.y2+w[1][1]);const P=bg(V,U,A,R,z,H);return M=M||V.position.x!==P.position.x||V.position.y!==P.position.y,V.position=P.position,V.positionAbsolute=P.positionAbsolute,V}),!M)return;O(c.current,!0,!0),l(!0);const G=i?I:fn(D);if(G&&g.current){const[V,U]=ln({nodeId:i,dragItems:c.current,nodeInternals:A});G(g.current,V,U)}},x=()=>{if(!h.current)return;const[N,q]=Hv(_.current,h.current);if(N!==0||q!==0){const{transform:A,panBy:I}=s.getState();f.current.x=(f.current.x??0)-N/A[2],f.current.y=(f.current.y??0)-q/A[2],I({x:N,y:q})&&E(f.current)}d.current=requestAnimationFrame(x)},S=N=>{const{nodeInternals:q,multiSelectionActive:A,nodesDraggable:I,unselectNodesAndEdges:D,onNodeDragStart:O,onSelectionDragStart:w}=s.getState();p.current=!0;const T=i?O:fn(w);(!o||!a)&&!A&&i&&(q.get(i)?.selected||D()),i&&a&&o&&Nu({id:i,store:s,nodeRef:e});const C=b(N);if(f.current=C,c.current=Pw(q,I,C,i),T&&c.current){const[z,H]=ln({nodeId:i,dragItems:c.current,nodeInternals:q});T(N.sourceEvent,z,H)}};if(t)m.on(".drag",null);else{const N=mb().on("start",q=>{const{domNode:A,nodeDragThreshold:I}=s.getState();I===0&&S(q),y.current=!1;const D=b(q);f.current=D,h.current=A?.getBoundingClientRect()||null,_.current=Je(q.sourceEvent,h.current)}).on("drag",q=>{const A=b(q),{autoPanOnNodeDrag:I,nodeDragThreshold:D}=s.getState();if(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!v.current&&p.current&&I&&(v.current=!0,x()),!p.current){const O=A.xSnapped-(f?.current?.x??0),w=A.ySnapped-(f?.current?.y??0);Math.sqrt(O*O+w*w)>D&&S(q)}(f.current.x!==A.xSnapped||f.current.y!==A.ySnapped)&&c.current&&p.current&&(g.current=q.sourceEvent,_.current=Je(q.sourceEvent,h.current),E(A))}}).on("end",q=>{if(!(!p.current||y.current)&&(l(!1),v.current=!1,p.current=!1,cancelAnimationFrame(d.current),c.current)){const{updateNodePositions:A,nodeInternals:I,onNodeDragStop:D,onSelectionDragStop:O}=s.getState(),w=i?D:fn(O);if(A(c.current,!1,!1),w){const[T,C]=ln({nodeId:i,dragItems:c.current,nodeInternals:I});w(q.sourceEvent,T,C)}}}).filter(q=>{const A=q.target;return!q.button&&(!r||!Qc(A,`.${r}`,e))&&(!n||Qc(A,n,e))});return m.call(N),()=>{m.on(".drag",null)}}}},[e,t,r,n,a,s,i,o,b]),u}function Eg(){const e=fe();return k.useCallback(r=>{const{nodeInternals:n,nodeExtent:i,updateNodePositions:a,getNodes:o,snapToGrid:s,snapGrid:u,onError:l,nodesDraggable:c}=e.getState(),f=o().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),d=s?u[0]:5,h=s?u[1]:5,_=r.isShiftPressed?4:1,g=r.x*d*_,v=r.y*h*_,p=f.map(y=>{if(y.positionAbsolute){const b={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+v};s&&(b.x=u[0]*Math.round(b.x/u[0]),b.y=u[1]*Math.round(b.y/u[1]));const{positionAbsolute:m,position:E}=bg(y,b,n,i,void 0,l);y.position=E,y.positionAbsolute=m}return y});a(p,!0,!1)},[])}const mt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Mt=e=>{const t=({id:r,type:n,data:i,xPos:a,yPos:o,xPosOrigin:s,yPosOrigin:u,selected:l,onClick:c,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,onContextMenu:_,onDoubleClick:g,style:v,className:p,isDraggable:y,isSelectable:b,isConnectable:m,isFocusable:E,selectNodesOnDrag:x,sourcePosition:S,targetPosition:N,hidden:q,resizeObserver:A,dragHandle:I,zIndex:D,isParent:O,noDragClassName:w,noPanClassName:T,initialized:C,disableKeyboardA11y:z,ariaLabel:H,rfId:M,hasHandleBounds:B})=>{const G=fe(),V=k.useRef(null),U=k.useRef(null),R=k.useRef(S),P=k.useRef(N),F=k.useRef(n),$=b||y||c||f||d||h,j=Eg(),W=Tt(r,G.getState,f),Z=Tt(r,G.getState,d),te=Tt(r,G.getState,h),ie=Tt(r,G.getState,_),re=Tt(r,G.getState,g),ee=K=>{const{nodeDragThreshold:Y}=G.getState();if(b&&(!x||!y||Y>0)&&Nu({id:r,store:G,nodeRef:V}),c){const oe=G.getState().nodeInternals.get(r);oe&&c(K,{...oe})}},X=K=>{if(!Su(K)&&!z)if(Uv.includes(K.key)&&b){const Y=K.key==="Escape";Nu({id:r,store:G,unselect:Y,nodeRef:V})}else y&&l&&Object.prototype.hasOwnProperty.call(mt,K.key)&&(G.setState({ariaLiveMessage:`Moved selected node ${K.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~o}`}),j({x:mt[K.key].x,y:mt[K.key].y,isShiftPressed:K.shiftKey}))};k.useEffect(()=>()=>{U.current&&(A?.unobserve(U.current),U.current=null)},[]),k.useEffect(()=>{if(V.current&&!q){const K=V.current;(!C||!B||U.current!==K)&&(U.current&&A?.unobserve(U.current),A?.observe(K),U.current=K)}},[q,C,B]),k.useEffect(()=>{const K=F.current!==n,Y=R.current!==S,oe=P.current!==N;V.current&&(K||Y||oe)&&(K&&(F.current=n),Y&&(R.current=S),oe&&(P.current=N),G.getState().updateNodeDimensions([{id:r,nodeElement:V.current,forceUpdate:!0}]))},[r,n,S,N]);const ue=wg({nodeRef:V,disabled:q||!y,noDragClassName:w,handleSelector:I,nodeId:r,isSelectable:b,selectNodesOnDrag:x});return q?null:L.createElement("div",{className:pe(["react-flow__node",`react-flow__node-${n}`,{[T]:y},p,{selected:l,selectable:b,parent:O,dragging:ue}]),ref:V,style:{zIndex:D,transform:`translate(${s}px,${u}px)`,pointerEvents:$?"all":"none",visibility:C?"visible":"hidden",...v},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:W,onMouseMove:Z,onMouseLeave:te,onContextMenu:ie,onClick:ee,onDoubleClick:re,onKeyDown:E?X:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":z?void 0:`${fg}-${M}`,"aria-label":H},L.createElement(W0,{value:r},L.createElement(e,{id:r,data:i,type:n,xPos:a,yPos:o,selected:l,isConnectable:m,sourcePosition:S,targetPosition:N,dragging:ue,dragHandle:I,zIndex:D})))};return t.displayName="NodeWrapper",k.memo(t)};const Dw=e=>{const t=e.getNodes().filter(r=>r.selected);return{...xr(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function Lw({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const n=fe(),{width:i,height:a,x:o,y:s,transformString:u,userSelectionActive:l}=ne(Dw,he),c=Eg(),f=k.useRef(null);if(k.useEffect(()=>{r||f.current?.focus({preventScroll:!0})},[r]),wg({nodeRef:f}),l||!i||!a)return null;const d=e?_=>{const g=n.getState().getNodes().filter(v=>v.selected);e(_,g)}:void 0,h=_=>{Object.prototype.hasOwnProperty.call(mt,_.key)&&c({x:mt[_.key].x,y:mt[_.key].y,isShiftPressed:_.shiftKey})};return L.createElement("div",{className:pe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u}},L.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:r?void 0:-1,onKeyDown:r?void 0:h,style:{width:i,height:a,top:s,left:o}}))}var Fw=k.memo(Lw);const zw=e=>e.nodesSelectionActive,xg=({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,deleteKeyCode:s,onMove:u,onMoveStart:l,onMoveEnd:c,selectionKeyCode:f,selectionOnDrag:d,selectionMode:h,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:v,panActivationKeyCode:p,zoomActivationKeyCode:y,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:x,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:A,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:w,preventScrolling:T,onSelectionContextMenu:C,noWheelClassName:z,noPanClassName:H,disableKeyboardA11y:M})=>{const B=ne(zw),G=Gt(f),V=Gt(p),U=V||A,R=V||x,P=G||d&&U!==!0;return Sw({deleteKeyCode:s,multiSelectionKeyCode:v}),L.createElement(Aw,{onMove:u,onMoveStart:l,onMoveEnd:c,onPaneContextMenu:a,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:R,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:!G&&U,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:w,zoomActivationKeyCode:y,preventScrolling:T,noWheelClassName:z,noPanClassName:H},L.createElement(mg,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:U,isSelecting:!!P,selectionMode:h},e,B&&L.createElement(Fw,{onSelectionContextMenu:C,noPanClassName:H,disableKeyboardA11y:M})))};xg.displayName="FlowRenderer";var Bw=k.memo(xg);function Hw(e){return ne(k.useCallback(r=>e?Jv(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function $w(e){const t={input:Mt(e.input||sg),default:Mt(e.default||Au),output:Mt(e.output||cg),group:Mt(e.group||Vu)},r={},n=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Mt(e[a]||Au),i),r);return{...t,...n}}const Gw=({x:e,y:t,width:r,height:n,origin:i})=>!r||!n?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-r*i[0],y:t-n*i[1]},Vw=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Sg=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:n,elementsSelectable:i,updateNodeDimensions:a,onError:o}=ne(Vw,he),s=Hw(e.onlyRenderVisibleElements),u=k.useRef(),l=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(f=>{const d=f.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));a(d)});return u.current=c,c},[]);return k.useEffect(()=>()=>{u?.current?.disconnect()},[]),L.createElement("div",{className:"react-flow__nodes",style:ju},s.map(c=>{let f=c.type||"default";e.nodeTypes[f]||(o?.("003",Ue.error003(f)),f="default");const d=e.nodeTypes[f]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),_=!!(c.selectable||i&&typeof c.selectable>"u"),g=!!(c.connectable||r&&typeof c.connectable>"u"),v=!!(c.focusable||n&&typeof c.focusable>"u"),p=e.nodeExtent?Fu(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=p?.x??0,b=p?.y??0,m=Gw({x:y,y:b,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return L.createElement(d,{key:c.id,id:c.id,className:c.className,style:c.style,type:f,data:c.data,sourcePosition:c.sourcePosition||J.Bottom,targetPosition:c.targetPosition||J.Top,hidden:c.hidden,xPos:y,yPos:b,xPosOrigin:m.x,yPosOrigin:m.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:_,isConnectable:g,isFocusable:v,resizeObserver:l,dragHandle:c.dragHandle,zIndex:c[se]?.z??0,isParent:!!c[se]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel,hasHandleBounds:!!c[se]?.handleBounds})}))};Sg.displayName="NodeRenderer";var Uw=k.memo(Sg);const jw=(e,t,r)=>r===J.Left?e-t:r===J.Right?e+t:e,Kw=(e,t,r)=>r===J.Top?e-t:r===J.Bottom?e+t:e,tl="react-flow__edgeupdater",rl=({position:e,centerX:t,centerY:r,radius:n=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s})=>L.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:pe([tl,`${tl}-${s}`]),cx:jw(t,n,e),cy:Kw(r,n,e),r:n,stroke:"transparent",fill:"transparent"}),Yw=()=>!0;var vt=e=>{const t=({id:r,className:n,type:i,data:a,onClick:o,onEdgeDoubleClick:s,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,style:v,source:p,target:y,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,elementsSelectable:q,hidden:A,sourceHandleId:I,targetHandleId:D,onContextMenu:O,onMouseEnter:w,onMouseMove:T,onMouseLeave:C,reconnectRadius:z,onReconnect:H,onReconnectStart:M,onReconnectEnd:B,markerEnd:G,markerStart:V,rfId:U,ariaLabel:R,isFocusable:P,isReconnectable:F,pathOptions:$,interactionWidth:j,disableKeyboardA11y:W})=>{const Z=k.useRef(null),[te,ie]=k.useState(!1),[re,ee]=k.useState(!1),X=fe(),ue=k.useMemo(()=>`url('#${Ru(V,U)}')`,[V,U]),K=k.useMemo(()=>`url('#${Ru(G,U)}')`,[G,U]);if(A)return null;const Y=de=>{const{edges:we,addSelectedEdges:ve,unselectNodesAndEdges:ye,multiSelectionActive:ft}=X.getState(),De=we.find(et=>et.id===r);De&&(q&&(X.setState({nodesSelectionActive:!1}),De.selected&&ft?(ye({nodes:[],edges:[De]}),Z.current?.blur()):ve([r])),o&&o(de,De))},oe=It(r,X.getState,s),Ce=It(r,X.getState,O),Oe=It(r,X.getState,w),ge=It(r,X.getState,T),ce=It(r,X.getState,C),me=(de,we)=>{if(de.button!==0)return;const{edges:ve,isValidConnection:ye}=X.getState(),ft=we?y:p,De=(we?D:I)||null,et=we?"target":"source",Hr=ye||Yw,$r=we,Ct=ve.find(tt=>tt.id===r);ee(!0),M?.(de,Ct,et);const Gr=tt=>{ee(!1),B?.(tt,Ct,et)};ng({event:de,handleId:De,nodeId:ft,onConnect:tt=>H?.(Ct,tt),isTarget:$r,getState:X.getState,setState:X.setState,isValidConnection:Hr,edgeUpdaterType:et,onReconnectEnd:Gr})},Ae=de=>me(de,!0),ze=de=>me(de,!1),ke=()=>ie(!0),be=()=>ie(!1),Be=!q&&!o,Ye=de=>{if(!W&&Uv.includes(de.key)&&q){const{unselectNodesAndEdges:we,addSelectedEdges:ve,edges:ye}=X.getState();de.key==="Escape"?(Z.current?.blur(),we({edges:[ye.find(De=>De.id===r)]})):ve([r])}};return L.createElement("g",{className:pe(["react-flow__edge",`react-flow__edge-${i}`,n,{selected:u,animated:l,inactive:Be,updating:te}]),onClick:Y,onDoubleClick:oe,onContextMenu:Ce,onMouseEnter:Oe,onMouseMove:ge,onMouseLeave:ce,onKeyDown:P?Ye:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":R===null?void 0:R||`Edge from ${p} to ${y}`,"aria-describedby":P?`${dg}-${U}`:void 0,ref:Z},!re&&L.createElement(e,{id:r,source:p,target:y,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,data:a,style:v,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,sourceHandleId:I,targetHandleId:D,markerStart:ue,markerEnd:K,pathOptions:$,interactionWidth:j}),F&&L.createElement(L.Fragment,null,(F==="source"||F===!0)&&L.createElement(rl,{position:S,centerX:b,centerY:m,radius:z,onMouseDown:Ae,onMouseEnter:ke,onMouseOut:be,type:"source"}),(F==="target"||F===!0)&&L.createElement(rl,{position:N,centerX:E,centerY:x,radius:z,onMouseDown:ze,onMouseEnter:ke,onMouseOut:be,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function Ww(e){const t={default:vt(e.default||pr),straight:vt(e.bezier||Hu),step:vt(e.step||Bu),smoothstep:vt(e.step||Er),simplebezier:vt(e.simplebezier||zu)},r={},n=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=vt(e[a]||pr),i),r);return{...t,...n}}function nl(e,t,r=null){const n=(r?.x||0)+t.x,i=(r?.y||0)+t.y,a=r?.width||t.width,o=r?.height||t.height;switch(e){case J.Top:return{x:n+a/2,y:i};case J.Right:return{x:n+a,y:i+o/2};case J.Bottom:return{x:n+a/2,y:i+o};case J.Left:return{x:n,y:i+o/2}}}function il(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const Zw=(e,t,r,n,i,a)=>{const o=nl(r,e,t),s=nl(a,n,i);return{sourceX:o.x,sourceY:o.y,targetX:s.x,targetY:s.y}};function Xw({sourcePos:e,targetPos:t,sourceWidth:r,sourceHeight:n,targetWidth:i,targetHeight:a,width:o,height:s,transform:u}){const l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+r,t.x+i),y2:Math.max(e.y+n,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const c=Ht({x:(0-u[0])/u[2],y:(0-u[1])/u[2],width:o/u[2],height:s/u[2]}),f=Math.max(0,Math.min(c.x2,l.x2)-Math.max(c.x,l.x)),d=Math.max(0,Math.min(c.y2,l.y2)-Math.max(c.y,l.y));return Math.ceil(f*d)>0}function al(e){const t=e?.[se]?.handleBounds||null,r=t&&e?.width&&e?.height&&typeof e?.positionAbsolute?.x<"u"&&typeof e?.positionAbsolute?.y<"u";return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!r]}const Jw=[{level:0,isMaxLevel:!0,edges:[]}];function Qw(e,t,r=!1){let n=-1;const i=e.reduce((o,s)=>{const u=Se(s.zIndex);let l=u?s.zIndex:0;if(r){const c=t.get(s.target),f=t.get(s.source),d=s.selected||c?.selected||f?.selected,h=Math.max(f?.[se]?.z||0,c?.[se]?.z||0,1e3);l=(u?s.zIndex:0)+(d?h:0)}return o[l]?o[l].push(s):o[l]=[s],n=l>n?l:n,o},{}),a=Object.entries(i).map(([o,s])=>{const u=+o;return{edges:s,level:u,isMaxLevel:u===n}});return a.length===0?Jw:a}function e1(e,t,r){const n=ne(k.useCallback(i=>e?i.edges.filter(a=>{const o=t.get(a.source),s=t.get(a.target);return o?.width&&o?.height&&s?.width&&s?.height&&Xw({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return Qw(n,t,r)}const t1=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),r1=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ol={[hr.Arrow]:t1,[hr.ArrowClosed]:r1};function n1(e){const t=fe();return k.useMemo(()=>Object.prototype.hasOwnProperty.call(ol,e)?ol[e]:(t.getState().onError?.("009",Ue.error009(e)),null),[e])}const i1=({id:e,type:t,color:r,width:n=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:s="auto-start-reverse"})=>{const u=n1(t);return u?L.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${n}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:s,refX:"0",refY:"0"},L.createElement(u,{color:r,strokeWidth:o})):null},a1=({defaultColor:e,rfId:t})=>r=>{const n=[];return r.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(o=>{if(o&&typeof o=="object"){const s=Ru(o,t);n.includes(s)||(i.push({id:s,color:o.color||e,...o}),n.push(s))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},qg=({defaultColor:e,rfId:t})=>{const r=ne(k.useCallback(a1({defaultColor:e,rfId:t}),[e,t]),(n,i)=>!(n.length!==i.length||n.some((a,o)=>a.id!==i[o].id)));return L.createElement("defs",null,r.map(n=>L.createElement(i1,{id:n.id,key:n.id,type:n.type,color:n.color,width:n.width,height:n.height,markerUnits:n.markerUnits,strokeWidth:n.strokeWidth,orient:n.orient})))};qg.displayName="MarkerDefinitions";var o1=k.memo(qg);const s1=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Rg=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:n,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:u,onEdgeMouseLeave:l,onEdgeClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,children:v,disableKeyboardA11y:p})=>{const{edgesFocusable:y,edgesUpdatable:b,elementsSelectable:m,width:E,height:x,connectionMode:S,nodeInternals:N,onError:q}=ne(s1,he),A=e1(t,N,r);return E?L.createElement(L.Fragment,null,A.map(({level:I,edges:D,isMaxLevel:O})=>L.createElement("svg",{key:I,style:{zIndex:I},width:E,height:x,className:"react-flow__edges react-flow__container"},O&&L.createElement(o1,{defaultColor:e,rfId:n}),L.createElement("g",null,D.map(w=>{const[T,C,z]=al(N.get(w.source)),[H,M,B]=al(N.get(w.target));if(!z||!B)return null;let G=w.type||"default";i[G]||(q?.("011",Ue.error011(G)),G="default");const V=i[G]||i.default,U=S===ot.Strict?M.target:(M.target??[]).concat(M.source??[]),R=il(C.source,w.sourceHandle),P=il(U,w.targetHandle),F=R?.position||J.Bottom,$=P?.position||J.Top,j=!!(w.focusable||y&&typeof w.focusable>"u"),W=w.reconnectable||w.updatable,Z=typeof d<"u"&&(W||b&&typeof W>"u");if(!R||!P)return q?.("008",Ue.error008(R,w)),null;const{sourceX:te,sourceY:ie,targetX:re,targetY:ee}=Zw(T,R,F,H,P,$);return L.createElement(V,{key:w.id,id:w.id,className:pe([w.className,a]),type:G,data:w.data,selected:!!w.selected,animated:!!w.animated,hidden:!!w.hidden,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,style:w.style,source:w.source,target:w.target,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerEnd:w.markerEnd,markerStart:w.markerStart,sourceX:te,sourceY:ie,targetX:re,targetY:ee,sourcePosition:F,targetPosition:$,elementsSelectable:m,onContextMenu:o,onMouseEnter:s,onMouseMove:u,onMouseLeave:l,onClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,rfId:n,ariaLabel:w.ariaLabel,isFocusable:j,isReconnectable:Z,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth,disableKeyboardA11y:p})})))),v):null};Rg.displayName="EdgeRenderer";var u1=k.memo(Rg);const c1=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function l1({children:e}){const t=ne(c1);return L.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function f1(e){const t=Uu(),r=k.useRef(!1);k.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const d1={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top},Cg=({nodeId:e,handleType:t,style:r,type:n=Xe.Bezier,CustomComponent:i,connectionStatus:a})=>{const{fromNode:o,handleId:s,toX:u,toY:l,connectionMode:c}=ne(k.useCallback(x=>({fromNode:x.nodeInternals.get(e),handleId:x.connectionHandleId,toX:(x.connectionPosition.x-x.transform[0])/x.transform[2],toY:(x.connectionPosition.y-x.transform[1])/x.transform[2],connectionMode:x.connectionMode}),[e]),he),f=o?.[se]?.handleBounds;let d=f?.[t];if(c===ot.Loose&&(d=d||f?.[t==="source"?"target":"source"]),!o||!d)return null;const h=s?d.find(x=>x.id===s):d[0],_=h?h.x+h.width/2:(o.width??0)/2,g=h?h.y+h.height/2:o.height??0,v=(o.positionAbsolute?.x??0)+_,p=(o.positionAbsolute?.y??0)+g,y=h?.position,b=y?d1[y]:null;if(!y||!b)return null;if(i)return L.createElement(i,{connectionLineType:n,connectionLineStyle:r,fromNode:o,fromHandle:h,fromX:v,fromY:p,toX:u,toY:l,fromPosition:y,toPosition:b,connectionStatus:a});let m="";const E={sourceX:v,sourceY:p,sourcePosition:y,targetX:u,targetY:l,targetPosition:b};return n===Xe.Bezier?[m]=Zv(E):n===Xe.Step?[m]=qu({...E,borderRadius:0}):n===Xe.SmoothStep?[m]=qu(E):n===Xe.SimpleBezier?[m]=Wv(E):m=`M${v},${p} ${u},${l}`,L.createElement("path",{d:m,fill:"none",className:"react-flow__connection-path",style:r})};Cg.displayName="ConnectionLine";const h1=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function p1({containerStyle:e,style:t,type:r,component:n}){const{nodeId:i,handleType:a,nodesConnectable:o,width:s,height:u,connectionStatus:l}=ne(h1,he);return!(i&&a&&s&&o)?null:L.createElement("svg",{style:e,width:s,height:u,className:"react-flow__edges react-flow__connectionline react-flow__container"},L.createElement("g",{className:pe(["react-flow__connection",l])},L.createElement(Cg,{nodeId:i,handleType:a,style:t,type:r,CustomComponent:n,connectionStatus:l})))}function sl(e,t){return k.useRef(null),fe(),k.useMemo(()=>t(e),[e])}const Ag=({nodeTypes:e,edgeTypes:t,onMove:r,onMoveStart:n,onMoveEnd:i,onInit:a,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:u,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:v,connectionLineType:p,connectionLineStyle:y,connectionLineComponent:b,connectionLineContainerStyle:m,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:O,selectNodesOnDrag:w,defaultViewport:T,translateExtent:C,minZoom:z,maxZoom:H,preventScrolling:M,defaultMarkerColor:B,zoomOnScroll:G,zoomOnPinch:V,panOnScroll:U,panOnScrollSpeed:R,panOnScrollMode:P,zoomOnDoubleClick:F,panOnDrag:$,onPaneClick:j,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneScroll:ie,onPaneContextMenu:re,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:K,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Oe,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,elevateEdgesOnSelect:Ae,disableKeyboardA11y:ze,nodeOrigin:ke,nodeExtent:be,rfId:Be})=>{const Ye=sl(e,$w),de=sl(t,Ww);return f1(a),L.createElement(Bw,{onPaneClick:j,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneContextMenu:re,onPaneScroll:ie,deleteKeyCode:I,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,elementsSelectable:O,onMove:r,onMoveStart:n,onMoveEnd:i,zoomOnScroll:G,zoomOnPinch:V,zoomOnDoubleClick:F,panOnScroll:U,panOnScrollSpeed:R,panOnScrollMode:P,panOnDrag:$,defaultViewport:T,translateExtent:C,minZoom:z,maxZoom:H,onSelectionContextMenu:_,preventScrolling:M,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,disableKeyboardA11y:ze},L.createElement(l1,null,L.createElement(u1,{edgeTypes:de,onEdgeClick:s,onEdgeDoubleClick:l,onlyRenderVisibleElements:D,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:K,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Oe,defaultMarkerColor:B,noPanClassName:me,elevateEdgesOnSelect:!!Ae,disableKeyboardA11y:ze,rfId:Be},L.createElement(p1,{style:y,type:p,component:b,containerStyle:m})),L.createElement("div",{className:"react-flow__edgelabel-renderer"}),L.createElement(Uw,{nodeTypes:Ye,onNodeClick:o,onNodeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,selectNodesOnDrag:w,onlyRenderVisibleElements:D,noPanClassName:me,noDragClassName:ge,disableKeyboardA11y:ze,nodeOrigin:ke,nodeExtent:be,rfId:Be})))};Ag.displayName="GraphView";var v1=k.memo(Ag);const Iu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],We={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Iu,nodeExtent:Iu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ot.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:G0,isValidConnection:void 0},g1=()=>Im((e,t)=>({...We,setNodes:r=>{const{nodeInternals:n,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:un(r,n,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:n={}}=t();e({edges:r.map(i=>({...n,...i}))})},setDefaultNodesAndEdges:(r,n)=>{const i=typeof r<"u",a=typeof n<"u",o=i?un(r,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:o,edges:a?n:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:r=>{const{onNodesChange:n,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:o,fitViewOnInitOptions:s,domNode:u,nodeOrigin:l}=t(),c=u?.querySelector(".react-flow__viewport");if(!c)return;const f=window.getComputedStyle(c),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=r.reduce((g,v)=>{const p=i.get(v.id);if(p?.hidden)i.set(p.id,{...p,[se]:{...p[se],handleBounds:void 0}});else if(p){const y=Lu(v.nodeElement);!!(y.width&&y.height&&(p.width!==y.width||p.height!==y.height||v.forceUpdate))&&(i.set(p.id,{...p,[se]:{...p[se],handleBounds:{source:el(".source",v.nodeElement,d,l),target:el(".target",v.nodeElement,d,l)}},...y}),g.push({id:p.id,type:"dimensions",dimensions:y}))}return g},[]);pg(i,l);const _=o||a&&!o&&vg(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:_}),h?.length>0&&n?.(h)},updateNodePositions:(r,n=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),o=r.map(s=>{const u={id:s.id,type:"position",dragging:i};return n&&(u.positionAbsolute=s.positionAbsolute,u.position=s.position),u});a(o)},triggerNodeChanges:r=>{const{onNodesChange:n,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:o,getNodes:s,elevateNodesOnSelect:u}=t();if(r?.length){if(a){const l=yg(r,s()),c=un(l,i,o,u);e({nodeInternals:c})}n?.(r)}},addSelectedNodes:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=gt(a(),r),s=gt(i,[])),rr({changedNodes:o,changedEdges:s,get:t,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=gt(i,r),s=gt(a(),[])),rr({changedNodes:s,changedEdges:o,get:t,set:e})},unselectNodesAndEdges:({nodes:r,edges:n}={})=>{const{edges:i,getNodes:a}=t(),o=r||a(),s=n||i,u=o.map(c=>(c.selected=!1,Ze(c.id,!1))),l=s.map(c=>Ze(c.id,!1));rr({changedNodes:u,changedEdges:l,get:t,set:e})},setMinZoom:r=>{const{d3Zoom:n,maxZoom:i}=t();n?.scaleExtent([r,i]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:n,minZoom:i}=t();n?.scaleExtent([i,r]),e({maxZoom:r})},setTranslateExtent:r=>{t().d3Zoom?.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:n}=t(),a=n().filter(s=>s.selected).map(s=>Ze(s.id,!1)),o=r.filter(s=>s.selected).map(s=>Ze(s.id,!1));rr({changedNodes:a,changedEdges:o,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:n}=t();n.forEach(i=>{i.positionAbsolute=Fu(i.position,r)}),e({nodeExtent:r,nodeInternals:new Map(n)})},panBy:r=>{const{transform:n,width:i,height:a,d3Zoom:o,d3Selection:s,translateExtent:u}=t();if(!o||!s||!r.x&&!r.y)return!1;const l=Ge.translate(n[0]+r.x,n[1]+r.y).scale(n[2]),c=[[0,0],[i,a]],f=o?.constrain()(l,c,u);return o.transform(s,f),n[0]!==f.x||n[1]!==f.y||n[2]!==f.k},cancelConnection:()=>e({connectionNodeId:We.connectionNodeId,connectionHandleId:We.connectionHandleId,connectionHandleType:We.connectionHandleType,connectionStatus:We.connectionStatus,connectionStartHandle:We.connectionStartHandle,connectionEndHandle:We.connectionEndHandle}),reset:()=>e({...We})}),Object.is),Ng=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=g1()),L.createElement(D0,{value:t.current},e)};Ng.displayName="ReactFlowProvider";const Ig=({children:e})=>k.useContext(wr)?L.createElement(L.Fragment,null,e):L.createElement(Ng,null,e);Ig.displayName="ReactFlowWrapper";const y1={input:sg,default:Au,output:cg,group:Vu},m1={default:pr,straight:Hu,step:Bu,smoothstep:Er,simplebezier:zu},_1=[0,0],b1=[15,15],w1={x:0,y:0,zoom:1},E1={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},x1=k.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,className:i,nodeTypes:a=y1,edgeTypes:o=m1,onNodeClick:s,onEdgeClick:u,onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onNodesDelete:A,onEdgesDelete:I,onSelectionChange:D,onSelectionDragStart:O,onSelectionDrag:w,onSelectionDragStop:T,onSelectionContextMenu:C,onSelectionStart:z,onSelectionEnd:H,connectionMode:M=ot.Strict,connectionLineType:B=Xe.Bezier,connectionLineStyle:G,connectionLineComponent:V,connectionLineContainerStyle:U,deleteKeyCode:R="Backspace",selectionKeyCode:P="Shift",selectionOnDrag:F=!1,selectionMode:$=$t.Full,panActivationKeyCode:j="Space",multiSelectionKeyCode:W=dr()?"Meta":"Control",zoomActivationKeyCode:Z=dr()?"Meta":"Control",snapToGrid:te=!1,snapGrid:ie=b1,onlyRenderVisibleElements:re=!1,selectNodesOnDrag:ee=!0,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:K,nodeOrigin:Y=_1,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Oe,defaultViewport:ge=w1,minZoom:ce=.5,maxZoom:me=2,translateExtent:Ae=Iu,preventScrolling:ze=!0,nodeExtent:ke,defaultMarkerColor:be="#b1b1b7",zoomOnScroll:Be=!0,zoomOnPinch:Ye=!0,panOnScroll:de=!1,panOnScrollSpeed:we=.5,panOnScrollMode:ve=nt.Free,zoomOnDoubleClick:ye=!0,panOnDrag:ft=!0,onPaneClick:De,onPaneMouseEnter:et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Ct,onPaneContextMenu:Gr,children:fc,onEdgeContextMenu:tt,onEdgeDoubleClick:Oy,onEdgeMouseEnter:ky,onEdgeMouseMove:Dy,onEdgeMouseLeave:Ly,onEdgeUpdate:Fy,onEdgeUpdateStart:zy,onEdgeUpdateEnd:By,onReconnect:Hy,onReconnectStart:$y,onReconnectEnd:Gy,reconnectRadius:Vy=10,edgeUpdaterRadius:Uy=10,onNodesChange:jy,onEdgesChange:Ky,noDragClassName:Yy="nodrag",noWheelClassName:Wy="nowheel",noPanClassName:dc="nopan",fitView:Zy=!1,fitViewOptions:Xy,connectOnClick:Jy=!0,attributionPosition:Qy,proOptions:em,defaultEdgeOptions:tm,elevateNodesOnSelect:rm=!0,elevateEdgesOnSelect:nm=!1,disableKeyboardA11y:hc=!1,autoPanOnConnect:im=!0,autoPanOnNodeDrag:am=!0,connectionRadius:om=20,isValidConnection:sm,onError:um,style:cm,id:pc,nodeDragThreshold:lm,...fm},dm)=>{const Vr=pc||"1";return L.createElement("div",{...fm,style:{...cm,...E1},ref:dm,className:pe(["react-flow",i]),"data-testid":"rf__wrapper",id:pc},L.createElement(Ig,null,L.createElement(v1,{onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onNodeClick:s,onEdgeClick:u,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,nodeTypes:a,edgeTypes:o,connectionLineType:B,connectionLineStyle:G,connectionLineComponent:V,connectionLineContainerStyle:U,selectionKeyCode:P,selectionOnDrag:F,selectionMode:$,deleteKeyCode:R,multiSelectionKeyCode:W,panActivationKeyCode:j,zoomActivationKeyCode:Z,onlyRenderVisibleElements:re,selectNodesOnDrag:ee,defaultViewport:ge,translateExtent:Ae,minZoom:ce,maxZoom:me,preventScrolling:ze,zoomOnScroll:Be,zoomOnPinch:Ye,zoomOnDoubleClick:ye,panOnScroll:de,panOnScrollSpeed:we,panOnScrollMode:ve,panOnDrag:ft,onPaneClick:De,onPaneMouseEnter:et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Ct,onPaneContextMenu:Gr,onSelectionContextMenu:C,onSelectionStart:z,onSelectionEnd:H,onEdgeContextMenu:tt,onEdgeDoubleClick:Oy,onEdgeMouseEnter:ky,onEdgeMouseMove:Dy,onEdgeMouseLeave:Ly,onReconnect:Hy??Fy,onReconnectStart:$y??zy,onReconnectEnd:Gy??By,reconnectRadius:Vy??Uy,defaultMarkerColor:be,noDragClassName:Yy,noWheelClassName:Wy,noPanClassName:dc,elevateEdgesOnSelect:nm,rfId:Vr,disableKeyboardA11y:hc,nodeOrigin:Y,nodeExtent:ke}),L.createElement(dw,{nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:K,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Oe,elevateNodesOnSelect:rm,minZoom:ce,maxZoom:me,nodeExtent:ke,onNodesChange:jy,onEdgesChange:Ky,snapToGrid:te,snapGrid:ie,connectionMode:M,translateExtent:Ae,connectOnClick:Jy,defaultEdgeOptions:tm,fitView:Zy,fitViewOptions:Xy,onNodesDelete:A,onEdgesDelete:I,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onSelectionDrag:w,onSelectionDragStart:O,onSelectionDragStop:T,noPanClassName:dc,nodeOrigin:Y,rfId:Vr,autoPanOnConnect:im,autoPanOnNodeDrag:am,onError:um,connectionRadius:om,isValidConnection:sm,nodeDragThreshold:lm}),L.createElement(lw,{onSelectionChange:D}),fc,L.createElement(F0,{proOptions:em,position:Qy}),L.createElement(yw,{rfId:Vr,disableKeyboardA11y:hc})))});x1.displayName="ReactFlow";function Tg(e){return t=>{const[r,n]=k.useState(t),i=k.useCallback(a=>n(o=>e(a,o)),[]);return[r,n,i]}}const tq=Tg(yg),rq=Tg(Tw),Mg=({id:e,x:t,y:r,width:n,height:i,style:a,color:o,strokeColor:s,strokeWidth:u,className:l,borderRadius:c,shapeRendering:f,onClick:d,selected:h})=>{const{background:_,backgroundColor:g}=a||{},v=o||_||g;return L.createElement("rect",{className:pe(["react-flow__minimap-node",{selected:h},l]),x:t,y:r,rx:c,ry:c,width:n,height:i,fill:v,stroke:s,strokeWidth:u,shapeRendering:f,onClick:d?p=>d(p,e):void 0})};Mg.displayName="MiniMapNode";var S1=k.memo(Mg);const q1=e=>e.nodeOrigin,R1=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),dn=e=>e instanceof Function?e:()=>e;function C1({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:r="",nodeBorderRadius:n=5,nodeStrokeWidth:i=2,nodeComponent:a=S1,onClick:o}){const s=ne(R1,he),u=ne(q1),l=dn(t),c=dn(e),f=dn(r),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return L.createElement(L.Fragment,null,s.map(h=>{const{x:_,y:g}=it(h,u).positionAbsolute;return L.createElement(a,{key:h.id,x:_,y:g,width:h.width,height:h.height,style:h.style,selected:h.selected,className:f(h),color:l(h),borderRadius:n,strokeColor:c(h),strokeWidth:i,shapeRendering:d,onClick:o,id:h.id})}))}var A1=k.memo(C1);const N1=200,I1=150,T1=e=>{const t=e.getNodes(),r={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:r,boundingRect:t.length>0?H0(xr(t,e.nodeOrigin),r):r,rfId:e.rfId}},M1="react-flow__minimap-desc";function Pg({style:e,className:t,nodeStrokeColor:r="transparent",nodeColor:n="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:o=2,nodeComponent:s,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:l="none",maskStrokeWidth:c=1,position:f="bottom-right",onClick:d,onNodeClick:h,pannable:_=!1,zoomable:g=!1,ariaLabel:v="React Flow mini map",inversePan:p=!1,zoomStep:y=10,offsetScale:b=5}){const m=fe(),E=k.useRef(null),{boundingRect:x,viewBB:S,rfId:N}=ne(T1,he),q=e?.width??N1,A=e?.height??I1,I=x.width/q,D=x.height/A,O=Math.max(I,D),w=O*q,T=O*A,C=b*O,z=x.x-(w-x.width)/2-C,H=x.y-(T-x.height)/2-C,M=w+C*2,B=T+C*2,G=`${M1}-${N}`,V=k.useRef(0);V.current=O,k.useEffect(()=>{if(E.current){const P=xe(E.current),F=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie}=m.getState();if(W.sourceEvent.type!=="wheel"||!te||!ie)return;const re=-W.sourceEvent.deltaY*(W.sourceEvent.deltaMode===1?.05:W.sourceEvent.deltaMode?1:.002)*y,ee=Z[2]*Math.pow(2,re);ie.scaleTo(te,ee)},$=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie,translateExtent:re,width:ee,height:X}=m.getState();if(W.sourceEvent.type!=="mousemove"||!te||!ie)return;const ue=V.current*Math.max(1,Z[2])*(p?-1:1),K={x:Z[0]-W.sourceEvent.movementX*ue,y:Z[1]-W.sourceEvent.movementY*ue},Y=[[0,0],[ee,X]],oe=Ge.translate(K.x,K.y).scale(Z[2]),Ce=ie.constrain()(oe,Y,re);ie.transform(te,Ce)},j=zv().on("zoom",_?$:null).on("zoom.wheel",g?F:null);return P.call(j),()=>{P.on("zoom",null)}}},[_,g,p,y]);const U=d?P=>{const F=Ne(P);d(P,{x:F[0],y:F[1]})}:void 0,R=h?(P,F)=>{const $=m.getState().nodeInternals.get(F);h(P,$)}:void 0;return L.createElement(Du,{position:f,style:e,className:pe(["react-flow__minimap",t]),"data-testid":"rf__minimap"},L.createElement("svg",{width:q,height:A,viewBox:`${z} ${H} ${M} ${B}`,role:"img","aria-labelledby":G,ref:E,onClick:U},v&&L.createElement("title",{id:G},v),L.createElement(A1,{onClick:R,nodeColor:n,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),L.createElement("path",{className:"react-flow__minimap-mask",d:`M${z-C},${H-C}h${M+C*2}v${B+C*2}h${-M-C*2}z +import{u as hm,R as L,r as k}from"./router-9vIXuQkh.js";import{i as pm,a as vc,b as vm,c as gc,d as gm,e as ym,f as mm}from"./charts-simvewUa.js";import{c as Xt}from"./react-vendor-BmxF9s7Q.js";var Ur,yc;function qe(){if(yc)return Ur;yc=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Ur=e,Ur}var jr,mc;function gv(){if(mc)return jr;mc=1;var e=typeof Xt=="object"&&Xt&&Xt.Object===Object&&Xt;return jr=e,jr}var Kr,_c;function Me(){if(_c)return Kr;_c=1;var e=gv(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Kr=r,Kr}var Yr,bc;function _m(){if(bc)return Yr;bc=1;var e=Me(),t=function(){return e.Date.now()};return Yr=t,Yr}var Wr,wc;function bm(){if(wc)return Wr;wc=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Wr=t,Wr}var Zr,Ec;function wm(){if(Ec)return Zr;Ec=1;var e=bm(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Zr=r,Zr}var Xr,xc;function Et(){if(xc)return Xr;xc=1;var e=Me(),t=e.Symbol;return Xr=t,Xr}var Jr,Sc;function Em(){if(Sc)return Jr;Sc=1;var e=Et(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=r.call(o,i),u=o[i];try{o[i]=void 0;var l=!0}catch{}var c=n.call(o);return l&&(s?o[i]=u:delete o[i]),c}return Jr=a,Jr}var Qr,qc;function xm(){if(qc)return Qr;qc=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Qr=r,Qr}var en,Rc;function st(){if(Rc)return en;Rc=1;var e=Et(),t=Em(),r=xm(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):r(s)}return en=o,en}var tn,Cc;function Le(){if(Cc)return tn;Cc=1;function e(t){return t!=null&&typeof t=="object"}return tn=e,tn}var rn,Ac;function xt(){if(Ac)return rn;Ac=1;var e=st(),t=Le(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return rn=n,rn}var nn,Nc;function Sm(){if(Nc)return nn;Nc=1;var e=wm(),t=qe(),r=xt(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return n;if(t(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=t(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=e(l);var f=a.test(l);return f||o.test(l)?s(l.slice(2),f?2:8):i.test(l)?n:+l}return nn=u,nn}function pe(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,n;r{let t;const r=new Set,n=(c,f)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(_=>_(t,h))}},i=()=>t,u={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{(qm?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},l=t=e(n,i,u);return u},Rm=e=>e?Ic(e):Ic,{useDebugValue:Cm}=L,{useSyncExternalStoreWithSelector:Am}=hm,Nm=e=>e;function yv(e,t=Nm,r){const n=Am(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Cm(n),n}const Tc=(e,t)=>{const r=Rm(e),n=(i,a=t)=>yv(r,i,a);return Object.assign(n,r),n},Im=(e,t)=>e?Tc(e,t):Tc;function he(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,i]of e)if(!Object.is(i,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}var Tm={value:()=>{}};function yr(){for(var e=0,t=arguments.length,r={},n;e=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}ir.prototype=yr.prototype={constructor:ir,on:function(e,t){var r=this._,n=Mm(e+"",r),i,a=-1,o=n.length;if(arguments.length<2){for(;++a0)for(var r=new Array(i),n=0,i,a;n=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Pc.hasOwnProperty(t)?{space:Pc[t],local:e}:e}function Om(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===mu&&t.documentElement.namespaceURI===mu?t.createElement(e):t.createElementNS(r,e)}}function km(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mv(e){var t=mr(e);return(t.local?km:Om)(t)}function Dm(){}function Tu(e){return e==null?Dm:function(){return this.querySelector(e)}}function Lm(e){typeof e!="function"&&(e=Tu(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i=b&&(b=y+1);!(E=v[b])&&++b<_;);m._next=E||null}}return o=new Ee(o,n),o._enter=s,o._exit=u,o}function n_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function i_(){return new Ee(this._exit||this._groups.map(Ev),this._parents)}function a_(e,t,r){var n=this.enter(),i=this,a=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}function o_(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=new Array(i),u=0;u=0;)(o=n[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function u_(e){e||(e=c_);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),a=0;at?1:e>=t?0:NaN}function l_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function f_(){return Array.from(this)}function d_(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?x_:typeof t=="function"?q_:S_)(e,t,r??"")):_t(this.node(),e)}function _t(e,t){return e.style.getPropertyValue(t)||xv(e).getComputedStyle(e,null).getPropertyValue(t)}function C_(e){return function(){delete this[e]}}function A_(e,t){return function(){this[e]=t}}function N_(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function I_(e,t){return arguments.length>1?this.each((t==null?C_:typeof t=="function"?N_:A_)(e,t)):this.node()[e]}function Sv(e){return e.trim().split(/^|\s+/)}function Mu(e){return e.classList||new qv(e)}function qv(e){this._node=e,this._names=Sv(e.getAttribute("class")||"")}qv.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Rv(e,t){for(var r=Mu(e),n=-1,i=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function ib(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,a;r()=>e;function _u(e,{sourceEvent:t,subject:r,target:n,identifier:i,active:a,x:o,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}_u.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pb(e){return!e.ctrlKey&&!e.button}function vb(){return this.parentNode}function gb(e,t){return t??{x:e.x,y:e.y}}function yb(){return navigator.maxTouchPoints||"ontouchstart"in this}function mb(){var e=pb,t=vb,r=gb,n=yb,i={},a=yr("start","drag","end"),o=0,s,u,l,c,f=0;function d(m){m.on("mousedown.drag",h).filter(n).on("touchstart.drag",v).on("touchmove.drag",p,hb).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(m,E){if(!(c||!e.call(this,m,E))){var x=b(this,t.call(this,m,E),m,E,"mouse");x&&(xe(m.view).on("mousemove.drag",_,zt).on("mouseup.drag",g,zt),Iv(m.view),an(m),l=!1,s=m.clientX,u=m.clientY,x("start",m))}}function _(m){if(yt(m),!l){var E=m.clientX-s,x=m.clientY-u;l=E*E+x*x>f}i.mouse("drag",m)}function g(m){xe(m.view).on("mousemove.drag mouseup.drag",null),Tv(m.view,l),yt(m),i.mouse("end",m)}function v(m,E){if(e.call(this,m,E)){var x=m.changedTouches,S=t.call(this,m,E),N=x.length,q,A;for(q=0;q=0&&e._call.call(void 0,t),e=e._next;--bt}function Oc(){at=(lr=Bt.now())+_r,bt=Pt=0;try{bb()}finally{bt=0,Eb(),at=0}}function wb(){var e=Bt.now(),t=e-lr;t>Mv&&(_r-=t,lr=e)}function Eb(){for(var e,t=cr,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:cr=r);Ot=e,bu(n)}function bu(e){if(!bt){Pt&&(Pt=clearTimeout(Pt));var t=e-at;t>24?(e<1/0&&(Pt=setTimeout(Oc,e-Bt.now()-_r)),At&&(At=clearInterval(At))):(At||(lr=Bt.now(),At=setInterval(wb,Mv)),bt=1,Pv(Oc))}}function kc(e,t,r){var n=new fr;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var xb=yr("start","end","cancel","interrupt"),Sb=[],kv=0,Dc=1,wu=2,ar=3,Lc=4,Eu=5,or=6;function br(e,t,r,n,i,a){var o=e.__transition;if(!o)e.__transition={};else if(r in o)return;qb(e,r,{name:t,index:n,group:i,on:xb,tween:Sb,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:kv})}function Ou(e,t){var r=Pe(e,t);if(r.state>kv)throw new Error("too late; already scheduled");return r}function Fe(e,t){var r=Pe(e,t);if(r.state>ar)throw new Error("too late; already running");return r}function Pe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function qb(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=Ov(a,0,r.time);function a(l){r.state=Dc,r.timer.restart(o,r.delay,r.time),r.delay<=l&&o(l-r.delay)}function o(l){var c,f,d,h;if(r.state!==Dc)return u();for(c in n)if(h=n[c],h.name===r.name){if(h.state===ar)return kc(o);h.state===Lc?(h.state=or,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[c]):+cwu&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function t0(e,t,r){var n,i,a=e0(t)?Ou:Fe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}function r0(e,t){var r=this._id;return arguments.length<2?Pe(this.node(),r).on.on(e):this.each(t0(r,e,t))}function n0(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function i0(){return this.on("end.remove",n0(this._id))}function a0(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Tu(e));for(var n=this._groups,i=n.length,a=new Array(i),o=0;o()=>e;function I0(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function $e(e,t,r){this.k=e,this.x=t,this.y=r}$e.prototype={constructor:$e,scale:function(e){return e===1?this:new $e(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $e(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ge=new $e(1,0,0);$e.prototype;function on(e){e.stopImmediatePropagation()}function Nt(e){e.preventDefault(),e.stopImmediatePropagation()}function T0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function M0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fc(){return this.__zoom||Ge}function P0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function O0(){return navigator.maxTouchPoints||"ontouchstart"in this}function k0(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],o=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function zv(){var e=T0,t=M0,r=k0,n=P0,i=O0,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,u=mm,l=yr("start","zoom","end"),c,f,d,h=500,_=150,g=0,v=10;function p(w){w.property("__zoom",Fc).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(w,T,C,z){var H=w.selection?w.selection():w;H.property("__zoom",Fc),w!==H?E(w,T,C,z):H.interrupt().each(function(){x(this,arguments).event(z).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},p.scaleBy=function(w,T,C,z){p.scaleTo(w,function(){var H=this.__zoom.k,M=typeof T=="function"?T.apply(this,arguments):T;return H*M},C,z)},p.scaleTo=function(w,T,C,z){p.transform(w,function(){var H=t.apply(this,arguments),M=this.__zoom,B=C==null?m(H):typeof C=="function"?C.apply(this,arguments):C,G=M.invert(B),V=typeof T=="function"?T.apply(this,arguments):T;return r(b(y(M,V),B,G),H,o)},C,z)},p.translateBy=function(w,T,C,z){p.transform(w,function(){return r(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),o)},null,z)},p.translateTo=function(w,T,C,z,H){p.transform(w,function(){var M=t.apply(this,arguments),B=this.__zoom,G=z==null?m(M):typeof z=="function"?z.apply(this,arguments):z;return r(Ge.translate(G[0],G[1]).scale(B.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof C=="function"?-C.apply(this,arguments):-C),M,o)},z,H)};function y(w,T){return T=Math.max(a[0],Math.min(a[1],T)),T===w.k?w:new $e(T,w.x,w.y)}function b(w,T,C){var z=T[0]-C[0]*w.k,H=T[1]-C[1]*w.k;return z===w.x&&H===w.y?w:new $e(w.k,z,H)}function m(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function E(w,T,C,z){w.on("start.zoom",function(){x(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(z).end()}).tween("zoom",function(){var H=this,M=arguments,B=x(H,M).event(z),G=t.apply(H,M),V=C==null?m(G):typeof C=="function"?C.apply(H,M):C,U=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),R=H.__zoom,P=typeof T=="function"?T.apply(H,M):T,F=u(R.invert(V).concat(U/R.k),P.invert(V).concat(U/P.k));return function($){if($===1)$=P;else{var j=F($),W=U/j[2];$=new $e(W,V[0]-j[0]*W,V[1]-j[1]*W)}B.zoom(null,$)}})}function x(w,T,C){return!C&&w.__zooming||new S(w,T)}function S(w,T){this.that=w,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,T),this.taps=0}S.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,T){return this.mouse&&w!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var T=xe(this.that).datum();l.call(w,this.that,new I0(w,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:l}),T)}};function N(w,...T){if(!e.apply(this,arguments))return;var C=x(this,T).event(w),z=this.__zoom,H=Math.max(a[0],Math.min(a[1],z.k*Math.pow(2,n.apply(this,arguments)))),M=Ne(w);if(C.wheel)(C.mouse[0][0]!==M[0]||C.mouse[0][1]!==M[1])&&(C.mouse[1]=z.invert(C.mouse[0]=M)),clearTimeout(C.wheel);else{if(z.k===H)return;C.mouse=[M,z.invert(M)],sr(this),C.start()}Nt(w),C.wheel=setTimeout(B,_),C.zoom("mouse",r(b(y(z,H),C.mouse[0],C.mouse[1]),C.extent,o));function B(){C.wheel=null,C.end()}}function q(w,...T){if(d||!e.apply(this,arguments))return;var C=w.currentTarget,z=x(this,T,!0).event(w),H=xe(w.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",U,!0),M=Ne(w,C),B=w.clientX,G=w.clientY;Iv(w.view),on(w),z.mouse=[M,this.__zoom.invert(M)],sr(this),z.start();function V(R){if(Nt(R),!z.moved){var P=R.clientX-B,F=R.clientY-G;z.moved=P*P+F*F>g}z.event(R).zoom("mouse",r(b(z.that.__zoom,z.mouse[0]=Ne(R,C),z.mouse[1]),z.extent,o))}function U(R){H.on("mousemove.zoom mouseup.zoom",null),Tv(R.view,z.moved),Nt(R),z.event(R).end()}}function A(w,...T){if(e.apply(this,arguments)){var C=this.__zoom,z=Ne(w.changedTouches?w.changedTouches[0]:w,this),H=C.invert(z),M=C.k*(w.shiftKey?.5:2),B=r(b(y(C,M),z,H),t.apply(this,T),o);Nt(w),s>0?xe(this).transition().duration(s).call(E,B,z,w):xe(this).call(p.transform,B,z,w)}}function I(w,...T){if(e.apply(this,arguments)){var C=w.touches,z=C.length,H=x(this,T,w.changedTouches.length===z).event(w),M,B,G,V;for(on(w),B=0;B"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},Bv=Ue.error001();function ne(e,t){const r=k.useContext(wr);if(r===null)throw new Error(Bv);return yv(r,e,t)}const fe=()=>{const e=k.useContext(wr);if(e===null)throw new Error(Bv);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},L0=e=>e.userSelectionActive?"none":"all";function Du({position:e,children:t,className:r,style:n,...i}){const a=ne(L0),o=`${e}`.split("-");return L.createElement("div",{className:pe(["react-flow__panel",r,...o]),style:{...n,pointerEvents:a},...i},t)}function F0({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:L.createElement(Du,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},L.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const z0=({x:e,y:t,label:r,labelStyle:n={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:u,className:l,...c})=>{const f=k.useRef(null),[d,h]=k.useState({x:0,y:0,width:0,height:0}),_=pe(["react-flow__edge-textwrapper",l]);return k.useEffect(()=>{if(f.current){const g=f.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[r]),typeof r>"u"||!r?null:L.createElement("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:_,visibility:d.width?"visible":"hidden",...c},i&&L.createElement("rect",{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:s,ry:s}),L.createElement("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:f,style:n},r),u)};var B0=k.memo(z0);const Lu=e=>({width:e.offsetWidth,height:e.offsetHeight}),wt=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),Fu=(e={x:0,y:0},t)=>({x:wt(e.x,t[0][0],t[1][0]),y:wt(e.y,t[0][1],t[1][1])}),zc=(e,t,r)=>er?-wt(Math.abs(e-r),1,50)/50:0,Hv=(e,t)=>{const r=zc(e.x,35,t.width-35)*20,n=zc(e.y,35,t.height-35)*20;return[r,n]},$v=e=>e.getRootNode?.()||window?.document,Gv=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Ht=({x:e,y:t,width:r,height:n})=>({x:e,y:t,x2:e+r,y2:t+n}),Vv=({x:e,y:t,x2:r,y2:n})=>({x:e,y:t,width:r-e,height:n-t}),Bc=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),H0=(e,t)=>Vv(Gv(Ht(e),Ht(t))),xu=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*n)},$0=e=>Se(e.width)&&Se(e.height)&&Se(e.x)&&Se(e.y),Se=e=>!isNaN(e)&&isFinite(e),se=Symbol.for("internals"),Uv=["Enter"," ","Escape"],G0=(e,t)=>{},V0=e=>"nativeEvent"in e;function Su(e){const r=(V0(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r?.nodeName)||r?.hasAttribute("contenteditable")||!!r?.closest(".nokey")}const jv=e=>"clientX"in e,Je=(e,t)=>{const r=jv(e),n=r?e.clientX:e.touches?.[0].clientX,i=r?e.clientY:e.touches?.[0].clientY;return{x:n-(t?.left??0),y:i-(t?.top??0)}},dr=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,Ut=({id:e,path:t,labelX:r,labelY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h=20})=>L.createElement(L.Fragment,null,L.createElement("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:d}),h&&L.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Se(r)&&Se(n)?L.createElement(B0,{x:r,y:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l}):null);Ut.displayName="BaseEdge";function It(e,t,r){return r===void 0?r:n=>{const i=t().edges.find(a=>a.id===e);i&&r(n,{...i})}}function Kv({sourceX:e,sourceY:t,targetX:r,targetY:n}){const i=Math.abs(r-e)/2,a=r{const[v,p,y]=Wv({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a});return L.createElement(Ut,{path:v,labelX:p,labelY:y,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:g})});zu.displayName="SimpleBezierEdge";const $c={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}},U0=({source:e,sourcePosition:t=J.Bottom,target:r})=>t===J.Left||t===J.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function j0({source:e,sourcePosition:t=J.Bottom,target:r,targetPosition:n=J.Top,center:i,offset:a}){const o=$c[t],s=$c[n],u={x:e.x+o.x*a,y:e.y+o.y*a},l={x:r.x+s.x*a,y:r.y+s.y*a},c=U0({source:u,sourcePosition:t,target:l}),f=c.x!==0?"x":"y",d=c[f];let h=[],_,g;const v={x:0,y:0},p={x:0,y:0},[y,b,m,E]=Kv({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(o[f]*s[f]===-1){_=i.x??y,g=i.y??b;const S=[{x:_,y:u.y},{x:_,y:l.y}],N=[{x:u.x,y:g},{x:l.x,y:g}];o[f]===d?h=f==="x"?S:N:h=f==="x"?N:S}else{const S=[{x:u.x,y:l.y}],N=[{x:l.x,y:u.y}];if(f==="x"?h=o.x===d?N:S:h=o.y===d?S:N,t===n){const O=Math.abs(e[f]-r[f]);if(O<=a){const w=Math.min(a-1,a-O);o[f]===d?v[f]=(u[f]>e[f]?-1:1)*w:p[f]=(l[f]>r[f]?-1:1)*w}}if(t!==n){const O=f==="x"?"y":"x",w=o[f]===s[O],T=u[O]>l[O],C=u[O]=D?(_=(q.x+A.x)/2,g=h[0].y):(_=h[0].x,g=(q.y+A.y)/2)}return[[e,{x:u.x+v.x,y:u.y+v.y},...h,{x:l.x+p.x,y:l.y+p.y},r],_,g,m,E]}function K0(e,t,r,n){const i=Math.min(Gc(e,t)/2,Gc(t,r)/2,n),{x:a,y:o}=t;if(e.x===a&&a===r.x||e.y===o&&o===r.y)return`L${a} ${o}`;if(e.y===o){const l=e.x{let b="";return y>0&&y{const[p,y,b]=qu({sourceX:e,sourceY:t,sourcePosition:f,targetX:r,targetY:n,targetPosition:d,borderRadius:g?.borderRadius,offset:g?.offset});return L.createElement(Ut,{path:p,labelX:y,labelY:b,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:h,markerStart:_,interactionWidth:v})});Er.displayName="SmoothStepEdge";const Bu=k.memo(e=>L.createElement(Er,{...e,pathOptions:k.useMemo(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));Bu.displayName="StepEdge";function Y0({sourceX:e,sourceY:t,targetX:r,targetY:n}){const[i,a,o,s]=Kv({sourceX:e,sourceY:t,targetX:r,targetY:n});return[`M ${e},${t}L ${r},${n}`,i,a,o,s]}const Hu=k.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})=>{const[_,g,v]=Y0({sourceX:e,sourceY:t,targetX:r,targetY:n});return L.createElement(Ut,{path:_,labelX:g,labelY:v,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})});Hu.displayName="StraightEdge";function er(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Vc({pos:e,x1:t,y1:r,x2:n,y2:i,c:a}){switch(e){case J.Left:return[t-er(t-n,a),r];case J.Right:return[t+er(n-t,a),r];case J.Top:return[t,r-er(r-i,a)];case J.Bottom:return[t,r+er(i-r,a)]}}function Zv({sourceX:e,sourceY:t,sourcePosition:r=J.Bottom,targetX:n,targetY:i,targetPosition:a=J.Top,curvature:o=.25}){const[s,u]=Vc({pos:r,x1:e,y1:t,x2:n,y2:i,c:o}),[l,c]=Vc({pos:a,x1:n,y1:i,x2:e,y2:t,c:o}),[f,d,h,_]=Yv({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:s,sourceControlY:u,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${u} ${l},${c} ${n},${i}`,f,d,h,_]}const pr=k.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,sourcePosition:i=J.Bottom,targetPosition:a=J.Top,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,pathOptions:g,interactionWidth:v})=>{const[p,y,b]=Zv({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a,curvature:g?.curvature});return L.createElement(Ut,{path:p,labelX:y,labelY:b,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:v})});pr.displayName="BezierEdge";const $u=k.createContext(null),W0=$u.Provider;$u.Consumer;const Z0=()=>k.useContext($u),X0=e=>"id"in e&&"source"in e&&"target"in e,J0=({source:e,sourceHandle:t,target:r,targetHandle:n})=>`reactflow__edge-${e}${t||""}-${r}${n||""}`,Ru=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`,Q0=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),ew=(e,t)=>{if(!e.source||!e.target)return t;let r;return X0(e)?r={...e}:r={...e,id:J0(e)},Q0(r,t)?t:t.concat(r)},Cu=({x:e,y:t},[r,n,i],a,[o,s])=>{const u={x:(e-r)/i,y:(t-n)/i};return a?{x:o*Math.round(u.x/o),y:s*Math.round(u.y/s)}:u},Xv=({x:e,y:t},[r,n,i])=>({x:e*i+r,y:t*i+n}),it=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*t[0],n=(e.height??0)*t[1],i={x:e.position.x-r,y:e.position.y-n};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-n}:i}},xr=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((n,i)=>{const{x:a,y:o}=it(i,t).positionAbsolute;return Gv(n,Ht({x:a,y:o,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Vv(r)},Jv=(e,t,[r,n,i]=[0,0,1],a=!1,o=!1,s=[0,0])=>{const u={x:(t.x-r)/i,y:(t.y-n)/i,width:t.width/i,height:t.height/i},l=[];return e.forEach(c=>{const{width:f,height:d,selectable:h=!0,hidden:_=!1}=c;if(o&&!h||_)return!1;const{positionAbsolute:g}=it(c,s),v={x:g.x,y:g.y,width:f||0,height:d||0},p=xu(u,v),y=typeof f>"u"||typeof d>"u"||f===null||d===null,b=a&&p>0,m=(f||0)*(d||0);(y||b||p>=m||c.dragging)&&l.push(c)}),l},Qv=(e,t)=>{const r=e.map(n=>n.id);return t.filter(n=>r.includes(n.source)||r.includes(n.target))},eg=(e,t,r,n,i,a=.1)=>{const o=t/(e.width*(1+a)),s=r/(e.height*(1+a)),u=Math.min(o,s),l=wt(u,n,i),c=e.x+e.width/2,f=e.y+e.height/2,d=t/2-c*l,h=r/2-f*l;return{x:d,y:h,zoom:l}},rt=(e,t=0)=>e.transition().duration(t);function Uc(e,t,r,n){return(t[r]||[]).reduce((i,a)=>(`${e.id}-${a.id}-${r}`!==n&&i.push({id:a.id||null,type:r,nodeId:e.id,x:(e.positionAbsolute?.x??0)+a.x+a.width/2,y:(e.positionAbsolute?.y??0)+a.y+a.height/2}),i),[])}function tw(e,t,r,n,i,a){const{x:o,y:s}=Je(e),l=t.elementsFromPoint(o,s).find(_=>_.classList.contains("react-flow__handle"));if(l){const _=l.getAttribute("data-nodeid");if(_){const g=Gu(void 0,l),v=l.getAttribute("data-handleid"),p=a({nodeId:_,id:v,type:g});if(p){const y=i.find(b=>b.nodeId===_&&b.type===g&&b.id===v);return{handle:{id:v,type:g,nodeId:_,x:y?.x||r.x,y:y?.y||r.y},validHandleResult:p}}}}let c=[],f=1/0;if(i.forEach(_=>{const g=Math.sqrt((_.x-r.x)**2+(_.y-r.y)**2);if(g<=n){const v=a(_);g<=f&&(g_.isValid),h=c.some(({handle:_})=>_.type==="target");return c.find(({handle:_,validHandleResult:g})=>h?_.type==="target":d?g.isValid:!0)||c[0]}const rw={source:null,target:null,sourceHandle:null,targetHandle:null},tg=()=>({handleDomNode:null,isValid:!1,connection:rw,endHandle:null});function rg(e,t,r,n,i,a,o){const s=i==="target",u=o.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),l={...tg(),handleDomNode:u};if(u){const c=Gu(void 0,u),f=u.getAttribute("data-nodeid"),d=u.getAttribute("data-handleid"),h=u.classList.contains("connectable"),_=u.classList.contains("connectableend"),g={source:s?f:r,sourceHandle:s?d:n,target:s?r:f,targetHandle:s?n:d};l.connection=g,h&&_&&(t===ot.Strict?s&&c==="source"||!s&&c==="target":f!==r||d!==n)&&(l.endHandle={nodeId:f,handleId:d,type:c},l.isValid=a(g))}return l}function nw({nodes:e,nodeId:t,handleId:r,handleType:n}){return e.reduce((i,a)=>{if(a[se]){const{handleBounds:o}=a[se];let s=[],u=[];o&&(s=Uc(a,o,"source",`${t}-${r}-${n}`),u=Uc(a,o,"target",`${t}-${r}-${n}`)),i.push(...s,...u)}return i},[])}function Gu(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function sn(e){e?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function iw(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function ng({event:e,handleId:t,nodeId:r,onConnect:n,isTarget:i,getState:a,setState:o,isValidConnection:s,edgeUpdaterType:u,onReconnectEnd:l}){const c=$v(e.target),{connectionMode:f,domNode:d,autoPanOnConnect:h,connectionRadius:_,onConnectStart:g,panBy:v,getNodes:p,cancelConnection:y}=a();let b=0,m;const{x:E,y:x}=Je(e),S=c?.elementFromPoint(E,x),N=Gu(u,S),q=d?.getBoundingClientRect();if(!q||!N)return;let A,I=Je(e,q),D=!1,O=null,w=!1,T=null;const C=nw({nodes:p(),nodeId:r,handleId:t,handleType:N}),z=()=>{if(!h)return;const[B,G]=Hv(I,q);v({x:B,y:G}),b=requestAnimationFrame(z)};o({connectionPosition:I,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:N,connectionStartHandle:{nodeId:r,handleId:t,type:N},connectionEndHandle:null}),g?.(e,{nodeId:r,handleId:t,handleType:N});function H(B){const{transform:G}=a();I=Je(B,q);const{handle:V,validHandleResult:U}=tw(B,c,Cu(I,G,!1,[1,1]),_,C,R=>rg(R,f,r,t,i?"target":"source",s,c));if(m=V,D||(z(),D=!0),T=U.handleDomNode,O=U.connection,w=U.isValid,o({connectionPosition:m&&w?Xv({x:m.x,y:m.y},G):I,connectionStatus:iw(!!m,w),connectionEndHandle:U.endHandle}),!m&&!w&&!T)return sn(A);O.source!==O.target&&T&&(sn(A),A=T,T.classList.add("connecting","react-flow__handle-connecting"),T.classList.toggle("valid",w),T.classList.toggle("react-flow__handle-valid",w))}function M(B){(m||T)&&O&&w&&n?.(O),a().onConnectEnd?.(B),u&&l?.(B),sn(A),y(),cancelAnimationFrame(b),D=!1,w=!1,O=null,T=null,c.removeEventListener("mousemove",H),c.removeEventListener("mouseup",M),c.removeEventListener("touchmove",H),c.removeEventListener("touchend",M)}c.addEventListener("mousemove",H),c.addEventListener("mouseup",M),c.addEventListener("touchmove",H),c.addEventListener("touchend",M)}const jc=()=>!0,aw=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),ow=(e,t,r)=>n=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:o}=n;return{connecting:i?.nodeId===e&&i?.handleId===t&&i?.type===r||a?.nodeId===e&&a?.handleId===t&&a?.type===r,clickConnecting:o?.nodeId===e&&o?.handleId===t&&o?.type===r}},ig=k.forwardRef(({type:e="source",position:t=J.Top,isValidConnection:r,isConnectable:n=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:u,className:l,onMouseDown:c,onTouchStart:f,...d},h)=>{const _=o||null,g=e==="target",v=fe(),p=Z0(),{connectOnClick:y,noPanClassName:b}=ne(aw,he),{connecting:m,clickConnecting:E}=ne(ow(p,_,e),he);p||v.getState().onError?.("010",Ue.error010());const x=q=>{const{defaultEdgeOptions:A,onConnect:I,hasDefaultEdges:D}=v.getState(),O={...A,...q};if(D){const{edges:w,setEdges:T}=v.getState();T(ew(O,w))}I?.(O),s?.(O)},S=q=>{if(!p)return;const A=jv(q);i&&(A&&q.button===0||!A)&&ng({event:q,handleId:_,nodeId:p,onConnect:x,isTarget:g,getState:v.getState,setState:v.setState,isValidConnection:r||v.getState().isValidConnection||jc}),A?c?.(q):f?.(q)},N=q=>{const{onClickConnectStart:A,onClickConnectEnd:I,connectionClickStartHandle:D,connectionMode:O,isValidConnection:w}=v.getState();if(!p||!D&&!i)return;if(!D){A?.(q,{nodeId:p,handleId:_,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:p,type:e,handleId:_}});return}const T=$v(q.target),C=r||w||jc,{connection:z,isValid:H}=rg({nodeId:p,id:_,type:e},O,D.nodeId,D.handleId||null,D.type,C,T);H&&x(z),I?.(q),v.setState({connectionClickStartHandle:null})};return L.createElement("div",{"data-handleid":_,"data-nodeid":p,"data-handlepos":t,"data-id":`${p}-${_}-${e}`,className:pe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,l,{source:!g,target:g,connectable:n,connectablestart:i,connectableend:a,connecting:E,connectionindicator:n&&(i&&!m||a&&m)}]),onMouseDown:S,onTouchStart:S,onClick:y?N:void 0,ref:h,...d},u)});ig.displayName="Handle";var vr=k.memo(ig);const ag=({data:e,isConnectable:t,targetPosition:r=J.Top,sourcePosition:n=J.Bottom})=>L.createElement(L.Fragment,null,L.createElement(vr,{type:"target",position:r,isConnectable:t}),e?.label,L.createElement(vr,{type:"source",position:n,isConnectable:t}));ag.displayName="DefaultNode";var Au=k.memo(ag);const og=({data:e,isConnectable:t,sourcePosition:r=J.Bottom})=>L.createElement(L.Fragment,null,e?.label,L.createElement(vr,{type:"source",position:r,isConnectable:t}));og.displayName="InputNode";var sg=k.memo(og);const ug=({data:e,isConnectable:t,targetPosition:r=J.Top})=>L.createElement(L.Fragment,null,L.createElement(vr,{type:"target",position:r,isConnectable:t}),e?.label);ug.displayName="OutputNode";var cg=k.memo(ug);const Vu=()=>null;Vu.displayName="GroupNode";const sw=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),tr=e=>e.id;function uw(e,t){return he(e.selectedNodes.map(tr),t.selectedNodes.map(tr))&&he(e.selectedEdges.map(tr),t.selectedEdges.map(tr))}const lg=k.memo(({onSelectionChange:e})=>{const t=fe(),{selectedNodes:r,selectedEdges:n}=ne(sw,uw);return k.useEffect(()=>{const i={nodes:r,edges:n};e?.(i),t.getState().onSelectionChange.forEach(a=>a(i))},[r,n,e]),null});lg.displayName="SelectionListener";const cw=e=>!!e.onSelectionChange;function lw({onSelectionChange:e}){const t=ne(cw);return e||t?L.createElement(lg,{onSelectionChange:e}):null}const fw=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function dt(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Q(e,t,r){k.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const dw=({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:i,onConnectStart:a,onConnectEnd:o,onClickConnectStart:s,onClickConnectEnd:u,nodesDraggable:l,nodesConnectable:c,nodesFocusable:f,edgesFocusable:d,edgesUpdatable:h,elevateNodesOnSelect:_,minZoom:g,maxZoom:v,nodeExtent:p,onNodesChange:y,onEdgesChange:b,elementsSelectable:m,connectionMode:E,snapGrid:x,snapToGrid:S,translateExtent:N,connectOnClick:q,defaultEdgeOptions:A,fitView:I,fitViewOptions:D,onNodesDelete:O,onEdgesDelete:w,onNodeDrag:T,onNodeDragStart:C,onNodeDragStop:z,onSelectionDrag:H,onSelectionDragStart:M,onSelectionDragStop:B,noPanClassName:G,nodeOrigin:V,rfId:U,autoPanOnConnect:R,autoPanOnNodeDrag:P,onError:F,connectionRadius:$,isValidConnection:j,nodeDragThreshold:W})=>{const{setNodes:Z,setEdges:te,setDefaultNodesAndEdges:ie,setMinZoom:re,setMaxZoom:ee,setTranslateExtent:X,setNodeExtent:ue,reset:K}=ne(fw,he),Y=fe();return k.useEffect(()=>{const oe=n?.map(Ce=>({...Ce,...A}));return ie(r,oe),()=>{K()}},[]),Q("defaultEdgeOptions",A,Y.setState),Q("connectionMode",E,Y.setState),Q("onConnect",i,Y.setState),Q("onConnectStart",a,Y.setState),Q("onConnectEnd",o,Y.setState),Q("onClickConnectStart",s,Y.setState),Q("onClickConnectEnd",u,Y.setState),Q("nodesDraggable",l,Y.setState),Q("nodesConnectable",c,Y.setState),Q("nodesFocusable",f,Y.setState),Q("edgesFocusable",d,Y.setState),Q("edgesUpdatable",h,Y.setState),Q("elementsSelectable",m,Y.setState),Q("elevateNodesOnSelect",_,Y.setState),Q("snapToGrid",S,Y.setState),Q("snapGrid",x,Y.setState),Q("onNodesChange",y,Y.setState),Q("onEdgesChange",b,Y.setState),Q("connectOnClick",q,Y.setState),Q("fitViewOnInit",I,Y.setState),Q("fitViewOnInitOptions",D,Y.setState),Q("onNodesDelete",O,Y.setState),Q("onEdgesDelete",w,Y.setState),Q("onNodeDrag",T,Y.setState),Q("onNodeDragStart",C,Y.setState),Q("onNodeDragStop",z,Y.setState),Q("onSelectionDrag",H,Y.setState),Q("onSelectionDragStart",M,Y.setState),Q("onSelectionDragStop",B,Y.setState),Q("noPanClassName",G,Y.setState),Q("nodeOrigin",V,Y.setState),Q("rfId",U,Y.setState),Q("autoPanOnConnect",R,Y.setState),Q("autoPanOnNodeDrag",P,Y.setState),Q("onError",F,Y.setState),Q("connectionRadius",$,Y.setState),Q("isValidConnection",j,Y.setState),Q("nodeDragThreshold",W,Y.setState),dt(e,Z),dt(t,te),dt(g,re),dt(v,ee),dt(N,X),dt(p,ue),null},Kc={display:"none"},hw={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},fg="react-flow__node-desc",dg="react-flow__edge-desc",pw="react-flow__aria-live",vw=e=>e.ariaLiveMessage;function gw({rfId:e}){const t=ne(vw);return L.createElement("div",{id:`${pw}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:hw},t)}function yw({rfId:e,disableKeyboardA11y:t}){return L.createElement(L.Fragment,null,L.createElement("div",{id:`${fg}-${e}`,style:Kc},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),L.createElement("div",{id:`${dg}-${e}`,style:Kc},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&L.createElement(gw,{rfId:e}))}var Gt=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,n]=k.useState(!1),i=k.useRef(!1),a=k.useRef(new Set([])),[o,s]=k.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),c=l.reduce((f,d)=>f.concat(...d),[]);return[l,c]}return[[],[]]},[e]);return k.useEffect(()=>{const u=typeof document<"u"?document:null,l=t?.target||u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Su(h))return!1;const g=Wc(h.code,s);a.current.add(h[g]),Yc(o,a.current,!1)&&(h.preventDefault(),n(!0))},f=h=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Su(h))return!1;const g=Wc(h.code,s);Yc(o,a.current,!0)?(n(!1),a.current.clear()):a.current.delete(h[g]),h.key==="Meta"&&a.current.clear(),i.current=!1},d=()=>{a.current.clear(),n(!1)};return l?.addEventListener("keydown",c),l?.addEventListener("keyup",f),window.addEventListener("blur",d),()=>{l?.removeEventListener("keydown",c),l?.removeEventListener("keyup",f),window.removeEventListener("blur",d)}}},[e,n]),r};function Yc(e,t,r){return e.filter(n=>r||n.length===t.size).some(n=>n.every(i=>t.has(i)))}function Wc(e,t){return t.includes(e)?"code":"key"}function hg(e,t,r,n){const i=e.parentNode||e.parentId;if(!i)return r;const a=t.get(i),o=it(a,n);return hg(a,t,{x:(r.x??0)+o.x,y:(r.y??0)+o.y,z:(a[se]?.z??0)>(r.z??0)?a[se]?.z??0:r.z??0},n)}function pg(e,t,r){e.forEach(n=>{const i=n.parentNode||n.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||r?.[n.id]){const{x:a,y:o,z:s}=hg(n,e,{...n.position,z:n[se]?.z??0},t);n.positionAbsolute={x:a,y:o},n[se].z=s,r?.[n.id]&&(n[se].isParent=!0)}})}function un(e,t,r,n){const i=new Map,a={},o=n?1e3:0;return e.forEach(s=>{const u=(Se(s.zIndex)?s.zIndex:0)+(s.selected?o:0),l=t.get(s.id),c={...s,positionAbsolute:{x:s.position.x,y:s.position.y}},f=s.parentNode||s.parentId;f&&(a[f]=!0);const d=l?.type&&l?.type!==s.type;Object.defineProperty(c,se,{enumerable:!1,value:{handleBounds:d?void 0:l?.[se]?.handleBounds,z:u}}),i.set(s.id,c)}),pg(i,r,a),i}function vg(e,t={}){const{getNodes:r,width:n,height:i,minZoom:a,maxZoom:o,d3Zoom:s,d3Selection:u,fitViewOnInitDone:l,fitViewOnInit:c,nodeOrigin:f}=e(),d=t.initial&&!l&&c;if(s&&u&&(d||!t.initial)){const _=r().filter(v=>{const p=t.includeHiddenNodes?v.width&&v.height:!v.hidden;return t.nodes?.length?p&&t.nodes.some(y=>y.id===v.id):p}),g=_.every(v=>v.width&&v.height);if(_.length>0&&g){const v=xr(_,f),{x:p,y,zoom:b}=eg(v,n,i,t.minZoom??a,t.maxZoom??o,t.padding??.1),m=Ge.translate(p,y).scale(b);return typeof t.duration=="number"&&t.duration>0?s.transform(rt(u,t.duration),m):s.transform(u,m),!0}}return!1}function mw(e,t){return e.forEach(r=>{const n=t.get(r.id);n&&t.set(n.id,{...n,[se]:n[se],selected:r.selected})}),new Map(t)}function _w(e,t){return t.map(r=>{const n=e.find(i=>i.id===r.id);return n&&(r.selected=n.selected),r})}function rr({changedNodes:e,changedEdges:t,get:r,set:n}){const{nodeInternals:i,edges:a,onNodesChange:o,onEdgesChange:s,hasDefaultNodes:u,hasDefaultEdges:l}=r();e?.length&&(u&&n({nodeInternals:mw(e,i)}),o?.(e)),t?.length&&(l&&n({edges:_w(t,a)}),s?.(t))}const ht=()=>{},bw={zoomIn:ht,zoomOut:ht,zoomTo:ht,getZoom:()=>1,setViewport:ht,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ht,fitBounds:ht,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},ww=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Ew=()=>{const e=fe(),{d3Zoom:t,d3Selection:r}=ne(ww,he);return k.useMemo(()=>r&&t?{zoomIn:i=>t.scaleBy(rt(r,i?.duration),1.2),zoomOut:i=>t.scaleBy(rt(r,i?.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(rt(r,a?.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[o,s,u]=e.getState().transform,l=Ge.translate(i.x??o,i.y??s).scale(i.zoom??u);t.transform(rt(r,a?.duration),l)},getViewport:()=>{const[i,a,o]=e.getState().transform;return{x:i,y:a,zoom:o}},fitView:i=>vg(e.getState,i),setCenter:(i,a,o)=>{const{width:s,height:u,maxZoom:l}=e.getState(),c=typeof o?.zoom<"u"?o.zoom:l,f=s/2-i*c,d=u/2-a*c,h=Ge.translate(f,d).scale(c);t.transform(rt(r,o?.duration),h)},fitBounds:(i,a)=>{const{width:o,height:s,minZoom:u,maxZoom:l}=e.getState(),{x:c,y:f,zoom:d}=eg(i,o,s,u,l,a?.padding??.1),h=Ge.translate(c,f).scale(d);t.transform(rt(r,a?.duration),h)},project:i=>{const{transform:a,snapToGrid:o,snapGrid:s}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Cu(i,a,o,s)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:o,snapGrid:s,domNode:u}=e.getState();if(!u)return i;const{x:l,y:c}=u.getBoundingClientRect(),f={x:i.x-l,y:i.y-c};return Cu(f,a,o,s)},flowToScreenPosition:i=>{const{transform:a,domNode:o}=e.getState();if(!o)return i;const{x:s,y:u}=o.getBoundingClientRect(),l=Xv(i,a);return{x:l.x+s,y:l.y+u}},viewportInitialized:!0}:bw,[t,r])};function Uu(){const e=Ew(),t=fe(),r=k.useCallback(()=>t.getState().getNodes().map(g=>({...g})),[]),n=k.useCallback(g=>t.getState().nodeInternals.get(g),[]),i=k.useCallback(()=>{const{edges:g=[]}=t.getState();return g.map(v=>({...v}))},[]),a=k.useCallback(g=>{const{edges:v=[]}=t.getState();return v.find(p=>p.id===g)},[]),o=k.useCallback(g=>{const{getNodes:v,setNodes:p,hasDefaultNodes:y,onNodesChange:b}=t.getState(),m=v(),E=typeof g=="function"?g(m):g;if(y)p(E);else if(b){const x=E.length===0?m.map(S=>({type:"remove",id:S.id})):E.map(S=>({item:S,type:"reset"}));b(x)}},[]),s=k.useCallback(g=>{const{edges:v=[],setEdges:p,hasDefaultEdges:y,onEdgesChange:b}=t.getState(),m=typeof g=="function"?g(v):g;if(y)p(m);else if(b){const E=m.length===0?v.map(x=>({type:"remove",id:x.id})):m.map(x=>({item:x,type:"reset"}));b(E)}},[]),u=k.useCallback(g=>{const v=Array.isArray(g)?g:[g],{getNodes:p,setNodes:y,hasDefaultNodes:b,onNodesChange:m}=t.getState();if(b){const x=[...p(),...v];y(x)}else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),l=k.useCallback(g=>{const v=Array.isArray(g)?g:[g],{edges:p=[],setEdges:y,hasDefaultEdges:b,onEdgesChange:m}=t.getState();if(b)y([...p,...v]);else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),c=k.useCallback(()=>{const{getNodes:g,edges:v=[],transform:p}=t.getState(),[y,b,m]=p;return{nodes:g().map(E=>({...E})),edges:v.map(E=>({...E})),viewport:{x:y,y:b,zoom:m}}},[]),f=k.useCallback(({nodes:g,edges:v})=>{const{nodeInternals:p,getNodes:y,edges:b,hasDefaultNodes:m,hasDefaultEdges:E,onNodesDelete:x,onEdgesDelete:S,onNodesChange:N,onEdgesChange:q}=t.getState(),A=(g||[]).map(T=>T.id),I=(v||[]).map(T=>T.id),D=y().reduce((T,C)=>{const z=C.parentNode||C.parentId,H=!A.includes(C.id)&&z&&T.find(B=>B.id===z);return(typeof C.deletable=="boolean"?C.deletable:!0)&&(A.includes(C.id)||H)&&T.push(C),T},[]),O=b.filter(T=>typeof T.deletable=="boolean"?T.deletable:!0),w=O.filter(T=>I.includes(T.id));if(D||w){const T=Qv(D,O),C=[...w,...T],z=C.reduce((H,M)=>(H.includes(M.id)||H.push(M.id),H),[]);if((E||m)&&(E&&t.setState({edges:b.filter(H=>!z.includes(H.id))}),m&&(D.forEach(H=>{p.delete(H.id)}),t.setState({nodeInternals:new Map(p)}))),z.length>0&&(S?.(C),q&&q(z.map(H=>({id:H,type:"remove"})))),D.length>0&&(x?.(D),N)){const H=D.map(M=>({id:M.id,type:"remove"}));N(H)}}},[]),d=k.useCallback(g=>{const v=$0(g),p=v?null:t.getState().nodeInternals.get(g.id);return!v&&!p?[null,null,v]:[v?g:Bc(p),p,v]},[]),h=k.useCallback((g,v=!0,p)=>{const[y,b,m]=d(g);return y?(p||t.getState().getNodes()).filter(E=>{if(!m&&(E.id===b.id||!E.positionAbsolute))return!1;const x=Bc(E),S=xu(x,y);return v&&S>0||S>=y.width*y.height}):[]},[]),_=k.useCallback((g,v,p=!0)=>{const[y]=d(g);if(!y)return!1;const b=xu(y,v);return p&&b>0||b>=y.width*y.height},[]);return k.useMemo(()=>({...e,getNodes:r,getNode:n,getEdges:i,getEdge:a,setNodes:o,setEdges:s,addNodes:u,addEdges:l,toObject:c,deleteElements:f,getIntersectingNodes:h,isNodeIntersecting:_}),[e,r,n,i,a,o,s,u,l,c,f,h,_])}const xw={actInsideInputWithModifier:!1};var Sw=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=fe(),{deleteElements:n}=Uu(),i=Gt(e,xw),a=Gt(t);k.useEffect(()=>{if(i){const{edges:o,getNodes:s}=r.getState(),u=s().filter(c=>c.selected),l=o.filter(c=>c.selected);n({nodes:u,edges:l}),r.setState({nodesSelectionActive:!1})}},[i]),k.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])};function qw(e){const t=fe();k.useEffect(()=>{let r;const n=()=>{if(!e.current)return;const i=Lu(e.current);(i.height===0||i.width===0)&&t.getState().onError?.("004",Ue.error004()),t.setState({width:i.width||500,height:i.height||500})};return n(),window.addEventListener("resize",n),e.current&&(r=new ResizeObserver(()=>n()),r.observe(e.current)),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}},[])}const ju={position:"absolute",width:"100%",height:"100%",top:0,left:0},Rw=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,nr=e=>({x:e.x,y:e.y,zoom:e.k}),pt=(e,t)=>e.target.closest(`.${t}`),Zc=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xc=e=>{const t=e.ctrlKey&&dr()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Cw=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Aw=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:n,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:u=nt.Free,zoomOnDoubleClick:l=!0,elementsSelectable:c,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:_,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:p=!0,children:y,noWheelClassName:b,noPanClassName:m})=>{const E=k.useRef(),x=fe(),S=k.useRef(!1),N=k.useRef(!1),q=k.useRef(null),A=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:D,d3ZoomHandler:O,userSelectionActive:w}=ne(Cw,he),T=Gt(v),C=k.useRef(0),z=k.useRef(!1),H=k.useRef();return qw(q),k.useEffect(()=>{if(q.current){const M=q.current.getBoundingClientRect(),B=zv().scaleExtent([_,g]).translateExtent(h),G=xe(q.current).call(B),V=Ge.translate(d.x,d.y).scale(wt(d.zoom,_,g)),U=[[0,0],[M.width,M.height]],R=B.constrain()(V,U,h);B.transform(G,R),B.wheelDelta(Xc),x.setState({d3Zoom:B,d3Selection:G,d3ZoomHandler:G.on("wheel.zoom"),transform:[R.x,R.y,R.k],domNode:q.current.closest(".react-flow")})}},[]),k.useEffect(()=>{D&&I&&(o&&!T&&!w?D.on("wheel.zoom",M=>{if(pt(M,b))return!1;M.preventDefault(),M.stopImmediatePropagation();const B=D.property("__zoom").k||1;if(M.ctrlKey&&a){const j=Ne(M),W=Xc(M),Z=B*Math.pow(2,W);I.scaleTo(D,Z,j,M);return}const G=M.deltaMode===1?20:1;let V=u===nt.Vertical?0:M.deltaX*G,U=u===nt.Horizontal?0:M.deltaY*G;!dr()&&M.shiftKey&&u!==nt.Vertical&&(V=M.deltaY*G,U=0),I.translateBy(D,-(V/B)*s,-(U/B)*s,{internal:!0});const R=nr(D.property("__zoom")),{onViewportChangeStart:P,onViewportChange:F,onViewportChangeEnd:$}=x.getState();clearTimeout(H.current),z.current||(z.current=!0,t?.(M,R),P?.(R)),z.current&&(e?.(M,R),F?.(R),H.current=setTimeout(()=>{r?.(M,R),$?.(R),z.current=!1},150))},{passive:!1}):typeof O<"u"&&D.on("wheel.zoom",function(M,B){if(!p&&M.type==="wheel"&&!M.ctrlKey||pt(M,b))return null;M.preventDefault(),O.call(this,M,B)},{passive:!1}))},[w,o,u,D,I,O,T,a,p,b,t,e,r]),k.useEffect(()=>{I&&I.on("start",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;C.current=M.sourceEvent?.button;const{onViewportChangeStart:B}=x.getState(),G=nr(M.transform);S.current=!0,A.current=G,M.sourceEvent?.type==="mousedown"&&x.setState({paneDragging:!0}),B?.(G),t?.(M.sourceEvent,G)})},[I,t]),k.useEffect(()=>{I&&(w&&!S.current?I.on("zoom",null):w||I.on("zoom",M=>{const{onViewportChange:B}=x.getState();if(x.setState({transform:[M.transform.x,M.transform.y,M.transform.k]}),N.current=!!(n&&Zc(f,C.current??0)),(e||B)&&!M.sourceEvent?.internal){const G=nr(M.transform);B?.(G),e?.(M.sourceEvent,G)}}))},[w,I,e,f,n]),k.useEffect(()=>{I&&I.on("end",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=x.getState();if(S.current=!1,x.setState({paneDragging:!1}),n&&Zc(f,C.current??0)&&!N.current&&n(M.sourceEvent),N.current=!1,(r||B)&&Rw(A.current,M.transform)){const G=nr(M.transform);A.current=G,clearTimeout(E.current),E.current=setTimeout(()=>{B?.(G),r?.(M.sourceEvent,G)},o?150:0)}})},[I,o,f,r,n]),k.useEffect(()=>{I&&I.filter(M=>{const B=T||i,G=a&&M.ctrlKey;if((f===!0||Array.isArray(f)&&f.includes(1))&&M.button===1&&M.type==="mousedown"&&(pt(M,"react-flow__node")||pt(M,"react-flow__edge")))return!0;if(!f&&!B&&!o&&!l&&!a||w||!l&&M.type==="dblclick"||pt(M,b)&&M.type==="wheel"||pt(M,m)&&(M.type!=="wheel"||o&&M.type==="wheel"&&!T)||!a&&M.ctrlKey&&M.type==="wheel"||!B&&!o&&!G&&M.type==="wheel"||!f&&(M.type==="mousedown"||M.type==="touchstart")||Array.isArray(f)&&!f.includes(M.button)&&M.type==="mousedown")return!1;const V=Array.isArray(f)&&f.includes(M.button)||!M.button||M.button<=1;return(!M.ctrlKey||M.type==="wheel")&&V})},[w,I,i,a,o,l,f,c,T]),L.createElement("div",{className:"react-flow__renderer",ref:q,style:ju},y)},Nw=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Iw(){const{userSelectionActive:e,userSelectionRect:t}=ne(Nw,he);return e&&t?L.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Jc(e,t){const r=t.parentNode||t.parentId,n=e.find(i=>i.id===r);if(n){const i=t.position.x+t.width-n.width,a=t.position.y+t.height-n.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,i>0&&(n.style.width+=i),a>0&&(n.style.height+=a),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function gg(e,t){if(e.some(n=>n.type==="reset"))return e.filter(n=>n.type==="reset").map(n=>n.item);const r=e.filter(n=>n.type==="add").map(n=>n.item);return t.reduce((n,i)=>{const a=e.filter(s=>s.id===i.id);if(a.length===0)return n.push(i),n;const o={...i};for(const s of a)if(s)switch(s.type){case"select":{o.selected=s.selected;break}case"position":{typeof s.position<"u"&&(o.position=s.position),typeof s.positionAbsolute<"u"&&(o.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(o.dragging=s.dragging),o.expandParent&&Jc(n,o);break}case"dimensions":{typeof s.dimensions<"u"&&(o.width=s.dimensions.width,o.height=s.dimensions.height),typeof s.updateStyle<"u"&&(o.style={...o.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(o.resizing=s.resizing),o.expandParent&&Jc(n,o);break}case"remove":return n}return n.push(o),n},r)}function yg(e,t){return gg(e,t)}function Tw(e,t){return gg(e,t)}const Ze=(e,t)=>({id:e,type:"select",selected:t});function gt(e,t){return e.reduce((r,n)=>{const i=t.includes(n.id);return!n.selected&&i?(n.selected=!0,r.push(Ze(n.id,!0))):n.selected&&!i&&(n.selected=!1,r.push(Ze(n.id,!1))),r},[])}const cn=(e,t)=>r=>{r.target===t.current&&e?.(r)},Mw=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),mg=k.memo(({isSelecting:e,selectionMode:t=$t.Full,panOnDrag:r,onSelectionStart:n,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:o,onPaneScroll:s,onPaneMouseEnter:u,onPaneMouseMove:l,onPaneMouseLeave:c,children:f})=>{const d=k.useRef(null),h=fe(),_=k.useRef(0),g=k.useRef(0),v=k.useRef(),{userSelectionActive:p,elementsSelectable:y,dragging:b}=ne(Mw,he),m=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},E=O=>{a?.(O),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},x=O=>{if(Array.isArray(r)&&r?.includes(2)){O.preventDefault();return}o?.(O)},S=s?O=>s(O):void 0,N=O=>{const{resetSelectedElements:w,domNode:T}=h.getState();if(v.current=T?.getBoundingClientRect(),!y||!e||O.button!==0||O.target!==d.current||!v.current)return;const{x:C,y:z}=Je(O,v.current);w(),h.setState({userSelectionRect:{width:0,height:0,startX:C,startY:z,x:C,y:z}}),n?.(O)},q=O=>{const{userSelectionRect:w,nodeInternals:T,edges:C,transform:z,onNodesChange:H,onEdgesChange:M,nodeOrigin:B,getNodes:G}=h.getState();if(!e||!v.current||!w)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Je(O,v.current),U=w.startX??0,R=w.startY??0,P={...w,x:V.xZ.id),W=$.map(Z=>Z.id);if(_.current!==W.length){_.current=W.length;const Z=gt(F,W);Z.length&&H?.(Z)}if(g.current!==j.length){g.current=j.length;const Z=gt(C,j);Z.length&&M?.(Z)}h.setState({userSelectionRect:P})},A=O=>{if(O.button!==0)return;const{userSelectionRect:w}=h.getState();!p&&w&&O.target===d.current&&E?.(O),h.setState({nodesSelectionActive:_.current>0}),m(),i?.(O)},I=O=>{p&&(h.setState({nodesSelectionActive:_.current>0}),i?.(O)),m()},D=y&&(e||p);return L.createElement("div",{className:pe(["react-flow__pane",{dragging:b,selection:e}]),onClick:D?void 0:cn(E,d),onContextMenu:cn(x,d),onWheel:cn(S,d),onMouseEnter:D?void 0:u,onMouseDown:D?N:void 0,onMouseMove:D?q:l,onMouseUp:D?A:void 0,onMouseLeave:D?I:c,ref:d,style:ju},f,L.createElement(Iw,null))});mg.displayName="Pane";function _g(e,t){const r=e.parentNode||e.parentId;if(!r)return!1;const n=t.get(r);return n?n.selected?!0:_g(n,t):!1}function Qc(e,t,r){let n=e;do{if(n?.matches(t))return!0;if(n===r.current)return!1;n=n.parentElement}while(n);return!1}function Pw(e,t,r,n){return Array.from(e.values()).filter(i=>(i.selected||i.id===n)&&(!i.parentNode||i.parentId||!_g(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>({id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:r.x-(i.positionAbsolute?.x??0),y:r.y-(i.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}))}function Ow(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function bg(e,t,r,n,i=[0,0],a){const o=Ow(e,e.extent||n);let s=o;const u=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(u&&e.width&&e.height){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=f&&Se(d)&&Se(h)&&Se(f.width)&&Se(f.height)?[[d+e.width*i[0],h+e.height*i[1]],[d+f.width-e.width+e.width*i[0],h+f.height-e.height+e.height*i[1]]]:s}else a?.("005",Ue.error005()),s=o;else if(e.extent&&u&&e.extent!=="parent"){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+h],[e.extent[1][0]+d,e.extent[1][1]+h]]}let l={x:0,y:0};if(u){const f=r.get(u);l=it(f,i).positionAbsolute}const c=s&&s!=="parent"?Fu(t,s):t;return{position:{x:c.x-l.x,y:c.y-l.y},positionAbsolute:c}}function ln({nodeId:e,dragItems:t,nodeInternals:r}){const n=t.map(i=>({...r.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?n.find(i=>i.id===e):n[0],n]}const el=(e,t,r,n)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),o=t.getBoundingClientRect(),s={x:o.width*n[0],y:o.height*n[1]};return a.map(u=>{const l=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),position:u.getAttribute("data-handlepos"),x:(l.left-o.left-s.x)/r,y:(l.top-o.top-s.y)/r,...Lu(u)}})};function Tt(e,t,r){return r===void 0?r:n=>{const i=t().nodeInternals.get(e);i&&r(n,{...i})}}function Nu({id:e,store:t,unselect:r=!1,nodeRef:n}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeInternals:s,onError:u}=t.getState(),l=s.get(e);if(!l){u?.("012",Ue.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(r||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>n?.current?.blur())):i([e])}function kw(){const e=fe();return k.useCallback(({sourceEvent:r})=>{const{transform:n,snapGrid:i,snapToGrid:a}=e.getState(),o=r.touches?r.touches[0].clientX:r.clientX,s=r.touches?r.touches[0].clientY:r.clientY,u={x:(o-n[0])/n[2],y:(s-n[1])/n[2]};return{xSnapped:a?i[0]*Math.round(u.x/i[0]):u.x,ySnapped:a?i[1]*Math.round(u.y/i[1]):u.y,...u}},[])}function fn(e){return(t,r,n)=>e?.(t,n)}function wg({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:n,nodeId:i,isSelectable:a,selectNodesOnDrag:o}){const s=fe(),[u,l]=k.useState(!1),c=k.useRef([]),f=k.useRef({x:null,y:null}),d=k.useRef(0),h=k.useRef(null),_=k.useRef({x:0,y:0}),g=k.useRef(null),v=k.useRef(!1),p=k.useRef(!1),y=k.useRef(!1),b=kw();return k.useEffect(()=>{if(e?.current){const m=xe(e.current),E=({x:N,y:q})=>{const{nodeInternals:A,onNodeDrag:I,onSelectionDrag:D,updateNodePositions:O,nodeExtent:w,snapGrid:T,snapToGrid:C,nodeOrigin:z,onError:H}=s.getState();f.current={x:N,y:q};let M=!1,B={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&w){const V=xr(c.current,z);B=Ht(V)}if(c.current=c.current.map(V=>{const U={x:N-V.distance.x,y:q-V.distance.y};C&&(U.x=T[0]*Math.round(U.x/T[0]),U.y=T[1]*Math.round(U.y/T[1]));const R=[[w[0][0],w[0][1]],[w[1][0],w[1][1]]];c.current.length>1&&w&&!V.extent&&(R[0][0]=V.positionAbsolute.x-B.x+w[0][0],R[1][0]=V.positionAbsolute.x+(V.width??0)-B.x2+w[1][0],R[0][1]=V.positionAbsolute.y-B.y+w[0][1],R[1][1]=V.positionAbsolute.y+(V.height??0)-B.y2+w[1][1]);const P=bg(V,U,A,R,z,H);return M=M||V.position.x!==P.position.x||V.position.y!==P.position.y,V.position=P.position,V.positionAbsolute=P.positionAbsolute,V}),!M)return;O(c.current,!0,!0),l(!0);const G=i?I:fn(D);if(G&&g.current){const[V,U]=ln({nodeId:i,dragItems:c.current,nodeInternals:A});G(g.current,V,U)}},x=()=>{if(!h.current)return;const[N,q]=Hv(_.current,h.current);if(N!==0||q!==0){const{transform:A,panBy:I}=s.getState();f.current.x=(f.current.x??0)-N/A[2],f.current.y=(f.current.y??0)-q/A[2],I({x:N,y:q})&&E(f.current)}d.current=requestAnimationFrame(x)},S=N=>{const{nodeInternals:q,multiSelectionActive:A,nodesDraggable:I,unselectNodesAndEdges:D,onNodeDragStart:O,onSelectionDragStart:w}=s.getState();p.current=!0;const T=i?O:fn(w);(!o||!a)&&!A&&i&&(q.get(i)?.selected||D()),i&&a&&o&&Nu({id:i,store:s,nodeRef:e});const C=b(N);if(f.current=C,c.current=Pw(q,I,C,i),T&&c.current){const[z,H]=ln({nodeId:i,dragItems:c.current,nodeInternals:q});T(N.sourceEvent,z,H)}};if(t)m.on(".drag",null);else{const N=mb().on("start",q=>{const{domNode:A,nodeDragThreshold:I}=s.getState();I===0&&S(q),y.current=!1;const D=b(q);f.current=D,h.current=A?.getBoundingClientRect()||null,_.current=Je(q.sourceEvent,h.current)}).on("drag",q=>{const A=b(q),{autoPanOnNodeDrag:I,nodeDragThreshold:D}=s.getState();if(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!v.current&&p.current&&I&&(v.current=!0,x()),!p.current){const O=A.xSnapped-(f?.current?.x??0),w=A.ySnapped-(f?.current?.y??0);Math.sqrt(O*O+w*w)>D&&S(q)}(f.current.x!==A.xSnapped||f.current.y!==A.ySnapped)&&c.current&&p.current&&(g.current=q.sourceEvent,_.current=Je(q.sourceEvent,h.current),E(A))}}).on("end",q=>{if(!(!p.current||y.current)&&(l(!1),v.current=!1,p.current=!1,cancelAnimationFrame(d.current),c.current)){const{updateNodePositions:A,nodeInternals:I,onNodeDragStop:D,onSelectionDragStop:O}=s.getState(),w=i?D:fn(O);if(A(c.current,!1,!1),w){const[T,C]=ln({nodeId:i,dragItems:c.current,nodeInternals:I});w(q.sourceEvent,T,C)}}}).filter(q=>{const A=q.target;return!q.button&&(!r||!Qc(A,`.${r}`,e))&&(!n||Qc(A,n,e))});return m.call(N),()=>{m.on(".drag",null)}}}},[e,t,r,n,a,s,i,o,b]),u}function Eg(){const e=fe();return k.useCallback(r=>{const{nodeInternals:n,nodeExtent:i,updateNodePositions:a,getNodes:o,snapToGrid:s,snapGrid:u,onError:l,nodesDraggable:c}=e.getState(),f=o().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),d=s?u[0]:5,h=s?u[1]:5,_=r.isShiftPressed?4:1,g=r.x*d*_,v=r.y*h*_,p=f.map(y=>{if(y.positionAbsolute){const b={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+v};s&&(b.x=u[0]*Math.round(b.x/u[0]),b.y=u[1]*Math.round(b.y/u[1]));const{positionAbsolute:m,position:E}=bg(y,b,n,i,void 0,l);y.position=E,y.positionAbsolute=m}return y});a(p,!0,!1)},[])}const mt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Mt=e=>{const t=({id:r,type:n,data:i,xPos:a,yPos:o,xPosOrigin:s,yPosOrigin:u,selected:l,onClick:c,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,onContextMenu:_,onDoubleClick:g,style:v,className:p,isDraggable:y,isSelectable:b,isConnectable:m,isFocusable:E,selectNodesOnDrag:x,sourcePosition:S,targetPosition:N,hidden:q,resizeObserver:A,dragHandle:I,zIndex:D,isParent:O,noDragClassName:w,noPanClassName:T,initialized:C,disableKeyboardA11y:z,ariaLabel:H,rfId:M,hasHandleBounds:B})=>{const G=fe(),V=k.useRef(null),U=k.useRef(null),R=k.useRef(S),P=k.useRef(N),F=k.useRef(n),$=b||y||c||f||d||h,j=Eg(),W=Tt(r,G.getState,f),Z=Tt(r,G.getState,d),te=Tt(r,G.getState,h),ie=Tt(r,G.getState,_),re=Tt(r,G.getState,g),ee=K=>{const{nodeDragThreshold:Y}=G.getState();if(b&&(!x||!y||Y>0)&&Nu({id:r,store:G,nodeRef:V}),c){const oe=G.getState().nodeInternals.get(r);oe&&c(K,{...oe})}},X=K=>{if(!Su(K)&&!z)if(Uv.includes(K.key)&&b){const Y=K.key==="Escape";Nu({id:r,store:G,unselect:Y,nodeRef:V})}else y&&l&&Object.prototype.hasOwnProperty.call(mt,K.key)&&(G.setState({ariaLiveMessage:`Moved selected node ${K.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~o}`}),j({x:mt[K.key].x,y:mt[K.key].y,isShiftPressed:K.shiftKey}))};k.useEffect(()=>()=>{U.current&&(A?.unobserve(U.current),U.current=null)},[]),k.useEffect(()=>{if(V.current&&!q){const K=V.current;(!C||!B||U.current!==K)&&(U.current&&A?.unobserve(U.current),A?.observe(K),U.current=K)}},[q,C,B]),k.useEffect(()=>{const K=F.current!==n,Y=R.current!==S,oe=P.current!==N;V.current&&(K||Y||oe)&&(K&&(F.current=n),Y&&(R.current=S),oe&&(P.current=N),G.getState().updateNodeDimensions([{id:r,nodeElement:V.current,forceUpdate:!0}]))},[r,n,S,N]);const ue=wg({nodeRef:V,disabled:q||!y,noDragClassName:w,handleSelector:I,nodeId:r,isSelectable:b,selectNodesOnDrag:x});return q?null:L.createElement("div",{className:pe(["react-flow__node",`react-flow__node-${n}`,{[T]:y},p,{selected:l,selectable:b,parent:O,dragging:ue}]),ref:V,style:{zIndex:D,transform:`translate(${s}px,${u}px)`,pointerEvents:$?"all":"none",visibility:C?"visible":"hidden",...v},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:W,onMouseMove:Z,onMouseLeave:te,onContextMenu:ie,onClick:ee,onDoubleClick:re,onKeyDown:E?X:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":z?void 0:`${fg}-${M}`,"aria-label":H},L.createElement(W0,{value:r},L.createElement(e,{id:r,data:i,type:n,xPos:a,yPos:o,selected:l,isConnectable:m,sourcePosition:S,targetPosition:N,dragging:ue,dragHandle:I,zIndex:D})))};return t.displayName="NodeWrapper",k.memo(t)};const Dw=e=>{const t=e.getNodes().filter(r=>r.selected);return{...xr(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function Lw({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const n=fe(),{width:i,height:a,x:o,y:s,transformString:u,userSelectionActive:l}=ne(Dw,he),c=Eg(),f=k.useRef(null);if(k.useEffect(()=>{r||f.current?.focus({preventScroll:!0})},[r]),wg({nodeRef:f}),l||!i||!a)return null;const d=e?_=>{const g=n.getState().getNodes().filter(v=>v.selected);e(_,g)}:void 0,h=_=>{Object.prototype.hasOwnProperty.call(mt,_.key)&&c({x:mt[_.key].x,y:mt[_.key].y,isShiftPressed:_.shiftKey})};return L.createElement("div",{className:pe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u}},L.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:r?void 0:-1,onKeyDown:r?void 0:h,style:{width:i,height:a,top:s,left:o}}))}var Fw=k.memo(Lw);const zw=e=>e.nodesSelectionActive,xg=({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,deleteKeyCode:s,onMove:u,onMoveStart:l,onMoveEnd:c,selectionKeyCode:f,selectionOnDrag:d,selectionMode:h,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:v,panActivationKeyCode:p,zoomActivationKeyCode:y,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:x,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:A,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:w,preventScrolling:T,onSelectionContextMenu:C,noWheelClassName:z,noPanClassName:H,disableKeyboardA11y:M})=>{const B=ne(zw),G=Gt(f),V=Gt(p),U=V||A,R=V||x,P=G||d&&U!==!0;return Sw({deleteKeyCode:s,multiSelectionKeyCode:v}),L.createElement(Aw,{onMove:u,onMoveStart:l,onMoveEnd:c,onPaneContextMenu:a,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:R,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:!G&&U,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:w,zoomActivationKeyCode:y,preventScrolling:T,noWheelClassName:z,noPanClassName:H},L.createElement(mg,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:U,isSelecting:!!P,selectionMode:h},e,B&&L.createElement(Fw,{onSelectionContextMenu:C,noPanClassName:H,disableKeyboardA11y:M})))};xg.displayName="FlowRenderer";var Bw=k.memo(xg);function Hw(e){return ne(k.useCallback(r=>e?Jv(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function $w(e){const t={input:Mt(e.input||sg),default:Mt(e.default||Au),output:Mt(e.output||cg),group:Mt(e.group||Vu)},r={},n=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Mt(e[a]||Au),i),r);return{...t,...n}}const Gw=({x:e,y:t,width:r,height:n,origin:i})=>!r||!n?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-r*i[0],y:t-n*i[1]},Vw=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Sg=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:n,elementsSelectable:i,updateNodeDimensions:a,onError:o}=ne(Vw,he),s=Hw(e.onlyRenderVisibleElements),u=k.useRef(),l=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(f=>{const d=f.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));a(d)});return u.current=c,c},[]);return k.useEffect(()=>()=>{u?.current?.disconnect()},[]),L.createElement("div",{className:"react-flow__nodes",style:ju},s.map(c=>{let f=c.type||"default";e.nodeTypes[f]||(o?.("003",Ue.error003(f)),f="default");const d=e.nodeTypes[f]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),_=!!(c.selectable||i&&typeof c.selectable>"u"),g=!!(c.connectable||r&&typeof c.connectable>"u"),v=!!(c.focusable||n&&typeof c.focusable>"u"),p=e.nodeExtent?Fu(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=p?.x??0,b=p?.y??0,m=Gw({x:y,y:b,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return L.createElement(d,{key:c.id,id:c.id,className:c.className,style:c.style,type:f,data:c.data,sourcePosition:c.sourcePosition||J.Bottom,targetPosition:c.targetPosition||J.Top,hidden:c.hidden,xPos:y,yPos:b,xPosOrigin:m.x,yPosOrigin:m.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:_,isConnectable:g,isFocusable:v,resizeObserver:l,dragHandle:c.dragHandle,zIndex:c[se]?.z??0,isParent:!!c[se]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel,hasHandleBounds:!!c[se]?.handleBounds})}))};Sg.displayName="NodeRenderer";var Uw=k.memo(Sg);const jw=(e,t,r)=>r===J.Left?e-t:r===J.Right?e+t:e,Kw=(e,t,r)=>r===J.Top?e-t:r===J.Bottom?e+t:e,tl="react-flow__edgeupdater",rl=({position:e,centerX:t,centerY:r,radius:n=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s})=>L.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:pe([tl,`${tl}-${s}`]),cx:jw(t,n,e),cy:Kw(r,n,e),r:n,stroke:"transparent",fill:"transparent"}),Yw=()=>!0;var vt=e=>{const t=({id:r,className:n,type:i,data:a,onClick:o,onEdgeDoubleClick:s,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,style:v,source:p,target:y,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,elementsSelectable:q,hidden:A,sourceHandleId:I,targetHandleId:D,onContextMenu:O,onMouseEnter:w,onMouseMove:T,onMouseLeave:C,reconnectRadius:z,onReconnect:H,onReconnectStart:M,onReconnectEnd:B,markerEnd:G,markerStart:V,rfId:U,ariaLabel:R,isFocusable:P,isReconnectable:F,pathOptions:$,interactionWidth:j,disableKeyboardA11y:W})=>{const Z=k.useRef(null),[te,ie]=k.useState(!1),[re,ee]=k.useState(!1),X=fe(),ue=k.useMemo(()=>`url('#${Ru(V,U)}')`,[V,U]),K=k.useMemo(()=>`url('#${Ru(G,U)}')`,[G,U]);if(A)return null;const Y=de=>{const{edges:we,addSelectedEdges:ve,unselectNodesAndEdges:ye,multiSelectionActive:ft}=X.getState(),De=we.find(et=>et.id===r);De&&(q&&(X.setState({nodesSelectionActive:!1}),De.selected&&ft?(ye({nodes:[],edges:[De]}),Z.current?.blur()):ve([r])),o&&o(de,De))},oe=It(r,X.getState,s),Ce=It(r,X.getState,O),Oe=It(r,X.getState,w),ge=It(r,X.getState,T),ce=It(r,X.getState,C),me=(de,we)=>{if(de.button!==0)return;const{edges:ve,isValidConnection:ye}=X.getState(),ft=we?y:p,De=(we?D:I)||null,et=we?"target":"source",Hr=ye||Yw,$r=we,Ct=ve.find(tt=>tt.id===r);ee(!0),M?.(de,Ct,et);const Gr=tt=>{ee(!1),B?.(tt,Ct,et)};ng({event:de,handleId:De,nodeId:ft,onConnect:tt=>H?.(Ct,tt),isTarget:$r,getState:X.getState,setState:X.setState,isValidConnection:Hr,edgeUpdaterType:et,onReconnectEnd:Gr})},Ae=de=>me(de,!0),ze=de=>me(de,!1),ke=()=>ie(!0),be=()=>ie(!1),Be=!q&&!o,Ye=de=>{if(!W&&Uv.includes(de.key)&&q){const{unselectNodesAndEdges:we,addSelectedEdges:ve,edges:ye}=X.getState();de.key==="Escape"?(Z.current?.blur(),we({edges:[ye.find(De=>De.id===r)]})):ve([r])}};return L.createElement("g",{className:pe(["react-flow__edge",`react-flow__edge-${i}`,n,{selected:u,animated:l,inactive:Be,updating:te}]),onClick:Y,onDoubleClick:oe,onContextMenu:Ce,onMouseEnter:Oe,onMouseMove:ge,onMouseLeave:ce,onKeyDown:P?Ye:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":R===null?void 0:R||`Edge from ${p} to ${y}`,"aria-describedby":P?`${dg}-${U}`:void 0,ref:Z},!re&&L.createElement(e,{id:r,source:p,target:y,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,data:a,style:v,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,sourceHandleId:I,targetHandleId:D,markerStart:ue,markerEnd:K,pathOptions:$,interactionWidth:j}),F&&L.createElement(L.Fragment,null,(F==="source"||F===!0)&&L.createElement(rl,{position:S,centerX:b,centerY:m,radius:z,onMouseDown:Ae,onMouseEnter:ke,onMouseOut:be,type:"source"}),(F==="target"||F===!0)&&L.createElement(rl,{position:N,centerX:E,centerY:x,radius:z,onMouseDown:ze,onMouseEnter:ke,onMouseOut:be,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function Ww(e){const t={default:vt(e.default||pr),straight:vt(e.bezier||Hu),step:vt(e.step||Bu),smoothstep:vt(e.step||Er),simplebezier:vt(e.simplebezier||zu)},r={},n=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=vt(e[a]||pr),i),r);return{...t,...n}}function nl(e,t,r=null){const n=(r?.x||0)+t.x,i=(r?.y||0)+t.y,a=r?.width||t.width,o=r?.height||t.height;switch(e){case J.Top:return{x:n+a/2,y:i};case J.Right:return{x:n+a,y:i+o/2};case J.Bottom:return{x:n+a/2,y:i+o};case J.Left:return{x:n,y:i+o/2}}}function il(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const Zw=(e,t,r,n,i,a)=>{const o=nl(r,e,t),s=nl(a,n,i);return{sourceX:o.x,sourceY:o.y,targetX:s.x,targetY:s.y}};function Xw({sourcePos:e,targetPos:t,sourceWidth:r,sourceHeight:n,targetWidth:i,targetHeight:a,width:o,height:s,transform:u}){const l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+r,t.x+i),y2:Math.max(e.y+n,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const c=Ht({x:(0-u[0])/u[2],y:(0-u[1])/u[2],width:o/u[2],height:s/u[2]}),f=Math.max(0,Math.min(c.x2,l.x2)-Math.max(c.x,l.x)),d=Math.max(0,Math.min(c.y2,l.y2)-Math.max(c.y,l.y));return Math.ceil(f*d)>0}function al(e){const t=e?.[se]?.handleBounds||null,r=t&&e?.width&&e?.height&&typeof e?.positionAbsolute?.x<"u"&&typeof e?.positionAbsolute?.y<"u";return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!r]}const Jw=[{level:0,isMaxLevel:!0,edges:[]}];function Qw(e,t,r=!1){let n=-1;const i=e.reduce((o,s)=>{const u=Se(s.zIndex);let l=u?s.zIndex:0;if(r){const c=t.get(s.target),f=t.get(s.source),d=s.selected||c?.selected||f?.selected,h=Math.max(f?.[se]?.z||0,c?.[se]?.z||0,1e3);l=(u?s.zIndex:0)+(d?h:0)}return o[l]?o[l].push(s):o[l]=[s],n=l>n?l:n,o},{}),a=Object.entries(i).map(([o,s])=>{const u=+o;return{edges:s,level:u,isMaxLevel:u===n}});return a.length===0?Jw:a}function e1(e,t,r){const n=ne(k.useCallback(i=>e?i.edges.filter(a=>{const o=t.get(a.source),s=t.get(a.target);return o?.width&&o?.height&&s?.width&&s?.height&&Xw({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return Qw(n,t,r)}const t1=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),r1=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ol={[hr.Arrow]:t1,[hr.ArrowClosed]:r1};function n1(e){const t=fe();return k.useMemo(()=>Object.prototype.hasOwnProperty.call(ol,e)?ol[e]:(t.getState().onError?.("009",Ue.error009(e)),null),[e])}const i1=({id:e,type:t,color:r,width:n=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:s="auto-start-reverse"})=>{const u=n1(t);return u?L.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${n}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:s,refX:"0",refY:"0"},L.createElement(u,{color:r,strokeWidth:o})):null},a1=({defaultColor:e,rfId:t})=>r=>{const n=[];return r.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(o=>{if(o&&typeof o=="object"){const s=Ru(o,t);n.includes(s)||(i.push({id:s,color:o.color||e,...o}),n.push(s))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},qg=({defaultColor:e,rfId:t})=>{const r=ne(k.useCallback(a1({defaultColor:e,rfId:t}),[e,t]),(n,i)=>!(n.length!==i.length||n.some((a,o)=>a.id!==i[o].id)));return L.createElement("defs",null,r.map(n=>L.createElement(i1,{id:n.id,key:n.id,type:n.type,color:n.color,width:n.width,height:n.height,markerUnits:n.markerUnits,strokeWidth:n.strokeWidth,orient:n.orient})))};qg.displayName="MarkerDefinitions";var o1=k.memo(qg);const s1=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Rg=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:n,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:u,onEdgeMouseLeave:l,onEdgeClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,children:v,disableKeyboardA11y:p})=>{const{edgesFocusable:y,edgesUpdatable:b,elementsSelectable:m,width:E,height:x,connectionMode:S,nodeInternals:N,onError:q}=ne(s1,he),A=e1(t,N,r);return E?L.createElement(L.Fragment,null,A.map(({level:I,edges:D,isMaxLevel:O})=>L.createElement("svg",{key:I,style:{zIndex:I},width:E,height:x,className:"react-flow__edges react-flow__container"},O&&L.createElement(o1,{defaultColor:e,rfId:n}),L.createElement("g",null,D.map(w=>{const[T,C,z]=al(N.get(w.source)),[H,M,B]=al(N.get(w.target));if(!z||!B)return null;let G=w.type||"default";i[G]||(q?.("011",Ue.error011(G)),G="default");const V=i[G]||i.default,U=S===ot.Strict?M.target:(M.target??[]).concat(M.source??[]),R=il(C.source,w.sourceHandle),P=il(U,w.targetHandle),F=R?.position||J.Bottom,$=P?.position||J.Top,j=!!(w.focusable||y&&typeof w.focusable>"u"),W=w.reconnectable||w.updatable,Z=typeof d<"u"&&(W||b&&typeof W>"u");if(!R||!P)return q?.("008",Ue.error008(R,w)),null;const{sourceX:te,sourceY:ie,targetX:re,targetY:ee}=Zw(T,R,F,H,P,$);return L.createElement(V,{key:w.id,id:w.id,className:pe([w.className,a]),type:G,data:w.data,selected:!!w.selected,animated:!!w.animated,hidden:!!w.hidden,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,style:w.style,source:w.source,target:w.target,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerEnd:w.markerEnd,markerStart:w.markerStart,sourceX:te,sourceY:ie,targetX:re,targetY:ee,sourcePosition:F,targetPosition:$,elementsSelectable:m,onContextMenu:o,onMouseEnter:s,onMouseMove:u,onMouseLeave:l,onClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,rfId:n,ariaLabel:w.ariaLabel,isFocusable:j,isReconnectable:Z,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth,disableKeyboardA11y:p})})))),v):null};Rg.displayName="EdgeRenderer";var u1=k.memo(Rg);const c1=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function l1({children:e}){const t=ne(c1);return L.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function f1(e){const t=Uu(),r=k.useRef(!1);k.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const d1={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top},Cg=({nodeId:e,handleType:t,style:r,type:n=Xe.Bezier,CustomComponent:i,connectionStatus:a})=>{const{fromNode:o,handleId:s,toX:u,toY:l,connectionMode:c}=ne(k.useCallback(x=>({fromNode:x.nodeInternals.get(e),handleId:x.connectionHandleId,toX:(x.connectionPosition.x-x.transform[0])/x.transform[2],toY:(x.connectionPosition.y-x.transform[1])/x.transform[2],connectionMode:x.connectionMode}),[e]),he),f=o?.[se]?.handleBounds;let d=f?.[t];if(c===ot.Loose&&(d=d||f?.[t==="source"?"target":"source"]),!o||!d)return null;const h=s?d.find(x=>x.id===s):d[0],_=h?h.x+h.width/2:(o.width??0)/2,g=h?h.y+h.height/2:o.height??0,v=(o.positionAbsolute?.x??0)+_,p=(o.positionAbsolute?.y??0)+g,y=h?.position,b=y?d1[y]:null;if(!y||!b)return null;if(i)return L.createElement(i,{connectionLineType:n,connectionLineStyle:r,fromNode:o,fromHandle:h,fromX:v,fromY:p,toX:u,toY:l,fromPosition:y,toPosition:b,connectionStatus:a});let m="";const E={sourceX:v,sourceY:p,sourcePosition:y,targetX:u,targetY:l,targetPosition:b};return n===Xe.Bezier?[m]=Zv(E):n===Xe.Step?[m]=qu({...E,borderRadius:0}):n===Xe.SmoothStep?[m]=qu(E):n===Xe.SimpleBezier?[m]=Wv(E):m=`M${v},${p} ${u},${l}`,L.createElement("path",{d:m,fill:"none",className:"react-flow__connection-path",style:r})};Cg.displayName="ConnectionLine";const h1=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function p1({containerStyle:e,style:t,type:r,component:n}){const{nodeId:i,handleType:a,nodesConnectable:o,width:s,height:u,connectionStatus:l}=ne(h1,he);return!(i&&a&&s&&o)?null:L.createElement("svg",{style:e,width:s,height:u,className:"react-flow__edges react-flow__connectionline react-flow__container"},L.createElement("g",{className:pe(["react-flow__connection",l])},L.createElement(Cg,{nodeId:i,handleType:a,style:t,type:r,CustomComponent:n,connectionStatus:l})))}function sl(e,t){return k.useRef(null),fe(),k.useMemo(()=>t(e),[e])}const Ag=({nodeTypes:e,edgeTypes:t,onMove:r,onMoveStart:n,onMoveEnd:i,onInit:a,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:u,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:v,connectionLineType:p,connectionLineStyle:y,connectionLineComponent:b,connectionLineContainerStyle:m,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:O,selectNodesOnDrag:w,defaultViewport:T,translateExtent:C,minZoom:z,maxZoom:H,preventScrolling:M,defaultMarkerColor:B,zoomOnScroll:G,zoomOnPinch:V,panOnScroll:U,panOnScrollSpeed:R,panOnScrollMode:P,zoomOnDoubleClick:F,panOnDrag:$,onPaneClick:j,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneScroll:ie,onPaneContextMenu:re,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:K,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Oe,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,elevateEdgesOnSelect:Ae,disableKeyboardA11y:ze,nodeOrigin:ke,nodeExtent:be,rfId:Be})=>{const Ye=sl(e,$w),de=sl(t,Ww);return f1(a),L.createElement(Bw,{onPaneClick:j,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneContextMenu:re,onPaneScroll:ie,deleteKeyCode:I,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,elementsSelectable:O,onMove:r,onMoveStart:n,onMoveEnd:i,zoomOnScroll:G,zoomOnPinch:V,zoomOnDoubleClick:F,panOnScroll:U,panOnScrollSpeed:R,panOnScrollMode:P,panOnDrag:$,defaultViewport:T,translateExtent:C,minZoom:z,maxZoom:H,onSelectionContextMenu:_,preventScrolling:M,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,disableKeyboardA11y:ze},L.createElement(l1,null,L.createElement(u1,{edgeTypes:de,onEdgeClick:s,onEdgeDoubleClick:l,onlyRenderVisibleElements:D,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:K,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Oe,defaultMarkerColor:B,noPanClassName:me,elevateEdgesOnSelect:!!Ae,disableKeyboardA11y:ze,rfId:Be},L.createElement(p1,{style:y,type:p,component:b,containerStyle:m})),L.createElement("div",{className:"react-flow__edgelabel-renderer"}),L.createElement(Uw,{nodeTypes:Ye,onNodeClick:o,onNodeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,selectNodesOnDrag:w,onlyRenderVisibleElements:D,noPanClassName:me,noDragClassName:ge,disableKeyboardA11y:ze,nodeOrigin:ke,nodeExtent:be,rfId:Be})))};Ag.displayName="GraphView";var v1=k.memo(Ag);const Iu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],We={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Iu,nodeExtent:Iu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ot.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:G0,isValidConnection:void 0},g1=()=>Im((e,t)=>({...We,setNodes:r=>{const{nodeInternals:n,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:un(r,n,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:n={}}=t();e({edges:r.map(i=>({...n,...i}))})},setDefaultNodesAndEdges:(r,n)=>{const i=typeof r<"u",a=typeof n<"u",o=i?un(r,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:o,edges:a?n:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:r=>{const{onNodesChange:n,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:o,fitViewOnInitOptions:s,domNode:u,nodeOrigin:l}=t(),c=u?.querySelector(".react-flow__viewport");if(!c)return;const f=window.getComputedStyle(c),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=r.reduce((g,v)=>{const p=i.get(v.id);if(p?.hidden)i.set(p.id,{...p,[se]:{...p[se],handleBounds:void 0}});else if(p){const y=Lu(v.nodeElement);!!(y.width&&y.height&&(p.width!==y.width||p.height!==y.height||v.forceUpdate))&&(i.set(p.id,{...p,[se]:{...p[se],handleBounds:{source:el(".source",v.nodeElement,d,l),target:el(".target",v.nodeElement,d,l)}},...y}),g.push({id:p.id,type:"dimensions",dimensions:y}))}return g},[]);pg(i,l);const _=o||a&&!o&&vg(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:_}),h?.length>0&&n?.(h)},updateNodePositions:(r,n=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),o=r.map(s=>{const u={id:s.id,type:"position",dragging:i};return n&&(u.positionAbsolute=s.positionAbsolute,u.position=s.position),u});a(o)},triggerNodeChanges:r=>{const{onNodesChange:n,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:o,getNodes:s,elevateNodesOnSelect:u}=t();if(r?.length){if(a){const l=yg(r,s()),c=un(l,i,o,u);e({nodeInternals:c})}n?.(r)}},addSelectedNodes:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=gt(a(),r),s=gt(i,[])),rr({changedNodes:o,changedEdges:s,get:t,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=gt(i,r),s=gt(a(),[])),rr({changedNodes:s,changedEdges:o,get:t,set:e})},unselectNodesAndEdges:({nodes:r,edges:n}={})=>{const{edges:i,getNodes:a}=t(),o=r||a(),s=n||i,u=o.map(c=>(c.selected=!1,Ze(c.id,!1))),l=s.map(c=>Ze(c.id,!1));rr({changedNodes:u,changedEdges:l,get:t,set:e})},setMinZoom:r=>{const{d3Zoom:n,maxZoom:i}=t();n?.scaleExtent([r,i]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:n,minZoom:i}=t();n?.scaleExtent([i,r]),e({maxZoom:r})},setTranslateExtent:r=>{t().d3Zoom?.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:n}=t(),a=n().filter(s=>s.selected).map(s=>Ze(s.id,!1)),o=r.filter(s=>s.selected).map(s=>Ze(s.id,!1));rr({changedNodes:a,changedEdges:o,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:n}=t();n.forEach(i=>{i.positionAbsolute=Fu(i.position,r)}),e({nodeExtent:r,nodeInternals:new Map(n)})},panBy:r=>{const{transform:n,width:i,height:a,d3Zoom:o,d3Selection:s,translateExtent:u}=t();if(!o||!s||!r.x&&!r.y)return!1;const l=Ge.translate(n[0]+r.x,n[1]+r.y).scale(n[2]),c=[[0,0],[i,a]],f=o?.constrain()(l,c,u);return o.transform(s,f),n[0]!==f.x||n[1]!==f.y||n[2]!==f.k},cancelConnection:()=>e({connectionNodeId:We.connectionNodeId,connectionHandleId:We.connectionHandleId,connectionHandleType:We.connectionHandleType,connectionStatus:We.connectionStatus,connectionStartHandle:We.connectionStartHandle,connectionEndHandle:We.connectionEndHandle}),reset:()=>e({...We})}),Object.is),Ng=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=g1()),L.createElement(D0,{value:t.current},e)};Ng.displayName="ReactFlowProvider";const Ig=({children:e})=>k.useContext(wr)?L.createElement(L.Fragment,null,e):L.createElement(Ng,null,e);Ig.displayName="ReactFlowWrapper";const y1={input:sg,default:Au,output:cg,group:Vu},m1={default:pr,straight:Hu,step:Bu,smoothstep:Er,simplebezier:zu},_1=[0,0],b1=[15,15],w1={x:0,y:0,zoom:1},E1={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},x1=k.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,className:i,nodeTypes:a=y1,edgeTypes:o=m1,onNodeClick:s,onEdgeClick:u,onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onNodesDelete:A,onEdgesDelete:I,onSelectionChange:D,onSelectionDragStart:O,onSelectionDrag:w,onSelectionDragStop:T,onSelectionContextMenu:C,onSelectionStart:z,onSelectionEnd:H,connectionMode:M=ot.Strict,connectionLineType:B=Xe.Bezier,connectionLineStyle:G,connectionLineComponent:V,connectionLineContainerStyle:U,deleteKeyCode:R="Backspace",selectionKeyCode:P="Shift",selectionOnDrag:F=!1,selectionMode:$=$t.Full,panActivationKeyCode:j="Space",multiSelectionKeyCode:W=dr()?"Meta":"Control",zoomActivationKeyCode:Z=dr()?"Meta":"Control",snapToGrid:te=!1,snapGrid:ie=b1,onlyRenderVisibleElements:re=!1,selectNodesOnDrag:ee=!0,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:K,nodeOrigin:Y=_1,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Oe,defaultViewport:ge=w1,minZoom:ce=.5,maxZoom:me=2,translateExtent:Ae=Iu,preventScrolling:ze=!0,nodeExtent:ke,defaultMarkerColor:be="#b1b1b7",zoomOnScroll:Be=!0,zoomOnPinch:Ye=!0,panOnScroll:de=!1,panOnScrollSpeed:we=.5,panOnScrollMode:ve=nt.Free,zoomOnDoubleClick:ye=!0,panOnDrag:ft=!0,onPaneClick:De,onPaneMouseEnter:et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Ct,onPaneContextMenu:Gr,children:fc,onEdgeContextMenu:tt,onEdgeDoubleClick:Oy,onEdgeMouseEnter:ky,onEdgeMouseMove:Dy,onEdgeMouseLeave:Ly,onEdgeUpdate:Fy,onEdgeUpdateStart:zy,onEdgeUpdateEnd:By,onReconnect:Hy,onReconnectStart:$y,onReconnectEnd:Gy,reconnectRadius:Vy=10,edgeUpdaterRadius:Uy=10,onNodesChange:jy,onEdgesChange:Ky,noDragClassName:Yy="nodrag",noWheelClassName:Wy="nowheel",noPanClassName:dc="nopan",fitView:Zy=!1,fitViewOptions:Xy,connectOnClick:Jy=!0,attributionPosition:Qy,proOptions:em,defaultEdgeOptions:tm,elevateNodesOnSelect:rm=!0,elevateEdgesOnSelect:nm=!1,disableKeyboardA11y:hc=!1,autoPanOnConnect:im=!0,autoPanOnNodeDrag:am=!0,connectionRadius:om=20,isValidConnection:sm,onError:um,style:cm,id:pc,nodeDragThreshold:lm,...fm},dm)=>{const Vr=pc||"1";return L.createElement("div",{...fm,style:{...cm,...E1},ref:dm,className:pe(["react-flow",i]),"data-testid":"rf__wrapper",id:pc},L.createElement(Ig,null,L.createElement(v1,{onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onNodeClick:s,onEdgeClick:u,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,nodeTypes:a,edgeTypes:o,connectionLineType:B,connectionLineStyle:G,connectionLineComponent:V,connectionLineContainerStyle:U,selectionKeyCode:P,selectionOnDrag:F,selectionMode:$,deleteKeyCode:R,multiSelectionKeyCode:W,panActivationKeyCode:j,zoomActivationKeyCode:Z,onlyRenderVisibleElements:re,selectNodesOnDrag:ee,defaultViewport:ge,translateExtent:Ae,minZoom:ce,maxZoom:me,preventScrolling:ze,zoomOnScroll:Be,zoomOnPinch:Ye,zoomOnDoubleClick:ye,panOnScroll:de,panOnScrollSpeed:we,panOnScrollMode:ve,panOnDrag:ft,onPaneClick:De,onPaneMouseEnter:et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Ct,onPaneContextMenu:Gr,onSelectionContextMenu:C,onSelectionStart:z,onSelectionEnd:H,onEdgeContextMenu:tt,onEdgeDoubleClick:Oy,onEdgeMouseEnter:ky,onEdgeMouseMove:Dy,onEdgeMouseLeave:Ly,onReconnect:Hy??Fy,onReconnectStart:$y??zy,onReconnectEnd:Gy??By,reconnectRadius:Vy??Uy,defaultMarkerColor:be,noDragClassName:Yy,noWheelClassName:Wy,noPanClassName:dc,elevateEdgesOnSelect:nm,rfId:Vr,disableKeyboardA11y:hc,nodeOrigin:Y,nodeExtent:ke}),L.createElement(dw,{nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:K,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Oe,elevateNodesOnSelect:rm,minZoom:ce,maxZoom:me,nodeExtent:ke,onNodesChange:jy,onEdgesChange:Ky,snapToGrid:te,snapGrid:ie,connectionMode:M,translateExtent:Ae,connectOnClick:Jy,defaultEdgeOptions:tm,fitView:Zy,fitViewOptions:Xy,onNodesDelete:A,onEdgesDelete:I,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onSelectionDrag:w,onSelectionDragStart:O,onSelectionDragStop:T,noPanClassName:dc,nodeOrigin:Y,rfId:Vr,autoPanOnConnect:im,autoPanOnNodeDrag:am,onError:um,connectionRadius:om,isValidConnection:sm,nodeDragThreshold:lm}),L.createElement(lw,{onSelectionChange:D}),fc,L.createElement(F0,{proOptions:em,position:Qy}),L.createElement(yw,{rfId:Vr,disableKeyboardA11y:hc})))});x1.displayName="ReactFlow";function Tg(e){return t=>{const[r,n]=k.useState(t),i=k.useCallback(a=>n(o=>e(a,o)),[]);return[r,n,i]}}const tq=Tg(yg),rq=Tg(Tw),Mg=({id:e,x:t,y:r,width:n,height:i,style:a,color:o,strokeColor:s,strokeWidth:u,className:l,borderRadius:c,shapeRendering:f,onClick:d,selected:h})=>{const{background:_,backgroundColor:g}=a||{},v=o||_||g;return L.createElement("rect",{className:pe(["react-flow__minimap-node",{selected:h},l]),x:t,y:r,rx:c,ry:c,width:n,height:i,fill:v,stroke:s,strokeWidth:u,shapeRendering:f,onClick:d?p=>d(p,e):void 0})};Mg.displayName="MiniMapNode";var S1=k.memo(Mg);const q1=e=>e.nodeOrigin,R1=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),dn=e=>e instanceof Function?e:()=>e;function C1({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:r="",nodeBorderRadius:n=5,nodeStrokeWidth:i=2,nodeComponent:a=S1,onClick:o}){const s=ne(R1,he),u=ne(q1),l=dn(t),c=dn(e),f=dn(r),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return L.createElement(L.Fragment,null,s.map(h=>{const{x:_,y:g}=it(h,u).positionAbsolute;return L.createElement(a,{key:h.id,x:_,y:g,width:h.width,height:h.height,style:h.style,selected:h.selected,className:f(h),color:l(h),borderRadius:n,strokeColor:c(h),strokeWidth:i,shapeRendering:d,onClick:o,id:h.id})}))}var A1=k.memo(C1);const N1=200,I1=150,T1=e=>{const t=e.getNodes(),r={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:r,boundingRect:t.length>0?H0(xr(t,e.nodeOrigin),r):r,rfId:e.rfId}},M1="react-flow__minimap-desc";function Pg({style:e,className:t,nodeStrokeColor:r="transparent",nodeColor:n="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:o=2,nodeComponent:s,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:l="none",maskStrokeWidth:c=1,position:f="bottom-right",onClick:d,onNodeClick:h,pannable:_=!1,zoomable:g=!1,ariaLabel:v="React Flow mini map",inversePan:p=!1,zoomStep:y=10,offsetScale:b=5}){const m=fe(),E=k.useRef(null),{boundingRect:x,viewBB:S,rfId:N}=ne(T1,he),q=e?.width??N1,A=e?.height??I1,I=x.width/q,D=x.height/A,O=Math.max(I,D),w=O*q,T=O*A,C=b*O,z=x.x-(w-x.width)/2-C,H=x.y-(T-x.height)/2-C,M=w+C*2,B=T+C*2,G=`${M1}-${N}`,V=k.useRef(0);V.current=O,k.useEffect(()=>{if(E.current){const P=xe(E.current),F=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie}=m.getState();if(W.sourceEvent.type!=="wheel"||!te||!ie)return;const re=-W.sourceEvent.deltaY*(W.sourceEvent.deltaMode===1?.05:W.sourceEvent.deltaMode?1:.002)*y,ee=Z[2]*Math.pow(2,re);ie.scaleTo(te,ee)},$=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie,translateExtent:re,width:ee,height:X}=m.getState();if(W.sourceEvent.type!=="mousemove"||!te||!ie)return;const ue=V.current*Math.max(1,Z[2])*(p?-1:1),K={x:Z[0]-W.sourceEvent.movementX*ue,y:Z[1]-W.sourceEvent.movementY*ue},Y=[[0,0],[ee,X]],oe=Ge.translate(K.x,K.y).scale(Z[2]),Ce=ie.constrain()(oe,Y,re);ie.transform(te,Ce)},j=zv().on("zoom",_?$:null).on("zoom.wheel",g?F:null);return P.call(j),()=>{P.on("zoom",null)}}},[_,g,p,y]);const U=d?P=>{const F=Ne(P);d(P,{x:F[0],y:F[1]})}:void 0,R=h?(P,F)=>{const $=m.getState().nodeInternals.get(F);h(P,$)}:void 0;return L.createElement(Du,{position:f,style:e,className:pe(["react-flow__minimap",t]),"data-testid":"rf__minimap"},L.createElement("svg",{width:q,height:A,viewBox:`${z} ${H} ${M} ${B}`,role:"img","aria-labelledby":G,ref:E,onClick:U},v&&L.createElement("title",{id:G},v),L.createElement(A1,{onClick:R,nodeColor:n,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),L.createElement("path",{className:"react-flow__minimap-mask",d:`M${z-C},${H-C}h${M+C*2}v${B+C*2}h${-M-C*2}z M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fill:u,fillRule:"evenodd",stroke:l,strokeWidth:c,pointerEvents:"none"})))}Pg.displayName="MiniMap";var nq=k.memo(Pg);function P1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},L.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function O1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},L.createElement("path",{d:"M0 0h32v4.2H0z"}))}function k1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},L.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function D1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},L.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function L1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},L.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const kt=({children:e,className:t,...r})=>L.createElement("button",{type:"button",className:pe(["react-flow__controls-button",t]),...r},e);kt.displayName="ControlButton";const F1=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Og=({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:n=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:u,className:l,children:c,position:f="bottom-left"})=>{const d=fe(),[h,_]=k.useState(!1),{isInteractive:g,minZoomReached:v,maxZoomReached:p}=ne(F1,he),{zoomIn:y,zoomOut:b,fitView:m}=Uu();if(k.useEffect(()=>{_(!0)},[]),!h)return null;const E=()=>{y(),a?.()},x=()=>{b(),o?.()},S=()=>{m(i),s?.()},N=()=>{d.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),u?.(!g)};return L.createElement(Du,{className:pe(["react-flow__controls",l]),position:f,style:e,"data-testid":"rf__controls"},t&&L.createElement(L.Fragment,null,L.createElement(kt,{onClick:E,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:p},L.createElement(P1,null)),L.createElement(kt,{onClick:x,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:v},L.createElement(O1,null))),r&&L.createElement(kt,{className:"react-flow__controls-fitview",onClick:S,title:"fit view","aria-label":"fit view"},L.createElement(k1,null)),n&&L.createElement(kt,{className:"react-flow__controls-interactive",onClick:N,title:"toggle interactivity","aria-label":"toggle interactivity"},g?L.createElement(L1,null):L.createElement(D1,null)),c)};Og.displayName="Controls";var iq=k.memo(Og),Ie;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ie||(Ie={}));function z1({color:e,dimensions:t,lineWidth:r}){return L.createElement("path",{stroke:e,strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function B1({color:e,radius:t}){return L.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const H1={[Ie.Dots]:"#91919a",[Ie.Lines]:"#eee",[Ie.Cross]:"#e2e2e2"},$1={[Ie.Dots]:1,[Ie.Lines]:1,[Ie.Cross]:6},G1=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function kg({id:e,variant:t=Ie.Dots,gap:r=20,size:n,lineWidth:i=1,offset:a=2,color:o,style:s,className:u}){const l=k.useRef(null),{transform:c,patternId:f}=ne(G1,he),d=o||H1[t],h=n||$1[t],_=t===Ie.Dots,g=t===Ie.Cross,v=Array.isArray(r)?r:[r,r],p=[v[0]*c[2]||1,v[1]*c[2]||1],y=h*c[2],b=g?[y,y]:p,m=_?[y/a,y/a]:[b[0]/a,b[1]/a];return L.createElement("svg",{className:pe(["react-flow__background",u]),style:{...s,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:l,"data-testid":"rf__background"},L.createElement("pattern",{id:f+e,x:c[0]%p[0],y:c[1]%p[1],width:p[0],height:p[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${m[0]},-${m[1]})`},_?L.createElement(B1,{color:d,radius:y/a}):L.createElement(z1,{dimensions:b,color:d,lineWidth:i})),L.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f+e})`}))}kg.displayName="Background";var aq=k.memo(kg);function Ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var hn,ul;function V1(){if(ul)return hn;ul=1;function e(){this.__data__=[],this.size=0}return hn=e,hn}var pn,cl;function St(){if(cl)return pn;cl=1;function e(t,r){return t===r||t!==t&&r!==r}return pn=e,pn}var vn,ll;function Sr(){if(ll)return vn;ll=1;var e=St();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return vn=t,vn}var gn,fl;function U1(){if(fl)return gn;fl=1;var e=Sr(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return gn=n,gn}var yn,dl;function j1(){if(dl)return yn;dl=1;var e=Sr();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return yn=t,yn}var mn,hl;function K1(){if(hl)return mn;hl=1;var e=Sr();function t(r){return e(this.__data__,r)>-1}return mn=t,mn}var _n,pl;function Y1(){if(pl)return _n;pl=1;var e=Sr();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return _n=t,_n}var bn,vl;function qr(){if(vl)return bn;vl=1;var e=V1(),t=U1(),r=j1(),n=K1(),i=Y1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s-1&&n%1==0&&n-1&&r%1==0&&r<=e}return si=t,si}var ui,af;function _E(){if(af)return ui;af=1;var e=st(),t=Xu(),r=Le(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",s="[object Error]",u="[object Function]",l="[object Map]",c="[object Number]",f="[object Object]",d="[object RegExp]",h="[object Set]",_="[object String]",g="[object WeakMap]",v="[object ArrayBuffer]",p="[object DataView]",y="[object Float32Array]",b="[object Float64Array]",m="[object Int8Array]",E="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",N="[object Uint8ClampedArray]",q="[object Uint16Array]",A="[object Uint32Array]",I={};I[y]=I[b]=I[m]=I[E]=I[x]=I[S]=I[N]=I[q]=I[A]=!0,I[n]=I[i]=I[v]=I[a]=I[p]=I[o]=I[s]=I[u]=I[l]=I[c]=I[f]=I[d]=I[h]=I[_]=I[g]=!1;function D(O){return r(O)&&t(O.length)&&!!I[e(O)]}return ui=D,ui}var ci,of;function Mr(){if(of)return ci;of=1;function e(t){return function(r){return t(r)}}return ci=e,ci}var Lt={exports:{}};Lt.exports;var sf;function Ju(){return sf||(sf=1,(function(e,t){var r=gv(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,s=(function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}})();e.exports=s})(Lt,Lt.exports)),Lt.exports}var li,uf;function Wt(){if(uf)return li;uf=1;var e=_E(),t=Mr(),r=Ju(),n=r&&r.isTypedArray,i=n?t(n):e;return li=i,li}var fi,cf;function Fg(){if(cf)return fi;cf=1;var e=gE(),t=Yt(),r=le(),n=qt(),i=Tr(),a=Wt(),o=Object.prototype,s=o.hasOwnProperty;function u(l,c){var f=r(l),d=!f&&t(l),h=!f&&!d&&n(l),_=!f&&!d&&!h&&a(l),g=f||d||h||_,v=g?e(l.length,String):[],p=v.length;for(var y in l)(c||s.call(l,y))&&!(g&&(y=="length"||h&&(y=="offset"||y=="parent")||_&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,p)))&&v.push(y);return v}return fi=u,fi}var di,lf;function Pr(){if(lf)return di;lf=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return di=t,di}var hi,ff;function zg(){if(ff)return hi;ff=1;function e(t,r){return function(n){return t(r(n))}}return hi=e,hi}var pi,df;function bE(){if(df)return pi;df=1;var e=zg(),t=e(Object.keys,Object);return pi=t,pi}var vi,hf;function Qu(){if(hf)return vi;hf=1;var e=Pr(),t=bE(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var s in Object(a))n.call(a,s)&&s!="constructor"&&o.push(s);return o}return vi=i,vi}var gi,pf;function je(){if(pf)return gi;pf=1;var e=jt(),t=Xu();function r(n){return n!=null&&t(n.length)&&!e(n)}return gi=r,gi}var yi,vf;function Qe(){if(vf)return yi;vf=1;var e=Fg(),t=Qu(),r=je();function n(i){return r(i)?e(i):t(i)}return yi=n,yi}var mi,gf;function wE(){if(gf)return mi;gf=1;var e=Kt(),t=Qe();function r(n,i){return n&&e(i,t(i),n)}return mi=r,mi}var _i,yf;function EE(){if(yf)return _i;yf=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return _i=e,_i}var bi,mf;function xE(){if(mf)return bi;mf=1;var e=qe(),t=Pr(),r=EE(),n=Object.prototype,i=n.hasOwnProperty;function a(o){if(!e(o))return r(o);var s=t(o),u=[];for(var l in o)l=="constructor"&&(s||!i.call(o,l))||u.push(l);return u}return bi=a,bi}var wi,_f;function ct(){if(_f)return wi;_f=1;var e=Fg(),t=xE(),r=je();function n(i){return r(i)?e(i,!0):t(i)}return wi=n,wi}var Ei,bf;function SE(){if(bf)return Ei;bf=1;var e=Kt(),t=ct();function r(n,i){return n&&e(i,t(i),n)}return Ei=r,Ei}var Ft={exports:{}};Ft.exports;var wf;function Bg(){return wf||(wf=1,(function(e,t){var r=Me(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a?r.Buffer:void 0,s=o?o.allocUnsafe:void 0;function u(l,c){if(c)return l.slice();var f=l.length,d=s?s(f):new l.constructor(f);return l.copy(d),d}e.exports=u})(Ft,Ft.exports)),Ft.exports}var xi,Ef;function Hg(){if(Ef)return xi;Ef=1;function e(t,r){var n=-1,i=t.length;for(r||(r=Array(i));++nh))return!1;var g=f.get(o),v=f.get(s);if(g&&v)return g==s&&v==o;var p=-1,y=!0,b=u&i?new e:void 0;for(f.set(o,s),f.set(s,o);++p0&&a(c)?i>1?r(c,i-1,a,o,s):e(s,c):o||(s[s.length]=c)}return s}return po=r,po}var vo,hh;function wx(){if(hh)return vo;hh=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return vo=e,vo}var go,ph;function my(){if(ph)return go;ph=1;var e=wx(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,s=-1,u=t(o.length-i,0),l=Array(u);++s0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return mo=n,mo}var _o,yh;function _y(){if(yh)return _o;yh=1;var e=Ex(),t=xx(),r=t(e);return _o=r,_o}var bo,mh;function zr(){if(mh)return bo;mh=1;var e=lt(),t=my(),r=_y();function n(i,a){return r(t(i,a,e),i+"")}return bo=n,bo}var wo,_h;function by(){if(_h)return wo;_h=1;function e(t,r,n,i){for(var a=t.length,o=n+(i?1:-1);i?o--:++o-1}return qo=t,qo}var Ro,Sh;function Ax(){if(Sh)return Ro;Sh=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var p=l?null:i(u);if(p)return a(p);_=!1,d=n,v=new e}else v=l?[]:g;e:for(;++f1?h.setNode(_,f):h.setNode(_)}),this},i.prototype.setNode=function(c,f){return e.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=f),this):(this._nodes[c]=arguments.length>1?f:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=r,this._children[c]={},this._children[r][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return e.has(this._nodes,c)},i.prototype.removeNode=function(c){var f=this;if(e.has(this._nodes,c)){var d=function(h){f.removeEdge(f._edgeObjs[h])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],e.each(this.children(c),function(h){f.setParent(h)}),delete this._children[c]),e.each(e.keys(this._in[c]),d),delete this._in[c],delete this._preds[c],e.each(e.keys(this._out[c]),d),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,f){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(f))f=r;else{f+="";for(var d=f;!e.isUndefined(d);d=this.parent(d))if(d===c)throw new Error("Setting "+f+" as parent of "+c+" would create a cycle");this.setNode(f)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=f,this._children[f][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var f=this._parent[c];if(f!==r)return f}},i.prototype.children=function(c){if(e.isUndefined(c)&&(c=r),this._isCompound){var f=this._children[c];if(f)return e.keys(f)}else{if(c===r)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var f=this._preds[c];if(f)return e.keys(f)},i.prototype.successors=function(c){var f=this._sucs[c];if(f)return e.keys(f)},i.prototype.neighbors=function(c){var f=this.predecessors(c);if(f)return e.union(f,this.successors(c))},i.prototype.isLeaf=function(c){var f;return this.isDirected()?f=this.successors(c):f=this.neighbors(c),f.length===0},i.prototype.filterNodes=function(c){var f=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});f.setGraph(this.graph());var d=this;e.each(this._nodes,function(g,v){c(v)&&f.setNode(v,g)}),e.each(this._edgeObjs,function(g){f.hasNode(g.v)&&f.hasNode(g.w)&&f.setEdge(g,d.edge(g))});var h={};function _(g){var v=d.parent(g);return v===void 0||f.hasNode(v)?(h[g]=v,v):v in h?h[v]:_(v)}return this._isCompound&&e.each(f.nodes(),function(g){f.setParent(g,_(g))}),f},i.prototype.setDefaultEdgeLabel=function(c){return e.isFunction(c)||(c=e.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(c,f){var d=this,h=arguments;return e.reduce(c,function(_,g){return h.length>1?d.setEdge(_,g,f):d.setEdge(_,g),g}),this},i.prototype.setEdge=function(){var c,f,d,h,_=!1,g=arguments[0];typeof g=="object"&&g!==null&&"v"in g?(c=g.v,f=g.w,d=g.name,arguments.length===2&&(h=arguments[1],_=!0)):(c=g,f=arguments[1],d=arguments[3],arguments.length>2&&(h=arguments[2],_=!0)),c=""+c,f=""+f,e.isUndefined(d)||(d=""+d);var v=s(this._isDirected,c,f,d);if(e.has(this._edgeLabels,v))return _&&(this._edgeLabels[v]=h),this;if(!e.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(f),this._edgeLabels[v]=_?h:this._defaultEdgeLabelFn(c,f,d);var p=u(this._isDirected,c,f,d);return c=p.v,f=p.w,Object.freeze(p),this._edgeObjs[v]=p,a(this._preds[f],c),a(this._sucs[c],f),this._in[f][v]=p,this._out[c][v]=p,this._edgeCount++,this},i.prototype.edge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return this._edgeLabels[h]},i.prototype.hasEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return e.has(this._edgeLabels,h)},i.prototype.removeEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d),_=this._edgeObjs[h];return _&&(c=_.v,f=_.w,delete this._edgeLabels[h],delete this._edgeObjs[h],o(this._preds[f],c),o(this._sucs[c],f),delete this._in[f][h],delete this._out[c][h],this._edgeCount--),this},i.prototype.inEdges=function(c,f){var d=this._in[c];if(d){var h=e.values(d);return f?e.filter(h,function(_){return _.v===f}):h}},i.prototype.outEdges=function(c,f){var d=this._out[c];if(d){var h=e.values(d);return f?e.filter(h,function(_){return _.w===f}):h}},i.prototype.nodeEdges=function(c,f){var d=this.inEdges(c,f);if(d)return d.concat(this.outEdges(c,f))};function a(c,f){c[f]?c[f]++:c[f]=1}function o(c,f){--c[f]||delete c[f]}function s(c,f,d,h){var _=""+f,g=""+d;if(!c&&_>g){var v=_;_=g,g=v}return _+n+g+n+(e.isUndefined(h)?t:h)}function u(c,f,d,h){var _=""+f,g=""+d;if(!c&&_>g){var v=_;_=g,g=v}var p={v:_,w:g};return h&&(p.name=h),p}function l(c,f){return s(c,f.v,f.w,f.name)}return ko}var Do,Oh;function Ox(){return Oh||(Oh=1,Do="2.1.8"),Do}var Lo,kh;function kx(){return kh||(kh=1,Lo={Graph:cc(),version:Ox()}),Lo}var Fo,Dh;function Dx(){if(Dh)return Fo;Dh=1;var e=Re(),t=cc();Fo={write:r,read:a};function r(o){var s={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:i(o)};return e.isUndefined(o.graph())||(s.value=e.clone(o.graph())),s}function n(o){return e.map(o.nodes(),function(s){var u=o.node(s),l=o.parent(s),c={v:s};return e.isUndefined(u)||(c.value=u),e.isUndefined(l)||(c.parent=l),c})}function i(o){return e.map(o.edges(),function(s){var u=o.edge(s),l={v:s.v,w:s.w};return e.isUndefined(s.name)||(l.name=s.name),e.isUndefined(u)||(l.value=u),l})}function a(o){var s=new t(o.options).setGraph(o.value);return e.each(o.nodes,function(u){s.setNode(u.v,u.value),u.parent&&s.setParent(u.v,u.parent)}),e.each(o.edges,function(u){s.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),s}return Fo}var zo,Lh;function Lx(){if(Lh)return zo;Lh=1;var e=Re();zo=t;function t(r){var n={},i=[],a;function o(s){e.has(n,s)||(n[s]=!0,a.push(s),e.each(r.successors(s),o),e.each(r.predecessors(s),o))}return e.each(r.nodes(),function(s){a=[],o(s),a.length&&i.push(a)}),i}return zo}var Bo,Fh;function xy(){if(Fh)return Bo;Fh=1;var e=Re();Bo=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var n=this._keyIndices[r];if(n!==void 0)return this._arr[n].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,n){var i=this._keyIndices;if(r=String(r),!e.has(i,r)){var a=this._arr,o=a.length;return i[r]=o,a.push({key:r,priority:n}),this._decrease(o),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,n){var i=this._keyIndices[r];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},t.prototype._heapify=function(r){var n=this._arr,i=2*r,a=i+1,o=r;i>1,!(n[a].priority0&&(f=c.removeMin(),d=l[f],d.distance!==Number.POSITIVE_INFINITY);)u(f).forEach(h);return l}return Ho}var $o,Bh;function Fx(){if(Bh)return $o;Bh=1;var e=Sy(),t=Re();$o=r;function r(n,i,a){return t.transform(n.nodes(),function(o,s){o[s]=e(n,s,i,a)},{})}return $o}var Go,Hh;function qy(){if(Hh)return Go;Hh=1;var e=Re();Go=t;function t(r){var n=0,i=[],a={},o=[];function s(u){var l=a[u]={onStack:!0,lowlink:n,index:n++};if(i.push(u),r.successors(u).forEach(function(d){e.has(a,d)?a[d].onStack&&(l.lowlink=Math.min(l.lowlink,a[d].index)):(s(d),l.lowlink=Math.min(l.lowlink,a[d].lowlink))}),l.lowlink===l.index){var c=[],f;do f=i.pop(),a[f].onStack=!1,c.push(f);while(u!==f);o.push(c)}}return r.nodes().forEach(function(u){e.has(a,u)||s(u)}),o}return Go}var Vo,$h;function zx(){if($h)return Vo;$h=1;var e=Re(),t=qy();Vo=r;function r(n){return e.filter(t(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return Vo}var Uo,Gh;function Bx(){if(Gh)return Uo;Gh=1;var e=Re();Uo=r;var t=e.constant(1);function r(i,a,o){return n(i,a||t,o||function(s){return i.outEdges(s)})}function n(i,a,o){var s={},u=i.nodes();return u.forEach(function(l){s[l]={},s[l][l]={distance:0},u.forEach(function(c){l!==c&&(s[l][c]={distance:Number.POSITIVE_INFINITY})}),o(l).forEach(function(c){var f=c.v===l?c.w:c.v,d=a(c);s[l][f]={distance:d,predecessor:l}})}),u.forEach(function(l){var c=s[l];u.forEach(function(f){var d=s[f];u.forEach(function(h){var _=d[l],g=c[h],v=d[h],p=_.distance+g.distance;p0;){if(l=u.removeMin(),e.has(s,l))o.setEdge(l,s[l]);else{if(f)throw new Error("Input graph is not connected: "+i);f=!0}i.nodeEdges(l).forEach(c)}return o}return Xo}var Jo,Zh;function Ux(){return Zh||(Zh=1,Jo={components:Lx(),dijkstra:Sy(),dijkstraAll:Fx(),findCycles:zx(),floydWarshall:Bx(),isAcyclic:Hx(),postorder:$x(),preorder:Gx(),prim:Vx(),tarjan:qy(),topsort:Ry()}),Jo}var Qo,Xh;function jx(){if(Xh)return Qo;Xh=1;var e=kx();return Qo={Graph:e.Graph,json:Dx(),alg:Ux(),version:e.version},Qo}var es,Jh;function Te(){if(Jh)return es;Jh=1;var e;if(typeof Ku=="function")try{e=jx()}catch{}return e||(e=window.graphlib),es=e,es}var ts,Qh;function Kx(){if(Qh)return ts;Qh=1;var e=Jg(),t=1,r=4;function n(i){return e(i,t|r)}return ts=n,ts}var rs,ep;function Br(){if(ep)return rs;ep=1;var e=St(),t=je(),r=Tr(),n=qe();function i(a,o,s){if(!n(s))return!1;var u=typeof o;return(u=="number"?t(s)&&r(o,s.length):u=="string"&&o in s)?e(s[o],a):!1}return rs=i,rs}var ns,tp;function Yx(){if(tp)return ns;tp=1;var e=zr(),t=St(),r=Br(),n=ct(),i=Object.prototype,a=i.hasOwnProperty,o=e(function(s,u){s=Object(s);var l=-1,c=u.length,f=c>2?u[2]:void 0;for(f&&r(u[0],u[1],f)&&(c=1);++l-1?u[l?a[c]:c]:void 0}}return is=n,is}var as,np;function Ay(){if(np)return as;np=1;var e=Sm(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*r}return i===i?i:0}return as=n,as}var os,ip;function Zx(){if(ip)return os;ip=1;var e=Ay();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return os=t,os}var ss,ap;function Xx(){if(ap)return ss;ap=1;var e=by(),t=Ke(),r=Zx(),n=Math.max;function i(a,o,s){var u=a==null?0:a.length;if(!u)return-1;var l=s==null?0:r(s);return l<0&&(l=n(u+l,0)),e(a,t(o,3),l)}return ss=i,ss}var us,op;function Jx(){if(op)return us;op=1;var e=Wx(),t=Xx(),r=e(t);return us=r,us}var cs,sp;function Ny(){if(sp)return cs;sp=1;var e=uc();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return cs=t,cs}var ls,up;function Qx(){if(up)return ls;up=1;var e=ic(),t=Qg(),r=ct();function n(i,a){return i==null?i:e(i,t(a),r)}return ls=n,ls}var fs,cp;function eS(){if(cp)return fs;cp=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return fs=e,fs}var ds,lp;function tS(){if(lp)return ds;lp=1;var e=Nr(),t=ac(),r=Ke();function n(i,a){var o={};return a=r(a,3),t(i,function(s,u,l){e(o,u,a(s,u,l))}),o}return ds=n,ds}var hs,fp;function lc(){if(fp)return hs;fp=1;var e=xt();function t(r,n,i){for(var a=-1,o=r.length;++ar}return ps=e,ps}var vs,hp;function nS(){if(hp)return vs;hp=1;var e=lc(),t=rS(),r=lt();function n(i){return i&&i.length?e(i,r,t):void 0}return vs=n,vs}var gs,pp;function Iy(){if(pp)return gs;pp=1;var e=Nr(),t=St();function r(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&e(n,i,a)}return gs=r,gs}var ys,vp;function iS(){if(vp)return ys;vp=1;var e=st(),t=Or(),r=Le(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,u=o.call(Object);function l(c){if(!r(c)||e(c)!=n)return!1;var f=t(c);if(f===null)return!0;var d=s.call(f,"constructor")&&f.constructor;return typeof d=="function"&&d instanceof d&&o.call(d)==u}return ys=l,ys}var ms,gp;function Ty(){if(gp)return ms;gp=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return ms=e,ms}var _s,yp;function aS(){if(yp)return _s;yp=1;var e=Kt(),t=ct();function r(n){return e(n,t(n))}return _s=r,_s}var bs,mp;function oS(){if(mp)return bs;mp=1;var e=Iy(),t=Bg(),r=Wg(),n=Hg(),i=Xg(),a=Yt(),o=le(),s=wy(),u=qt(),l=jt(),c=qe(),f=iS(),d=Wt(),h=Ty(),_=aS();function g(v,p,y,b,m,E,x){var S=h(v,y),N=h(p,y),q=x.get(N);if(q){e(v,y,q);return}var A=E?E(S,N,y+"",v,p,x):void 0,I=A===void 0;if(I){var D=o(N),O=!D&&u(N),w=!D&&!O&&d(N);A=N,D||O||w?o(S)?A=S:s(S)?A=n(S):O?(I=!1,A=t(N,!0)):w?(I=!1,A=r(N,!0)):A=[]:f(N)||a(N)?(A=S,a(S)?A=_(S):(!c(S)||l(S))&&(A=i(N))):I=!1}I&&(x.set(N,A),m(A,N,b,E,x),x.delete(N)),e(v,y,A)}return bs=g,bs}var ws,_p;function sS(){if(_p)return ws;_p=1;var e=Ar(),t=Iy(),r=ic(),n=oS(),i=qe(),a=ct(),o=Ty();function s(u,l,c,f,d){u!==l&&r(l,function(h,_){if(d||(d=new e),i(h))n(u,l,_,c,s,f,d);else{var g=f?f(o(u,_),h,_+"",u,l,d):void 0;g===void 0&&(g=h),t(u,_,g)}},a)}return ws=s,ws}var Es,bp;function uS(){if(bp)return Es;bp=1;var e=zr(),t=Br();function r(n){return e(function(i,a){var o=-1,s=a.length,u=s>1?a[s-1]:void 0,l=s>2?a[2]:void 0;for(u=n.length>3&&typeof u=="function"?(s--,u):void 0,l&&t(a[0],a[1],l)&&(u=s<3?void 0:u,s=1),i=Object(i);++on||s&&u&&c&&!l&&!f||a&&u&&c||!i&&c||!o)return 1;if(!a&&!s&&!f&&r=l)return c;var f=i[a];return c*(f=="desc"?-1:1)}}return r.index-n.index}return Ls=t,Ls}var Fs,Dp;function xS(){if(Dp)return Fs;Dp=1;var e=Dr(),t=Fr(),r=Ke(),n=vy(),i=bS(),a=Mr(),o=ES(),s=lt(),u=le();function l(c,f,d){f.length?f=e(f,function(g){return u(g)?function(v){return t(v,g.length===1?g[0]:g)}:g}):f=[s];var h=-1;f=e(f,a(r));var _=n(c,function(g,v,p){var y=e(f,function(b){return b(g)});return{criteria:y,index:++h,value:g}});return i(_,function(g,v){return o(g,v,d)})}return Fs=l,Fs}var zs,Lp;function SS(){if(Lp)return zs;Lp=1;var e=uc(),t=xS(),r=zr(),n=Br(),i=r(function(a,o){if(a==null)return[];var s=o.length;return s>1&&n(a,o[0],o[1])?o=[]:s>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return zs=i,zs}var Bs,Fp;function qS(){if(Fp)return Bs;Fp=1;var e=uy(),t=0;function r(n){var i=++t;return e(n)+i}return Bs=r,Bs}var Hs,zp;function RS(){if(zp)return Hs;zp=1;function e(t,r,n){for(var i=-1,a=t.length,o=r.length,s={};++i0;--v)if(g=c[v].dequeue(),g){d=d.concat(o(l,c,f,g,!0));break}}}return d}function o(l,c,f,d,h){var _=h?[]:void 0;return e.forEach(l.inEdges(d.v),function(g){var v=l.edge(g),p=l.node(g.v);h&&_.push({v:g.v,w:g.w}),p.out-=v,u(c,f,p)}),e.forEach(l.outEdges(d.v),function(g){var v=l.edge(g),p=g.w,y=l.node(p);y.in-=v,u(c,f,y)}),l.removeNode(d.v),_}function s(l,c){var f=new t,d=0,h=0;e.forEach(l.nodes(),function(v){f.setNode(v,{v,in:0,out:0})}),e.forEach(l.edges(),function(v){var p=f.edge(v.v,v.w)||0,y=c(v),b=p+y;f.setEdge(v.v,v.w,b),h=Math.max(h,f.node(v.v).out+=y),d=Math.max(d,f.node(v.w).in+=y)});var _=e.range(h+d+3).map(function(){return new r}),g=d+1;return e.forEach(f.nodes(),function(v){u(_,g,f.node(v))}),{graph:f,buckets:_,zeroIdx:g}}function u(l,c,f){f.out?f.in?l[f.out-f.in+c].enqueue(f):l[l.length-1].enqueue(f):l[0].enqueue(f)}return Us}var js,Vp;function IS(){if(Vp)return js;Vp=1;var e=ae(),t=NS();js={run:r,undo:i};function r(a){var o=a.graph().acyclicer==="greedy"?t(a,s(a)):n(a);e.forEach(o,function(u){var l=a.edge(u);a.removeEdge(u),l.forwardName=u.name,l.reversed=!0,a.setEdge(u.w,u.v,l,e.uniqueId("rev"))});function s(u){return function(l){return u.edge(l).weight}}}function n(a){var o=[],s={},u={};function l(c){e.has(u,c)||(u[c]=!0,s[c]=!0,e.forEach(a.outEdges(c),function(f){e.has(s,f.w)?o.push(f):l(f.w)}),delete s[c])}return e.forEach(a.nodes(),l),o}function i(a){e.forEach(a.edges(),function(o){var s=a.edge(o);if(s.reversed){a.removeEdge(o);var u=s.forwardName;delete s.reversed,delete s.forwardName,a.setEdge(o.w,o.v,s,u)}})}return js}var Ks,Up;function _e(){if(Up)return Ks;Up=1;var e=ae(),t=Te().Graph;Ks={addDummyNode:r,simplify:n,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:o,intersectRect:s,buildLayerMatrix:u,normalizeRanks:l,removeEmptyRanks:c,addBorderNode:f,maxRank:d,partition:h,time:_,notime:g};function r(v,p,y,b){var m;do m=e.uniqueId(b);while(v.hasNode(m));return y.dummy=p,v.setNode(m,y),m}function n(v){var p=new t().setGraph(v.graph());return e.forEach(v.nodes(),function(y){p.setNode(y,v.node(y))}),e.forEach(v.edges(),function(y){var b=p.edge(y.v,y.w)||{weight:0,minlen:1},m=v.edge(y);p.setEdge(y.v,y.w,{weight:b.weight+m.weight,minlen:Math.max(b.minlen,m.minlen)})}),p}function i(v){var p=new t({multigraph:v.isMultigraph()}).setGraph(v.graph());return e.forEach(v.nodes(),function(y){v.children(y).length||p.setNode(y,v.node(y))}),e.forEach(v.edges(),function(y){p.setEdge(y,v.edge(y))}),p}function a(v){var p=e.map(v.nodes(),function(y){var b={};return e.forEach(v.outEdges(y),function(m){b[m.w]=(b[m.w]||0)+v.edge(m).weight}),b});return e.zipObject(v.nodes(),p)}function o(v){var p=e.map(v.nodes(),function(y){var b={};return e.forEach(v.inEdges(y),function(m){b[m.v]=(b[m.v]||0)+v.edge(m).weight}),b});return e.zipObject(v.nodes(),p)}function s(v,p){var y=v.x,b=v.y,m=p.x-y,E=p.y-b,x=v.width/2,S=v.height/2;if(!m&&!E)throw new Error("Not possible to find intersection inside of the rectangle");var N,q;return Math.abs(E)*x>Math.abs(m)*S?(E<0&&(S=-S),N=S*m/E,q=S):(m<0&&(x=-x),N=x,q=x*E/m),{x:y+N,y:b+q}}function u(v){var p=e.map(e.range(d(v)+1),function(){return[]});return e.forEach(v.nodes(),function(y){var b=v.node(y),m=b.rank;e.isUndefined(m)||(p[m][b.order]=y)}),p}function l(v){var p=e.min(e.map(v.nodes(),function(y){return v.node(y).rank}));e.forEach(v.nodes(),function(y){var b=v.node(y);e.has(b,"rank")&&(b.rank-=p)})}function c(v){var p=e.min(e.map(v.nodes(),function(E){return v.node(E).rank})),y=[];e.forEach(v.nodes(),function(E){var x=v.node(E).rank-p;y[x]||(y[x]=[]),y[x].push(E)});var b=0,m=v.graph().nodeRankFactor;e.forEach(y,function(E,x){e.isUndefined(E)&&x%m!==0?--b:b&&e.forEach(E,function(S){v.node(S).rank+=b})})}function f(v,p,y,b){var m={width:0,height:0};return arguments.length>=4&&(m.rank=y,m.order=b),r(v,"border",m,p)}function d(v){return e.max(e.map(v.nodes(),function(p){var y=v.node(p).rank;if(!e.isUndefined(y))return y}))}function h(v,p){var y={lhs:[],rhs:[]};return e.forEach(v,function(b){p(b)?y.lhs.push(b):y.rhs.push(b)}),y}function _(v,p){var y=e.now();try{return p()}finally{console.log(v+" time: "+(e.now()-y)+"ms")}}function g(v,p){return p()}return Ks}var Ys,jp;function TS(){if(jp)return Ys;jp=1;var e=ae(),t=_e();Ys={run:r,undo:i};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(o){n(a,o)})}function n(a,o){var s=o.v,u=a.node(s).rank,l=o.w,c=a.node(l).rank,f=o.name,d=a.edge(o),h=d.labelRank;if(c!==u+1){a.removeEdge(o);var _,g,v;for(v=0,++u;uq.lim&&(A=q,I=!0);var D=e.filter(m.edges(),function(O){return I===y(b,b.node(O.v),A)&&I!==y(b,b.node(O.w),A)});return e.minBy(D,function(O){return r(m,O)})}function g(b,m,E,x){var S=E.v,N=E.w;b.removeEdge(S,N),b.setEdge(x.v,x.w,{}),f(b),u(b,m),v(b,m)}function v(b,m){var E=e.find(b.nodes(),function(S){return!m.node(S).parent}),x=i(b,E);x=x.slice(1),e.forEach(x,function(S){var N=b.node(S).parent,q=m.edge(S,N),A=!1;q||(q=m.edge(N,S),A=!0),m.node(S).rank=m.node(N).rank+(A?q.minlen:-q.minlen)})}function p(b,m,E){return b.hasEdge(m,E)}function y(b,m,E){return E.low<=m.lim&&m.lim<=E.lim}return Xs}var Js,Zp;function PS(){if(Zp)return Js;Zp=1;var e=gr(),t=e.longestPath,r=Py(),n=MS();Js=i;function i(u){switch(u.graph().ranker){case"network-simplex":s(u);break;case"tight-tree":o(u);break;case"longest-path":a(u);break;default:s(u)}}var a=t;function o(u){t(u),r(u)}function s(u){n(u)}return Js}var Qs,Xp;function OS(){if(Xp)return Qs;Xp=1;var e=ae();Qs=t;function t(i){var a=n(i);e.forEach(i.graph().dummyChains,function(o){for(var s=i.node(o),u=s.edgeObj,l=r(i,a,u.v,u.w),c=l.path,f=l.lca,d=0,h=c[d],_=!0;o!==u.w;){if(s=i.node(o),_){for(;(h=c[d])!==f&&i.node(h).maxRankc||f>a[d].lim));for(h=d,d=s;(d=i.parent(d))!==h;)l.push(d);return{path:u.concat(l.reverse()),lca:h}}function n(i){var a={},o=0;function s(u){var l=o;e.forEach(i.children(u),s),a[u]={low:l,lim:o++}}return e.forEach(i.children(),s),a}return Qs}var eu,Jp;function kS(){if(Jp)return eu;Jp=1;var e=ae(),t=_e();eu={run:r,cleanup:o};function r(s){var u=t.addDummyNode(s,"root",{},"_root"),l=i(s),c=e.max(e.values(l))-1,f=2*c+1;s.graph().nestingRoot=u,e.forEach(s.edges(),function(h){s.edge(h).minlen*=f});var d=a(s)+1;e.forEach(s.children(),function(h){n(s,u,f,d,c,l,h)}),s.graph().nodeRankFactor=f}function n(s,u,l,c,f,d,h){var _=s.children(h);if(!_.length){h!==u&&s.setEdge(u,h,{weight:0,minlen:l});return}var g=t.addBorderNode(s,"_bt"),v=t.addBorderNode(s,"_bb"),p=s.node(h);s.setParent(g,h),p.borderTop=g,s.setParent(v,h),p.borderBottom=v,e.forEach(_,function(y){n(s,u,l,c,f,d,y);var b=s.node(y),m=b.borderTop?b.borderTop:y,E=b.borderBottom?b.borderBottom:y,x=b.borderTop?c:2*c,S=m!==E?1:f-d[h]+1;s.setEdge(g,m,{weight:x,minlen:S,nestingEdge:!0}),s.setEdge(E,v,{weight:x,minlen:S,nestingEdge:!0})}),s.parent(h)||s.setEdge(u,g,{weight:0,minlen:f+d[h]})}function i(s){var u={};function l(c,f){var d=s.children(c);d&&d.length&&e.forEach(d,function(h){l(h,f+1)}),u[c]=f}return e.forEach(s.children(),function(c){l(c,1)}),u}function a(s){return e.reduce(s.edges(),function(u,l){return u+s.edge(l).weight},0)}function o(s){var u=s.graph();s.removeNode(u.nestingRoot),delete u.nestingRoot,e.forEach(s.edges(),function(l){var c=s.edge(l);c.nestingEdge&&s.removeEdge(l)})}return eu}var tu,Qp;function DS(){if(Qp)return tu;Qp=1;var e=ae(),t=_e();tu=r;function r(i){function a(o){var s=i.children(o),u=i.node(o);if(s.length&&e.forEach(s,a),e.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var l=u.minRank,c=u.maxRank+1;l0;)h%2&&(_+=c[h+1]),h=h-1>>1,c[h]+=d.weight;f+=d.weight*_})),f}return iu}var au,nv;function BS(){if(nv)return au;nv=1;var e=ae();au=t;function t(r,n){return e.map(n,function(i){var a=r.inEdges(i);if(a.length){var o=e.reduce(a,function(s,u){var l=r.edge(u),c=r.node(u.v);return{sum:s.sum+l.weight*c.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:i,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:i}})}return au}var ou,iv;function HS(){if(iv)return ou;iv=1;var e=ae();ou=t;function t(i,a){var o={};e.forEach(i,function(u,l){var c=o[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:l};e.isUndefined(u.barycenter)||(c.barycenter=u.barycenter,c.weight=u.weight)}),e.forEach(a.edges(),function(u){var l=o[u.v],c=o[u.w];!e.isUndefined(l)&&!e.isUndefined(c)&&(c.indegree++,l.out.push(o[u.w]))});var s=e.filter(o,function(u){return!u.indegree});return r(s)}function r(i){var a=[];function o(l){return function(c){c.merged||(e.isUndefined(c.barycenter)||e.isUndefined(l.barycenter)||c.barycenter>=l.barycenter)&&n(l,c)}}function s(l){return function(c){c.in.push(l),--c.indegree===0&&i.push(c)}}for(;i.length;){var u=i.pop();a.push(u),e.forEach(u.in.reverse(),o(u)),e.forEach(u.out,s(u))}return e.map(e.filter(a,function(l){return!l.merged}),function(l){return e.pick(l,["vs","i","barycenter","weight"])})}function n(i,a){var o=0,s=0;i.weight&&(o+=i.barycenter*i.weight,s+=i.weight),a.weight&&(o+=a.barycenter*a.weight,s+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=o/s,i.weight=s,i.i=Math.min(a.i,i.i),a.merged=!0}return ou}var su,av;function $S(){if(av)return su;av=1;var e=ae(),t=_e();su=r;function r(a,o){var s=t.partition(a,function(g){return e.has(g,"barycenter")}),u=s.lhs,l=e.sortBy(s.rhs,function(g){return-g.i}),c=[],f=0,d=0,h=0;u.sort(i(!!o)),h=n(c,l,h),e.forEach(u,function(g){h+=g.vs.length,c.push(g.vs),f+=g.barycenter*g.weight,d+=g.weight,h=n(c,l,h)});var _={vs:e.flatten(c,!0)};return d&&(_.barycenter=f/d,_.weight=d),_}function n(a,o,s){for(var u;o.length&&(u=e.last(o)).i<=s;)o.pop(),a.push(u.vs),s++;return s}function i(a){return function(o,s){return o.barycenters.barycenter?1:a?s.i-o.i:o.i-s.i}}return su}var uu,ov;function GS(){if(ov)return uu;ov=1;var e=ae(),t=BS(),r=HS(),n=$S();uu=i;function i(s,u,l,c){var f=s.children(u),d=s.node(u),h=d?d.borderLeft:void 0,_=d?d.borderRight:void 0,g={};h&&(f=e.filter(f,function(E){return E!==h&&E!==_}));var v=t(s,f);e.forEach(v,function(E){if(s.children(E.v).length){var x=i(s,E.v,l,c);g[E.v]=x,e.has(x,"barycenter")&&o(E,x)}});var p=r(v,l);a(p,g);var y=n(p,c);if(h&&(y.vs=e.flatten([h,y.vs,_],!0),s.predecessors(h).length)){var b=s.node(s.predecessors(h)[0]),m=s.node(s.predecessors(_)[0]);e.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+b.order+m.order)/(y.weight+2),y.weight+=2}return y}function a(s,u){e.forEach(s,function(l){l.vs=e.flatten(l.vs.map(function(c){return u[c]?u[c].vs:c}),!0)})}function o(s,u){e.isUndefined(s.barycenter)?(s.barycenter=u.barycenter,s.weight=u.weight):(s.barycenter=(s.barycenter*s.weight+u.barycenter*u.weight)/(s.weight+u.weight),s.weight+=u.weight)}return uu}var cu,sv;function VS(){if(sv)return cu;sv=1;var e=ae(),t=Te().Graph;cu=r;function r(i,a,o){var s=n(i),u=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(function(l){return i.node(l)});return e.forEach(i.nodes(),function(l){var c=i.node(l),f=i.parent(l);(c.rank===a||c.minRank<=a&&a<=c.maxRank)&&(u.setNode(l),u.setParent(l,f||s),e.forEach(i[o](l),function(d){var h=d.v===l?d.w:d.v,_=u.edge(h,l),g=e.isUndefined(_)?0:_.weight;u.setEdge(h,l,{weight:i.edge(d).weight+g})}),e.has(c,"minRank")&&u.setNode(l,{borderLeft:c.borderLeft[a],borderRight:c.borderRight[a]}))}),u}function n(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return cu}var lu,uv;function US(){if(uv)return lu;uv=1;var e=ae();lu=t;function t(r,n,i){var a={},o;e.forEach(i,function(s){for(var u=r.parent(s),l,c;u;){if(l=r.parent(u),l?(c=a[l],a[l]=u):(c=o,o=u),c&&c!==u){n.setEdge(c,u);return}u=l}})}return lu}var fu,cv;function jS(){if(cv)return fu;cv=1;var e=ae(),t=FS(),r=zS(),n=GS(),i=VS(),a=US(),o=Te().Graph,s=_e();fu=u;function u(d){var h=s.maxRank(d),_=l(d,e.range(1,h+1),"inEdges"),g=l(d,e.range(h-1,-1,-1),"outEdges"),v=t(d);f(d,v);for(var p=Number.POSITIVE_INFINITY,y,b=0,m=0;m<4;++b,++m){c(b%2?_:g,b%4>=2),v=s.buildLayerMatrix(d);var E=r(d,v);EA)&&o(b,O,I)})})}function E(x,S){var N=-1,q,A=0;return e.forEach(S,function(I,D){if(p.node(I).dummy==="border"){var O=p.predecessors(I);O.length&&(q=p.node(O[0]).order,m(S,A,D,N,q),A=D,N=q)}m(S,A,S.length,q,x.length)}),S}return e.reduce(y,E),b}function a(p,y){if(p.node(y).dummy)return e.find(p.predecessors(y),function(b){return p.node(b).dummy})}function o(p,y,b){if(y>b){var m=y;y=b,b=m}var E=p[y];E||(p[y]=E={}),E[b]=!0}function s(p,y,b){if(y>b){var m=y;y=b,b=m}return e.has(p[y],b)}function u(p,y,b,m){var E={},x={},S={};return e.forEach(y,function(N){e.forEach(N,function(q,A){E[q]=q,x[q]=q,S[q]=A})}),e.forEach(y,function(N){var q=-1;e.forEach(N,function(A){var I=m(A);if(I.length){I=e.sortBy(I,function(C){return S[C]});for(var D=(I.length-1)/2,O=Math.floor(D),w=Math.ceil(D);O<=w;++O){var T=I[O];x[A]===A&&qn[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Cs(),b=le();const at=ue(b),Co=Ms({__proto__:null,default:at},[b]),re=new WeakMap,Is=new WeakMap,Tt={current:[]};let qt=!1,mt=0;const pt=new Set,Pt=new Map;function Qe(t){for(const s of t){if(Tt.current.includes(s))continue;Tt.current.push(s),s.recompute();const e=Is.get(s);if(e)for(const n of e){const o=re.get(n);o?.length&&Qe(o)}}}function Es(t){const s={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(s)}function ks(t){const s={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(s)}function ts(t){if(mt>0&&!Pt.has(t)&&Pt.set(t,t.prevState),pt.add(t),!(mt>0)&&!qt)try{for(qt=!0;pt.size>0;){const s=Array.from(pt);pt.clear();for(const e of s){const n=Pt.get(e)??e.prevState;e.prevState=n,Es(e)}for(const e of s){const n=re.get(e);n&&(Tt.current.push(e),Qe(n))}for(const e of s){const n=re.get(e);if(n)for(const o of n)ks(o)}}}finally{qt=!1,Tt.current=[],Pt.clear()}}function gt(t){mt++;try{t()}finally{if(mt--,mt===0){const s=pt.values().next().value;s&&ts(s)}}}function Ts(t){return typeof t=="function"}class Os{constructor(s,e){this.listeners=new Set,this.subscribe=n=>{var o,i;this.listeners.add(n);const r=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,n,this);return()=>{this.listeners.delete(n),r?.()}},this.prevState=s,this.state=s,this.options=e}setState(s){var e,n,o;this.prevState=this.state,(e=this.options)!=null&&e.updateFn?this.state=this.options.updateFn(this.prevState)(s):Ts(s)?this.state=s(this.prevState):this.state=s,(o=(n=this.options)==null?void 0:n.onUpdate)==null||o.call(n),ts(this)}}const G="__TSR_index",Me="popstate",Ie="beforeunload";function Fs(t){let s=t.getLocation();const e=new Set,n=r=>{s=t.getLocation(),e.forEach(a=>a({location:s,action:r}))},o=r=>{t.notifyOnIndexChange??!0?n(r):s=t.getLocation()},i=async({task:r,navigateOpts:a,...c})=>{if(a?.ignoreBlocker??!1){r();return}const d=t.getBlockers?.()??[],l=c.type==="PUSH"||c.type==="REPLACE";if(typeof document<"u"&&d.length&&l)for(const u of d){const f=Ot(c.path,c.state);if(await u.blockerFn({currentLocation:s,nextLocation:f,action:c.type})){t.onBlocked?.();return}}r()};return{get location(){return s},get length(){return t.getLength()},subscribers:e,subscribe:r=>(e.add(r),()=>{e.delete(r)}),push:(r,a,c)=>{const h=s.state[G];a=Ee(h+1,a),i({task:()=>{t.pushState(r,a),n({type:"PUSH"})},navigateOpts:c,type:"PUSH",path:r,state:a})},replace:(r,a,c)=>{const h=s.state[G];a=Ee(h,a),i({task:()=>{t.replaceState(r,a),n({type:"REPLACE"})},navigateOpts:c,type:"REPLACE",path:r,state:a})},go:(r,a)=>{i({task:()=>{t.go(r),o({type:"GO",index:r})},navigateOpts:a,type:"GO"})},back:r=>{i({task:()=>{t.back(r?.ignoreBlocker??!1),o({type:"BACK"})},navigateOpts:r,type:"BACK"})},forward:r=>{i({task:()=>{t.forward(r?.ignoreBlocker??!1),o({type:"FORWARD"})},navigateOpts:r,type:"FORWARD"})},canGoBack:()=>s.state[G]!==0,createHref:r=>t.createHref(r),block:r=>{if(!t.setBlockers)return()=>{};const a=t.getBlockers?.()??[];return t.setBlockers([...a,r]),()=>{const c=t.getBlockers?.()??[];t.setBlockers?.(c.filter(h=>h!==r))}},flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:n}}function Ee(t,s){s||(s={});const e=he();return{...s,key:e,__TSR_key:e,[G]:t}}function As(t){const s=typeof document<"u"?window:void 0,e=s.history.pushState,n=s.history.replaceState;let o=[];const i=()=>o,r=w=>o=w,a=(w=>w),c=(()=>Ot(`${s.location.pathname}${s.location.search}${s.location.hash}`,s.history.state));if(!s.history.state?.__TSR_key&&!s.history.state?.key){const w=he();s.history.replaceState({[G]:0,key:w,__TSR_key:w},"")}let h=c(),d,l=!1,u=!1,f=!1,p=!1;const g=()=>h;let m,y;const v=()=>{m&&(R._ignoreSubscribers=!0,(m.isPush?s.history.pushState:s.history.replaceState)(m.state,"",m.href),R._ignoreSubscribers=!1,m=void 0,y=void 0,d=void 0)},S=(w,C,M)=>{const I=a(C);y||(d=h),h=Ot(C,M),m={href:I,state:M,isPush:m?.isPush||w==="push"},y||(y=Promise.resolve().then(()=>v()))},x=w=>{h=c(),R.notify({type:w})},L=async()=>{if(u){u=!1;return}const w=c(),C=w.state[G]-h.state[G],M=C===1,I=C===-1,F=!M&&!I||l;l=!1;const A=F?"GO":I?"BACK":"FORWARD",j=F?{type:"GO",index:C}:{type:I?"BACK":"FORWARD"};if(f)f=!1;else{const N=i();if(typeof document<"u"&&N.length){for(const nt of N)if(await nt.blockerFn({currentLocation:h,nextLocation:w,action:A})){u=!0,s.history.go(1),R.notify(j);return}}}h=c(),R.notify(j)},_=w=>{if(p){p=!1;return}let C=!1;const M=i();if(typeof document<"u"&&M.length)for(const I of M){const F=I.enableBeforeUnload??!0;if(F===!0){C=!0;break}if(typeof F=="function"&&F()===!0){C=!0;break}}if(C)return w.preventDefault(),w.returnValue=""},R=Fs({getLocation:g,getLength:()=>s.history.length,pushState:(w,C)=>S("push",w,C),replaceState:(w,C)=>S("replace",w,C),back:w=>(w&&(f=!0),p=!0,s.history.back()),forward:w=>{w&&(f=!0),p=!0,s.history.forward()},go:w=>{l=!0,s.history.go(w)},createHref:w=>a(w),flush:v,destroy:()=>{s.history.pushState=e,s.history.replaceState=n,s.removeEventListener(Ie,_,{capture:!0}),s.removeEventListener(Me,L)},onBlocked:()=>{d&&h!==d&&(h=d)},getBlockers:i,setBlockers:r,notifyOnIndexChange:!1});return s.addEventListener(Ie,_,{capture:!0}),s.addEventListener(Me,L),s.history.pushState=function(...w){const C=e.apply(s.history,w);return R._ignoreSubscribers||x("PUSH"),C},s.history.replaceState=function(...w){const C=n.apply(s.history,w);return R._ignoreSubscribers||x("REPLACE"),C},R}function Ot(t,s){const e=t.indexOf("#"),n=t.indexOf("?"),o=he();return{href:t,pathname:t.substring(0,e>0?n>0?Math.min(e,n):e:n>0?n:t.length),hash:e>-1?t.substring(e):"",search:n>-1?t.slice(n,e===-1?void 0:e):"",state:s||{[G]:0,key:o,__TSR_key:o}}}function he(){return(Math.random()+1).toString(36).substring(7)}function Ft(t){return t[t.length-1]}function Bs(t){return typeof t=="function"}function H(t,s){return Bs(t)?t(s):t}const zs=Object.prototype.hasOwnProperty;function z(t,s){if(t===s)return t;const e=s,n=Oe(t)&&Oe(e);if(!n&&!(At(t)&&At(e)))return e;const o=n?t:ke(t);if(!o)return e;const i=n?e:ke(e);if(!i)return e;const r=o.length,a=i.length,c=n?new Array(a):{};let h=0;for(let d=0;d"u")return!0;const e=s.prototype;return!(!Te(e)||!e.hasOwnProperty("isPrototypeOf"))}function Te(t){return Object.prototype.toString.call(t)==="[object Object]"}function Oe(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Z(t,s,e){if(t===s)return!0;if(typeof t!=typeof s)return!1;if(Array.isArray(t)&&Array.isArray(s)){if(t.length!==s.length)return!1;for(let n=0,o=t.length;no||!Z(t[r],s[r],e)))return!1;return o===i}return!1}function ct(t){let s,e;const n=new Promise((o,i)=>{s=o,e=i});return n.status="pending",n.resolve=o=>{n.status="resolved",n.value=o,s(o),t?.(o)},n.reject=o=>{n.status="rejected",e(o)},n}function J(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}function Fe(t){try{return decodeURI(t)}catch{return t.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}}function Ae(t,s){if(!t)return t;const e=/%25|%5C/gi;let n=0,o="",i;for(;(i=e.exec(t))!==null;)o+=Fe(t.slice(n,i.index))+i[0],n=e.lastIndex;return o+Fe(n?t.slice(n):t)}var Ds="Invariant failed";function K(t,s){if(!t)throw new Error(Ds)}function Bt(t){const s=new Map;let e,n;const o=i=>{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,n&&(n.next=i,i.prev=n)):(i.next.prev=void 0,e=i.next,i.next=void 0,n&&(i.prev=n,n.next=i)),n=i)};return{get(i){const r=s.get(i);if(r)return o(r),r.value},set(i,r){if(s.size>=t&&e){const c=e;s.delete(c.key),c.next&&(e=c.next,c.next.prev=void 0),c===n&&(n=void 0)}const a=s.get(i);if(a)a.value=r,o(a);else{const c={key:i,value:r,prev:n};n&&(n.next=c),n=c,e||(e=c),s.set(i,c)}},clear(){s.clear(),e=void 0,n=void 0}}}const lt=0,et=1,st=2,vt=3,js=/^([^{]*)\{\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,Ns=/^([^{]*)\{-\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,Ws=/^([^{]*)\{\$\}([^}]*)$/;function de(t,s,e=new Uint16Array(6)){const n=t.indexOf("/",s),o=n===-1?t.length:n,i=t.substring(s,o);if(!i||!i.includes("$"))return e[0]=lt,e[1]=s,e[2]=s,e[3]=o,e[4]=o,e[5]=o,e;if(i==="$"){const h=t.length;return e[0]=st,e[1]=s,e[2]=s,e[3]=h,e[4]=h,e[5]=h,e}if(i.charCodeAt(0)===36)return e[0]=et,e[1]=s,e[2]=s+1,e[3]=o,e[4]=o,e[5]=o,e;const r=i.match(Ws);if(r){const d=r[1].length;return e[0]=st,e[1]=s+d,e[2]=s+d+1,e[3]=s+d+2,e[4]=s+d+3,e[5]=t.length,e}const a=i.match(Ns);if(a){const h=a[1],d=a[2],l=a[3],u=h.length;return e[0]=vt,e[1]=s+u,e[2]=s+u+3,e[3]=s+u+3+d.length,e[4]=o-l.length,e[5]=o,e}const c=i.match(js);if(c){const h=c[1],d=c[2],l=c[3],u=h.length;return e[0]=et,e[1]=s+u,e[2]=s+u+2,e[3]=s+u+2+d.length,e[4]=o-l.length,e[5]=o,e}return e[0]=lt,e[1]=s,e[2]=s,e[3]=o,e[4]=o,e[5]=o,e}function Wt(t,s,e,n,o,i,r){r?.(e);let a=n;{const c=e.fullPath??e.from,h=c.length,d=e.options?.caseSensitive??t;for(;a_.caseSensitive===v&&_.prefix===S&&_.suffix===x);if(L)u=L;else{const _=Jt(et,e.fullPath??e.from,v,S,x);u=_,_.depth=i,_.parent=o,o.dynamic??=[],o.dynamic.push(_)}break}case vt:{const m=c.substring(f,l[1]),y=c.substring(l[4],p),v=d&&!!(m||y),S=m?v?m:m.toLowerCase():void 0,x=y?v?y:y.toLowerCase():void 0,L=o.optional?.find(_=>_.caseSensitive===v&&_.prefix===S&&_.suffix===x);if(L)u=L;else{const _=Jt(vt,e.fullPath??e.from,v,S,x);u=_,_.parent=o,_.depth=i,o.optional??=[],o.optional.push(_)}break}case st:{const m=c.substring(f,l[1]),y=c.substring(l[4],p),v=d&&!!(m||y),S=m?v?m:m.toLowerCase():void 0,x=y?v?y:y.toLowerCase():void 0,L=Jt(st,e.fullPath??e.from,v,S,x);u=L,L.parent=o,L.depth=i,o.wildcard??=[],o.wildcard.push(L)}}o=u}if((e.path||!e.children)&&!e.isRoot){const l=c.endsWith("/");l||(o.notFound=e),(!o.route||!o.isIndex&&l)&&(o.route=e,o.fullPath=e.fullPath??e.from),o.isIndex||=l}}if(e.children)for(const c of e.children)Wt(t,s,c,a,o,i,r)}function Gt(t,s){if(t.prefix&&s.prefix&&t.prefix!==s.prefix){if(t.prefix.startsWith(s.prefix))return-1;if(s.prefix.startsWith(t.prefix))return 1}if(t.suffix&&s.suffix&&t.suffix!==s.suffix){if(t.suffix.endsWith(s.suffix))return-1;if(s.suffix.endsWith(t.suffix))return 1}return t.prefix&&!s.prefix?-1:!t.prefix&&s.prefix?1:t.suffix&&!s.suffix?-1:!t.suffix&&s.suffix?1:t.caseSensitive&&!s.caseSensitive?-1:!t.caseSensitive&&s.caseSensitive?1:0}function X(t){if(t.static)for(const s of t.static.values())X(s);if(t.staticInsensitive)for(const s of t.staticInsensitive.values())X(s);if(t.dynamic?.length){t.dynamic.sort(Gt);for(const s of t.dynamic)X(s)}if(t.optional?.length){t.optional.sort(Gt);for(const s of t.optional)X(s)}if(t.wildcard?.length){t.wildcard.sort(Gt);for(const s of t.wildcard)X(s)}}function St(t){return{kind:lt,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,isIndex:!1,notFound:null}}function Jt(t,s,e,n,o){return{kind:t,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:s,parent:null,isIndex:!1,notFound:null,caseSensitive:e,prefix:n,suffix:o}}function $s(t,s){const e=St("/"),n=new Uint16Array(6);for(const o of t)Wt(!1,n,o,1,e,0);X(e),s.masksTree=e,s.flatCache=Bt(1e3)}function Us(t,s){t||="/";const e=s.flatCache.get(t);if(e)return e;const n=fe(t,s.masksTree);return s.flatCache.set(t,n),n}function Vs(t,s,e,n,o){t||="/",n||="/";const i=s?`case\0${t}`:t;let r=o.singleCache.get(i);if(!r){r=St("/");const a=new Uint16Array(6);Wt(s,a,{from:t},1,r,0),o.singleCache.set(i,r)}return fe(n,r,e)}function Ks(t,s,e=!1){const n=e?t:`nofuzz\0${t}`,o=s.matchCache.get(n);if(o!==void 0)return o;t||="/";const i=fe(t,s.segmentTree,e);return i&&(i.branch=Js(i.route)),s.matchCache.set(n,i),i}function Hs(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function qs(t,s=!1,e){const n=St(t.fullPath),o=new Uint16Array(6),i={},r={};let a=0;return Wt(s,o,t,1,n,0,h=>{if(e?.(h,a),K(!(h.id in i),`Duplicate routes found with id: ${String(h.id)}`),i[h.id]=h,a!==0&&h.path){const d=Hs(h.fullPath);(!r[d]||h.fullPath.endsWith("/"))&&(r[d]=h)}a++}),X(n),{processedTree:{segmentTree:n,singleCache:Bt(1e3),matchCache:Bt(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:r}}function fe(t,s,e=!1){const n=t.split("/"),o=Xs(t,n,s,e);if(!o)return null;const i=Gs(t,n,o),r="**"in o;return r&&(i["**"]=o["**"]),{route:r?o.node.notFound??o.node.route:o.node.route,params:i}}function Gs(t,s,e){const n=Ys(e.node);let o=null;const i={};for(let r=0,a=0,c=0;a=0;w--){const C=u.optional[w];a.push({node:C,index:f,skipped:_,depth:R,statics:m,dynamics:y,optionals:v})}if(!S)for(let w=u.optional.length-1;w>=0;w--){const C=u.optional[w],{prefix:M,suffix:I}=C;if(M||I){const F=C.caseSensitive?x:L??=x.toLowerCase();if(M&&!F.startsWith(M)||I&&!F.endsWith(I))continue}a.push({node:C,index:f+1,skipped:p,depth:R,statics:m,dynamics:y,optionals:v+1})}}if(!S&&u.dynamic&&x)for(let _=u.dynamic.length-1;_>=0;_--){const R=u.dynamic[_],{prefix:w,suffix:C}=R;if(w||C){const M=R.caseSensitive?x:L??=x.toLowerCase();if(w&&!M.startsWith(w)||C&&!M.endsWith(C))continue}a.push({node:R,index:f+1,skipped:p,depth:g+1,statics:m,dynamics:y+1,optionals:v})}if(!S&&u.staticInsensitive){const _=u.staticInsensitive.get(L??=x.toLowerCase());_&&a.push({node:_,index:f+1,skipped:p,depth:g+1,statics:m+1,dynamics:y,optionals:v})}if(!S&&u.static){const _=u.static.get(x);_&&a.push({node:_,index:f+1,skipped:p,depth:g+1,statics:m+1,dynamics:y,optionals:v})}}if(d&&c)return bt(c,d)?d:c;if(d)return d;if(c)return c;if(n&&h){let l=h.index;for(let f=0;ft.statics||s.statics===t.statics&&(s.dynamics>t.dynamics||s.dynamics===t.dynamics&&(s.optionals>t.optionals||s.optionals===t.optionals&&(s.node.isIndex>t.node.isIndex||s.node.isIndex===t.node.isIndex&&s.depth>t.depth))):!0}function It(t){return pe(t.filter(s=>s!==void 0).join("/"))}function pe(t){return t.replace(/\/{2,}/g,"/")}function es(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function Q(t){const s=t.length;return s>1&&t[s-1]==="/"?t.replace(/\/{1,}$/,""):t}function Et(t){return Q(es(t))}function zt(t,s){return t?.endsWith("/")&&t!=="/"&&t!==`${s}/`?t.slice(0,-1):t}function Zs(t,s,e){return zt(t,e)===zt(s,e)}function Qs({base:t,to:s,trailingSlash:e="never",cache:n}){const o=s.startsWith("/"),i=!o&&s===".";let r;if(n){r=o?s:i?t:t+"\0"+s;const l=n.get(r);if(l)return l}let a;if(i)a=t.split("/");else if(o)a=s.split("/");else{for(a=t.split("/");a.length>1&&Ft(a)==="";)a.pop();const l=s.split("/");for(let u=0,f=l.length;u1&&(Ft(a)===""?e==="never"&&a.pop():e==="always"&&a.push(""));let c,h="";for(let l=0;l0&&(h+="/");const u=a[l];if(!u)continue;c=de(u,0,c);const f=c[0];if(f===lt){h+=u;continue}const p=c[5],g=u.substring(0,c[1]),m=u.substring(c[4],p),y=u.substring(c[2],c[3]);f===et?h+=g||m?`${g}{$${y}}${m}`:`$${y}`:f===st?h+=g||m?`${g}{$}${m}`:"$":h+=`${g}{-$${y}}${m}`}h=pe(h);const d=h||"/";return r&&n&&n.set(r,d),d}function Yt(t,s,e){const n=s[t];return typeof n!="string"?n:t==="_splat"?encodeURI(n):tn(n,e)}function Xt({path:t,params:s,decodeCharMap:e}){let n=!1;const o={};if(!t||t==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:n};if(!t.includes("$"))return{interpolatedPath:t,usedParams:o,isMissingParams:n};const i=t.length;let r=0,a,c="";for(;r{let e;return(...n)=>{e||(e=setTimeout(()=>{t(...n),e=null},s))}};function nn(){const t=en();if(!t)return null;const s=t.getItem(Dt);let e=s?JSON.parse(s):{};return{state:e,set:n=>(e=H(n,e)||e,t.setItem(Dt,JSON.stringify(e)))}}const Ct=nn(),ae=t=>t.state.__TSR_key||t.href;function on(t){const s=[];let e;for(;e=t.parentNode;)s.push(`${t.tagName}:nth-child(${Array.prototype.indexOf.call(e.children,t)+1})`),t=e;return`${s.reverse().join(" > ")}`.toLowerCase()}let jt=!1;function ss({storageKey:t,key:s,behavior:e,shouldScrollRestoration:n,scrollToTopSelectors:o,location:i}){let r;try{r=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(h){console.error(h);return}const a=s||window.history.state?.__TSR_key,c=r[a];jt=!0;t:{if(n&&c&&Object.keys(c).length>0){for(const l in c){const u=c[l];if(l==="window")window.scrollTo({top:u.scrollY,left:u.scrollX,behavior:e});else if(l){const f=document.querySelector(l);f&&(f.scrollLeft=u.scrollX,f.scrollTop=u.scrollY)}}break t}const h=(i??window.location).hash.split("#",2)[1];if(h){const l=window.history.state?.__hashScrollIntoViewOptions??!0;if(l){const u=document.getElementById(h);u&&u.scrollIntoView(l)}break t}const d={top:0,left:0,behavior:e};if(window.scrollTo(d),o)for(const l of o){if(l==="window")continue;const u=typeof l=="function"?l():document.querySelector(l);u&&u.scrollTo(d)}}jt=!1}function rn(t,s){if(!Ct&&!t.isServer||((t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),t.isServer||t.isScrollRestorationSetup||!Ct))return;t.isScrollRestorationSetup=!0,jt=!1;const n=t.options.getScrollRestorationKey||ae;window.history.scrollRestoration="manual";const o=i=>{if(jt||!t.isScrollRestoring)return;let r="";if(i.target===document||i.target===window)r="window";else{const c=i.target.getAttribute("data-scroll-restoration-id");c?r=`[data-scroll-restoration-id="${c}"]`:r=on(i.target)}const a=n(t.state.location);Ct.set(c=>{const h=c[a]||={},d=h[r]||={};if(r==="window")d.scrollX=window.scrollX||0,d.scrollY=window.scrollY||0;else if(r){const l=document.querySelector(r);l&&(d.scrollX=l.scrollLeft||0,d.scrollY=l.scrollTop||0)}return c})};typeof document<"u"&&document.addEventListener("scroll",sn(o,100),!0),t.subscribe("onRendered",i=>{const r=n(i.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation})||(ss({storageKey:Dt,key:r,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&Ct.set(a=>(a[r]||={},a)))})}function an(t){if(typeof document<"u"&&document.querySelector){const s=t.state.location.state.__hashScrollIntoViewOptions??!0;if(s&&t.state.location.hash!==""){const e=document.getElementById(t.state.location.hash);e&&e.scrollIntoView(s)}}}function cn(t,s=String){const e=new URLSearchParams;for(const n in t){const o=t[n];o!==void 0&&e.set(n,s(o))}return e.toString()}function Zt(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function ln(t){const s=new URLSearchParams(t),e={};for(const[n,o]of s.entries()){const i=e[n];i==null?e[n]=Zt(o):Array.isArray(i)?i.push(Zt(o)):e[n]=[i,Zt(o)]}return e}const un=dn(JSON.parse),hn=fn(JSON.stringify,JSON.parse);function dn(t){return s=>{s[0]==="?"&&(s=s.substring(1));const e=ln(s);for(const n in e){const o=e[n];if(typeof o=="string")try{e[n]=t(o)}catch{}}return e}}function fn(t,s){const e=typeof s=="function";function n(o){if(typeof o=="object"&&o!==null)try{return t(o)}catch{}else if(e&&typeof o=="string")try{return s(o),t(o)}catch{}return o}return o=>{const i=cn(o,n);return i?`?${i}`:""}}const B="__root__";function pn(t){if(t.statusCode=t.statusCode||t.code||307,!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}const s=new Headers(t.headers);t.href&&s.get("Location")===null&&s.set("Location",t.href);const e=new Response(null,{status:t.statusCode,headers:s});if(e.options=t,t.throw)throw e;return e}function $(t){return t instanceof Response&&!!t.options}const kt=t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},$t=(t,s)=>!!(t.preload&&!t.router.state.matches.some(e=>e.id===s)),ns=(t,s)=>{const e=t.router.routesById[s.routeId??""]??t.router.routeTree;!e.options.notFoundComponent&&t.router.options?.defaultNotFoundComponent&&(e.options.notFoundComponent=t.router.options.defaultNotFoundComponent),K(e.options.notFoundComponent);const n=t.matches.find(o=>o.routeId===e.id);K(n,"Could not find match for route: "+e.id),t.updateMatch(n.id,o=>({...o,status:"notFound",error:s,isFetching:!1})),s.routerCode==="BEFORE_LOAD"&&e.parentRoute&&(s.routeId=e.parentRoute.id,ns(t,s))},q=(t,s,e)=>{if(!(!$(e)&&!D(e))){if($(e)&&e.redirectHandled&&!e.options.reloadDocument)throw e;if(s){s._nonReactive.beforeLoadPromise?.resolve(),s._nonReactive.loaderPromise?.resolve(),s._nonReactive.beforeLoadPromise=void 0,s._nonReactive.loaderPromise=void 0;const n=$(e)?"redirected":"notFound";s._nonReactive.error=e,t.updateMatch(s.id,o=>({...o,status:n,isFetching:!1,error:e})),D(e)&&!e.routeId&&(e.routeId=s.routeId),s._nonReactive.loadPromise?.resolve()}throw $(e)?(t.rendered=!0,e.options._fromLocation=t.location,e.redirectHandled=!0,e=t.router.resolveRedirect(e),e):(ns(t,e),e)}},os=(t,s)=>{const e=t.router.getMatch(s);return!!(!t.router.isServer&&e._nonReactive.dehydrated||t.router.isServer&&e.ssr===!1)},ht=(t,s,e,n)=>{const{id:o,routeId:i}=t.matches[s],r=t.router.looseRoutesById[i];if(e instanceof Promise)throw e;e.routerCode=n,t.firstBadMatchIndex??=s,q(t,t.router.getMatch(o),e);try{r.options.onError?.(e)}catch(a){e=a,q(t,t.router.getMatch(o),e)}t.updateMatch(o,a=>(a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,a._nonReactive.loadPromise?.resolve(),{...a,error:e,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},mn=(t,s,e,n)=>{const o=t.router.getMatch(s),i=t.matches[e-1]?.id,r=i?t.router.getMatch(i):void 0;if(t.router.isShell()){o.ssr=n.id===B;return}if(r?.ssr===!1){o.ssr=!1;return}const a=f=>f===!0&&r?.ssr==="data-only"?"data-only":f,c=t.router.options.defaultSsr??!0;if(n.options.ssr===void 0){o.ssr=a(c);return}if(typeof n.options.ssr!="function"){o.ssr=a(n.options.ssr);return}const{search:h,params:d}=o,l={search:Lt(h,o.searchError),params:Lt(d,o.paramsError),location:t.location,matches:t.matches.map(f=>({index:f.index,pathname:f.pathname,fullPath:f.fullPath,staticData:f.staticData,id:f.id,routeId:f.routeId,search:Lt(f.search,f.searchError),params:Lt(f.params,f.paramsError),ssr:f.ssr}))},u=n.options.ssr(l);if(J(u))return u.then(f=>{o.ssr=a(f??c)});o.ssr=a(u??c)},is=(t,s,e,n)=>{if(n._nonReactive.pendingTimeout!==void 0)return;const o=e.options.pendingMs??t.router.options.defaultPendingMs;if(!!(t.onReady&&!t.router.isServer&&!$t(t,s)&&(e.options.loader||e.options.beforeLoad||cs(e))&&typeof o=="number"&&o!==1/0&&(e.options.pendingComponent??t.router.options?.defaultPendingComponent))){const r=setTimeout(()=>{kt(t)},o);n._nonReactive.pendingTimeout=r}},gn=(t,s,e)=>{const n=t.router.getMatch(s);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;is(t,s,e,n);const o=()=>{const i=t.router.getMatch(s);i.preload&&(i.status==="redirected"||i.status==="notFound")&&q(t,i,i.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(o):o()},yn=(t,s,e,n)=>{const o=t.router.getMatch(s),i=o._nonReactive.loadPromise;o._nonReactive.loadPromise=ct(()=>{i?.resolve()});const{paramsError:r,searchError:a}=o;r&&ht(t,e,r,"PARSE_PARAMS"),a&&ht(t,e,a,"VALIDATE_SEARCH"),is(t,s,n,o);const c=new AbortController,h=t.matches[e-1]?.id,u={...(h?t.router.getMatch(h):void 0)?.context??t.router.options.context??void 0,...o.__routeContext};let f=!1;const p=()=>{f||(f=!0,t.updateMatch(s,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:c,context:u})))},g=()=>{o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,t.updateMatch(s,R=>({...R,isFetching:!1}))};if(!n.options.beforeLoad){gt(()=>{p(),g()});return}o._nonReactive.beforeLoadPromise=ct();const{search:m,params:y,cause:v}=o,S=$t(t,s),x={search:m,abortController:c,params:y,preload:S,context:u,location:t.location,navigate:R=>t.router.navigate({...R,_fromLocation:t.location}),buildLocation:t.router.buildLocation,cause:S?"preload":v,matches:t.matches,...t.router.options.additionalContext},L=R=>{if(R===void 0){gt(()=>{p(),g()});return}($(R)||D(R))&&(p(),ht(t,e,R,"BEFORE_LOAD")),gt(()=>{p(),t.updateMatch(s,w=>({...w,__beforeLoadContext:R,context:{...w.context,...R}})),g()})};let _;try{if(_=n.options.beforeLoad(x),J(_))return p(),_.catch(R=>{ht(t,e,R,"BEFORE_LOAD")}).then(L)}catch(R){p(),ht(t,e,R,"BEFORE_LOAD")}L(_)},vn=(t,s)=>{const{id:e,routeId:n}=t.matches[s],o=t.router.looseRoutesById[n],i=()=>{if(t.router.isServer){const c=mn(t,e,s,o);if(J(c))return c.then(a)}return a()},r=()=>yn(t,e,s,o),a=()=>{if(os(t,e))return;const c=gn(t,e,o);return J(c)?c.then(r):r()};return i()},yt=(t,s,e)=>{const n=t.router.getMatch(s);if(!n||!e.options.head&&!e.options.scripts&&!e.options.headers)return;const o={matches:t.matches,match:n,params:n.params,loaderData:n.loaderData};return Promise.all([e.options.head?.(o),e.options.scripts?.(o),e.options.headers?.(o)]).then(([i,r,a])=>{const c=i?.meta,h=i?.links,d=i?.scripts,l=i?.styles;return{meta:c,links:h,headScripts:d,headers:a,scripts:r,styles:l}})},rs=(t,s,e,n)=>{const o=t.matchPromises[e-1],{params:i,loaderDeps:r,abortController:a,cause:c}=t.router.getMatch(s);let h=t.router.options.context??{};for(let l=0;l<=e;l++){const u=t.matches[l];if(!u)continue;const f=t.router.getMatch(u.id);f&&(h={...h,...f.__routeContext??{},...f.__beforeLoadContext??{}})}const d=$t(t,s);return{params:i,deps:r,preload:!!d,parentMatchPromise:o,abortController:a,context:h,location:t.location,navigate:l=>t.router.navigate({...l,_fromLocation:t.location}),cause:d?"preload":c,route:n,...t.router.options.additionalContext}},Be=async(t,s,e,n)=>{try{const o=t.router.getMatch(s);try{(!t.router.isServer||o.ssr===!0)&&as(n);const i=n.options.loader?.(rs(t,s,e,n)),r=n.options.loader&&J(i);if(!!(r||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||o._nonReactive.minPendingPromise)&&t.updateMatch(s,l=>({...l,isFetching:"loader"})),n.options.loader){const l=r?await i:i;q(t,t.router.getMatch(s),l),l!==void 0&&t.updateMatch(s,u=>({...u,loaderData:l}))}n._lazyPromise&&await n._lazyPromise;const c=yt(t,s,n),h=c?await c:void 0,d=o._nonReactive.minPendingPromise;d&&await d,n._componentsPromise&&await n._componentsPromise,t.updateMatch(s,l=>({...l,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...h}))}catch(i){let r=i;const a=o._nonReactive.minPendingPromise;a&&await a,D(i)&&await n.options.notFoundComponent?.preload?.(),q(t,t.router.getMatch(s),i);try{n.options.onError?.(i)}catch(d){r=d,q(t,t.router.getMatch(s),d)}const c=yt(t,s,n),h=c?await c:void 0;t.updateMatch(s,d=>({...d,error:r,status:"error",isFetching:!1,...h}))}}catch(o){const i=t.router.getMatch(s);if(i){const r=yt(t,s,n);if(r){const a=await r;t.updateMatch(s,c=>({...c,...a}))}i._nonReactive.loaderPromise=void 0}q(t,i,o)}},Sn=async(t,s)=>{const{id:e,routeId:n}=t.matches[s];let o=!1,i=!1;const r=t.router.looseRoutesById[n];if(os(t,e)){if(t.router.isServer){const h=yt(t,e,r);if(h){const d=await h;t.updateMatch(e,l=>({...l,...d}))}return t.router.getMatch(e)}}else{const h=t.router.getMatch(e);if(h._nonReactive.loaderPromise){if(h.status==="success"&&!t.sync&&!h.preload)return h;await h._nonReactive.loaderPromise;const d=t.router.getMatch(e),l=d._nonReactive.error||d.error;l&&q(t,d,l)}else{const d=Date.now()-h.updatedAt,l=$t(t,e),u=l?r.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:r.options.staleTime??t.router.options.defaultStaleTime??0,f=r.options.shouldReload,p=typeof f=="function"?f(rs(t,e,s,r)):f,g=!!l&&!t.router.state.matches.some(S=>S.id===e),m=t.router.getMatch(e);m._nonReactive.loaderPromise=ct(),g!==m.preload&&t.updateMatch(e,S=>({...S,preload:g}));const{status:y,invalid:v}=m;if(o=y==="success"&&(v||(p??d>u)),!(l&&r.options.preload===!1))if(o&&!t.sync)i=!0,(async()=>{try{await Be(t,e,s,r);const S=t.router.getMatch(e);S._nonReactive.loaderPromise?.resolve(),S._nonReactive.loadPromise?.resolve(),S._nonReactive.loaderPromise=void 0}catch(S){$(S)&&await t.router.navigate(S.options)}})();else if(y!=="success"||o&&t.sync)await Be(t,e,s,r);else{const S=yt(t,e,r);if(S){const x=await S;t.updateMatch(e,L=>({...L,...x}))}}}}const a=t.router.getMatch(e);i||(a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loadPromise?.resolve()),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0,i||(a._nonReactive.loaderPromise=void 0),a._nonReactive.dehydrated=void 0;const c=i?a.isFetching:!1;return c!==a.isFetching||a.invalid!==!1?(t.updateMatch(e,h=>({...h,isFetching:c,invalid:!1})),t.router.getMatch(e)):a};async function ze(t){const s=Object.assign(t,{matchPromises:[]});!s.router.isServer&&s.router.state.matches.some(e=>e._forcePending)&&kt(s);try{for(let o=0;o{const{id:e,...n}=s.options;Object.assign(t.options,n),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0),!t._componentsLoaded&&t._componentsPromise===void 0){const s=()=>{const e=[];for(const n of ls){const o=t.options[n]?.preload;o&&e.push(o())}if(e.length)return Promise.all(e).then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0});t._componentsLoaded=!0,t._componentsPromise=void 0};t._componentsPromise=t._lazyPromise?t._lazyPromise.then(s):s()}return t._componentsPromise}function Lt(t,s){return s?{status:"error",error:s}:{status:"success",value:t}}function cs(t){for(const s of ls)if(t.options[s]?.preload)return!0;return!1}const ls=["component","errorComponent","pendingComponent","notFoundComponent"];function _n(t){return{input:({url:s})=>{for(const e of t)s=us(e,s);return s},output:({url:s})=>{for(let e=t.length-1;e>=0;e--)s=hs(t[e],s);return s}}}function wn(t){const s=Et(t.basepath),e=`/${s}`,n=`${e}/`,o=t.caseSensitive?e:e.toLowerCase(),i=t.caseSensitive?n:n.toLowerCase();return{input:({url:r})=>{const a=t.caseSensitive?r.pathname:r.pathname.toLowerCase();return a===o?r.pathname="/":a.startsWith(i)&&(r.pathname=r.pathname.slice(e.length)),r},output:({url:r})=>(r.pathname=It(["/",s,r.pathname]),r)}}function us(t,s){const e=t?.input?.({url:s});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return s}function hs(t,s){const e=t?.output?.({url:s});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return s}function tt(t){const s=t.resolvedLocation,e=t.location,n=s?.pathname!==e.pathname,o=s?.href!==e.href,i=s?.hash!==e.hash;return{fromLocation:s,toLocation:e,pathChanged:n,hrefChanged:o,hashChanged:i}}class Rn{constructor(s){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const n=this.options,o=this.basepath??n?.basepath??"/",i=this.basepath===void 0,r=n?.rewrite;this.options={...n,...e},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(u=>[encodeURIComponent(u),u])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=As())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new Os(Pn(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(u=>!["redirected"].includes(u.status))}}}),rn(this));let a=!1;const c=this.options.basepath??"/",h=this.options.rewrite;if(i||o!==c||r!==h){this.basepath=c;const u=[];Et(c)!==""&&u.push(wn({basepath:c})),h&&u.push(h),this.rewrite=u.length===0?void 0:u.length===1?u[0]:_n(u),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:e,routesByPath:n,processedTree:o}=qs(this.routeTree,this.options.caseSensitive,(r,a)=>{r.init({originalIndex:a})});this.options.routeMasks&&$s(this.options.routeMasks,o),this.routesById=e,this.routesByPath=n,this.processedTree=o;const i=this.options.notFoundRoute;i&&(i.init({originalIndex:99999999999}),this.routesById[i.id]=i)},this.subscribe=(e,n)=>{const o={eventType:e,fn:n};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=e=>{this.subscribers.forEach(n=>{n.eventType===e.type&&n.fn(e)})},this.parseLocation=(e,n)=>{const o=({href:c,state:h})=>{const d=new URL(c,this.origin),l=us(this.rewrite,d),u=this.options.parseSearch(l.search),f=this.options.stringifySearch(u);l.search=f;const p=l.href.replace(l.origin,""),{pathname:g,hash:m}=l;return{href:p,publicHref:c,url:l.href,pathname:Ae(g),searchStr:f,search:z(n?.search,u),hash:m.split("#").reverse()[0]??"",state:z(n?.state,h)}},i=o(e),{__tempLocation:r,__tempKey:a}=i.state;if(r&&(!a||a===this.tempLocationKey)){const c=o(r);return c.state.key=i.state.key,c.state.__TSR_key=i.state.__TSR_key,delete c.state.__tempLocation,{...c,maskedLocation:i}}return i},this.resolvePathCache=Bt(1e3),this.resolvePathWithBase=(e,n)=>Qs({base:e,to:pe(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,n,o)=>typeof e=="string"?this.matchRoutesInternal({pathname:e,search:n},o):this.matchRoutesInternal(e,n),this.getMatchedRoutes=e=>bn({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{const n=this.getMatch(e);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const e=this.state.matches.filter(i=>i.status==="pending"),n=this.state.matches.filter(i=>i.isFetching==="loader");new Set([...this.state.pendingMatches??[],...e,...n]).forEach(i=>{this.cancelMatch(i.id)})},this.buildLocation=e=>{const n=(i={})=>{const r=i._fromLocation||this.pendingBuiltLocation||this.latestLocation,a=this.matchRoutes(r,{_buildLocation:!0}),c=Ft(a);i.from;const h=i.unsafeRelative==="path"?r.pathname:i.from??c.fullPath,d=this.resolvePathWithBase(h,"."),l=c.search,u={...c.params},f=i.to?this.resolvePathWithBase(d,`${i.to}`):this.resolvePathWithBase(d,"."),p=i.params===!1||i.params===null?{}:(i.params??!0)===!0?u:Object.assign(u,H(i.params,u)),g=Xt({path:f,params:p}).interpolatedPath,m=this.matchRoutes(g,void 0,{_buildLocation:!0}).map(M=>this.looseRoutesById[M.routeId]);if(Object.keys(p).length>0)for(const M of m){const I=M.options.params?.stringify??M.options.stringifyParams;I&&Object.assign(p,I(p))}const y=e.leaveParams?f:Ae(Xt({path:f,params:p,decodeCharMap:this.pathParamsDecodeCharMap}).interpolatedPath);let v=l;if(e._includeValidateSearch&&this.options.search?.strict){const M={};m.forEach(I=>{if(I.options.validateSearch)try{Object.assign(M,ce(I.options.validateSearch,{...M,...v}))}catch{}}),v=M}v=Cn({search:v,dest:i,destRoutes:m,_includeValidateSearch:e._includeValidateSearch}),v=z(l,v);const S=this.options.stringifySearch(v),x=i.hash===!0?r.hash:i.hash?H(i.hash,r.hash):void 0,L=x?`#${x}`:"";let _=i.state===!0?r.state:i.state?H(i.state,r.state):{};_=z(r.state,_);const R=`${y}${S}${L}`,w=new URL(R,this.origin),C=hs(this.rewrite,w);return{publicHref:C.pathname+C.search+C.hash,href:R,url:C.href,pathname:y,search:v,searchStr:S,state:_,hash:x??"",unmaskOnReload:i.unmaskOnReload}},o=(i={},r)=>{const a=n(i);let c=r?n(r):void 0;if(!c){const h={};if(this.options.routeMasks){const d=Us(a.pathname,this.processedTree);if(d){Object.assign(h,d.params);const{from:l,params:u,...f}=d.route,p=u===!1||u===null?{}:(u??!0)===!0?h:Object.assign(h,H(u,h));r={from:e.from,...f,params:p},c=n(r)}}}return c&&(a.maskedLocation=c),a};return e.mask?o(e,{from:e.from,...e.mask}):o(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:n,...o})=>{const i=()=>{const c=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];c.forEach(d=>{o.state[d]=this.latestLocation.state[d]});const h=Z(o.state,this.latestLocation.state);return c.forEach(d=>{delete o.state[d]}),h},r=Q(this.latestLocation.href)===Q(o.href),a=this.commitLocationPromise;if(this.commitLocationPromise=ct(()=>{a?.resolve()}),r&&i())this.load();else{let{maskedLocation:c,hashScrollIntoView:h,...d}=o;c&&(d={...c,state:{...c.state,__tempKey:void 0,__tempLocation:{...d,search:d.searchStr,state:{...d.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(d.unmaskOnReload??this.options.unmaskOnReload??!1)&&(d.state.__tempKey=this.tempLocationKey)),d.state.__hashScrollIntoViewOptions=h??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[o.replace?"replace":"push"](d.publicHref,d.state,{ignoreBlocker:n})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:n,hashScrollIntoView:o,viewTransition:i,ignoreBlocker:r,href:a,...c}={})=>{if(a){const l=this.history.location.state.__TSR_index,u=Ot(a,{__TSR_index:e?l:l+1});c.to=u.pathname,c.search=this.options.parseSearch(u.search),c.hash=u.hash.slice(1)}const h=this.buildLocation({...c,_includeValidateSearch:!0});this.pendingBuiltLocation=h;const d=this.commitLocation({...h,viewTransition:i,replace:e,resetScroll:n,hashScrollIntoView:o,ignoreBlocker:r});return Promise.resolve().then(()=>{this.pendingBuiltLocation===h&&(this.pendingBuiltLocation=void 0)}),d},this.navigate=async({to:e,reloadDocument:n,href:o,...i})=>{if(!n&&o)try{new URL(`${o}`),n=!0}catch{}if(n){if(o||(o=this.buildLocation({to:e,...i}).url),!i.ignoreBlocker){const a=this.history.getBlockers?.()??[];for(const c of a)if(c?.blockerFn&&await c.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return i.replace?window.location.replace(o):window.location.href=o,Promise.resolve()}return this.buildAndCommitLocation({...i,href:o,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const n=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),o=i=>{try{return encodeURI(decodeURI(i))}catch{return i}};if(Et(o(this.latestLocation.href))!==Et(o(n.href))){let i=n.url;throw this.origin&&i.startsWith(this.origin)&&(i=i.replace(this.origin,"")||"/"),pn({href:i})}}const e=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:n.cachedMatches.filter(o=>!e.some(i=>i.id===o.id))}))},this.load=async e=>{let n,o,i;for(i=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();const c=this.latestLocation,h=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...tt({resolvedLocation:h,location:c})}),this.emit({type:"onBeforeLoad",...tt({resolvedLocation:h,location:c})}),await ze({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:c,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let d=[],l=[],u=[];gt(()=>{this.__store.setState(f=>{const p=f.matches,g=f.pendingMatches||f.matches;return d=p.filter(m=>!g.some(y=>y.id===m.id)),l=g.filter(m=>!p.some(y=>y.id===m.id)),u=g.filter(m=>p.some(y=>y.id===m.id)),{...f,isLoading:!1,loadedAt:Date.now(),matches:g,pendingMatches:void 0,cachedMatches:[...f.cachedMatches,...d.filter(m=>m.status!=="error"&&m.status!=="notFound")]}}),this.clearExpiredCache()}),[[d,"onLeave"],[l,"onEnter"],[u,"onStay"]].forEach(([f,p])=>{f.forEach(g=>{this.looseRoutesById[g.routeId].options[p]?.(g)})})})})}})}catch(c){$(c)?(n=c,this.isServer||this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):D(c)&&(o=c),this.__store.setState(h=>({...h,statusCode:n?n.status:o?404:h.matches.some(d=>d.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let r;this.hasNotFoundMatch()?r=404:this.__store.state.matches.some(a=>a.status==="error")&&(r=500),r!==void 0&&this.__store.setState(a=>({...a,statusCode:r}))},this.startViewTransition=e=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let o;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const i=this.latestLocation,r=this.state.resolvedLocation,a=typeof n.types=="function"?n.types(tt({resolvedLocation:r,location:i})):n.types;if(a===!1){e();return}o={update:e,types:a}}else o=e;document.startViewTransition(o)}else e()},this.updateMatch=(e,n)=>{this.startTransition(()=>{const o=this.state.pendingMatches?.some(i=>i.id===e)?"pendingMatches":this.state.matches.some(i=>i.id===e)?"matches":this.state.cachedMatches.some(i=>i.id===e)?"cachedMatches":"";o&&this.__store.setState(i=>({...i,[o]:i[o]?.map(r=>r.id===e?n(r):r)}))})},this.getMatch=e=>{const n=o=>o.id===e;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=e=>{const n=o=>e?.filter?.(o)??!0?{...o,invalid:!0,...e?.forcePending||o.status==="error"||o.status==="notFound"?{status:"pending",error:void 0}:void 0}:o;return this.__store.setState(o=>({...o,matches:o.matches.map(n),cachedMatches:o.cachedMatches.map(n),pendingMatches:o.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{if(!e.options.href){const n=this.buildLocation(e.options);let o=n.url;this.origin&&o.startsWith(this.origin)&&(o=o.replace(this.origin,"")||"/"),e.options.href=n.href,e.headers.set("Location",o)}return e.headers.get("Location")||e.headers.set("Location",e.options.href),e},this.clearCache=e=>{const n=e?.filter;n!==void 0?this.__store.setState(o=>({...o,cachedMatches:o.cachedMatches.filter(i=>!n(i))})):this.__store.setState(o=>({...o,cachedMatches:[]}))},this.clearExpiredCache=()=>{const e=n=>{const o=this.looseRoutesById[n.routeId];if(!o.options.loader)return!0;const i=(n.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=i};this.clearCache({filter:e})},this.loadRouteChunk=as,this.preloadRoute=async e=>{const n=this.buildLocation(e);let o=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:e});const i=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(a=>a.id)),r=new Set([...i,...this.state.cachedMatches.map(a=>a.id)]);gt(()=>{o.forEach(a=>{r.has(a.id)||this.__store.setState(c=>({...c,cachedMatches:[...c.cachedMatches,a]}))})});try{return o=await ze({router:this,matches:o,location:n,preload:!0,updateMatch:(a,c)=>{i.has(a)?o=o.map(h=>h.id===a?c(h):h):this.updateMatch(a,c)}}),o}catch(a){if($(a))return a.options.reloadDocument?void 0:await this.preloadRoute({...a.options,_fromLocation:n});D(a)||console.error(a);return}},this.matchRoute=(e,n)=>{const o={...e,to:e.to?this.resolvePathWithBase(e.from||"",e.to):void 0,params:e.params||{},leaveParams:!0},i=this.buildLocation(o);if(n?.pending&&this.state.status!=="pending")return!1;const a=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,c=Vs(i.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,a.pathname,this.processedTree);return!c||e.params&&!Z(c.params,e.params,{partial:!0})?!1:n?.includeSearch??!0?Z(a.search,i.search,{partial:!0})?c.params:!1:c.params},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status==="notFound"||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...s,caseSensitive:s.caseSensitive??!1,notFoundMode:s.notFoundMode??"fuzzy",stringifySearch:s.stringifySearch??hn,parseSearch:s.parseSearch??un}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(s,e){const n=this.getMatchedRoutes(s.pathname),{foundRoute:o,routeParams:i}=n;let{matchedRoutes:r}=n,a=!1;(o?o.path!=="/"&&i["**"]:Q(s.pathname))&&(this.options.notFoundRoute?r=[...r,this.options.notFoundRoute]:a=!0);const c=(()=>{if(a){if(this.options.notFoundMode!=="root")for(let l=r.length-1;l>=0;l--){const u=r[l];if(u.children)return u.id}return B}})(),h=[],d=l=>l?.id?l.context??this.options.context??void 0:this.options.context??void 0;return r.forEach((l,u)=>{const f=h[u-1],[p,g,m]=(()=>{const A=f?.search??s.search,j=f?._strictSearch??void 0;try{const N=ce(l.options.validateSearch,{...A})??void 0;return[{...A,...N},{...j,...N},void 0]}catch(N){let nt=N;if(N instanceof Nt||(nt=new Nt(N.message,{cause:N})),e?.throwOnError)throw nt;return[A,{},nt]}})(),y=l.options.loaderDeps?.({search:p})??"",v=y?JSON.stringify(y):"",{interpolatedPath:S,usedParams:x}=Xt({path:l.fullPath,params:i,decodeCharMap:this.pathParamsDecodeCharMap}),L=l.id+S+v,_=this.getMatch(L),R=this.state.matches.find(A=>A.routeId===l.id),w=_?._strictParams??x;let C;if(!_){const A=l.options.params?.parse??l.options.parseParams;if(A)try{Object.assign(w,A(w))}catch(j){if(D(j)||$(j)?C=j:C=new xn(j.message,{cause:j}),e?.throwOnError)throw C}}Object.assign(i,w);const M=R?"stay":"enter";let I;if(_)I={..._,cause:M,params:R?z(R.params,i):i,_strictParams:w,search:z(R?R.search:_.search,p),_strictSearch:g};else{const A=l.options.loader||l.options.beforeLoad||l.lazyFn||cs(l)?"pending":"success";I={id:L,ssr:this.isServer?void 0:l.options.ssr,index:u,routeId:l.id,params:R?z(R.params,i):i,_strictParams:w,pathname:S,updatedAt:Date.now(),search:R?z(R.search,p):p,_strictSearch:g,searchError:void 0,status:A,isFetching:!1,error:void 0,paramsError:C,__routeContext:void 0,_nonReactive:{loadPromise:ct()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:M,loaderDeps:R?z(R.loaderDeps,y):y,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:l.options.staticData||{},fullPath:l.fullPath}}e?.preload||(I.globalNotFound=c===l.id),I.searchError=m;const F=d(f);I.context={...F,...I.__routeContext,...I.__beforeLoadContext},h.push(I)}),h.forEach((l,u)=>{const f=this.looseRoutesById[l.routeId];if(!this.getMatch(l.id)&&e?._buildLocation!==!0){const g=h[u-1],m=d(g);if(f.options.context){const y={deps:l.loaderDeps,params:l.params,context:m??{},location:s,navigate:v=>this.navigate({...v,_fromLocation:s}),buildLocation:this.buildLocation,cause:l.cause,abortController:l.abortController,preload:!!l.preload,matches:h};l.__routeContext=f.options.context(y)??void 0}l.context={...m,...l.__routeContext,...l.__beforeLoadContext}}}),h}}class Nt extends Error{}class xn extends Error{}function Pn(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function ce(t,s){if(t==null)return{};if("~standard"in t){const e=t["~standard"].validate(s);if(e instanceof Promise)throw new Nt("Async validation not supported");if(e.issues)throw new Nt(JSON.stringify(e.issues,void 0,2),{cause:e});return e.value}return"parse"in t?t.parse(s):typeof t=="function"?t(s):{}}function bn({pathname:t,routesById:s,processedTree:e}){const n={},o=Q(t);let i;const r=Ks(o,e,!0);return r&&(i=r.route,Object.assign(n,r.params)),{matchedRoutes:r?.branch||[s[B]],routeParams:n,foundRoute:i}}function Cn({search:t,dest:s,destRoutes:e,_includeValidateSearch:n}){const o=e.reduce((a,c)=>{const h=[];if("search"in c.options)c.options.search?.middlewares&&h.push(...c.options.search.middlewares);else if(c.options.preSearchFilters||c.options.postSearchFilters){const d=({search:l,next:u})=>{let f=l;"preSearchFilters"in c.options&&c.options.preSearchFilters&&(f=c.options.preSearchFilters.reduce((g,m)=>m(g),l));const p=u(f);return"postSearchFilters"in c.options&&c.options.postSearchFilters?c.options.postSearchFilters.reduce((g,m)=>m(g),p):p};h.push(d)}if(n&&c.options.validateSearch){const d=({search:l,next:u})=>{const f=u(l);try{return{...f,...ce(c.options.validateSearch,f)??void 0}}catch{return f}};h.push(d)}return a.concat(h)},[])??[],i=({search:a})=>s.search?s.search===!0?a:H(s.search,a):{};o.push(i);const r=(a,c)=>{if(a>=o.length)return c;const h=o[a];return h({search:c,next:l=>r(a+1,l)})};return r(0,t)}const Ln="Error preloading route! ☝️";class ds{constructor(s){if(this.init=e=>{this.originalIndex=e.originalIndex;const n=this.options,o=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),o?this._path=B:this.parentRoute||K(!1);let i=o?B:n?.path;i&&i!=="/"&&(i=es(i));const r=n?.id||i;let a=o?B:It([this.parentRoute.id===B?"":this.parentRoute.id,r]);i===B&&(i="/"),a!==B&&(a=It(["/",a]));const c=a===B?"/":It([this.parentRoute.fullPath,i]);this._path=i,this._id=a,this._fullPath=c,this._to=c},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e=="object"&&e!==null&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=s||{},this.isRoot=!s?.getParentRoute,s?.id&&s?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Mn extends ds{constructor(s){super(s)}}function me(t){const s=t.errorComponent??Ut;return P.jsx(In,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:e,reset:n})=>e?b.createElement(s,{error:e,reset:n}):t.children})}class In extends b.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(s){return{resetKey:s.getResetKey()}}static getDerivedStateFromError(s){return{error:s}}reset(){this.setState({error:null})}componentDidUpdate(s,e){e.error&&e.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(s,e){this.props.onCatch&&this.props.onCatch(s,e)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Ut({error:t}){const[s,e]=b.useState(!1);return P.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[P.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[P.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),P.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>e(n=>!n),children:s?"Hide Error":"Show Error"})]}),P.jsx("div",{style:{height:".25rem"}}),s?P.jsx("div",{children:P.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?P.jsx("code",{children:t.message}):null})}):null]})}function En({children:t,fallback:s=null}){return kn()?P.jsx(at.Fragment,{children:t}):P.jsx(at.Fragment,{children:s})}function kn(){return at.useSyncExternalStore(Tn,()=>!0,()=>!1)}function Tn(){return()=>{}}var Qt={exports:{}},te={},ee={exports:{}},se={};var De;function On(){if(De)return se;De=1;var t=le();function s(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var e=typeof Object.is=="function"?Object.is:s,n=t.useState,o=t.useEffect,i=t.useLayoutEffect,r=t.useDebugValue;function a(l,u){var f=u(),p=n({inst:{value:f,getSnapshot:u}}),g=p[0].inst,m=p[1];return i(function(){g.value=f,g.getSnapshot=u,c(g)&&m({inst:g})},[l,f,u]),o(function(){return c(g)&&m({inst:g}),l(function(){c(g)&&m({inst:g})})},[l]),r(f),f}function c(l){var u=l.getSnapshot;l=l.value;try{var f=u();return!e(l,f)}catch{return!0}}function h(l,u){return u()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:a;return se.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,se}var je;function Fn(){return je||(je=1,ee.exports=On()),ee.exports}var Ne;function An(){if(Ne)return te;Ne=1;var t=le(),s=Fn();function e(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var n=typeof Object.is=="function"?Object.is:e,o=s.useSyncExternalStore,i=t.useRef,r=t.useEffect,a=t.useMemo,c=t.useDebugValue;return te.useSyncExternalStoreWithSelector=function(h,d,l,u,f){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function y(_){if(!v){if(v=!0,S=_,_=u(_),f!==void 0&&g.hasValue){var R=g.value;if(f(R,_))return x=R}return x=_}if(R=x,n(S,_))return R;var w=u(_);return f!==void 0&&f(R,w)?(S=_,R):(S=_,x=w)}var v=!1,S,x,L=l===void 0?null:l;return[function(){return y(d())},L===null?void 0:function(){return y(L())}]},[d,l,u,f]);var m=o(h,p[0],p[1]);return r(function(){g.hasValue=!0,g.value=m},[m]),c(m),m},te}var We;function Bn(){return We||(We=1,Qt.exports=An()),Qt.exports}var fs=Bn();const Lo=ue(fs);function zn(t,s=n=>n,e={}){const n=e.equal??Dn;return fs.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,s,n)}function Dn(t,s){if(Object.is(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(const[n,o]of t)if(!s.has(n)||!Object.is(o,s.get(n)))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(const n of t)if(!s.has(n))return!1;return!0}if(t instanceof Date&&s instanceof Date)return t.getTime()===s.getTime();const e=$e(t);if(e.length!==$e(s).length)return!1;for(let n=0;n"u"?ne:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=ne,ne)}function O(t){const s=b.useContext(ps());return t?.warn,s}function T(t){const s=O({warn:t?.router===void 0}),e=t?.router||s,n=b.useRef(void 0);return zn(e.__store,o=>{if(t?.select){if(t.structuralSharing??e.options.defaultStructuralSharing){const i=z(n.current,t.select(o));return n.current=i,i}return t.select(o)}return o})}const Vt=b.createContext(void 0),jn=b.createContext(void 0);function U(t){const s=b.useContext(t.from?jn:Vt);return T({select:n=>{const o=n.matches.find(i=>t.from?t.from===i.routeId:i.id===s);if(K(!((t.shouldThrow??!0)&&!o),`Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`),o!==void 0)return t.select?t.select(o):o},structuralSharing:t.structuralSharing})}function ge(t){return U({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:s=>t.select?t.select(s.loaderData):s.loaderData})}function ye(t){const{select:s,...e}=t;return U({...e,select:n=>s?s(n.loaderDeps):n.loaderDeps})}function ve(t){return U({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:s=>{const e=t.strict===!1?s.params:s._strictParams;return t.select?t.select(e):e}})}function Se(t){return U({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:s=>t.select?t.select(s.search):s.search})}const Mt=typeof window<"u"?b.useLayoutEffect:b.useEffect;function oe(t){const s=b.useRef({value:t,prev:null}),e=s.current.value;return t!==e&&(s.current={value:t,prev:e}),s.current.prev}function Nn(t,s,e={},n={}){b.useEffect(()=>{if(!t.current||n.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([i])=>{s(i)},e);return o.observe(t.current),()=>{o.disconnect()}},[s,e,n.disabled,t])}function Wn(t){const s=b.useRef(null);return b.useImperativeHandle(t,()=>s.current,[]),s}function _e(t){const s=O();return b.useCallback(e=>s.navigate({...e,from:e.from??t?.from}),[t?.from,s])}var we=Ls();const Mo=ue(we);function $n(t,s){const e=O(),[n,o]=b.useState(!1),i=b.useRef(!1),r=Wn(s),{activeProps:a,inactiveProps:c,activeOptions:h,to:d,preload:l,preloadDelay:u,hashScrollIntoView:f,replace:p,startTransition:g,resetScroll:m,viewTransition:y,children:v,target:S,disabled:x,style:L,className:_,onClick:R,onFocus:w,onMouseEnter:C,onMouseLeave:M,onTouchStart:I,ignoreBlocker:F,params:A,search:j,hash:N,state:nt,mask:Ss,reloadDocument:wo,unsafeRelative:Ro,from:xo,_fromLocation:Po,...Re}=t,_s=T({select:E=>E.location.search,structuralSharing:!0}),xe=t.from,ut=b.useMemo(()=>({...t,from:xe}),[e,_s,xe,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),V=b.useMemo(()=>e.buildLocation({...ut}),[e,ut]),_t=b.useMemo(()=>{if(x)return;let E=V.maskedLocation?V.maskedLocation.url:V.url,k=!1;return e.origin&&(E.startsWith(e.origin)?E=e.history.createHref(E.replace(e.origin,""))||"/":k=!0),{href:E,external:k}},[x,V.maskedLocation,V.url,e.origin,e.history]),wt=b.useMemo(()=>{if(_t?.external)return _t.href;try{return new URL(d),d}catch{}},[d,_t]),ot=t.reloadDocument||wt?!1:l??e.options.defaultPreload,Kt=u??e.options.defaultPreloadDelay??0,Ht=T({select:E=>{if(wt)return!1;if(h?.exact){if(!Zs(E.location.pathname,V.pathname,e.basepath))return!1}else{const k=zt(E.location.pathname,e.basepath),W=zt(V.pathname,e.basepath);if(!(k.startsWith(W)&&(k.length===W.length||k[W.length]==="/")))return!1}return(h?.includeSearch??!0)&&!Z(E.location.search,V.search,{partial:!h?.exact,ignoreUndefined:!h?.explicitUndefined})?!1:h?.includeHash?E.location.hash===V.hash:!0}}),Y=b.useCallback(()=>{e.preloadRoute({...ut}).catch(E=>{console.warn(E),console.warn(Ln)})},[e,ut]),ws=b.useCallback(E=>{E?.isIntersecting&&Y()},[Y]);Nn(r,ws,qn,{disabled:!!x||ot!=="viewport"}),b.useEffect(()=>{i.current||!x&&ot==="render"&&(Y(),i.current=!0)},[x,Y,ot]);const Rs=E=>{const k=E.currentTarget.getAttribute("target"),W=S!==void 0?S:k;if(!x&&!Gn(E)&&!E.defaultPrevented&&(!W||W==="_self")&&E.button===0){E.preventDefault(),we.flushSync(()=>{o(!0)});const Le=e.subscribe("onResolved",()=>{Le(),o(!1)});e.navigate({...ut,replace:p,resetScroll:m,hashScrollIntoView:f,startTransition:g,viewTransition:y,ignoreBlocker:F})}};if(wt)return{...Re,ref:r,href:wt,...v&&{children:v},...S&&{target:S},...x&&{disabled:x},...L&&{style:L},..._&&{className:_},...R&&{onClick:R},...w&&{onFocus:w},...C&&{onMouseEnter:C},...M&&{onMouseLeave:M},...I&&{onTouchStart:I}};const Pe=E=>{x||ot&&Y()},xs=Pe,Ps=E=>{if(!(x||!ot))if(!Kt)Y();else{const k=E.target;if(dt.has(k))return;const W=setTimeout(()=>{dt.delete(k),Y()},Kt);dt.set(k,W)}},bs=E=>{if(x||!ot||!Kt)return;const k=E.target,W=dt.get(k);W&&(clearTimeout(W),dt.delete(k))},Rt=Ht?H(a,{})??Un:ie,xt=Ht?ie:H(c,{})??ie,be=[_,Rt.className,xt.className].filter(Boolean).join(" "),Ce=(L||Rt.style||xt.style)&&{...L,...Rt.style,...xt.style};return{...Re,...Rt,...xt,href:_t?.href,ref:r,onClick:ft([R,Rs]),onFocus:ft([w,Pe]),onMouseEnter:ft([C,Ps]),onMouseLeave:ft([M,bs]),onTouchStart:ft([I,xs]),disabled:!!x,target:S,...Ce&&{style:Ce},...be&&{className:be},...x&&Vn,...Ht&&Kn,...n&&Hn}}const ie={},Un={className:"active"},Vn={role:"link","aria-disabled":!0},Kn={"data-status":"active","aria-current":"page"},Hn={"data-transitioning":"transitioning"},dt=new WeakMap,qn={rootMargin:"100px"},ft=t=>s=>{for(const e of t)if(e){if(s.defaultPrevented)return;e(s)}},ms=b.forwardRef((t,s)=>{const{_asChild:e,...n}=t,{type:o,ref:i,...r}=$n(n,s),a=typeof n.children=="function"?n.children({isActive:r["data-status"]==="active"}):n.children;return e===void 0&&delete r.disabled,b.createElement(e||"a",{...r,ref:i},a)});function Gn(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}class Jn extends ds{constructor(s){super(s),this.useMatch=e=>U({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>U({...e,from:this.id,select:n=>e?.select?e.select(n.context):n.context}),this.useSearch=e=>Se({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ve({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ye({...e,from:this.id}),this.useLoaderData=e=>ge({...e,from:this.id}),this.useNavigate=()=>_e({from:this.fullPath}),this.Link=at.forwardRef((e,n)=>P.jsx(ms,{ref:n,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function Yn(t){return new Jn(t)}class Xn extends Mn{constructor(s){super(s),this.useMatch=e=>U({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>U({...e,from:this.id,select:n=>e?.select?e.select(n.context):n.context}),this.useSearch=e=>Se({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ve({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ye({...e,from:this.id}),this.useLoaderData=e=>ge({...e,from:this.id}),this.useNavigate=()=>_e({from:this.fullPath}),this.Link=at.forwardRef((e,n)=>P.jsx(ms,{ref:n,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function Io(t){return new Xn(t)}function Ue(t){return typeof t=="object"?new Ve(t,{silent:!0}).createRoute(t):new Ve(t,{silent:!0}).createRoute}class Ve{constructor(s,e){this.path=s,this.createRoute=n=>{this.silent;const o=Yn(n);return o.isRoot=!1,o},this.silent=e?.silent}}class Ke{constructor(s){this.useMatch=e=>U({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>U({from:this.options.id,select:n=>e?.select?e.select(n.context):n.context}),this.useSearch=e=>Se({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>ve({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>ye({...e,from:this.options.id}),this.useLoaderData=e=>ge({...e,from:this.options.id}),this.useNavigate=()=>{const e=O();return _e({from:e.routesById[this.options.id].fullPath})},this.options=s,this.$$typeof=Symbol.for("react.memo")}}function He(t){return typeof t=="object"?new Ke(t):s=>new Ke({id:t,...s})}function Zn(){const t=O(),s=b.useRef({router:t,mounted:!1}),[e,n]=b.useState(!1),{hasPendingMatches:o,isLoading:i}=T({select:l=>({isLoading:l.isLoading,hasPendingMatches:l.matches.some(u=>u.status==="pending")}),structuralSharing:!0}),r=oe(i),a=i||e||o,c=oe(a),h=i||o,d=oe(h);return t.startTransition=l=>{n(!0),b.startTransition(()=>{l(),n(!1)})},b.useEffect(()=>{const l=t.history.subscribe(t.load),u=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Q(t.latestLocation.href)!==Q(u.href)&&t.commitLocation({...u,replace:!0}),()=>{l()}},[t,t.history]),Mt(()=>{if(typeof window<"u"&&t.ssr||s.current.router===t&&s.current.mounted)return;s.current={router:t,mounted:!0},(async()=>{try{await t.load()}catch(u){console.error(u)}})()},[t]),Mt(()=>{r&&!i&&t.emit({type:"onLoad",...tt(t.state)})},[r,t,i]),Mt(()=>{d&&!h&&t.emit({type:"onBeforeRouteMount",...tt(t.state)})},[h,d,t]),Mt(()=>{if(c&&!a){const l=tt(t.state);t.emit({type:"onResolved",...l}),t.__store.setState(u=>({...u,status:"idle",resolvedLocation:u.location})),l.hrefChanged&&an(t)}},[a,c,t]),null}function Qn(t){const s=T({select:e=>`not-found-${e.location.pathname}-${e.status}`});return P.jsx(me,{getResetKey:()=>s,onCatch:(e,n)=>{if(D(e))t.onCatch?.(e,n);else throw e},errorComponent:({error:e})=>{if(D(e))return t.fallback?.(e);throw e},children:t.children})}function to(){return P.jsx("p",{children:"Not Found"})}function rt(t){return P.jsx(P.Fragment,{children:t.children})}function gs(t,s,e){return s.options.notFoundComponent?P.jsx(s.options.notFoundComponent,{...e}):t.options.defaultNotFoundComponent?P.jsx(t.options.defaultNotFoundComponent,{...e}):P.jsx(to,{})}function eo({children:t}){const s=O();return s.isServer?P.jsx("script",{nonce:s.options.ssr?.nonce,className:"$tsr",dangerouslySetInnerHTML:{__html:t+';typeof $_TSR !== "undefined" && $_TSR.c()'}}):null}function so(){const t=O();if(!t.isScrollRestoring||!t.isServer||typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return null;const e=(t.options.getScrollRestorationKey||ae)(t.latestLocation),n=e!==ae(t.latestLocation)?e:void 0,o={storageKey:Dt,shouldScrollRestoration:!0};return n&&(o.key=n),P.jsx(eo,{children:`(${ss.toString()})(${JSON.stringify(o)})`})}const ys=b.memo(function({matchId:s}){const e=O(),n=T({select:y=>{const v=y.matches.find(S=>S.id===s);return K(v),{routeId:v.routeId,ssr:v.ssr,_displayPending:v._displayPending}},structuralSharing:!0}),o=e.routesById[n.routeId],i=o.options.pendingComponent??e.options.defaultPendingComponent,r=i?P.jsx(i,{}):null,a=o.options.errorComponent??e.options.defaultErrorComponent,c=o.options.onCatch??e.options.defaultOnCatch,h=o.isRoot?o.options.notFoundComponent??e.options.notFoundRoute?.options.component:o.options.notFoundComponent,d=n.ssr===!1||n.ssr==="data-only",l=(!o.isRoot||o.options.wrapInSuspense||d)&&(o.options.wrapInSuspense??i??(o.options.errorComponent?.preload||d))?b.Suspense:rt,u=a?me:rt,f=h?Qn:rt,p=T({select:y=>y.loadedAt}),g=T({select:y=>{const v=y.matches.findIndex(S=>S.id===s);return y.matches[v-1]?.routeId}}),m=o.isRoot?o.options.shellComponent??rt:rt;return P.jsxs(m,{children:[P.jsx(Vt.Provider,{value:s,children:P.jsx(l,{fallback:r,children:P.jsx(u,{getResetKey:()=>p,errorComponent:a||Ut,onCatch:(y,v)=>{if(D(y))throw y;c?.(y,v)},children:P.jsx(f,{fallback:y=>{if(!h||y.routeId&&y.routeId!==n.routeId||!y.routeId&&!o.isRoot)throw y;return b.createElement(h,y)},children:d||n._displayPending?P.jsx(En,{fallback:r,children:P.jsx(qe,{matchId:s})}):P.jsx(qe,{matchId:s})})})})}),g===B&&e.options.scrollRestoration?P.jsxs(P.Fragment,{children:[P.jsx(no,{}),P.jsx(so,{})]}):null]})});function no(){const t=O(),s=b.useRef(void 0);return P.jsx("script",{suppressHydrationWarning:!0,ref:e=>{e&&(s.current===void 0||s.current.href!==t.latestLocation.href)&&(t.emit({type:"onRendered",...tt(t.state)}),s.current=t.latestLocation)}},t.latestLocation.state.__TSR_key)}const qe=b.memo(function({matchId:s}){const e=O(),{match:n,key:o,routeId:i}=T({select:c=>{const h=c.matches.find(p=>p.id===s),d=h.routeId,u=(e.routesById[d].options.remountDeps??e.options.defaultRemountDeps)?.({routeId:d,loaderDeps:h.loaderDeps,params:h._strictParams,search:h._strictSearch});return{key:u?JSON.stringify(u):void 0,routeId:d,match:{id:h.id,status:h.status,error:h.error,_forcePending:h._forcePending,_displayPending:h._displayPending}}},structuralSharing:!0}),r=e.routesById[i],a=b.useMemo(()=>{const c=r.options.component??e.options.defaultComponent;return c?P.jsx(c,{},o):P.jsx(oo,{})},[o,r.options.component,e.options.defaultComponent]);if(n._displayPending)throw e.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw e.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status==="pending"){const c=r.options.pendingMinMs??e.options.defaultPendingMinMs;if(c){const h=e.getMatch(n.id);if(h&&!h._nonReactive.minPendingPromise&&!e.isServer){const d=ct();h._nonReactive.minPendingPromise=d,setTimeout(()=>{d.resolve(),h._nonReactive.minPendingPromise=void 0},c)}}throw e.getMatch(n.id)?._nonReactive.loadPromise}if(n.status==="notFound")return K(D(n.error)),gs(e,r,n.error);if(n.status==="redirected")throw K($(n.error)),e.getMatch(n.id)?._nonReactive.loadPromise;if(n.status==="error"){if(e.isServer){const c=(r.options.errorComponent??e.options.defaultErrorComponent)||Ut;return P.jsx(c,{error:n.error,reset:void 0,info:{componentStack:""}})}throw n.error}return a}),oo=b.memo(function(){const s=O(),e=b.useContext(Vt),n=T({select:h=>h.matches.find(d=>d.id===e)?.routeId}),o=s.routesById[n],i=T({select:h=>{const l=h.matches.find(u=>u.id===e);return K(l),l.globalNotFound}}),r=T({select:h=>{const d=h.matches,l=d.findIndex(u=>u.id===e);return d[l+1]?.id}}),a=s.options.defaultPendingComponent?P.jsx(s.options.defaultPendingComponent,{}):null;if(i)return gs(s,o,void 0);if(!r)return null;const c=P.jsx(ys,{matchId:r});return n===B?P.jsx(b.Suspense,{fallback:a,children:c}):c});function io(){const t=O(),e=t.routesById[B].options.pendingComponent??t.options.defaultPendingComponent,n=e?P.jsx(e,{}):null,o=t.isServer||typeof document<"u"&&t.ssr?rt:b.Suspense,i=P.jsxs(o,{fallback:n,children:[!t.isServer&&P.jsx(Zn,{}),P.jsx(ro,{})]});return t.options.InnerWrap?P.jsx(t.options.InnerWrap,{children:i}):i}function ro(){const t=O(),s=T({select:o=>o.matches[0]?.id}),e=T({select:o=>o.loadedAt}),n=s?P.jsx(ys,{matchId:s}):null;return P.jsx(Vt.Provider,{value:s,children:t.options.disableGlobalCatchBoundary?n:P.jsx(me,{getResetKey:()=>e,errorComponent:Ut,onCatch:o=>{o.message||o.toString()},children:n})})}function Eo(){const t=O();return T({select:s=>[s.location.href,s.resolvedLocation?.href,s.status],structuralSharing:!0}),b.useCallback(s=>{const{pending:e,caseSensitive:n,fuzzy:o,includeSearch:i,...r}=s;return t.matchRoute(r,{pending:e,caseSensitive:n,fuzzy:o,includeSearch:i})},[t])}const ko=t=>new ao(t);class ao extends Rn{constructor(s){super(s)}}typeof globalThis<"u"?(globalThis.createFileRoute=Ue,globalThis.createLazyFileRoute=He):typeof window<"u"&&(window.createFileRoute=Ue,window.createLazyFileRoute=He);function co({router:t,children:s,...e}){Object.keys(e).length>0&&t.update({...t.options,...e,context:{...t.options.context,...e.context}});const n=ps(),o=P.jsx(n.Provider,{value:t,children:s});return t.options.Wrap?P.jsx(t.options.Wrap,{children:o}):o}function To({router:t,...s}){return P.jsx(co,{router:t,...s,children:P.jsx(io,{})})}function it(t,s,e){let n=e.initialDeps??[],o,i=!0;function r(){var a,c,h;let d;e.key&&((a=e.debug)!=null&&a.call(e))&&(d=Date.now());const l=t();if(!(l.length!==n.length||l.some((p,g)=>n[g]!==p)))return o;n=l;let f;if(e.key&&((c=e.debug)!=null&&c.call(e))&&(f=Date.now()),o=s(...l),e.key&&((h=e.debug)!=null&&h.call(e))){const p=Math.round((Date.now()-d)*100)/100,g=Math.round((Date.now()-f)*100)/100,m=g/16,y=(v,S)=>{for(v=String(v);v.length{n=a},r}function Ge(t,s){if(t===void 0)throw new Error("Unexpected undefined");return t}const lo=(t,s)=>Math.abs(t-s)<1.01,uo=(t,s,e)=>{let n;return function(...o){t.clearTimeout(n),n=t.setTimeout(()=>s.apply(this,o),e)}},Je=t=>{const{offsetWidth:s,offsetHeight:e}=t;return{width:s,height:e}},ho=t=>t,fo=t=>{const s=Math.max(t.startIndex-t.overscan,0),e=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let o=s;o<=e;o++)n.push(o);return n},po=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;const o=r=>{const{width:a,height:c}=r;s({width:Math.round(a),height:Math.round(c)})};if(o(Je(e)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(r=>{const a=()=>{const c=r[0];if(c?.borderBoxSize){const h=c.borderBoxSize[0];if(h){o({width:h.inlineSize,height:h.blockSize});return}}o(Je(e))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},Ye={passive:!0},Xe=typeof window>"u"?!0:"onscrollend"in window,mo=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;let o=0;const i=t.options.useScrollendEvent&&Xe?()=>{}:uo(n,()=>{s(o,!1)},t.options.isScrollingResetDelay),r=d=>()=>{const{horizontal:l,isRtl:u}=t.options;o=l?e.scrollLeft*(u&&-1||1):e.scrollTop,i(),s(o,d)},a=r(!0),c=r(!1);c(),e.addEventListener("scroll",a,Ye);const h=t.options.useScrollendEvent&&Xe;return h&&e.addEventListener("scrollend",c,Ye),()=>{e.removeEventListener("scroll",a),h&&e.removeEventListener("scrollend",c)}},go=(t,s,e)=>{if(s?.borderBoxSize){const n=s.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return t[e.options.horizontal?"offsetWidth":"offsetHeight"]},yo=(t,{adjustments:s=0,behavior:e},n)=>{var o,i;const r=t+s;(i=(o=n.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[n.options.horizontal?"left":"top"]:r,behavior:e})};class vo{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const r=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var o;(o=n())==null||o.disconnect(),e=null},observe:o=>{var i;return(i=n())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=n())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,o])=>{typeof o>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ho,rangeExtractor:fo,onChange:()=>{},measureElement:go,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var n,o;(o=(n=this.options).onChange)==null||o.call(n,this,e)},this.maybeNotify=it(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,n)=>{const o=new Map,i=new Map;for(let r=n-1;r>=0;r--){const a=e[r];if(o.has(a.lane))continue;const c=i.get(a.lane);if(c==null||a.end>c.end?i.set(a.lane,a):a.endr.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=it(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,n,o,i,r,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:a}),{key:!1,skipInitialOnChange:!0,onChange:()=>{this.notify(this.isScrolling)}}),this.getMeasurements=it(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:a},c)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const u of this.laneAssignments.keys())u>=e&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const h=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,h),l=new Array(a).fill(void 0);for(let u=0;u1){g=p;const x=l[g],L=x!==void 0?d[x]:void 0;m=L?L.end+this.options.gap:n+o}else{const x=this.options.lanes===1?d[u-1]:this.getFurthestMeasurement(d,u);m=x?x.end+this.options.gap:n+o,g=x?x.lane:u%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(u,g)}const y=c.get(f),v=typeof y=="number"?y:this.options.estimateSize(u),S=m+v;d[u]={index:u,start:m,size:v,end:S,key:f,lane:g},l[g]=u}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=it(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,o,i)=>this.range=e.length>0&&n>0?So({measurements:e,outerSize:n,scrollOffset:o,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=it(()=>{let e=null,n=null;const o=this.calculateRange();return o&&(e=o.startIndex,n=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,o,i,r)=>i===null||r===null?[]:e({startIndex:i,endIndex:r,overscan:n,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,o=e.getAttribute(n);return o?parseInt(o,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(e,n)=>{const o=this.indexFromElement(e),i=this.measurementsCache[o];if(!i)return;const r=i.key,a=this.elementsCache.get(r);a!==e&&(a&&this.observer.unobserve(a),this.observer.observe(e),this.elementsCache.set(r,e)),e.isConnected&&this.resizeItem(o,this.options.measureElement(e,n,this))},this.resizeItem=(e,n)=>{const o=this.measurementsCache[e];if(!o)return;const i=this.itemSizeCache.get(o.key)??o.size,r=n-i;r!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,r,this):o.start{if(!e){this.elementsCache.forEach((n,o)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(o))});return}this._measureElement(e,void 0)},this.getVirtualItems=it(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const o=[];for(let i=0,r=e.length;ithis.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return Ge(n[vs(0,n.length-1,o=>Ge(n[o]).start,e)])},this.getOffsetForAlignment=(e,n,o=0)=>{const i=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=e>=r+i?"end":"start"),n==="center"?e+=(o-i)/2:n==="end"&&(e-=i);const a=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const o=this.measurementsCache[e];if(!o)return;const i=this.getSize(),r=this.getScrollOffset();if(n==="auto")if(o.end>=r+i-this.options.scrollPaddingEnd)n="end";else if(o.start<=r+this.options.scrollPaddingStart)n="start";else return[r,n];const a=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,o.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:n="start",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,n),{adjustments:void 0,behavior:o})},this.scrollToIndex=(e,{align:n="auto",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let i=0;const r=10,a=h=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(e,h);if(!d){console.warn("Failed to get offset for index:",e);return}const[l,u]=d;this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const f=this.getScrollOffset(),p=this.getOffsetForIndex(e,u);if(!p){console.warn("Failed to get offset for index:",e);return}lo(p[0],f)||c(u)})},c=h=>{this.targetWindow&&(i++,ia(h)):console.warn(`Failed to scroll to index ${e} after ${r} attempts.`))};a(n)},this.scrollBy=(e,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var e;const n=this.getMeasurements();let o;if(n.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((e=n[n.length-1])==null?void 0:e.end)??0;else{const i=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&i.some(a=>a===null);){const a=n[r];i[a.lane]===null&&(i[a.lane]=a.end),r--}o=Math.max(...i.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:o})=>{this.options.scrollToFn(e,{behavior:o,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}}const vs=(t,s,e,n)=>{for(;t<=s;){const o=(t+s)/2|0,i=e(o);if(in)s=o-1;else return o}return t>0?t-1:0};function So({measurements:t,outerSize:s,scrollOffset:e,lanes:n}){const o=t.length-1,i=c=>t[c].start;if(t.length<=n)return{startIndex:0,endIndex:o};let r=vs(0,o,i,e),a=r;if(n===1)for(;a1){const c=Array(n).fill(0);for(;ad=0&&h.some(d=>d>=e);){const d=t[r];h[d.lane]=d.start,r--}r=Math.max(0,r-r%n),a=Math.min(o,a+(n-1-a%n))}return{startIndex:r,endIndex:a}}const Ze=typeof document<"u"?b.useLayoutEffect:b.useEffect;function _o(t){const s=b.useReducer(()=>({}),{})[1],e={...t,onChange:(o,i)=>{var r;i?we.flushSync(s):s(),(r=t.onChange)==null||r.call(t,o,i)}},[n]=b.useState(()=>new vo(e));return n.setOptions(e),Ze(()=>n._didMount(),[]),Ze(()=>n._willUpdate()),n}function Oo(t){return _o({observeElementRect:po,observeElementOffset:mo,scrollToFn:yo,...t})}export{ms as L,oo as O,at as R,Co as a,we as b,Mo as c,Fn as d,_e as e,Oo as f,Eo as g,Io as h,K as i,P as j,Yn as k,ko as l,pn as m,To as n,b as r,Lo as u,fs as w}; + color: hsl(${Math.max(0,Math.min(120-120*m,120))}deg 100% 31%);`,e?.key)}return e?.onChange&&!(i&&e.skipInitialOnChange)&&e.onChange(o),i=!1,o}return r.updateDeps=a=>{n=a},r}function Ge(t,s){if(t===void 0)throw new Error("Unexpected undefined");return t}const lo=(t,s)=>Math.abs(t-s)<1.01,uo=(t,s,e)=>{let n;return function(...o){t.clearTimeout(n),n=t.setTimeout(()=>s.apply(this,o),e)}},Je=t=>{const{offsetWidth:s,offsetHeight:e}=t;return{width:s,height:e}},ho=t=>t,fo=t=>{const s=Math.max(t.startIndex-t.overscan,0),e=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let o=s;o<=e;o++)n.push(o);return n},po=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;const o=r=>{const{width:a,height:c}=r;s({width:Math.round(a),height:Math.round(c)})};if(o(Je(e)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(r=>{const a=()=>{const c=r[0];if(c?.borderBoxSize){const h=c.borderBoxSize[0];if(h){o({width:h.inlineSize,height:h.blockSize});return}}o(Je(e))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},Ye={passive:!0},Xe=typeof window>"u"?!0:"onscrollend"in window,mo=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;let o=0;const i=t.options.useScrollendEvent&&Xe?()=>{}:uo(n,()=>{s(o,!1)},t.options.isScrollingResetDelay),r=d=>()=>{const{horizontal:l,isRtl:u}=t.options;o=l?e.scrollLeft*(u&&-1||1):e.scrollTop,i(),s(o,d)},a=r(!0),c=r(!1);c(),e.addEventListener("scroll",a,Ye);const h=t.options.useScrollendEvent&&Xe;return h&&e.addEventListener("scrollend",c,Ye),()=>{e.removeEventListener("scroll",a),h&&e.removeEventListener("scrollend",c)}},go=(t,s,e)=>{if(s?.borderBoxSize){const n=s.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return t[e.options.horizontal?"offsetWidth":"offsetHeight"]},yo=(t,{adjustments:s=0,behavior:e},n)=>{var o,i;const r=t+s;(i=(o=n.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[n.options.horizontal?"left":"top"]:r,behavior:e})};class vo{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const r=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var o;(o=n())==null||o.disconnect(),e=null},observe:o=>{var i;return(i=n())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=n())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,o])=>{typeof o>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ho,rangeExtractor:fo,onChange:()=>{},measureElement:go,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var n,o;(o=(n=this.options).onChange)==null||o.call(n,this,e)},this.maybeNotify=it(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,n)=>{const o=new Map,i=new Map;for(let r=n-1;r>=0;r--){const a=e[r];if(o.has(a.lane))continue;const c=i.get(a.lane);if(c==null||a.end>c.end?i.set(a.lane,a):a.endr.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=it(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,n,o,i,r,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:a}),{key:!1,skipInitialOnChange:!0,onChange:()=>{this.notify(this.isScrolling)}}),this.getMeasurements=it(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:a},c)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const u of this.laneAssignments.keys())u>=e&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const h=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,h),l=new Array(a).fill(void 0);for(let u=0;u1){g=p;const x=l[g],L=x!==void 0?d[x]:void 0;m=L?L.end+this.options.gap:n+o}else{const x=this.options.lanes===1?d[u-1]:this.getFurthestMeasurement(d,u);m=x?x.end+this.options.gap:n+o,g=x?x.lane:u%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(u,g)}const y=c.get(f),v=typeof y=="number"?y:this.options.estimateSize(u),S=m+v;d[u]={index:u,start:m,size:v,end:S,key:f,lane:g},l[g]=u}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=it(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,o,i)=>this.range=e.length>0&&n>0?So({measurements:e,outerSize:n,scrollOffset:o,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=it(()=>{let e=null,n=null;const o=this.calculateRange();return o&&(e=o.startIndex,n=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,o,i,r)=>i===null||r===null?[]:e({startIndex:i,endIndex:r,overscan:n,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,o=e.getAttribute(n);return o?parseInt(o,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(e,n)=>{const o=this.indexFromElement(e),i=this.measurementsCache[o];if(!i)return;const r=i.key,a=this.elementsCache.get(r);a!==e&&(a&&this.observer.unobserve(a),this.observer.observe(e),this.elementsCache.set(r,e)),e.isConnected&&this.resizeItem(o,this.options.measureElement(e,n,this))},this.resizeItem=(e,n)=>{const o=this.measurementsCache[e];if(!o)return;const i=this.itemSizeCache.get(o.key)??o.size,r=n-i;r!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,r,this):o.start{if(!e){this.elementsCache.forEach((n,o)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(o))});return}this._measureElement(e,void 0)},this.getVirtualItems=it(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const o=[];for(let i=0,r=e.length;ithis.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return Ge(n[vs(0,n.length-1,o=>Ge(n[o]).start,e)])},this.getOffsetForAlignment=(e,n,o=0)=>{const i=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=e>=r+i?"end":"start"),n==="center"?e+=(o-i)/2:n==="end"&&(e-=i);const a=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const o=this.measurementsCache[e];if(!o)return;const i=this.getSize(),r=this.getScrollOffset();if(n==="auto")if(o.end>=r+i-this.options.scrollPaddingEnd)n="end";else if(o.start<=r+this.options.scrollPaddingStart)n="start";else return[r,n];const a=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,o.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:n="start",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,n),{adjustments:void 0,behavior:o})},this.scrollToIndex=(e,{align:n="auto",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let i=0;const r=10,a=h=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(e,h);if(!d){console.warn("Failed to get offset for index:",e);return}const[l,u]=d;this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const f=this.getScrollOffset(),p=this.getOffsetForIndex(e,u);if(!p){console.warn("Failed to get offset for index:",e);return}lo(p[0],f)||c(u)})},c=h=>{this.targetWindow&&(i++,ia(h)):console.warn(`Failed to scroll to index ${e} after ${r} attempts.`))};a(n)},this.scrollBy=(e,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var e;const n=this.getMeasurements();let o;if(n.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((e=n[n.length-1])==null?void 0:e.end)??0;else{const i=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&i.some(a=>a===null);){const a=n[r];i[a.lane]===null&&(i[a.lane]=a.end),r--}o=Math.max(...i.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:o})=>{this.options.scrollToFn(e,{behavior:o,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}}const vs=(t,s,e,n)=>{for(;t<=s;){const o=(t+s)/2|0,i=e(o);if(in)s=o-1;else return o}return t>0?t-1:0};function So({measurements:t,outerSize:s,scrollOffset:e,lanes:n}){const o=t.length-1,i=c=>t[c].start;if(t.length<=n)return{startIndex:0,endIndex:o};let r=vs(0,o,i,e),a=r;if(n===1)for(;a1){const c=Array(n).fill(0);for(;ad=0&&h.some(d=>d>=e);){const d=t[r];h[d.lane]=d.start,r--}r=Math.max(0,r-r%n),a=Math.min(o,a+(n-1-a%n))}return{startIndex:r,endIndex:a}}const Ze=typeof document<"u"?b.useLayoutEffect:b.useEffect;function _o(t){const s=b.useReducer(()=>({}),{})[1],e={...t,onChange:(o,i)=>{var r;i?we.flushSync(s):s(),(r=t.onChange)==null||r.call(t,o,i)}},[n]=b.useState(()=>new vo(e));return n.setOptions(e),Ze(()=>n._didMount(),[]),Ze(()=>n._willUpdate()),n}function Oo(t){return _o({observeElementRect:po,observeElementOffset:mo,scrollToFn:yo,...t})}export{ms as L,oo as O,at as R,Co as a,we as b,Mo as c,Fn as d,_e as e,Oo as f,Se as g,Eo as h,K as i,P as j,Io as k,Yn as l,ko as m,pn as n,To as o,b as r,Lo as u,fs as w}; diff --git a/webui/dist/assets/uppy-CcUbCiwl.js b/webui/dist/assets/uppy-x-2TBvZ1.js similarity index 99% rename from webui/dist/assets/uppy-CcUbCiwl.js rename to webui/dist/assets/uppy-x-2TBvZ1.js index 9aa8399e..38cfc9fd 100644 --- a/webui/dist/assets/uppy-CcUbCiwl.js +++ b/webui/dist/assets/uppy-x-2TBvZ1.js @@ -1,4 +1,4 @@ -import{g as re}from"./react-vendor-BmxF9s7Q.js";import{r as Ti,a as gs,b as ys}from"./reactflow-DLoXAt4c.js";import"./router-Bz250laD.js";import"./charts-DbiuC1q1.js";import"./radix-extra-Dp24oM_w.js";const bs=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function vs(i,e,t){const s=bs.exec(i),n=e.mimeType??s?.[1]??"plain/text";let r;if(s?.[2]!=null){const a=atob(decodeURIComponent(s[3])),o=new Uint8Array(a.length);for(let d=0;d(e+=`-${_s(t)}`,"/"))+e}function Fs(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${Nt(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${Nt(i.meta.relativePath.toLowerCase())}`),i.data?.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function Ss(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Ts(i,e){if(Ss(i))return i.id;const t=ki(i);return Fs({...i,type:t},e)}const ue=Array.from;function Ps(i){const e=ue(i.files);return Promise.resolve(e)}function Ai(i,e,t,{onSuccess:s}){i.readEntries(n=>{const r=[...e,...n];n.length?queueMicrotask(()=>{Ai(i,r,t,{onSuccess:s})}):s(r)},n=>{t(n),s(e)})}function Oi(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,s)=>i.file(t,s))},async*values(){const t=i.createReader();yield*await new Promise(n=>{Ai(t,[],e,{onSuccess:r=>n(r.map(a=>Oi(a,e)))})})},isSameEntry:void 0}}async function*Ui(i,e,t=void 0){const s=()=>`${e}/${i.name}`;if(i.kind==="file"){const n=await i.getFile();n!=null?(n.relativePath=e?s():null,yield n):t!=null&&(yield t)}else if(i.kind==="directory")for await(const n of i.values())yield*Ui(n,e?s():i.name);else t!=null&&(yield t)}async function*Cs(i,e){const t=await Promise.all(Array.from(i.items,async s=>{let n;return n??=Oi(typeof s.getAsEntry=="function"?s.getAsEntry():s.webkitGetAsEntry(),e),{fileSystemHandle:n,lastResortFile:s.getAsFile()}}));for(const{lastResortFile:s,fileSystemHandle:n}of t)if(n!=null)try{yield*Ui(n,"",s)}catch(r){s!=null?yield s:e(r)}else s!=null&&(yield s)}async function Es(i,e){const t=e?.logDropError??Function.prototype;try{const s=[];for await(const n of Cs(i,t))s.push(n);return s}catch{return Ps(i)}}function ks(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}function Me(i){return i<10?`0${i}`:i.toString()}function Oe(){const i=new Date,e=Me(i.getHours()),t=Me(i.getMinutes()),s=Me(i.getSeconds());return`${e}:${t}:${s}`}function As(){if(typeof window>"u")return!1;const i=document.body;return!(i==null||window==null||!("draggable"in i)||!("ondragstart"in i)||!("ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}function Dt(i){return i.startsWith("blob:")}function It(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function Os(i){const e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,s=Math.floor(i%60);return{hours:e,minutes:t,seconds:s}}function Us(i){const e=Os(i),t=e.hours===0?"":`${e.hours}h`,s=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,n=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${s}${n}`}function Ns(i,e,t){const s=[];return i.forEach(n=>typeof n!="string"?s.push(n):e[Symbol.split](n).forEach((r,a,o)=>{r!==""&&s.push(r),a{throw new Error(`missing string: ${i}`)};class Ni{locale;constructor(e,{onMissingKey:t=Ds}={}){this.locale={strings:{},pluralize(s){return s===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;const t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let s=this.locale.strings[e];if(s==null&&(this.#e(e),s=e),typeof s=="object"){if(t&&typeof t.smart_count<"u"){const r=this.locale.pluralize(t.smart_count);return xt(s[r],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof s!="string")throw new Error("string was not a string");return xt(s,t)}}const Be="...";function Di(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=Be.length+1)return`${i.slice(0,e-1)}…`;const t=e-Be.length,s=Math.ceil(t/2),n=Math.floor(t/2);return i.slice(0,s)+Be+i.slice(-n)}var ye,T,Ii,Q,Mt,xi,Mi,Bi,ut,tt,it,ce={},Ri=[],Is=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,be=Array.isArray;function V(i,e){for(var t in e)i[t]=e[t];return i}function ht(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function ct(i,e,t){var s,n,r,a={};for(r in e)r=="key"?s=e[r]:r=="ref"?n=e[r]:a[r]=e[r];if(arguments.length>2&&(a.children=arguments.length>3?ye.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(r in i.defaultProps)a[r]===void 0&&(a[r]=i.defaultProps[r]);return he(i,a,s,n,null)}function he(i,e,t,s,n){var r={type:i,props:e,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++Ii,__i:-1,__u:0};return n==null&&T.vnode!=null&&T.vnode(r),r}function xs(){return{current:null}}function G(i){return i.children}function W(i,e){this.props=i,this.context=e}function se(i,e){if(e==null)return i.__?se(i.__,i.__i+1):null;for(var t;eo&&Q.sort(Mi),i=Q.shift(),o=Q.length,i.__d&&(t=void 0,s=void 0,n=(s=(e=i).__v).__e,r=[],a=[],e.__P&&((t=V({},s)).__v=s.__v+1,T.vnode&&T.vnode(t),pt(e.__P,t,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??se(s),!!(32&s.__u),a),t.__v=s.__v,t.__.__k[t.__i]=t,Hi(r,t,a),s.__e=s.__=null,t.__e!=n&&Li(t)));Ne.__r=0}function zi(i,e,t,s,n,r,a,o,d,u,c){var h,p,f,m,y,v,b,g=s&&s.__k||Ri,w=e.length;for(d=Ms(t,e,g,d,w),h=0;h0?he(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=i,a.__b=i.__b+1,o=null,(u=a.__i=Bs(a,t,d,h))!=-1&&(h--,(o=t[u])&&(o.__u|=2)),o==null||o.__v==null?(u==-1&&(n>c?p--:nd?p--:p++,a.__u|=4))):i.__k[r]=null;if(h)for(r=0;r(c?1:0)){for(n=t-1,r=t+1;n>=0||r=0?n--:r++])!=null&&(2&u.__u)==0&&o==u.key&&d==u.type)return a}return-1}function Rt(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||Is.test(e)?t:t+"px"}function we(i,e,t,s,n){var r,a;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof s=="string"&&(i.style.cssText=s=""),s)for(e in s)t&&e in t||Rt(i.style,e,"");if(t)for(e in t)s&&t[e]==s[e]||Rt(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(Bi,"$1")),a=e.toLowerCase(),e=a in i||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+r]=t,t?s?t.u=s.u:(t.u=ut,i.addEventListener(e,r?it:tt,r)):i.removeEventListener(e,r?it:tt,r);else{if(n=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Lt(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=ut++;else if(e.t0?i:be(i)?i.map(qi):V({},i)}function Rs(i,e,t,s,n,r,a,o,d){var u,c,h,p,f,m,y,v=t.props,b=e.props,g=e.type;if(g=="svg"?n="http://www.w3.org/2000/svg":g=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),r!=null){for(u=0;u2&&(o.children=arguments.length>3?ye.call(arguments,2):t),he(i.type,o,s||i.key,n||i.ref,null)}ye=Ri.slice,T={__e:function(i,e,t,s){for(var n,r,a;e=e.__;)if((n=e.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(i)),a=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(i,s||{}),a=n.__d),a)return n.__E=n}catch(o){i=o}throw i}},Ii=0,W.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=V({},this.state),typeof i=="function"&&(i=i(V({},t),this.props)),i&&V(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Bt(this))},W.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Bt(this))},W.prototype.render=G,Q=[],xi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mi=function(i,e){return i.__v.__b-e.__v.__b},Ne.__r=0,Bi=/(PointerCapture)$|Capture$/i,ut=0,tt=Lt(!1),it=Lt(!0);var zs=0;function l(i,e,t,s,n,r){e||(e={});var a,o,d=e;if("ref"in d)for(o in d={},e)o=="ref"?a=e[o]:d[o]=e[o];var u={type:i,props:d,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--zs,__i:-1,__u:0,__source:n,__self:r};if(typeof i=="function"&&(a=i.defaultProps))for(o in a)d[o]===void 0&&(d[o]=a[o]);return T.vnode&&T.vnode(u),u}var pe,k,Re,$t,fe=0,Wi=[],O=T,Ht=O.__b,qt=O.__r,jt=O.diffed,Vt=O.__c,Wt=O.unmount,Gt=O.__;function mt(i,e){O.__h&&O.__h(k,i,fe||e),fe=0;var t=k.__H||(k.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function ne(i){return fe=1,$s(Ki,i)}function $s(i,e,t){var s=mt(pe++,2);if(s.t=i,!s.__c&&(s.__=[Ki(void 0,e),function(o){var d=s.__N?s.__N[0]:s.__[0],u=s.t(d,o);d!==u&&(s.__N=[u,s.__[1]],s.__c.setState({}))}],s.__c=k,!k.__f)){var n=function(o,d,u){if(!s.__c.__H)return!0;var c=s.__c.__H.__.filter(function(p){return!!p.__c});if(c.every(function(p){return!p.__N}))return!r||r.call(this,o,d,u);var h=s.__c.props!==o;return c.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(h=!0)}}),r&&r.call(this,o,d,u)||h};k.__f=!0;var r=k.shouldComponentUpdate,a=k.componentWillUpdate;k.componentWillUpdate=function(o,d,u){if(this.__e){var c=r;r=void 0,n(o,d,u),r=c}a&&a.call(this,o,d,u)},k.shouldComponentUpdate=n}return s.__N||s.__}function De(i,e){var t=mt(pe++,3);!O.__s&&Gi(t.__H,e)&&(t.__=i,t.u=e,k.__H.__h.push(t))}function ie(i){return fe=5,gt(function(){return{current:i}},[])}function gt(i,e){var t=mt(pe++,7);return Gi(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function Ie(i,e){return fe=8,gt(function(){return i},e)}function Hs(){for(var i;i=Wi.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Ue),i.__H.__h.forEach(nt),i.__H.__h=[]}catch(e){i.__H.__h=[],O.__e(e,i.__v)}}O.__b=function(i){k=null,Ht&&Ht(i)},O.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Gt&&Gt(i,e)},O.__r=function(i){qt&&qt(i),pe=0;var e=(k=i.__c).__H;e&&(Re===k?(e.__h=[],k.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Ue),e.__h.forEach(nt),e.__h=[],pe=0)),Re=k},O.diffed=function(i){jt&&jt(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Wi.push(e)!==1&&$t===O.requestAnimationFrame||(($t=O.requestAnimationFrame)||qs)(Hs)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Re=k=null},O.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Ue),t.__h=t.__h.filter(function(s){return!s.__||nt(s)})}catch(s){e.some(function(n){n.__h&&(n.__h=[])}),e=[],O.__e(s,t.__v)}}),Vt&&Vt(i,e)},O.unmount=function(i){Wt&&Wt(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(s){try{Ue(s)}catch(n){e=n}}),t.__H=void 0,e&&O.__e(e,t.__v))};var Kt=typeof requestAnimationFrame=="function";function qs(i){var e,t=function(){clearTimeout(s),Kt&&cancelAnimationFrame(e),setTimeout(i)},s=setTimeout(t,35);Kt&&(e=requestAnimationFrame(t))}function Ue(i){var e=k,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),k=e}function nt(i){var e=k;i.__c=i.__(),k=e}function Gi(i,e){return!i||i.length!==e.length||e.some(function(t,s){return t!==i[s]})}function Ki(i,e){return typeof e=="function"?e(i):e}const js={position:"relative",width:"100%",minHeight:"100%"},Vs={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function Ws({data:i,rowHeight:e,renderRow:t,overscanCount:s=10,padding:n=4,...r}){const a=ie(null),[o,d]=ne(0),[u,c]=ne(0);De(()=>{function g(){a.current!=null&&u!==a.current.offsetHeight&&c(a.current.offsetHeight)}return g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[u]);const h=Ie(()=>{a.current&&d(a.current.scrollTop)},[]);let p=Math.floor(o/e),f=Math.floor(u/e);s&&(p=Math.max(0,p-p%s),f+=s);const m=p+f+n,y=i.slice(p,m),v={...js,height:i.length*e},b={...Vs,top:p*e};return l("div",{onScroll:h,ref:a,...r,children:l("div",{role:"presentation",style:v,children:l("div",{role:"presentation",style:b,children:y.map(t)})})})}class Gs{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){const{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new Ni([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}const Ks={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Oe()}]`,...i)},Xs={debug:(...i)=>console.debug(`[Uppy] [${Oe()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Oe()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Oe()}]`,...i)};var Le,Xt;function Ys(){return Xt||(Xt=1,Le=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);const t=e<0;let s=Math.abs(e);if(t&&(s=-s),s===0)return"0 B";const n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.min(Math.floor(Math.log(s)/Math.log(1024)),n.length-1),a=Number(s/1024**r),o=n[r];return`${a>=10||a%1===0?Math.round(a):a.toFixed(1)} ${o}`}),Le}var Qs=Ys();const J=re(Qs);var ze,Yt;function Js(){if(Yt)return ze;Yt=1;function i(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return i.prototype.match=function(e){var t=!0,s=this.parts,n,r=s.length,a;if(typeof e=="string"||e instanceof String)if(!this.hasWild&&this.text!=e)t=!1;else{for(a=(e||"").split(this.separator),n=0;t&&n=2}return s?n(s.split(";")[0]):n},$e}var en=Zs();const tn=re(en),sn={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class R extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0}class nn{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{const s=e();if(s.restrictions?.allowedFileTypes!=null&&!Array.isArray(s.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return s}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:s,maxNumberOfFiles:n}=this.getOpts().restrictions;if(n&&e.filter(a=>!a.isGhost).length+t.length>n)throw new R(`${this.getI18n()("youCanOnlyUploadX",{smart_count:n})}`);if(s){const r=[...e,...t].reduce((a,o)=>a+(o.size??0),0);if(r>s)throw new R(this.getI18n()("aggregateExceedsSize",{sizeAllowed:J(s),size:J(r)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:s,allowedFileTypes:n}=this.getOpts().restrictions;if(n&&!n.some(a=>a.includes("/")?e.type?tn(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){const a=n.join(", ");throw new R(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new R(this.getI18n()("exceedsSize",{size:J(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(s&&e.size!=null&&e.size{this.validateSingleFile(s)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length(t=s,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}class me extends Gs{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof me||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:me}}));else if(typeof e=="function"){const s=e;this.uppy.iteratePlugins(n=>{n instanceof s&&(t=n)})}return t}mount(e,t){const s=t.id,n=ws(e);if(n){this.isTargetDOMEl=!0;const o=document.createElement("div");return o.classList.add("uppy-Root"),this.#e=rn(d=>{this.uppy.getPlugin(this.id)&&(zt(this.render(d,o),o),this.afterUpdate())}),this.uppy.log(`Installing ${s} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(n.innerHTML=""),zt(this.render(this.uppy.getState(),o),o),this.el=o,n.appendChild(o),o.dir=this.opts.direction||ks(o)||"ltr",this.onMount(),this.el}const r=this.getTargetPlugin(e);if(r)return this.uppy.log(`Installing ${s} to ${r.id}`),this.parent=r,this.el=r.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${s}`);let a=`Invalid target option given to ${s}.`;throw typeof e=="function"?a+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":a+="If you meant to target an HTML element, please make sure that the element exists. Check that the + - - - - - - - - - - - - - + + + + + + + + + + + + +