@inspectr/mcplab 1.28.4 → 1.28.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,11 @@ function u9(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&
2
2
  `+B+l}var V=!1;function ee(l,d){if(!l||V)return"";V=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(d)if(d=function(){throw Error()},Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(Se){var w=Se}Reflect.construct(l,[],d)}else{try{d.call()}catch(Se){w=Se}l.call(d.prototype)}else{try{throw Error()}catch(Se){w=Se}l()}}catch(Se){if(Se&&w&&typeof Se.stack=="string"){for(var _=Se.stack.split(`
3
3
  `),R=w.stack.split(`
4
4
  `),D=_.length-1,re=R.length-1;1<=D&&0<=re&&_[D]!==R[re];)re--;for(;1<=D&&0<=re;D--,re--)if(_[D]!==R[re]){if(D!==1||re!==1)do if(D--,re--,0>re||_[D]!==R[re]){var ce=`
5
- `+_[D].replace(" at new "," at ");return l.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",l.displayName)),ce}while(1<=D&&0<=re);break}}}finally{V=!1,Error.prepareStackTrace=g}return(l=l?l.displayName||l.name:"")?z(l):""}function ae(l){switch(l.tag){case 5:return z(l.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return l=ee(l.type,!1),l;case 11:return l=ee(l.type.render,!1),l;case 1:return l=ee(l.type,!0),l;default:return""}}function ue(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case P:return"Fragment";case E:return"Portal";case $:return"Profiler";case T:return"StrictMode";case X:return"Suspense";case L:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case H:return(l.displayName||"Context")+".Consumer";case Y:return(l._context.displayName||"Context")+".Provider";case F:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case I:return d=l.displayName||null,d!==null?d:ue(l.type)||"Memo";case M:d=l._payload,l=l._init;try{return ue(l(d))}catch{}}return null}function se(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ue(d);case 8:return d===T?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function xe(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function oe(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function de(l){var d=oe(l)?"checked":"value",g=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),w=""+l[d];if(!l.hasOwnProperty(d)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var _=g.get,R=g.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return _.call(this)},set:function(D){w=""+D,R.call(this,D)}}),Object.defineProperty(l,d,{enumerable:g.enumerable}),{getValue:function(){return w},setValue:function(D){w=""+D},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function De(l){l._valueTracker||(l._valueTracker=de(l))}function me(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var g=d.getValue(),w="";return l&&(w=oe(l)?l.checked?"true":"false":l.value),l=w,l!==g?(d.setValue(l),!0):!1}function ge(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function we(l,d){var g=d.checked;return Q({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:g??l._wrapperState.initialChecked})}function at(l,d){var g=d.defaultValue==null?"":d.defaultValue,w=d.checked!=null?d.checked:d.defaultChecked;g=xe(d.value!=null?d.value:g),l._wrapperState={initialChecked:w,initialValue:g,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function tt(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function it(l,d){tt(l,d);var g=xe(d.value),w=d.type;if(g!=null)w==="number"?(g===0&&l.value===""||l.value!=g)&&(l.value=""+g):l.value!==""+g&&(l.value=""+g);else if(w==="submit"||w==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Ge(l,d.type,g):d.hasOwnProperty("defaultValue")&&Ge(l,d.type,xe(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function At(l,d,g){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var w=d.type;if(!(w!=="submit"&&w!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,g||d===l.value||(l.value=d),l.defaultValue=d}g=l.name,g!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,g!==""&&(l.name=g)}function Ge(l,d,g){(d!=="number"||ge(l.ownerDocument)!==l)&&(g==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+g&&(l.defaultValue=""+g))}var Ee=Array.isArray;function Re(l,d,g,w){if(l=l.options,d){d={};for(var _=0;_<g.length;_++)d["$"+g[_]]=!0;for(g=0;g<l.length;g++)_=d.hasOwnProperty("$"+l[g].value),l[g].selected!==_&&(l[g].selected=_),_&&w&&(l[g].defaultSelected=!0)}else{for(g=""+xe(g),d=null,_=0;_<l.length;_++){if(l[_].value===g){l[_].selected=!0,w&&(l[_].defaultSelected=!0);return}d!==null||l[_].disabled||(d=l[_])}d!==null&&(d.selected=!0)}}function Ze(l,d){if(d.dangerouslySetInnerHTML!=null)throw Error(n(91));return Q({},d,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function ht(l,d){var g=d.value;if(g==null){if(g=d.children,d=d.defaultValue,g!=null){if(d!=null)throw Error(n(92));if(Ee(g)){if(1<g.length)throw Error(n(93));g=g[0]}d=g}d==null&&(d=""),g=d}l._wrapperState={initialValue:xe(g)}}function Ft(l,d){var g=xe(d.value),w=xe(d.defaultValue);g!=null&&(g=""+g,g!==l.value&&(l.value=g),d.defaultValue==null&&l.defaultValue!==g&&(l.defaultValue=g)),w!=null&&(l.defaultValue=""+w)}function zt(l){var d=l.textContent;d===l._wrapperState.initialValue&&d!==""&&d!==null&&(l.value=d)}function jt(l){switch(l){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function rn(l,d){return l==null||l==="http://www.w3.org/1999/xhtml"?jt(d):l==="http://www.w3.org/2000/svg"&&d==="foreignObject"?"http://www.w3.org/1999/xhtml":l}var an,qt=(function(l){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(d,g,w,_){MSApp.execUnsafeLocalFunction(function(){return l(d,g,w,_)})}:l})(function(l,d){if(l.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in l)l.innerHTML=d;else{for(an=an||document.createElement("div"),an.innerHTML="<svg>"+d.valueOf().toString()+"</svg>",d=an.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Zt(l,d){if(d){var g=l.firstChild;if(g&&g===l.lastChild&&g.nodeType===3){g.nodeValue=d;return}}l.textContent=d}var sn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ln=["Webkit","ms","Moz","O"];Object.keys(sn).forEach(function(l){ln.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),sn[d]=sn[l]})});function ke(l,d,g){return d==null||typeof d=="boolean"||d===""?"":g||typeof d!="number"||d===0||sn.hasOwnProperty(l)&&sn[l]?(""+d).trim():d+"px"}function ze(l,d){l=l.style;for(var g in d)if(d.hasOwnProperty(g)){var w=g.indexOf("--")===0,_=ke(g,d[g],w);g==="float"&&(g="cssFloat"),w?l.setProperty(g,_):l[g]=_}}var Xe=Q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function kt(l,d){if(d){if(Xe[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function vt(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var fe=null;function Oe(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Ve=null,U=null,le=null;function W(l){if(l=ld(l)){if(typeof Ve!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Up(d),Ve(l.stateNode,l.type,d))}}function ye(l){U?le?le.push(l):le=[l]:U=l}function ve(){if(U){var l=U,d=le;if(le=U=null,W(l),d)for(l=0;l<d.length;l++)W(d[l])}}function Ce(l,d){return l(d)}function _e(){}var K=!1;function pe(l,d,g){if(K)return l(d,g);K=!0;try{return Ce(l,d,g)}finally{K=!1,(U!==null||le!==null)&&(_e(),ve())}}function Ae(l,d){var g=l.stateNode;if(g===null)return null;var w=Up(g);if(w===null)return null;g=w[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(l=l.type,w=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!w;break e;default:l=!1}if(l)return null;if(g&&typeof g!="function")throw Error(n(231,d,typeof g));return g}var Ke=!1;if(c)try{var te={};Object.defineProperty(te,"passive",{get:function(){Ke=!0}}),window.addEventListener("test",te,te),window.removeEventListener("test",te,te)}catch{Ke=!1}function Le(l,d,g,w,_,R,D,re,ce){var Se=Array.prototype.slice.call(arguments,3);try{d.apply(g,Se)}catch(Be){this.onError(Be)}}var ot=!1,Ut=null,Te=!1,Qt=null,St={onError:function(l){ot=!0,Ut=l}};function Gt(l,d,g,w,_,R,D,re,ce){ot=!1,Ut=null,Le.apply(St,arguments)}function Xn(l,d,g,w,_,R,D,re,ce){if(Gt.apply(this,arguments),ot){if(ot){var Se=Ut;ot=!1,Ut=null}else throw Error(n(198));Te||(Te=!0,Qt=Se)}}function zn(l){var d=l,g=l;if(l.alternate)for(;d.return;)d=d.return;else{l=d;do d=l,(d.flags&4098)!==0&&(g=d.return),l=d.return;while(l)}return d.tag===3?g:null}function Ra(l){if(l.tag===13){var d=l.memoizedState;if(d===null&&(l=l.alternate,l!==null&&(d=l.memoizedState)),d!==null)return d.dehydrated}return null}function Xl(l){if(zn(l)!==l)throw Error(n(188))}function Bn(l){var d=l.alternate;if(!d){if(d=zn(l),d===null)throw Error(n(188));return d!==l?null:l}for(var g=l,w=d;;){var _=g.return;if(_===null)break;var R=_.alternate;if(R===null){if(w=_.return,w!==null){g=w;continue}break}if(_.child===R.child){for(R=_.child;R;){if(R===g)return Xl(_),l;if(R===w)return Xl(_),d;R=R.sibling}throw Error(n(188))}if(g.return!==w.return)g=_,w=R;else{for(var D=!1,re=_.child;re;){if(re===g){D=!0,g=_,w=R;break}if(re===w){D=!0,w=_,g=R;break}re=re.sibling}if(!D){for(re=R.child;re;){if(re===g){D=!0,g=R,w=_;break}if(re===w){D=!0,w=R,g=_;break}re=re.sibling}if(!D)throw Error(n(189))}}if(g.alternate!==w)throw Error(n(190))}if(g.tag!==3)throw Error(n(188));return g.stateNode.current===g?l:d}function Li(l){return l=Bn(l),l!==null?pa(l):null}function pa(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var d=pa(l);if(d!==null)return d;l=l.sibling}return null}var jr=t.unstable_scheduleCallback,io=t.unstable_cancelCallback,Fi=t.unstable_shouldYield,Wu=t.unstable_requestPaint,En=t.unstable_now,Hu=t.unstable_getCurrentPriorityLevel,Vo=t.unstable_ImmediatePriority,ie=t.unstable_UserBlockingPriority,rt=t.unstable_NormalPriority,Yt=t.unstable_LowPriority,Pt=t.unstable_IdlePriority,Lt=null,tn=null;function ne(l){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Lt,l,void 0,(l.current.flags&128)===128)}catch{}}var Ne=Math.clz32?Math.clz32:jn,pt=Math.log,Nt=Math.LN2;function jn(l){return l>>>=0,l===0?32:31-(pt(l)/Nt|0)|0}var bn=64,mn=4194304;function nn(l){switch(l&-l){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: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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function sr(l,d){var g=l.pendingLanes;if(g===0)return 0;var w=0,_=l.suspendedLanes,R=l.pingedLanes,D=g&268435455;if(D!==0){var re=D&~_;re!==0?w=nn(re):(R&=D,R!==0&&(w=nn(R)))}else D=g&~_,D!==0?w=nn(D):R!==0&&(w=nn(R));if(w===0)return 0;if(d!==0&&d!==w&&(d&_)===0&&(_=w&-w,R=d&-d,_>=R||_===16&&(R&4194240)!==0))return d;if((w&4)!==0&&(w|=g&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=w;0<d;)g=31-Ne(d),_=1<<g,w|=l[g],d&=~_;return w}function Ct(l,d){switch(l){case 1:case 2:case 4:return d+250;case 8:case 16:case 32:case 64: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 d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Zn(l,d){for(var g=l.suspendedLanes,w=l.pingedLanes,_=l.expirationTimes,R=l.pendingLanes;0<R;){var D=31-Ne(R),re=1<<D,ce=_[D];ce===-1?((re&g)===0||(re&w)!==0)&&(_[D]=Ct(re,d)):ce<=d&&(l.expiredLanes|=re),R&=~re}}function Vn(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function Ir(){var l=bn;return bn<<=1,(bn&4194240)===0&&(bn=64),l}function Ds(l){for(var d=[],g=0;31>g;g++)d.push(l);return d}function us(l,d,g){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-Ne(d),l[d]=g}function qn(l,d){var g=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var w=l.eventTimes;for(l=l.expirationTimes;0<g;){var _=31-Ne(g),R=1<<_;d[_]=0,w[_]=-1,l[_]=-1,g&=~R}}function zi(l,d){var g=l.entangledLanes|=d;for(l=l.entanglements;g;){var w=31-Ne(g),_=1<<w;_&d|l[w]&d&&(l[w]|=d),g&=~_}}var gn=0;function wk(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var jk,gx,Sk,Nk,Ck,vx=!1,Ap=[],Ko=null,Go=null,Yo=null,Vu=new Map,Ku=new Map,Xo=[],TU="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function _k(l,d){switch(l){case"focusin":case"focusout":Ko=null;break;case"dragenter":case"dragleave":Go=null;break;case"mouseover":case"mouseout":Yo=null;break;case"pointerover":case"pointerout":Vu.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ku.delete(d.pointerId)}}function Gu(l,d,g,w,_,R){return l===null||l.nativeEvent!==R?(l={blockedOn:d,domEventName:g,eventSystemFlags:w,nativeEvent:R,targetContainers:[_]},d!==null&&(d=ld(d),d!==null&&gx(d)),l):(l.eventSystemFlags|=w,d=l.targetContainers,_!==null&&d.indexOf(_)===-1&&d.push(_),l)}function OU(l,d,g,w,_){switch(d){case"focusin":return Ko=Gu(Ko,l,d,g,w,_),!0;case"dragenter":return Go=Gu(Go,l,d,g,w,_),!0;case"mouseover":return Yo=Gu(Yo,l,d,g,w,_),!0;case"pointerover":var R=_.pointerId;return Vu.set(R,Gu(Vu.get(R)||null,l,d,g,w,_)),!0;case"gotpointercapture":return R=_.pointerId,Ku.set(R,Gu(Ku.get(R)||null,l,d,g,w,_)),!0}return!1}function kk(l){var d=Bi(l.target);if(d!==null){var g=zn(d);if(g!==null){if(d=g.tag,d===13){if(d=Ra(g),d!==null){l.blockedOn=d,Ck(l.priority,function(){Sk(g)});return}}else if(d===3&&g.stateNode.current.memoizedState.isDehydrated){l.blockedOn=g.tag===3?g.stateNode.containerInfo:null;return}}}l.blockedOn=null}function Ep(l){if(l.blockedOn!==null)return!1;for(var d=l.targetContainers;0<d.length;){var g=yx(l.domEventName,l.eventSystemFlags,d[0],l.nativeEvent);if(g===null){g=l.nativeEvent;var w=new g.constructor(g.type,g);fe=w,g.target.dispatchEvent(w),fe=null}else return d=ld(g),d!==null&&gx(d),l.blockedOn=g,!1;d.shift()}return!0}function Ak(l,d,g){Ep(l)&&g.delete(d)}function MU(){vx=!1,Ko!==null&&Ep(Ko)&&(Ko=null),Go!==null&&Ep(Go)&&(Go=null),Yo!==null&&Ep(Yo)&&(Yo=null),Vu.forEach(Ak),Ku.forEach(Ak)}function Yu(l,d){l.blockedOn===d&&(l.blockedOn=null,vx||(vx=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,MU)))}function Xu(l){function d(_){return Yu(_,l)}if(0<Ap.length){Yu(Ap[0],l);for(var g=1;g<Ap.length;g++){var w=Ap[g];w.blockedOn===l&&(w.blockedOn=null)}}for(Ko!==null&&Yu(Ko,l),Go!==null&&Yu(Go,l),Yo!==null&&Yu(Yo,l),Vu.forEach(d),Ku.forEach(d),g=0;g<Xo.length;g++)w=Xo[g],w.blockedOn===l&&(w.blockedOn=null);for(;0<Xo.length&&(g=Xo[0],g.blockedOn===null);)kk(g),g.blockedOn===null&&Xo.shift()}var Ql=k.ReactCurrentBatchConfig,Pp=!0;function IU(l,d,g,w){var _=gn,R=Ql.transition;Ql.transition=null;try{gn=1,xx(l,d,g,w)}finally{gn=_,Ql.transition=R}}function $U(l,d,g,w){var _=gn,R=Ql.transition;Ql.transition=null;try{gn=4,xx(l,d,g,w)}finally{gn=_,Ql.transition=R}}function xx(l,d,g,w){if(Pp){var _=yx(l,d,g,w);if(_===null)$x(l,d,w,Rp,g),_k(l,w);else if(OU(_,l,d,g,w))w.stopPropagation();else if(_k(l,w),d&4&&-1<TU.indexOf(l)){for(;_!==null;){var R=ld(_);if(R!==null&&jk(R),R=yx(l,d,g,w),R===null&&$x(l,d,w,Rp,g),R===_)break;_=R}_!==null&&w.stopPropagation()}else $x(l,d,w,null,g)}}var Rp=null;function yx(l,d,g,w){if(Rp=null,l=Oe(w),l=Bi(l),l!==null)if(d=zn(l),d===null)l=null;else if(g=d.tag,g===13){if(l=Ra(d),l!==null)return l;l=null}else if(g===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;l=null}else d!==l&&(l=null);return Rp=l,null}function Ek(l){switch(l){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Hu()){case Vo:return 1;case ie:return 4;case rt:case Yt:return 16;case Pt:return 536870912;default:return 16}default:return 16}}var Qo=null,bx=null,Tp=null;function Pk(){if(Tp)return Tp;var l,d=bx,g=d.length,w,_="value"in Qo?Qo.value:Qo.textContent,R=_.length;for(l=0;l<g&&d[l]===_[l];l++);var D=g-l;for(w=1;w<=D&&d[g-w]===_[R-w];w++);return Tp=_.slice(l,1<w?1-w:void 0)}function Op(l){var d=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&d===13&&(l=13)):l=d,l===10&&(l=13),32<=l||l===13?l:0}function Mp(){return!0}function Rk(){return!1}function ha(l){function d(g,w,_,R,D){this._reactName=g,this._targetInst=_,this.type=w,this.nativeEvent=R,this.target=D,this.currentTarget=null;for(var re in l)l.hasOwnProperty(re)&&(g=l[re],this[re]=g?g(R):R[re]);return this.isDefaultPrevented=(R.defaultPrevented!=null?R.defaultPrevented:R.returnValue===!1)?Mp:Rk,this.isPropagationStopped=Rk,this}return Q(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var g=this.nativeEvent;g&&(g.preventDefault?g.preventDefault():typeof g.returnValue!="unknown"&&(g.returnValue=!1),this.isDefaultPrevented=Mp)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=Mp)},persist:function(){},isPersistent:Mp}),d}var Jl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wx=ha(Jl),Qu=Q({},Jl,{view:0,detail:0}),DU=ha(Qu),jx,Sx,Ju,Ip=Q({},Qu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cx,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Ju&&(Ju&&l.type==="mousemove"?(jx=l.screenX-Ju.screenX,Sx=l.screenY-Ju.screenY):Sx=jx=0,Ju=l),jx)},movementY:function(l){return"movementY"in l?l.movementY:Sx}}),Tk=ha(Ip),LU=Q({},Ip,{dataTransfer:0}),FU=ha(LU),zU=Q({},Qu,{relatedTarget:0}),Nx=ha(zU),BU=Q({},Jl,{animationName:0,elapsedTime:0,pseudoElement:0}),qU=ha(BU),UU=Q({},Jl,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),WU=ha(UU),HU=Q({},Jl,{data:0}),Ok=ha(HU),VU={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},KU={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},GU={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function YU(l){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(l):(l=GU[l])?!!d[l]:!1}function Cx(){return YU}var XU=Q({},Qu,{key:function(l){if(l.key){var d=VU[l.key]||l.key;if(d!=="Unidentified")return d}return l.type==="keypress"?(l=Op(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?KU[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cx,charCode:function(l){return l.type==="keypress"?Op(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?Op(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),QU=ha(XU),JU=Q({},Ip,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mk=ha(JU),ZU=Q({},Qu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cx}),e7=ha(ZU),t7=Q({},Jl,{propertyName:0,elapsedTime:0,pseudoElement:0}),n7=ha(t7),r7=Q({},Ip,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),a7=ha(r7),s7=[9,13,27,32],_x=c&&"CompositionEvent"in window,Zu=null;c&&"documentMode"in document&&(Zu=document.documentMode);var o7=c&&"TextEvent"in window&&!Zu,Ik=c&&(!_x||Zu&&8<Zu&&11>=Zu),$k=" ",Dk=!1;function Lk(l,d){switch(l){case"keyup":return s7.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fk(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Zl=!1;function i7(l,d){switch(l){case"compositionend":return Fk(d);case"keypress":return d.which!==32?null:(Dk=!0,$k);case"textInput":return l=d.data,l===$k&&Dk?null:l;default:return null}}function l7(l,d){if(Zl)return l==="compositionend"||!_x&&Lk(l,d)?(l=Pk(),Tp=bx=Qo=null,Zl=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return Ik&&d.locale!=="ko"?null:d.data;default:return null}}var c7={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function zk(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d==="input"?!!c7[l.type]:d==="textarea"}function Bk(l,d,g,w){ye(w),d=zp(d,"onChange"),0<d.length&&(g=new wx("onChange","change",null,g,w),l.push({event:g,listeners:d}))}var ed=null,td=null;function u7(l){sA(l,0)}function $p(l){var d=ac(l);if(me(d))return l}function d7(l,d){if(l==="change")return d}var qk=!1;if(c){var kx;if(c){var Ax="oninput"in document;if(!Ax){var Uk=document.createElement("div");Uk.setAttribute("oninput","return;"),Ax=typeof Uk.oninput=="function"}kx=Ax}else kx=!1;qk=kx&&(!document.documentMode||9<document.documentMode)}function Wk(){ed&&(ed.detachEvent("onpropertychange",Hk),td=ed=null)}function Hk(l){if(l.propertyName==="value"&&$p(td)){var d=[];Bk(d,td,l,Oe(l)),pe(u7,d)}}function f7(l,d,g){l==="focusin"?(Wk(),ed=d,td=g,ed.attachEvent("onpropertychange",Hk)):l==="focusout"&&Wk()}function p7(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return $p(td)}function h7(l,d){if(l==="click")return $p(d)}function m7(l,d){if(l==="input"||l==="change")return $p(d)}function g7(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var ds=typeof Object.is=="function"?Object.is:g7;function nd(l,d){if(ds(l,d))return!0;if(typeof l!="object"||l===null||typeof d!="object"||d===null)return!1;var g=Object.keys(l),w=Object.keys(d);if(g.length!==w.length)return!1;for(w=0;w<g.length;w++){var _=g[w];if(!u.call(d,_)||!ds(l[_],d[_]))return!1}return!0}function Vk(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function Kk(l,d){var g=Vk(l);l=0;for(var w;g;){if(g.nodeType===3){if(w=l+g.textContent.length,l<=d&&w>=d)return{node:g,offset:d-l};l=w}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=Vk(g)}}function Gk(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Gk(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function Yk(){for(var l=window,d=ge();d instanceof l.HTMLIFrameElement;){try{var g=typeof d.contentWindow.location.href=="string"}catch{g=!1}if(g)l=d.contentWindow;else break;d=ge(l.document)}return d}function Ex(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function v7(l){var d=Yk(),g=l.focusedElem,w=l.selectionRange;if(d!==g&&g&&g.ownerDocument&&Gk(g.ownerDocument.documentElement,g)){if(w!==null&&Ex(g)){if(d=w.start,l=w.end,l===void 0&&(l=d),"selectionStart"in g)g.selectionStart=d,g.selectionEnd=Math.min(l,g.value.length);else if(l=(d=g.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var _=g.textContent.length,R=Math.min(w.start,_);w=w.end===void 0?R:Math.min(w.end,_),!l.extend&&R>w&&(_=w,w=R,R=_),_=Kk(g,R);var D=Kk(g,w);_&&D&&(l.rangeCount!==1||l.anchorNode!==_.node||l.anchorOffset!==_.offset||l.focusNode!==D.node||l.focusOffset!==D.offset)&&(d=d.createRange(),d.setStart(_.node,_.offset),l.removeAllRanges(),R>w?(l.addRange(d),l.extend(D.node,D.offset)):(d.setEnd(D.node,D.offset),l.addRange(d)))}}for(d=[],l=g;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<d.length;g++)l=d[g],l.element.scrollLeft=l.left,l.element.scrollTop=l.top}}var x7=c&&"documentMode"in document&&11>=document.documentMode,ec=null,Px=null,rd=null,Rx=!1;function Xk(l,d,g){var w=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;Rx||ec==null||ec!==ge(w)||(w=ec,"selectionStart"in w&&Ex(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),rd&&nd(rd,w)||(rd=w,w=zp(Px,"onSelect"),0<w.length&&(d=new wx("onSelect","select",null,d,g),l.push({event:d,listeners:w}),d.target=ec)))}function Dp(l,d){var g={};return g[l.toLowerCase()]=d.toLowerCase(),g["Webkit"+l]="webkit"+d,g["Moz"+l]="moz"+d,g}var tc={animationend:Dp("Animation","AnimationEnd"),animationiteration:Dp("Animation","AnimationIteration"),animationstart:Dp("Animation","AnimationStart"),transitionend:Dp("Transition","TransitionEnd")},Tx={},Qk={};c&&(Qk=document.createElement("div").style,"AnimationEvent"in window||(delete tc.animationend.animation,delete tc.animationiteration.animation,delete tc.animationstart.animation),"TransitionEvent"in window||delete tc.transitionend.transition);function Lp(l){if(Tx[l])return Tx[l];if(!tc[l])return l;var d=tc[l],g;for(g in d)if(d.hasOwnProperty(g)&&g in Qk)return Tx[l]=d[g];return l}var Jk=Lp("animationend"),Zk=Lp("animationiteration"),eA=Lp("animationstart"),tA=Lp("transitionend"),nA=new Map,rA="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Jo(l,d){nA.set(l,d),o(d,[l])}for(var Ox=0;Ox<rA.length;Ox++){var Mx=rA[Ox],y7=Mx.toLowerCase(),b7=Mx[0].toUpperCase()+Mx.slice(1);Jo(y7,"on"+b7)}Jo(Jk,"onAnimationEnd"),Jo(Zk,"onAnimationIteration"),Jo(eA,"onAnimationStart"),Jo("dblclick","onDoubleClick"),Jo("focusin","onFocus"),Jo("focusout","onBlur"),Jo(tA,"onTransitionEnd"),i("onMouseEnter",["mouseout","mouseover"]),i("onMouseLeave",["mouseout","mouseover"]),i("onPointerEnter",["pointerout","pointerover"]),i("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ad="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),w7=new Set("cancel close invalid load scroll toggle".split(" ").concat(ad));function aA(l,d,g){var w=l.type||"unknown-event";l.currentTarget=g,Xn(w,d,void 0,l),l.currentTarget=null}function sA(l,d){d=(d&4)!==0;for(var g=0;g<l.length;g++){var w=l[g],_=w.event;w=w.listeners;e:{var R=void 0;if(d)for(var D=w.length-1;0<=D;D--){var re=w[D],ce=re.instance,Se=re.currentTarget;if(re=re.listener,ce!==R&&_.isPropagationStopped())break e;aA(_,re,Se),R=ce}else for(D=0;D<w.length;D++){if(re=w[D],ce=re.instance,Se=re.currentTarget,re=re.listener,ce!==R&&_.isPropagationStopped())break e;aA(_,re,Se),R=ce}}}if(Te)throw l=Qt,Te=!1,Qt=null,l}function Pn(l,d){var g=d[qx];g===void 0&&(g=d[qx]=new Set);var w=l+"__bubble";g.has(w)||(oA(d,l,2,!1),g.add(w))}function Ix(l,d,g){var w=0;d&&(w|=4),oA(g,l,w,d)}var Fp="_reactListening"+Math.random().toString(36).slice(2);function sd(l){if(!l[Fp]){l[Fp]=!0,r.forEach(function(g){g!=="selectionchange"&&(w7.has(g)||Ix(g,!1,l),Ix(g,!0,l))});var d=l.nodeType===9?l:l.ownerDocument;d===null||d[Fp]||(d[Fp]=!0,Ix("selectionchange",!1,d))}}function oA(l,d,g,w){switch(Ek(d)){case 1:var _=IU;break;case 4:_=$U;break;default:_=xx}g=_.bind(null,d,g,l),_=void 0,!Ke||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(_=!0),w?_!==void 0?l.addEventListener(d,g,{capture:!0,passive:_}):l.addEventListener(d,g,!0):_!==void 0?l.addEventListener(d,g,{passive:_}):l.addEventListener(d,g,!1)}function $x(l,d,g,w,_){var R=w;if((d&1)===0&&(d&2)===0&&w!==null)e:for(;;){if(w===null)return;var D=w.tag;if(D===3||D===4){var re=w.stateNode.containerInfo;if(re===_||re.nodeType===8&&re.parentNode===_)break;if(D===4)for(D=w.return;D!==null;){var ce=D.tag;if((ce===3||ce===4)&&(ce=D.stateNode.containerInfo,ce===_||ce.nodeType===8&&ce.parentNode===_))return;D=D.return}for(;re!==null;){if(D=Bi(re),D===null)return;if(ce=D.tag,ce===5||ce===6){w=R=D;continue e}re=re.parentNode}}w=w.return}pe(function(){var Se=R,Be=Oe(g),He=[];e:{var Fe=nA.get(l);if(Fe!==void 0){var dt=wx,xt=l;switch(l){case"keypress":if(Op(g)===0)break e;case"keydown":case"keyup":dt=QU;break;case"focusin":xt="focus",dt=Nx;break;case"focusout":xt="blur",dt=Nx;break;case"beforeblur":case"afterblur":dt=Nx;break;case"click":if(g.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":dt=Tk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":dt=FU;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":dt=e7;break;case Jk:case Zk:case eA:dt=qU;break;case tA:dt=n7;break;case"scroll":dt=DU;break;case"wheel":dt=a7;break;case"copy":case"cut":case"paste":dt=WU;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":dt=Mk}var yt=(d&4)!==0,Qn=!yt&&l==="scroll",be=yt?Fe!==null?Fe+"Capture":null:Fe;yt=[];for(var he=Se,je;he!==null;){je=he;var Ye=je.stateNode;if(je.tag===5&&Ye!==null&&(je=Ye,be!==null&&(Ye=Ae(he,be),Ye!=null&&yt.push(od(he,Ye,je)))),Qn)break;he=he.return}0<yt.length&&(Fe=new dt(Fe,xt,null,g,Be),He.push({event:Fe,listeners:yt}))}}if((d&7)===0){e:{if(Fe=l==="mouseover"||l==="pointerover",dt=l==="mouseout"||l==="pointerout",Fe&&g!==fe&&(xt=g.relatedTarget||g.fromElement)&&(Bi(xt)||xt[lo]))break e;if((dt||Fe)&&(Fe=Be.window===Be?Be:(Fe=Be.ownerDocument)?Fe.defaultView||Fe.parentWindow:window,dt?(xt=g.relatedTarget||g.toElement,dt=Se,xt=xt?Bi(xt):null,xt!==null&&(Qn=zn(xt),xt!==Qn||xt.tag!==5&&xt.tag!==6)&&(xt=null)):(dt=null,xt=Se),dt!==xt)){if(yt=Tk,Ye="onMouseLeave",be="onMouseEnter",he="mouse",(l==="pointerout"||l==="pointerover")&&(yt=Mk,Ye="onPointerLeave",be="onPointerEnter",he="pointer"),Qn=dt==null?Fe:ac(dt),je=xt==null?Fe:ac(xt),Fe=new yt(Ye,he+"leave",dt,g,Be),Fe.target=Qn,Fe.relatedTarget=je,Ye=null,Bi(Be)===Se&&(yt=new yt(be,he+"enter",xt,g,Be),yt.target=je,yt.relatedTarget=Qn,Ye=yt),Qn=Ye,dt&&xt)t:{for(yt=dt,be=xt,he=0,je=yt;je;je=nc(je))he++;for(je=0,Ye=be;Ye;Ye=nc(Ye))je++;for(;0<he-je;)yt=nc(yt),he--;for(;0<je-he;)be=nc(be),je--;for(;he--;){if(yt===be||be!==null&&yt===be.alternate)break t;yt=nc(yt),be=nc(be)}yt=null}else yt=null;dt!==null&&iA(He,Fe,dt,yt,!1),xt!==null&&Qn!==null&&iA(He,Qn,xt,yt,!0)}}e:{if(Fe=Se?ac(Se):window,dt=Fe.nodeName&&Fe.nodeName.toLowerCase(),dt==="select"||dt==="input"&&Fe.type==="file")var bt=d7;else if(zk(Fe))if(qk)bt=m7;else{bt=p7;var Rt=f7}else(dt=Fe.nodeName)&&dt.toLowerCase()==="input"&&(Fe.type==="checkbox"||Fe.type==="radio")&&(bt=h7);if(bt&&(bt=bt(l,Se))){Bk(He,bt,g,Be);break e}Rt&&Rt(l,Fe,Se),l==="focusout"&&(Rt=Fe._wrapperState)&&Rt.controlled&&Fe.type==="number"&&Ge(Fe,"number",Fe.value)}switch(Rt=Se?ac(Se):window,l){case"focusin":(zk(Rt)||Rt.contentEditable==="true")&&(ec=Rt,Px=Se,rd=null);break;case"focusout":rd=Px=ec=null;break;case"mousedown":Rx=!0;break;case"contextmenu":case"mouseup":case"dragend":Rx=!1,Xk(He,g,Be);break;case"selectionchange":if(x7)break;case"keydown":case"keyup":Xk(He,g,Be)}var Tt;if(_x)e:{switch(l){case"compositionstart":var Bt="onCompositionStart";break e;case"compositionend":Bt="onCompositionEnd";break e;case"compositionupdate":Bt="onCompositionUpdate";break e}Bt=void 0}else Zl?Lk(l,g)&&(Bt="onCompositionEnd"):l==="keydown"&&g.keyCode===229&&(Bt="onCompositionStart");Bt&&(Ik&&g.locale!=="ko"&&(Zl||Bt!=="onCompositionStart"?Bt==="onCompositionEnd"&&Zl&&(Tt=Pk()):(Qo=Be,bx="value"in Qo?Qo.value:Qo.textContent,Zl=!0)),Rt=zp(Se,Bt),0<Rt.length&&(Bt=new Ok(Bt,l,null,g,Be),He.push({event:Bt,listeners:Rt}),Tt?Bt.data=Tt:(Tt=Fk(g),Tt!==null&&(Bt.data=Tt)))),(Tt=o7?i7(l,g):l7(l,g))&&(Se=zp(Se,"onBeforeInput"),0<Se.length&&(Be=new Ok("onBeforeInput","beforeinput",null,g,Be),He.push({event:Be,listeners:Se}),Be.data=Tt))}sA(He,d)})}function od(l,d,g){return{instance:l,listener:d,currentTarget:g}}function zp(l,d){for(var g=d+"Capture",w=[];l!==null;){var _=l,R=_.stateNode;_.tag===5&&R!==null&&(_=R,R=Ae(l,g),R!=null&&w.unshift(od(l,R,_)),R=Ae(l,d),R!=null&&w.push(od(l,R,_))),l=l.return}return w}function nc(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5);return l||null}function iA(l,d,g,w,_){for(var R=d._reactName,D=[];g!==null&&g!==w;){var re=g,ce=re.alternate,Se=re.stateNode;if(ce!==null&&ce===w)break;re.tag===5&&Se!==null&&(re=Se,_?(ce=Ae(g,R),ce!=null&&D.unshift(od(g,ce,re))):_||(ce=Ae(g,R),ce!=null&&D.push(od(g,ce,re)))),g=g.return}D.length!==0&&l.push({event:d,listeners:D})}var j7=/\r\n?/g,S7=/\u0000|\uFFFD/g;function lA(l){return(typeof l=="string"?l:""+l).replace(j7,`
5
+ `+_[D].replace(" at new "," at ");return l.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",l.displayName)),ce}while(1<=D&&0<=re);break}}}finally{V=!1,Error.prepareStackTrace=g}return(l=l?l.displayName||l.name:"")?z(l):""}function ae(l){switch(l.tag){case 5:return z(l.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return l=ee(l.type,!1),l;case 11:return l=ee(l.type.render,!1),l;case 1:return l=ee(l.type,!0),l;default:return""}}function ue(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case P:return"Fragment";case E:return"Portal";case $:return"Profiler";case T:return"StrictMode";case X:return"Suspense";case L:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case H:return(l.displayName||"Context")+".Consumer";case Y:return(l._context.displayName||"Context")+".Provider";case F:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case I:return d=l.displayName||null,d!==null?d:ue(l.type)||"Memo";case M:d=l._payload,l=l._init;try{return ue(l(d))}catch{}}return null}function se(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ue(d);case 8:return d===T?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function xe(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function oe(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function de(l){var d=oe(l)?"checked":"value",g=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),w=""+l[d];if(!l.hasOwnProperty(d)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var _=g.get,R=g.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return _.call(this)},set:function(D){w=""+D,R.call(this,D)}}),Object.defineProperty(l,d,{enumerable:g.enumerable}),{getValue:function(){return w},setValue:function(D){w=""+D},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function De(l){l._valueTracker||(l._valueTracker=de(l))}function me(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var g=d.getValue(),w="";return l&&(w=oe(l)?l.checked?"true":"false":l.value),l=w,l!==g?(d.setValue(l),!0):!1}function ge(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function we(l,d){var g=d.checked;return Q({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:g??l._wrapperState.initialChecked})}function at(l,d){var g=d.defaultValue==null?"":d.defaultValue,w=d.checked!=null?d.checked:d.defaultChecked;g=xe(d.value!=null?d.value:g),l._wrapperState={initialChecked:w,initialValue:g,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function tt(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function it(l,d){tt(l,d);var g=xe(d.value),w=d.type;if(g!=null)w==="number"?(g===0&&l.value===""||l.value!=g)&&(l.value=""+g):l.value!==""+g&&(l.value=""+g);else if(w==="submit"||w==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Ge(l,d.type,g):d.hasOwnProperty("defaultValue")&&Ge(l,d.type,xe(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function At(l,d,g){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var w=d.type;if(!(w!=="submit"&&w!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,g||d===l.value||(l.value=d),l.defaultValue=d}g=l.name,g!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,g!==""&&(l.name=g)}function Ge(l,d,g){(d!=="number"||ge(l.ownerDocument)!==l)&&(g==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+g&&(l.defaultValue=""+g))}var Ee=Array.isArray;function Re(l,d,g,w){if(l=l.options,d){d={};for(var _=0;_<g.length;_++)d["$"+g[_]]=!0;for(g=0;g<l.length;g++)_=d.hasOwnProperty("$"+l[g].value),l[g].selected!==_&&(l[g].selected=_),_&&w&&(l[g].defaultSelected=!0)}else{for(g=""+xe(g),d=null,_=0;_<l.length;_++){if(l[_].value===g){l[_].selected=!0,w&&(l[_].defaultSelected=!0);return}d!==null||l[_].disabled||(d=l[_])}d!==null&&(d.selected=!0)}}function Ze(l,d){if(d.dangerouslySetInnerHTML!=null)throw Error(n(91));return Q({},d,{value:void 0,defaultValue:void 0,children:""+l._wrapperState.initialValue})}function ht(l,d){var g=d.value;if(g==null){if(g=d.children,d=d.defaultValue,g!=null){if(d!=null)throw Error(n(92));if(Ee(g)){if(1<g.length)throw Error(n(93));g=g[0]}d=g}d==null&&(d=""),g=d}l._wrapperState={initialValue:xe(g)}}function Ft(l,d){var g=xe(d.value),w=xe(d.defaultValue);g!=null&&(g=""+g,g!==l.value&&(l.value=g),d.defaultValue==null&&l.defaultValue!==g&&(l.defaultValue=g)),w!=null&&(l.defaultValue=""+w)}function zt(l){var d=l.textContent;d===l._wrapperState.initialValue&&d!==""&&d!==null&&(l.value=d)}function jt(l){switch(l){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function rn(l,d){return l==null||l==="http://www.w3.org/1999/xhtml"?jt(d):l==="http://www.w3.org/2000/svg"&&d==="foreignObject"?"http://www.w3.org/1999/xhtml":l}var an,qt=(function(l){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(d,g,w,_){MSApp.execUnsafeLocalFunction(function(){return l(d,g,w,_)})}:l})(function(l,d){if(l.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in l)l.innerHTML=d;else{for(an=an||document.createElement("div"),an.innerHTML="<svg>"+d.valueOf().toString()+"</svg>",d=an.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Zt(l,d){if(d){var g=l.firstChild;if(g&&g===l.lastChild&&g.nodeType===3){g.nodeValue=d;return}}l.textContent=d}var sn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ln=["Webkit","ms","Moz","O"];Object.keys(sn).forEach(function(l){ln.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),sn[d]=sn[l]})});function _e(l,d,g){return d==null||typeof d=="boolean"||d===""?"":g||typeof d!="number"||d===0||sn.hasOwnProperty(l)&&sn[l]?(""+d).trim():d+"px"}function ze(l,d){l=l.style;for(var g in d)if(d.hasOwnProperty(g)){var w=g.indexOf("--")===0,_=_e(g,d[g],w);g==="float"&&(g="cssFloat"),w?l.setProperty(g,_):l[g]=_}}var Xe=Q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function kt(l,d){if(d){if(Xe[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function vt(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var fe=null;function Oe(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Ve=null,U=null,le=null;function W(l){if(l=ld(l)){if(typeof Ve!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Up(d),Ve(l.stateNode,l.type,d))}}function ye(l){U?le?le.push(l):le=[l]:U=l}function ve(){if(U){var l=U,d=le;if(le=U=null,W(l),d)for(l=0;l<d.length;l++)W(d[l])}}function ke(l,d){return l(d)}function Ce(){}var K=!1;function pe(l,d,g){if(K)return l(d,g);K=!0;try{return ke(l,d,g)}finally{K=!1,(U!==null||le!==null)&&(Ce(),ve())}}function Ae(l,d){var g=l.stateNode;if(g===null)return null;var w=Up(g);if(w===null)return null;g=w[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(l=l.type,w=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!w;break e;default:l=!1}if(l)return null;if(g&&typeof g!="function")throw Error(n(231,d,typeof g));return g}var Ke=!1;if(c)try{var te={};Object.defineProperty(te,"passive",{get:function(){Ke=!0}}),window.addEventListener("test",te,te),window.removeEventListener("test",te,te)}catch{Ke=!1}function Le(l,d,g,w,_,R,D,re,ce){var Se=Array.prototype.slice.call(arguments,3);try{d.apply(g,Se)}catch(Be){this.onError(Be)}}var ot=!1,Ut=null,Te=!1,Qt=null,St={onError:function(l){ot=!0,Ut=l}};function Gt(l,d,g,w,_,R,D,re,ce){ot=!1,Ut=null,Le.apply(St,arguments)}function Xn(l,d,g,w,_,R,D,re,ce){if(Gt.apply(this,arguments),ot){if(ot){var Se=Ut;ot=!1,Ut=null}else throw Error(n(198));Te||(Te=!0,Qt=Se)}}function zn(l){var d=l,g=l;if(l.alternate)for(;d.return;)d=d.return;else{l=d;do d=l,(d.flags&4098)!==0&&(g=d.return),l=d.return;while(l)}return d.tag===3?g:null}function Ra(l){if(l.tag===13){var d=l.memoizedState;if(d===null&&(l=l.alternate,l!==null&&(d=l.memoizedState)),d!==null)return d.dehydrated}return null}function Xl(l){if(zn(l)!==l)throw Error(n(188))}function Bn(l){var d=l.alternate;if(!d){if(d=zn(l),d===null)throw Error(n(188));return d!==l?null:l}for(var g=l,w=d;;){var _=g.return;if(_===null)break;var R=_.alternate;if(R===null){if(w=_.return,w!==null){g=w;continue}break}if(_.child===R.child){for(R=_.child;R;){if(R===g)return Xl(_),l;if(R===w)return Xl(_),d;R=R.sibling}throw Error(n(188))}if(g.return!==w.return)g=_,w=R;else{for(var D=!1,re=_.child;re;){if(re===g){D=!0,g=_,w=R;break}if(re===w){D=!0,w=_,g=R;break}re=re.sibling}if(!D){for(re=R.child;re;){if(re===g){D=!0,g=R,w=_;break}if(re===w){D=!0,w=R,g=_;break}re=re.sibling}if(!D)throw Error(n(189))}}if(g.alternate!==w)throw Error(n(190))}if(g.tag!==3)throw Error(n(188));return g.stateNode.current===g?l:d}function Li(l){return l=Bn(l),l!==null?pa(l):null}function pa(l){if(l.tag===5||l.tag===6)return l;for(l=l.child;l!==null;){var d=pa(l);if(d!==null)return d;l=l.sibling}return null}var jr=t.unstable_scheduleCallback,io=t.unstable_cancelCallback,Fi=t.unstable_shouldYield,Wu=t.unstable_requestPaint,En=t.unstable_now,Hu=t.unstable_getCurrentPriorityLevel,Vo=t.unstable_ImmediatePriority,ie=t.unstable_UserBlockingPriority,rt=t.unstable_NormalPriority,Yt=t.unstable_LowPriority,Pt=t.unstable_IdlePriority,Lt=null,tn=null;function ne(l){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Lt,l,void 0,(l.current.flags&128)===128)}catch{}}var Ne=Math.clz32?Math.clz32:jn,pt=Math.log,Nt=Math.LN2;function jn(l){return l>>>=0,l===0?32:31-(pt(l)/Nt|0)|0}var bn=64,mn=4194304;function nn(l){switch(l&-l){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: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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function sr(l,d){var g=l.pendingLanes;if(g===0)return 0;var w=0,_=l.suspendedLanes,R=l.pingedLanes,D=g&268435455;if(D!==0){var re=D&~_;re!==0?w=nn(re):(R&=D,R!==0&&(w=nn(R)))}else D=g&~_,D!==0?w=nn(D):R!==0&&(w=nn(R));if(w===0)return 0;if(d!==0&&d!==w&&(d&_)===0&&(_=w&-w,R=d&-d,_>=R||_===16&&(R&4194240)!==0))return d;if((w&4)!==0&&(w|=g&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=w;0<d;)g=31-Ne(d),_=1<<g,w|=l[g],d&=~_;return w}function Ct(l,d){switch(l){case 1:case 2:case 4:return d+250;case 8:case 16:case 32:case 64: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 d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Zn(l,d){for(var g=l.suspendedLanes,w=l.pingedLanes,_=l.expirationTimes,R=l.pendingLanes;0<R;){var D=31-Ne(R),re=1<<D,ce=_[D];ce===-1?((re&g)===0||(re&w)!==0)&&(_[D]=Ct(re,d)):ce<=d&&(l.expiredLanes|=re),R&=~re}}function Vn(l){return l=l.pendingLanes&-1073741825,l!==0?l:l&1073741824?1073741824:0}function Ir(){var l=bn;return bn<<=1,(bn&4194240)===0&&(bn=64),l}function Ds(l){for(var d=[],g=0;31>g;g++)d.push(l);return d}function us(l,d,g){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-Ne(d),l[d]=g}function qn(l,d){var g=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var w=l.eventTimes;for(l=l.expirationTimes;0<g;){var _=31-Ne(g),R=1<<_;d[_]=0,w[_]=-1,l[_]=-1,g&=~R}}function zi(l,d){var g=l.entangledLanes|=d;for(l=l.entanglements;g;){var w=31-Ne(g),_=1<<w;_&d|l[w]&d&&(l[w]|=d),g&=~_}}var gn=0;function wk(l){return l&=-l,1<l?4<l?(l&268435455)!==0?16:536870912:4:1}var jk,gx,Sk,Nk,Ck,vx=!1,Ap=[],Ko=null,Go=null,Yo=null,Vu=new Map,Ku=new Map,Xo=[],TU="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function _k(l,d){switch(l){case"focusin":case"focusout":Ko=null;break;case"dragenter":case"dragleave":Go=null;break;case"mouseover":case"mouseout":Yo=null;break;case"pointerover":case"pointerout":Vu.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ku.delete(d.pointerId)}}function Gu(l,d,g,w,_,R){return l===null||l.nativeEvent!==R?(l={blockedOn:d,domEventName:g,eventSystemFlags:w,nativeEvent:R,targetContainers:[_]},d!==null&&(d=ld(d),d!==null&&gx(d)),l):(l.eventSystemFlags|=w,d=l.targetContainers,_!==null&&d.indexOf(_)===-1&&d.push(_),l)}function OU(l,d,g,w,_){switch(d){case"focusin":return Ko=Gu(Ko,l,d,g,w,_),!0;case"dragenter":return Go=Gu(Go,l,d,g,w,_),!0;case"mouseover":return Yo=Gu(Yo,l,d,g,w,_),!0;case"pointerover":var R=_.pointerId;return Vu.set(R,Gu(Vu.get(R)||null,l,d,g,w,_)),!0;case"gotpointercapture":return R=_.pointerId,Ku.set(R,Gu(Ku.get(R)||null,l,d,g,w,_)),!0}return!1}function kk(l){var d=Bi(l.target);if(d!==null){var g=zn(d);if(g!==null){if(d=g.tag,d===13){if(d=Ra(g),d!==null){l.blockedOn=d,Ck(l.priority,function(){Sk(g)});return}}else if(d===3&&g.stateNode.current.memoizedState.isDehydrated){l.blockedOn=g.tag===3?g.stateNode.containerInfo:null;return}}}l.blockedOn=null}function Ep(l){if(l.blockedOn!==null)return!1;for(var d=l.targetContainers;0<d.length;){var g=yx(l.domEventName,l.eventSystemFlags,d[0],l.nativeEvent);if(g===null){g=l.nativeEvent;var w=new g.constructor(g.type,g);fe=w,g.target.dispatchEvent(w),fe=null}else return d=ld(g),d!==null&&gx(d),l.blockedOn=g,!1;d.shift()}return!0}function Ak(l,d,g){Ep(l)&&g.delete(d)}function MU(){vx=!1,Ko!==null&&Ep(Ko)&&(Ko=null),Go!==null&&Ep(Go)&&(Go=null),Yo!==null&&Ep(Yo)&&(Yo=null),Vu.forEach(Ak),Ku.forEach(Ak)}function Yu(l,d){l.blockedOn===d&&(l.blockedOn=null,vx||(vx=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,MU)))}function Xu(l){function d(_){return Yu(_,l)}if(0<Ap.length){Yu(Ap[0],l);for(var g=1;g<Ap.length;g++){var w=Ap[g];w.blockedOn===l&&(w.blockedOn=null)}}for(Ko!==null&&Yu(Ko,l),Go!==null&&Yu(Go,l),Yo!==null&&Yu(Yo,l),Vu.forEach(d),Ku.forEach(d),g=0;g<Xo.length;g++)w=Xo[g],w.blockedOn===l&&(w.blockedOn=null);for(;0<Xo.length&&(g=Xo[0],g.blockedOn===null);)kk(g),g.blockedOn===null&&Xo.shift()}var Ql=k.ReactCurrentBatchConfig,Pp=!0;function IU(l,d,g,w){var _=gn,R=Ql.transition;Ql.transition=null;try{gn=1,xx(l,d,g,w)}finally{gn=_,Ql.transition=R}}function $U(l,d,g,w){var _=gn,R=Ql.transition;Ql.transition=null;try{gn=4,xx(l,d,g,w)}finally{gn=_,Ql.transition=R}}function xx(l,d,g,w){if(Pp){var _=yx(l,d,g,w);if(_===null)$x(l,d,w,Rp,g),_k(l,w);else if(OU(_,l,d,g,w))w.stopPropagation();else if(_k(l,w),d&4&&-1<TU.indexOf(l)){for(;_!==null;){var R=ld(_);if(R!==null&&jk(R),R=yx(l,d,g,w),R===null&&$x(l,d,w,Rp,g),R===_)break;_=R}_!==null&&w.stopPropagation()}else $x(l,d,w,null,g)}}var Rp=null;function yx(l,d,g,w){if(Rp=null,l=Oe(w),l=Bi(l),l!==null)if(d=zn(l),d===null)l=null;else if(g=d.tag,g===13){if(l=Ra(d),l!==null)return l;l=null}else if(g===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;l=null}else d!==l&&(l=null);return Rp=l,null}function Ek(l){switch(l){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Hu()){case Vo:return 1;case ie:return 4;case rt:case Yt:return 16;case Pt:return 536870912;default:return 16}default:return 16}}var Qo=null,bx=null,Tp=null;function Pk(){if(Tp)return Tp;var l,d=bx,g=d.length,w,_="value"in Qo?Qo.value:Qo.textContent,R=_.length;for(l=0;l<g&&d[l]===_[l];l++);var D=g-l;for(w=1;w<=D&&d[g-w]===_[R-w];w++);return Tp=_.slice(l,1<w?1-w:void 0)}function Op(l){var d=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&d===13&&(l=13)):l=d,l===10&&(l=13),32<=l||l===13?l:0}function Mp(){return!0}function Rk(){return!1}function ha(l){function d(g,w,_,R,D){this._reactName=g,this._targetInst=_,this.type=w,this.nativeEvent=R,this.target=D,this.currentTarget=null;for(var re in l)l.hasOwnProperty(re)&&(g=l[re],this[re]=g?g(R):R[re]);return this.isDefaultPrevented=(R.defaultPrevented!=null?R.defaultPrevented:R.returnValue===!1)?Mp:Rk,this.isPropagationStopped=Rk,this}return Q(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var g=this.nativeEvent;g&&(g.preventDefault?g.preventDefault():typeof g.returnValue!="unknown"&&(g.returnValue=!1),this.isDefaultPrevented=Mp)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=Mp)},persist:function(){},isPersistent:Mp}),d}var Jl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wx=ha(Jl),Qu=Q({},Jl,{view:0,detail:0}),DU=ha(Qu),jx,Sx,Ju,Ip=Q({},Qu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cx,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Ju&&(Ju&&l.type==="mousemove"?(jx=l.screenX-Ju.screenX,Sx=l.screenY-Ju.screenY):Sx=jx=0,Ju=l),jx)},movementY:function(l){return"movementY"in l?l.movementY:Sx}}),Tk=ha(Ip),LU=Q({},Ip,{dataTransfer:0}),FU=ha(LU),zU=Q({},Qu,{relatedTarget:0}),Nx=ha(zU),BU=Q({},Jl,{animationName:0,elapsedTime:0,pseudoElement:0}),qU=ha(BU),UU=Q({},Jl,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),WU=ha(UU),HU=Q({},Jl,{data:0}),Ok=ha(HU),VU={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},KU={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},GU={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function YU(l){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(l):(l=GU[l])?!!d[l]:!1}function Cx(){return YU}var XU=Q({},Qu,{key:function(l){if(l.key){var d=VU[l.key]||l.key;if(d!=="Unidentified")return d}return l.type==="keypress"?(l=Op(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?KU[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cx,charCode:function(l){return l.type==="keypress"?Op(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?Op(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),QU=ha(XU),JU=Q({},Ip,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mk=ha(JU),ZU=Q({},Qu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cx}),e7=ha(ZU),t7=Q({},Jl,{propertyName:0,elapsedTime:0,pseudoElement:0}),n7=ha(t7),r7=Q({},Ip,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),a7=ha(r7),s7=[9,13,27,32],_x=c&&"CompositionEvent"in window,Zu=null;c&&"documentMode"in document&&(Zu=document.documentMode);var o7=c&&"TextEvent"in window&&!Zu,Ik=c&&(!_x||Zu&&8<Zu&&11>=Zu),$k=" ",Dk=!1;function Lk(l,d){switch(l){case"keyup":return s7.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fk(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Zl=!1;function i7(l,d){switch(l){case"compositionend":return Fk(d);case"keypress":return d.which!==32?null:(Dk=!0,$k);case"textInput":return l=d.data,l===$k&&Dk?null:l;default:return null}}function l7(l,d){if(Zl)return l==="compositionend"||!_x&&Lk(l,d)?(l=Pk(),Tp=bx=Qo=null,Zl=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return Ik&&d.locale!=="ko"?null:d.data;default:return null}}var c7={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function zk(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d==="input"?!!c7[l.type]:d==="textarea"}function Bk(l,d,g,w){ye(w),d=zp(d,"onChange"),0<d.length&&(g=new wx("onChange","change",null,g,w),l.push({event:g,listeners:d}))}var ed=null,td=null;function u7(l){sA(l,0)}function $p(l){var d=ac(l);if(me(d))return l}function d7(l,d){if(l==="change")return d}var qk=!1;if(c){var kx;if(c){var Ax="oninput"in document;if(!Ax){var Uk=document.createElement("div");Uk.setAttribute("oninput","return;"),Ax=typeof Uk.oninput=="function"}kx=Ax}else kx=!1;qk=kx&&(!document.documentMode||9<document.documentMode)}function Wk(){ed&&(ed.detachEvent("onpropertychange",Hk),td=ed=null)}function Hk(l){if(l.propertyName==="value"&&$p(td)){var d=[];Bk(d,td,l,Oe(l)),pe(u7,d)}}function f7(l,d,g){l==="focusin"?(Wk(),ed=d,td=g,ed.attachEvent("onpropertychange",Hk)):l==="focusout"&&Wk()}function p7(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return $p(td)}function h7(l,d){if(l==="click")return $p(d)}function m7(l,d){if(l==="input"||l==="change")return $p(d)}function g7(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var ds=typeof Object.is=="function"?Object.is:g7;function nd(l,d){if(ds(l,d))return!0;if(typeof l!="object"||l===null||typeof d!="object"||d===null)return!1;var g=Object.keys(l),w=Object.keys(d);if(g.length!==w.length)return!1;for(w=0;w<g.length;w++){var _=g[w];if(!u.call(d,_)||!ds(l[_],d[_]))return!1}return!0}function Vk(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function Kk(l,d){var g=Vk(l);l=0;for(var w;g;){if(g.nodeType===3){if(w=l+g.textContent.length,l<=d&&w>=d)return{node:g,offset:d-l};l=w}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=Vk(g)}}function Gk(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Gk(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function Yk(){for(var l=window,d=ge();d instanceof l.HTMLIFrameElement;){try{var g=typeof d.contentWindow.location.href=="string"}catch{g=!1}if(g)l=d.contentWindow;else break;d=ge(l.document)}return d}function Ex(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function v7(l){var d=Yk(),g=l.focusedElem,w=l.selectionRange;if(d!==g&&g&&g.ownerDocument&&Gk(g.ownerDocument.documentElement,g)){if(w!==null&&Ex(g)){if(d=w.start,l=w.end,l===void 0&&(l=d),"selectionStart"in g)g.selectionStart=d,g.selectionEnd=Math.min(l,g.value.length);else if(l=(d=g.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var _=g.textContent.length,R=Math.min(w.start,_);w=w.end===void 0?R:Math.min(w.end,_),!l.extend&&R>w&&(_=w,w=R,R=_),_=Kk(g,R);var D=Kk(g,w);_&&D&&(l.rangeCount!==1||l.anchorNode!==_.node||l.anchorOffset!==_.offset||l.focusNode!==D.node||l.focusOffset!==D.offset)&&(d=d.createRange(),d.setStart(_.node,_.offset),l.removeAllRanges(),R>w?(l.addRange(d),l.extend(D.node,D.offset)):(d.setEnd(D.node,D.offset),l.addRange(d)))}}for(d=[],l=g;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof g.focus=="function"&&g.focus(),g=0;g<d.length;g++)l=d[g],l.element.scrollLeft=l.left,l.element.scrollTop=l.top}}var x7=c&&"documentMode"in document&&11>=document.documentMode,ec=null,Px=null,rd=null,Rx=!1;function Xk(l,d,g){var w=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;Rx||ec==null||ec!==ge(w)||(w=ec,"selectionStart"in w&&Ex(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),rd&&nd(rd,w)||(rd=w,w=zp(Px,"onSelect"),0<w.length&&(d=new wx("onSelect","select",null,d,g),l.push({event:d,listeners:w}),d.target=ec)))}function Dp(l,d){var g={};return g[l.toLowerCase()]=d.toLowerCase(),g["Webkit"+l]="webkit"+d,g["Moz"+l]="moz"+d,g}var tc={animationend:Dp("Animation","AnimationEnd"),animationiteration:Dp("Animation","AnimationIteration"),animationstart:Dp("Animation","AnimationStart"),transitionend:Dp("Transition","TransitionEnd")},Tx={},Qk={};c&&(Qk=document.createElement("div").style,"AnimationEvent"in window||(delete tc.animationend.animation,delete tc.animationiteration.animation,delete tc.animationstart.animation),"TransitionEvent"in window||delete tc.transitionend.transition);function Lp(l){if(Tx[l])return Tx[l];if(!tc[l])return l;var d=tc[l],g;for(g in d)if(d.hasOwnProperty(g)&&g in Qk)return Tx[l]=d[g];return l}var Jk=Lp("animationend"),Zk=Lp("animationiteration"),eA=Lp("animationstart"),tA=Lp("transitionend"),nA=new Map,rA="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Jo(l,d){nA.set(l,d),o(d,[l])}for(var Ox=0;Ox<rA.length;Ox++){var Mx=rA[Ox],y7=Mx.toLowerCase(),b7=Mx[0].toUpperCase()+Mx.slice(1);Jo(y7,"on"+b7)}Jo(Jk,"onAnimationEnd"),Jo(Zk,"onAnimationIteration"),Jo(eA,"onAnimationStart"),Jo("dblclick","onDoubleClick"),Jo("focusin","onFocus"),Jo("focusout","onBlur"),Jo(tA,"onTransitionEnd"),i("onMouseEnter",["mouseout","mouseover"]),i("onMouseLeave",["mouseout","mouseover"]),i("onPointerEnter",["pointerout","pointerover"]),i("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ad="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),w7=new Set("cancel close invalid load scroll toggle".split(" ").concat(ad));function aA(l,d,g){var w=l.type||"unknown-event";l.currentTarget=g,Xn(w,d,void 0,l),l.currentTarget=null}function sA(l,d){d=(d&4)!==0;for(var g=0;g<l.length;g++){var w=l[g],_=w.event;w=w.listeners;e:{var R=void 0;if(d)for(var D=w.length-1;0<=D;D--){var re=w[D],ce=re.instance,Se=re.currentTarget;if(re=re.listener,ce!==R&&_.isPropagationStopped())break e;aA(_,re,Se),R=ce}else for(D=0;D<w.length;D++){if(re=w[D],ce=re.instance,Se=re.currentTarget,re=re.listener,ce!==R&&_.isPropagationStopped())break e;aA(_,re,Se),R=ce}}}if(Te)throw l=Qt,Te=!1,Qt=null,l}function Pn(l,d){var g=d[qx];g===void 0&&(g=d[qx]=new Set);var w=l+"__bubble";g.has(w)||(oA(d,l,2,!1),g.add(w))}function Ix(l,d,g){var w=0;d&&(w|=4),oA(g,l,w,d)}var Fp="_reactListening"+Math.random().toString(36).slice(2);function sd(l){if(!l[Fp]){l[Fp]=!0,r.forEach(function(g){g!=="selectionchange"&&(w7.has(g)||Ix(g,!1,l),Ix(g,!0,l))});var d=l.nodeType===9?l:l.ownerDocument;d===null||d[Fp]||(d[Fp]=!0,Ix("selectionchange",!1,d))}}function oA(l,d,g,w){switch(Ek(d)){case 1:var _=IU;break;case 4:_=$U;break;default:_=xx}g=_.bind(null,d,g,l),_=void 0,!Ke||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(_=!0),w?_!==void 0?l.addEventListener(d,g,{capture:!0,passive:_}):l.addEventListener(d,g,!0):_!==void 0?l.addEventListener(d,g,{passive:_}):l.addEventListener(d,g,!1)}function $x(l,d,g,w,_){var R=w;if((d&1)===0&&(d&2)===0&&w!==null)e:for(;;){if(w===null)return;var D=w.tag;if(D===3||D===4){var re=w.stateNode.containerInfo;if(re===_||re.nodeType===8&&re.parentNode===_)break;if(D===4)for(D=w.return;D!==null;){var ce=D.tag;if((ce===3||ce===4)&&(ce=D.stateNode.containerInfo,ce===_||ce.nodeType===8&&ce.parentNode===_))return;D=D.return}for(;re!==null;){if(D=Bi(re),D===null)return;if(ce=D.tag,ce===5||ce===6){w=R=D;continue e}re=re.parentNode}}w=w.return}pe(function(){var Se=R,Be=Oe(g),He=[];e:{var Fe=nA.get(l);if(Fe!==void 0){var dt=wx,xt=l;switch(l){case"keypress":if(Op(g)===0)break e;case"keydown":case"keyup":dt=QU;break;case"focusin":xt="focus",dt=Nx;break;case"focusout":xt="blur",dt=Nx;break;case"beforeblur":case"afterblur":dt=Nx;break;case"click":if(g.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":dt=Tk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":dt=FU;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":dt=e7;break;case Jk:case Zk:case eA:dt=qU;break;case tA:dt=n7;break;case"scroll":dt=DU;break;case"wheel":dt=a7;break;case"copy":case"cut":case"paste":dt=WU;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":dt=Mk}var yt=(d&4)!==0,Qn=!yt&&l==="scroll",be=yt?Fe!==null?Fe+"Capture":null:Fe;yt=[];for(var he=Se,je;he!==null;){je=he;var Ye=je.stateNode;if(je.tag===5&&Ye!==null&&(je=Ye,be!==null&&(Ye=Ae(he,be),Ye!=null&&yt.push(od(he,Ye,je)))),Qn)break;he=he.return}0<yt.length&&(Fe=new dt(Fe,xt,null,g,Be),He.push({event:Fe,listeners:yt}))}}if((d&7)===0){e:{if(Fe=l==="mouseover"||l==="pointerover",dt=l==="mouseout"||l==="pointerout",Fe&&g!==fe&&(xt=g.relatedTarget||g.fromElement)&&(Bi(xt)||xt[lo]))break e;if((dt||Fe)&&(Fe=Be.window===Be?Be:(Fe=Be.ownerDocument)?Fe.defaultView||Fe.parentWindow:window,dt?(xt=g.relatedTarget||g.toElement,dt=Se,xt=xt?Bi(xt):null,xt!==null&&(Qn=zn(xt),xt!==Qn||xt.tag!==5&&xt.tag!==6)&&(xt=null)):(dt=null,xt=Se),dt!==xt)){if(yt=Tk,Ye="onMouseLeave",be="onMouseEnter",he="mouse",(l==="pointerout"||l==="pointerover")&&(yt=Mk,Ye="onPointerLeave",be="onPointerEnter",he="pointer"),Qn=dt==null?Fe:ac(dt),je=xt==null?Fe:ac(xt),Fe=new yt(Ye,he+"leave",dt,g,Be),Fe.target=Qn,Fe.relatedTarget=je,Ye=null,Bi(Be)===Se&&(yt=new yt(be,he+"enter",xt,g,Be),yt.target=je,yt.relatedTarget=Qn,Ye=yt),Qn=Ye,dt&&xt)t:{for(yt=dt,be=xt,he=0,je=yt;je;je=nc(je))he++;for(je=0,Ye=be;Ye;Ye=nc(Ye))je++;for(;0<he-je;)yt=nc(yt),he--;for(;0<je-he;)be=nc(be),je--;for(;he--;){if(yt===be||be!==null&&yt===be.alternate)break t;yt=nc(yt),be=nc(be)}yt=null}else yt=null;dt!==null&&iA(He,Fe,dt,yt,!1),xt!==null&&Qn!==null&&iA(He,Qn,xt,yt,!0)}}e:{if(Fe=Se?ac(Se):window,dt=Fe.nodeName&&Fe.nodeName.toLowerCase(),dt==="select"||dt==="input"&&Fe.type==="file")var bt=d7;else if(zk(Fe))if(qk)bt=m7;else{bt=p7;var Rt=f7}else(dt=Fe.nodeName)&&dt.toLowerCase()==="input"&&(Fe.type==="checkbox"||Fe.type==="radio")&&(bt=h7);if(bt&&(bt=bt(l,Se))){Bk(He,bt,g,Be);break e}Rt&&Rt(l,Fe,Se),l==="focusout"&&(Rt=Fe._wrapperState)&&Rt.controlled&&Fe.type==="number"&&Ge(Fe,"number",Fe.value)}switch(Rt=Se?ac(Se):window,l){case"focusin":(zk(Rt)||Rt.contentEditable==="true")&&(ec=Rt,Px=Se,rd=null);break;case"focusout":rd=Px=ec=null;break;case"mousedown":Rx=!0;break;case"contextmenu":case"mouseup":case"dragend":Rx=!1,Xk(He,g,Be);break;case"selectionchange":if(x7)break;case"keydown":case"keyup":Xk(He,g,Be)}var Tt;if(_x)e:{switch(l){case"compositionstart":var Bt="onCompositionStart";break e;case"compositionend":Bt="onCompositionEnd";break e;case"compositionupdate":Bt="onCompositionUpdate";break e}Bt=void 0}else Zl?Lk(l,g)&&(Bt="onCompositionEnd"):l==="keydown"&&g.keyCode===229&&(Bt="onCompositionStart");Bt&&(Ik&&g.locale!=="ko"&&(Zl||Bt!=="onCompositionStart"?Bt==="onCompositionEnd"&&Zl&&(Tt=Pk()):(Qo=Be,bx="value"in Qo?Qo.value:Qo.textContent,Zl=!0)),Rt=zp(Se,Bt),0<Rt.length&&(Bt=new Ok(Bt,l,null,g,Be),He.push({event:Bt,listeners:Rt}),Tt?Bt.data=Tt:(Tt=Fk(g),Tt!==null&&(Bt.data=Tt)))),(Tt=o7?i7(l,g):l7(l,g))&&(Se=zp(Se,"onBeforeInput"),0<Se.length&&(Be=new Ok("onBeforeInput","beforeinput",null,g,Be),He.push({event:Be,listeners:Se}),Be.data=Tt))}sA(He,d)})}function od(l,d,g){return{instance:l,listener:d,currentTarget:g}}function zp(l,d){for(var g=d+"Capture",w=[];l!==null;){var _=l,R=_.stateNode;_.tag===5&&R!==null&&(_=R,R=Ae(l,g),R!=null&&w.unshift(od(l,R,_)),R=Ae(l,d),R!=null&&w.push(od(l,R,_))),l=l.return}return w}function nc(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5);return l||null}function iA(l,d,g,w,_){for(var R=d._reactName,D=[];g!==null&&g!==w;){var re=g,ce=re.alternate,Se=re.stateNode;if(ce!==null&&ce===w)break;re.tag===5&&Se!==null&&(re=Se,_?(ce=Ae(g,R),ce!=null&&D.unshift(od(g,ce,re))):_||(ce=Ae(g,R),ce!=null&&D.push(od(g,ce,re)))),g=g.return}D.length!==0&&l.push({event:d,listeners:D})}var j7=/\r\n?/g,S7=/\u0000|\uFFFD/g;function lA(l){return(typeof l=="string"?l:""+l).replace(j7,`
6
6
  `).replace(S7,"")}function Bp(l,d,g){if(d=lA(d),lA(l)!==d&&g)throw Error(n(425))}function qp(){}var Dx=null,Lx=null;function Fx(l,d){return l==="textarea"||l==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var zx=typeof setTimeout=="function"?setTimeout:void 0,N7=typeof clearTimeout=="function"?clearTimeout:void 0,cA=typeof Promise=="function"?Promise:void 0,C7=typeof queueMicrotask=="function"?queueMicrotask:typeof cA<"u"?function(l){return cA.resolve(null).then(l).catch(_7)}:zx;function _7(l){setTimeout(function(){throw l})}function Bx(l,d){var g=d,w=0;do{var _=g.nextSibling;if(l.removeChild(g),_&&_.nodeType===8)if(g=_.data,g==="/$"){if(w===0){l.removeChild(_),Xu(d);return}w--}else g!=="$"&&g!=="$?"&&g!=="$!"||w++;g=_}while(g);Xu(d)}function Zo(l){for(;l!=null;l=l.nextSibling){var d=l.nodeType;if(d===1||d===3)break;if(d===8){if(d=l.data,d==="$"||d==="$!"||d==="$?")break;if(d==="/$")return null}}return l}function uA(l){l=l.previousSibling;for(var d=0;l;){if(l.nodeType===8){var g=l.data;if(g==="$"||g==="$!"||g==="$?"){if(d===0)return l;d--}else g==="/$"&&d++}l=l.previousSibling}return null}var rc=Math.random().toString(36).slice(2),Ls="__reactFiber$"+rc,id="__reactProps$"+rc,lo="__reactContainer$"+rc,qx="__reactEvents$"+rc,k7="__reactListeners$"+rc,A7="__reactHandles$"+rc;function Bi(l){var d=l[Ls];if(d)return d;for(var g=l.parentNode;g;){if(d=g[lo]||g[Ls]){if(g=d.alternate,d.child!==null||g!==null&&g.child!==null)for(l=uA(l);l!==null;){if(g=l[Ls])return g;l=uA(l)}return d}l=g,g=l.parentNode}return null}function ld(l){return l=l[Ls]||l[lo],!l||l.tag!==5&&l.tag!==6&&l.tag!==13&&l.tag!==3?null:l}function ac(l){if(l.tag===5||l.tag===6)return l.stateNode;throw Error(n(33))}function Up(l){return l[id]||null}var Ux=[],sc=-1;function ei(l){return{current:l}}function Rn(l){0>sc||(l.current=Ux[sc],Ux[sc]=null,sc--)}function Sn(l,d){sc++,Ux[sc]=l.current,l.current=d}var ti={},Ar=ei(ti),Yr=ei(!1),qi=ti;function oc(l,d){var g=l.type.contextTypes;if(!g)return ti;var w=l.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===d)return w.__reactInternalMemoizedMaskedChildContext;var _={},R;for(R in g)_[R]=d[R];return w&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=_),_}function Xr(l){return l=l.childContextTypes,l!=null}function Wp(){Rn(Yr),Rn(Ar)}function dA(l,d,g){if(Ar.current!==ti)throw Error(n(168));Sn(Ar,d),Sn(Yr,g)}function fA(l,d,g){var w=l.stateNode;if(d=d.childContextTypes,typeof w.getChildContext!="function")return g;w=w.getChildContext();for(var _ in w)if(!(_ in d))throw Error(n(108,se(l)||"Unknown",_));return Q({},g,w)}function Hp(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||ti,qi=Ar.current,Sn(Ar,l),Sn(Yr,Yr.current),!0}function pA(l,d,g){var w=l.stateNode;if(!w)throw Error(n(169));g?(l=fA(l,d,qi),w.__reactInternalMemoizedMergedChildContext=l,Rn(Yr),Rn(Ar),Sn(Ar,l)):Rn(Yr),Sn(Yr,g)}var co=null,Vp=!1,Wx=!1;function hA(l){co===null?co=[l]:co.push(l)}function E7(l){Vp=!0,hA(l)}function ni(){if(!Wx&&co!==null){Wx=!0;var l=0,d=gn;try{var g=co;for(gn=1;l<g.length;l++){var w=g[l];do w=w(!0);while(w!==null)}co=null,Vp=!1}catch(_){throw co!==null&&(co=co.slice(l+1)),jr(Vo,ni),_}finally{gn=d,Wx=!1}}return null}var ic=[],lc=0,Kp=null,Gp=0,Ta=[],Oa=0,Ui=null,uo=1,fo="";function Wi(l,d){ic[lc++]=Gp,ic[lc++]=Kp,Kp=l,Gp=d}function mA(l,d,g){Ta[Oa++]=uo,Ta[Oa++]=fo,Ta[Oa++]=Ui,Ui=l;var w=uo;l=fo;var _=32-Ne(w)-1;w&=~(1<<_),g+=1;var R=32-Ne(d)+_;if(30<R){var D=_-_%5;R=(w&(1<<D)-1).toString(32),w>>=D,_-=D,uo=1<<32-Ne(d)+_|g<<_|w,fo=R+l}else uo=1<<R|g<<_|w,fo=l}function Hx(l){l.return!==null&&(Wi(l,1),mA(l,1,0))}function Vx(l){for(;l===Kp;)Kp=ic[--lc],ic[lc]=null,Gp=ic[--lc],ic[lc]=null;for(;l===Ui;)Ui=Ta[--Oa],Ta[Oa]=null,fo=Ta[--Oa],Ta[Oa]=null,uo=Ta[--Oa],Ta[Oa]=null}var ma=null,ga=null,Dn=!1,fs=null;function gA(l,d){var g=Da(5,null,null,0);g.elementType="DELETED",g.stateNode=d,g.return=l,d=l.deletions,d===null?(l.deletions=[g],l.flags|=16):d.push(g)}function vA(l,d){switch(l.tag){case 5:var g=l.type;return d=d.nodeType!==1||g.toLowerCase()!==d.nodeName.toLowerCase()?null:d,d!==null?(l.stateNode=d,ma=l,ga=Zo(d.firstChild),!0):!1;case 6:return d=l.pendingProps===""||d.nodeType!==3?null:d,d!==null?(l.stateNode=d,ma=l,ga=null,!0):!1;case 13:return d=d.nodeType!==8?null:d,d!==null?(g=Ui!==null?{id:uo,overflow:fo}:null,l.memoizedState={dehydrated:d,treeContext:g,retryLane:1073741824},g=Da(18,null,null,0),g.stateNode=d,g.return=l,l.child=g,ma=l,ga=null,!0):!1;default:return!1}}function Kx(l){return(l.mode&1)!==0&&(l.flags&128)===0}function Gx(l){if(Dn){var d=ga;if(d){var g=d;if(!vA(l,d)){if(Kx(l))throw Error(n(418));d=Zo(g.nextSibling);var w=ma;d&&vA(l,d)?gA(w,g):(l.flags=l.flags&-4097|2,Dn=!1,ma=l)}}else{if(Kx(l))throw Error(n(418));l.flags=l.flags&-4097|2,Dn=!1,ma=l}}}function xA(l){for(l=l.return;l!==null&&l.tag!==5&&l.tag!==3&&l.tag!==13;)l=l.return;ma=l}function Yp(l){if(l!==ma)return!1;if(!Dn)return xA(l),Dn=!0,!1;var d;if((d=l.tag!==3)&&!(d=l.tag!==5)&&(d=l.type,d=d!=="head"&&d!=="body"&&!Fx(l.type,l.memoizedProps)),d&&(d=ga)){if(Kx(l))throw yA(),Error(n(418));for(;d;)gA(l,d),d=Zo(d.nextSibling)}if(xA(l),l.tag===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(n(317));e:{for(l=l.nextSibling,d=0;l;){if(l.nodeType===8){var g=l.data;if(g==="/$"){if(d===0){ga=Zo(l.nextSibling);break e}d--}else g!=="$"&&g!=="$!"&&g!=="$?"||d++}l=l.nextSibling}ga=null}}else ga=ma?Zo(l.stateNode.nextSibling):null;return!0}function yA(){for(var l=ga;l;)l=Zo(l.nextSibling)}function cc(){ga=ma=null,Dn=!1}function Yx(l){fs===null?fs=[l]:fs.push(l)}var P7=k.ReactCurrentBatchConfig;function cd(l,d,g){if(l=g.ref,l!==null&&typeof l!="function"&&typeof l!="object"){if(g._owner){if(g=g._owner,g){if(g.tag!==1)throw Error(n(309));var w=g.stateNode}if(!w)throw Error(n(147,l));var _=w,R=""+l;return d!==null&&d.ref!==null&&typeof d.ref=="function"&&d.ref._stringRef===R?d.ref:(d=function(D){var re=_.refs;D===null?delete re[R]:re[R]=D},d._stringRef=R,d)}if(typeof l!="string")throw Error(n(284));if(!g._owner)throw Error(n(290,l))}return l}function Xp(l,d){throw l=Object.prototype.toString.call(d),Error(n(31,l==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":l))}function bA(l){var d=l._init;return d(l._payload)}function wA(l){function d(be,he){if(l){var je=be.deletions;je===null?(be.deletions=[he],be.flags|=16):je.push(he)}}function g(be,he){if(!l)return null;for(;he!==null;)d(be,he),he=he.sibling;return null}function w(be,he){for(be=new Map;he!==null;)he.key!==null?be.set(he.key,he):be.set(he.index,he),he=he.sibling;return be}function _(be,he){return be=ui(be,he),be.index=0,be.sibling=null,be}function R(be,he,je){return be.index=je,l?(je=be.alternate,je!==null?(je=je.index,je<he?(be.flags|=2,he):je):(be.flags|=2,he)):(be.flags|=1048576,he)}function D(be){return l&&be.alternate===null&&(be.flags|=2),be}function re(be,he,je,Ye){return he===null||he.tag!==6?(he=zy(je,be.mode,Ye),he.return=be,he):(he=_(he,je),he.return=be,he)}function ce(be,he,je,Ye){var bt=je.type;return bt===P?Be(be,he,je.props.children,Ye,je.key):he!==null&&(he.elementType===bt||typeof bt=="object"&&bt!==null&&bt.$$typeof===M&&bA(bt)===he.type)?(Ye=_(he,je.props),Ye.ref=cd(be,he,je),Ye.return=be,Ye):(Ye=bh(je.type,je.key,je.props,null,be.mode,Ye),Ye.ref=cd(be,he,je),Ye.return=be,Ye)}function Se(be,he,je,Ye){return he===null||he.tag!==4||he.stateNode.containerInfo!==je.containerInfo||he.stateNode.implementation!==je.implementation?(he=By(je,be.mode,Ye),he.return=be,he):(he=_(he,je.children||[]),he.return=be,he)}function Be(be,he,je,Ye,bt){return he===null||he.tag!==7?(he=Ji(je,be.mode,Ye,bt),he.return=be,he):(he=_(he,je),he.return=be,he)}function He(be,he,je){if(typeof he=="string"&&he!==""||typeof he=="number")return he=zy(""+he,be.mode,je),he.return=be,he;if(typeof he=="object"&&he!==null){switch(he.$$typeof){case A:return je=bh(he.type,he.key,he.props,null,be.mode,je),je.ref=cd(be,null,he),je.return=be,je;case E:return he=By(he,be.mode,je),he.return=be,he;case M:var Ye=he._init;return He(be,Ye(he._payload),je)}if(Ee(he)||O(he))return he=Ji(he,be.mode,je,null),he.return=be,he;Xp(be,he)}return null}function Fe(be,he,je,Ye){var bt=he!==null?he.key:null;if(typeof je=="string"&&je!==""||typeof je=="number")return bt!==null?null:re(be,he,""+je,Ye);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case A:return je.key===bt?ce(be,he,je,Ye):null;case E:return je.key===bt?Se(be,he,je,Ye):null;case M:return bt=je._init,Fe(be,he,bt(je._payload),Ye)}if(Ee(je)||O(je))return bt!==null?null:Be(be,he,je,Ye,null);Xp(be,je)}return null}function dt(be,he,je,Ye,bt){if(typeof Ye=="string"&&Ye!==""||typeof Ye=="number")return be=be.get(je)||null,re(he,be,""+Ye,bt);if(typeof Ye=="object"&&Ye!==null){switch(Ye.$$typeof){case A:return be=be.get(Ye.key===null?je:Ye.key)||null,ce(he,be,Ye,bt);case E:return be=be.get(Ye.key===null?je:Ye.key)||null,Se(he,be,Ye,bt);case M:var Rt=Ye._init;return dt(be,he,je,Rt(Ye._payload),bt)}if(Ee(Ye)||O(Ye))return be=be.get(je)||null,Be(he,be,Ye,bt,null);Xp(he,Ye)}return null}function xt(be,he,je,Ye){for(var bt=null,Rt=null,Tt=he,Bt=he=0,vr=null;Tt!==null&&Bt<je.length;Bt++){Tt.index>Bt?(vr=Tt,Tt=null):vr=Tt.sibling;var cn=Fe(be,Tt,je[Bt],Ye);if(cn===null){Tt===null&&(Tt=vr);break}l&&Tt&&cn.alternate===null&&d(be,Tt),he=R(cn,he,Bt),Rt===null?bt=cn:Rt.sibling=cn,Rt=cn,Tt=vr}if(Bt===je.length)return g(be,Tt),Dn&&Wi(be,Bt),bt;if(Tt===null){for(;Bt<je.length;Bt++)Tt=He(be,je[Bt],Ye),Tt!==null&&(he=R(Tt,he,Bt),Rt===null?bt=Tt:Rt.sibling=Tt,Rt=Tt);return Dn&&Wi(be,Bt),bt}for(Tt=w(be,Tt);Bt<je.length;Bt++)vr=dt(Tt,be,Bt,je[Bt],Ye),vr!==null&&(l&&vr.alternate!==null&&Tt.delete(vr.key===null?Bt:vr.key),he=R(vr,he,Bt),Rt===null?bt=vr:Rt.sibling=vr,Rt=vr);return l&&Tt.forEach(function(di){return d(be,di)}),Dn&&Wi(be,Bt),bt}function yt(be,he,je,Ye){var bt=O(je);if(typeof bt!="function")throw Error(n(150));if(je=bt.call(je),je==null)throw Error(n(151));for(var Rt=bt=null,Tt=he,Bt=he=0,vr=null,cn=je.next();Tt!==null&&!cn.done;Bt++,cn=je.next()){Tt.index>Bt?(vr=Tt,Tt=null):vr=Tt.sibling;var di=Fe(be,Tt,cn.value,Ye);if(di===null){Tt===null&&(Tt=vr);break}l&&Tt&&di.alternate===null&&d(be,Tt),he=R(di,he,Bt),Rt===null?bt=di:Rt.sibling=di,Rt=di,Tt=vr}if(cn.done)return g(be,Tt),Dn&&Wi(be,Bt),bt;if(Tt===null){for(;!cn.done;Bt++,cn=je.next())cn=He(be,cn.value,Ye),cn!==null&&(he=R(cn,he,Bt),Rt===null?bt=cn:Rt.sibling=cn,Rt=cn);return Dn&&Wi(be,Bt),bt}for(Tt=w(be,Tt);!cn.done;Bt++,cn=je.next())cn=dt(Tt,be,Bt,cn.value,Ye),cn!==null&&(l&&cn.alternate!==null&&Tt.delete(cn.key===null?Bt:cn.key),he=R(cn,he,Bt),Rt===null?bt=cn:Rt.sibling=cn,Rt=cn);return l&&Tt.forEach(function(c9){return d(be,c9)}),Dn&&Wi(be,Bt),bt}function Qn(be,he,je,Ye){if(typeof je=="object"&&je!==null&&je.type===P&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case A:e:{for(var bt=je.key,Rt=he;Rt!==null;){if(Rt.key===bt){if(bt=je.type,bt===P){if(Rt.tag===7){g(be,Rt.sibling),he=_(Rt,je.props.children),he.return=be,be=he;break e}}else if(Rt.elementType===bt||typeof bt=="object"&&bt!==null&&bt.$$typeof===M&&bA(bt)===Rt.type){g(be,Rt.sibling),he=_(Rt,je.props),he.ref=cd(be,Rt,je),he.return=be,be=he;break e}g(be,Rt);break}else d(be,Rt);Rt=Rt.sibling}je.type===P?(he=Ji(je.props.children,be.mode,Ye,je.key),he.return=be,be=he):(Ye=bh(je.type,je.key,je.props,null,be.mode,Ye),Ye.ref=cd(be,he,je),Ye.return=be,be=Ye)}return D(be);case E:e:{for(Rt=je.key;he!==null;){if(he.key===Rt)if(he.tag===4&&he.stateNode.containerInfo===je.containerInfo&&he.stateNode.implementation===je.implementation){g(be,he.sibling),he=_(he,je.children||[]),he.return=be,be=he;break e}else{g(be,he);break}else d(be,he);he=he.sibling}he=By(je,be.mode,Ye),he.return=be,be=he}return D(be);case M:return Rt=je._init,Qn(be,he,Rt(je._payload),Ye)}if(Ee(je))return xt(be,he,je,Ye);if(O(je))return yt(be,he,je,Ye);Xp(be,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,he!==null&&he.tag===6?(g(be,he.sibling),he=_(he,je),he.return=be,be=he):(g(be,he),he=zy(je,be.mode,Ye),he.return=be,be=he),D(be)):g(be,he)}return Qn}var uc=wA(!0),jA=wA(!1),Qp=ei(null),Jp=null,dc=null,Xx=null;function Qx(){Xx=dc=Jp=null}function Jx(l){var d=Qp.current;Rn(Qp),l._currentValue=d}function Zx(l,d,g){for(;l!==null;){var w=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,w!==null&&(w.childLanes|=d)):w!==null&&(w.childLanes&d)!==d&&(w.childLanes|=d),l===g)break;l=l.return}}function fc(l,d){Jp=l,Xx=dc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(Qr=!0),l.firstContext=null)}function Ma(l){var d=l._currentValue;if(Xx!==l)if(l={context:l,memoizedValue:d,next:null},dc===null){if(Jp===null)throw Error(n(308));dc=l,Jp.dependencies={lanes:0,firstContext:l}}else dc=dc.next=l;return d}var Hi=null;function ey(l){Hi===null?Hi=[l]:Hi.push(l)}function SA(l,d,g,w){var _=d.interleaved;return _===null?(g.next=g,ey(d)):(g.next=_.next,_.next=g),d.interleaved=g,po(l,w)}function po(l,d){l.lanes|=d;var g=l.alternate;for(g!==null&&(g.lanes|=d),g=l,l=l.return;l!==null;)l.childLanes|=d,g=l.alternate,g!==null&&(g.childLanes|=d),g=l,l=l.return;return g.tag===3?g.stateNode:null}var ri=!1;function ty(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function NA(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function ho(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function ai(l,d,g){var w=l.updateQueue;if(w===null)return null;if(w=w.shared,(on&2)!==0){var _=w.pending;return _===null?d.next=d:(d.next=_.next,_.next=d),w.pending=d,po(l,g)}return _=w.interleaved,_===null?(d.next=d,ey(w)):(d.next=_.next,_.next=d),w.interleaved=d,po(l,g)}function Zp(l,d,g){if(d=d.updateQueue,d!==null&&(d=d.shared,(g&4194240)!==0)){var w=d.lanes;w&=l.pendingLanes,g|=w,d.lanes=g,zi(l,g)}}function CA(l,d){var g=l.updateQueue,w=l.alternate;if(w!==null&&(w=w.updateQueue,g===w)){var _=null,R=null;if(g=g.firstBaseUpdate,g!==null){do{var D={eventTime:g.eventTime,lane:g.lane,tag:g.tag,payload:g.payload,callback:g.callback,next:null};R===null?_=R=D:R=R.next=D,g=g.next}while(g!==null);R===null?_=R=d:R=R.next=d}else _=R=d;g={baseState:w.baseState,firstBaseUpdate:_,lastBaseUpdate:R,shared:w.shared,effects:w.effects},l.updateQueue=g;return}l=g.lastBaseUpdate,l===null?g.firstBaseUpdate=d:l.next=d,g.lastBaseUpdate=d}function eh(l,d,g,w){var _=l.updateQueue;ri=!1;var R=_.firstBaseUpdate,D=_.lastBaseUpdate,re=_.shared.pending;if(re!==null){_.shared.pending=null;var ce=re,Se=ce.next;ce.next=null,D===null?R=Se:D.next=Se,D=ce;var Be=l.alternate;Be!==null&&(Be=Be.updateQueue,re=Be.lastBaseUpdate,re!==D&&(re===null?Be.firstBaseUpdate=Se:re.next=Se,Be.lastBaseUpdate=ce))}if(R!==null){var He=_.baseState;D=0,Be=Se=ce=null,re=R;do{var Fe=re.lane,dt=re.eventTime;if((w&Fe)===Fe){Be!==null&&(Be=Be.next={eventTime:dt,lane:0,tag:re.tag,payload:re.payload,callback:re.callback,next:null});e:{var xt=l,yt=re;switch(Fe=d,dt=g,yt.tag){case 1:if(xt=yt.payload,typeof xt=="function"){He=xt.call(dt,He,Fe);break e}He=xt;break e;case 3:xt.flags=xt.flags&-65537|128;case 0:if(xt=yt.payload,Fe=typeof xt=="function"?xt.call(dt,He,Fe):xt,Fe==null)break e;He=Q({},He,Fe);break e;case 2:ri=!0}}re.callback!==null&&re.lane!==0&&(l.flags|=64,Fe=_.effects,Fe===null?_.effects=[re]:Fe.push(re))}else dt={eventTime:dt,lane:Fe,tag:re.tag,payload:re.payload,callback:re.callback,next:null},Be===null?(Se=Be=dt,ce=He):Be=Be.next=dt,D|=Fe;if(re=re.next,re===null){if(re=_.shared.pending,re===null)break;Fe=re,re=Fe.next,Fe.next=null,_.lastBaseUpdate=Fe,_.shared.pending=null}}while(!0);if(Be===null&&(ce=He),_.baseState=ce,_.firstBaseUpdate=Se,_.lastBaseUpdate=Be,d=_.shared.interleaved,d!==null){_=d;do D|=_.lane,_=_.next;while(_!==d)}else R===null&&(_.shared.lanes=0);Gi|=D,l.lanes=D,l.memoizedState=He}}function _A(l,d,g){if(l=d.effects,d.effects=null,l!==null)for(d=0;d<l.length;d++){var w=l[d],_=w.callback;if(_!==null){if(w.callback=null,w=g,typeof _!="function")throw Error(n(191,_));_.call(w)}}}var ud={},Fs=ei(ud),dd=ei(ud),fd=ei(ud);function Vi(l){if(l===ud)throw Error(n(174));return l}function ny(l,d){switch(Sn(fd,d),Sn(dd,l),Sn(Fs,ud),l=d.nodeType,l){case 9:case 11:d=(d=d.documentElement)?d.namespaceURI:rn(null,"");break;default:l=l===8?d.parentNode:d,d=l.namespaceURI||null,l=l.tagName,d=rn(d,l)}Rn(Fs),Sn(Fs,d)}function pc(){Rn(Fs),Rn(dd),Rn(fd)}function kA(l){Vi(fd.current);var d=Vi(Fs.current),g=rn(d,l.type);d!==g&&(Sn(dd,l),Sn(Fs,g))}function ry(l){dd.current===l&&(Rn(Fs),Rn(dd))}var Un=ei(0);function th(l){for(var d=l;d!==null;){if(d.tag===13){var g=d.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||g.data==="$?"||g.data==="$!"))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var ay=[];function sy(){for(var l=0;l<ay.length;l++)ay[l]._workInProgressVersionPrimary=null;ay.length=0}var nh=k.ReactCurrentDispatcher,oy=k.ReactCurrentBatchConfig,Ki=0,Wn=null,or=null,mr=null,rh=!1,pd=!1,hd=0,R7=0;function Er(){throw Error(n(321))}function iy(l,d){if(d===null)return!1;for(var g=0;g<d.length&&g<l.length;g++)if(!ds(l[g],d[g]))return!1;return!0}function ly(l,d,g,w,_,R){if(Ki=R,Wn=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,nh.current=l===null||l.memoizedState===null?I7:$7,l=g(w,_),pd){R=0;do{if(pd=!1,hd=0,25<=R)throw Error(n(301));R+=1,mr=or=null,d.updateQueue=null,nh.current=D7,l=g(w,_)}while(pd)}if(nh.current=oh,d=or!==null&&or.next!==null,Ki=0,mr=or=Wn=null,rh=!1,d)throw Error(n(300));return l}function cy(){var l=hd!==0;return hd=0,l}function zs(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mr===null?Wn.memoizedState=mr=l:mr=mr.next=l,mr}function Ia(){if(or===null){var l=Wn.alternate;l=l!==null?l.memoizedState:null}else l=or.next;var d=mr===null?Wn.memoizedState:mr.next;if(d!==null)mr=d,or=l;else{if(l===null)throw Error(n(310));or=l,l={memoizedState:or.memoizedState,baseState:or.baseState,baseQueue:or.baseQueue,queue:or.queue,next:null},mr===null?Wn.memoizedState=mr=l:mr=mr.next=l}return mr}function md(l,d){return typeof d=="function"?d(l):d}function uy(l){var d=Ia(),g=d.queue;if(g===null)throw Error(n(311));g.lastRenderedReducer=l;var w=or,_=w.baseQueue,R=g.pending;if(R!==null){if(_!==null){var D=_.next;_.next=R.next,R.next=D}w.baseQueue=_=R,g.pending=null}if(_!==null){R=_.next,w=w.baseState;var re=D=null,ce=null,Se=R;do{var Be=Se.lane;if((Ki&Be)===Be)ce!==null&&(ce=ce.next={lane:0,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null}),w=Se.hasEagerState?Se.eagerState:l(w,Se.action);else{var He={lane:Be,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null};ce===null?(re=ce=He,D=w):ce=ce.next=He,Wn.lanes|=Be,Gi|=Be}Se=Se.next}while(Se!==null&&Se!==R);ce===null?D=w:ce.next=re,ds(w,d.memoizedState)||(Qr=!0),d.memoizedState=w,d.baseState=D,d.baseQueue=ce,g.lastRenderedState=w}if(l=g.interleaved,l!==null){_=l;do R=_.lane,Wn.lanes|=R,Gi|=R,_=_.next;while(_!==l)}else _===null&&(g.lanes=0);return[d.memoizedState,g.dispatch]}function dy(l){var d=Ia(),g=d.queue;if(g===null)throw Error(n(311));g.lastRenderedReducer=l;var w=g.dispatch,_=g.pending,R=d.memoizedState;if(_!==null){g.pending=null;var D=_=_.next;do R=l(R,D.action),D=D.next;while(D!==_);ds(R,d.memoizedState)||(Qr=!0),d.memoizedState=R,d.baseQueue===null&&(d.baseState=R),g.lastRenderedState=R}return[R,w]}function AA(){}function EA(l,d){var g=Wn,w=Ia(),_=d(),R=!ds(w.memoizedState,_);if(R&&(w.memoizedState=_,Qr=!0),w=w.queue,fy(TA.bind(null,g,w,l),[l]),w.getSnapshot!==d||R||mr!==null&&mr.memoizedState.tag&1){if(g.flags|=2048,gd(9,RA.bind(null,g,w,_,d),void 0,null),gr===null)throw Error(n(349));(Ki&30)!==0||PA(g,d,_)}return _}function PA(l,d,g){l.flags|=16384,l={getSnapshot:d,value:g},d=Wn.updateQueue,d===null?(d={lastEffect:null,stores:null},Wn.updateQueue=d,d.stores=[l]):(g=d.stores,g===null?d.stores=[l]:g.push(l))}function RA(l,d,g,w){d.value=g,d.getSnapshot=w,OA(d)&&MA(l)}function TA(l,d,g){return g(function(){OA(d)&&MA(l)})}function OA(l){var d=l.getSnapshot;l=l.value;try{var g=d();return!ds(l,g)}catch{return!0}}function MA(l){var d=po(l,1);d!==null&&gs(d,l,1,-1)}function IA(l){var d=zs();return typeof l=="function"&&(l=l()),d.memoizedState=d.baseState=l,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:md,lastRenderedState:l},d.queue=l,l=l.dispatch=M7.bind(null,Wn,l),[d.memoizedState,l]}function gd(l,d,g,w){return l={tag:l,create:d,destroy:g,deps:w,next:null},d=Wn.updateQueue,d===null?(d={lastEffect:null,stores:null},Wn.updateQueue=d,d.lastEffect=l.next=l):(g=d.lastEffect,g===null?d.lastEffect=l.next=l:(w=g.next,g.next=l,l.next=w,d.lastEffect=l)),l}function $A(){return Ia().memoizedState}function ah(l,d,g,w){var _=zs();Wn.flags|=l,_.memoizedState=gd(1|d,g,void 0,w===void 0?null:w)}function sh(l,d,g,w){var _=Ia();w=w===void 0?null:w;var R=void 0;if(or!==null){var D=or.memoizedState;if(R=D.destroy,w!==null&&iy(w,D.deps)){_.memoizedState=gd(d,g,R,w);return}}Wn.flags|=l,_.memoizedState=gd(1|d,g,R,w)}function DA(l,d){return ah(8390656,8,l,d)}function fy(l,d){return sh(2048,8,l,d)}function LA(l,d){return sh(4,2,l,d)}function FA(l,d){return sh(4,4,l,d)}function zA(l,d){if(typeof d=="function")return l=l(),d(l),function(){d(null)};if(d!=null)return l=l(),d.current=l,function(){d.current=null}}function BA(l,d,g){return g=g!=null?g.concat([l]):null,sh(4,4,zA.bind(null,d,l),g)}function py(){}function qA(l,d){var g=Ia();d=d===void 0?null:d;var w=g.memoizedState;return w!==null&&d!==null&&iy(d,w[1])?w[0]:(g.memoizedState=[l,d],l)}function UA(l,d){var g=Ia();d=d===void 0?null:d;var w=g.memoizedState;return w!==null&&d!==null&&iy(d,w[1])?w[0]:(l=l(),g.memoizedState=[l,d],l)}function WA(l,d,g){return(Ki&21)===0?(l.baseState&&(l.baseState=!1,Qr=!0),l.memoizedState=g):(ds(g,d)||(g=Ir(),Wn.lanes|=g,Gi|=g,l.baseState=!0),d)}function T7(l,d){var g=gn;gn=g!==0&&4>g?g:4,l(!0);var w=oy.transition;oy.transition={};try{l(!1),d()}finally{gn=g,oy.transition=w}}function HA(){return Ia().memoizedState}function O7(l,d,g){var w=li(l);if(g={lane:w,action:g,hasEagerState:!1,eagerState:null,next:null},VA(l))KA(d,g);else if(g=SA(l,d,g,w),g!==null){var _=Dr();gs(g,l,w,_),GA(g,d,w)}}function M7(l,d,g){var w=li(l),_={lane:w,action:g,hasEagerState:!1,eagerState:null,next:null};if(VA(l))KA(d,_);else{var R=l.alternate;if(l.lanes===0&&(R===null||R.lanes===0)&&(R=d.lastRenderedReducer,R!==null))try{var D=d.lastRenderedState,re=R(D,g);if(_.hasEagerState=!0,_.eagerState=re,ds(re,D)){var ce=d.interleaved;ce===null?(_.next=_,ey(d)):(_.next=ce.next,ce.next=_),d.interleaved=_;return}}catch{}g=SA(l,d,_,w),g!==null&&(_=Dr(),gs(g,l,w,_),GA(g,d,w))}}function VA(l){var d=l.alternate;return l===Wn||d!==null&&d===Wn}function KA(l,d){pd=rh=!0;var g=l.pending;g===null?d.next=d:(d.next=g.next,g.next=d),l.pending=d}function GA(l,d,g){if((g&4194240)!==0){var w=d.lanes;w&=l.pendingLanes,g|=w,d.lanes=g,zi(l,g)}}var oh={readContext:Ma,useCallback:Er,useContext:Er,useEffect:Er,useImperativeHandle:Er,useInsertionEffect:Er,useLayoutEffect:Er,useMemo:Er,useReducer:Er,useRef:Er,useState:Er,useDebugValue:Er,useDeferredValue:Er,useTransition:Er,useMutableSource:Er,useSyncExternalStore:Er,useId:Er,unstable_isNewReconciler:!1},I7={readContext:Ma,useCallback:function(l,d){return zs().memoizedState=[l,d===void 0?null:d],l},useContext:Ma,useEffect:DA,useImperativeHandle:function(l,d,g){return g=g!=null?g.concat([l]):null,ah(4194308,4,zA.bind(null,d,l),g)},useLayoutEffect:function(l,d){return ah(4194308,4,l,d)},useInsertionEffect:function(l,d){return ah(4,2,l,d)},useMemo:function(l,d){var g=zs();return d=d===void 0?null:d,l=l(),g.memoizedState=[l,d],l},useReducer:function(l,d,g){var w=zs();return d=g!==void 0?g(d):d,w.memoizedState=w.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},w.queue=l,l=l.dispatch=O7.bind(null,Wn,l),[w.memoizedState,l]},useRef:function(l){var d=zs();return l={current:l},d.memoizedState=l},useState:IA,useDebugValue:py,useDeferredValue:function(l){return zs().memoizedState=l},useTransition:function(){var l=IA(!1),d=l[0];return l=T7.bind(null,l[1]),zs().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,g){var w=Wn,_=zs();if(Dn){if(g===void 0)throw Error(n(407));g=g()}else{if(g=d(),gr===null)throw Error(n(349));(Ki&30)!==0||PA(w,d,g)}_.memoizedState=g;var R={value:g,getSnapshot:d};return _.queue=R,DA(TA.bind(null,w,R,l),[l]),w.flags|=2048,gd(9,RA.bind(null,w,R,g,d),void 0,null),g},useId:function(){var l=zs(),d=gr.identifierPrefix;if(Dn){var g=fo,w=uo;g=(w&~(1<<32-Ne(w)-1)).toString(32)+g,d=":"+d+"R"+g,g=hd++,0<g&&(d+="H"+g.toString(32)),d+=":"}else g=R7++,d=":"+d+"r"+g.toString(32)+":";return l.memoizedState=d},unstable_isNewReconciler:!1},$7={readContext:Ma,useCallback:qA,useContext:Ma,useEffect:fy,useImperativeHandle:BA,useInsertionEffect:LA,useLayoutEffect:FA,useMemo:UA,useReducer:uy,useRef:$A,useState:function(){return uy(md)},useDebugValue:py,useDeferredValue:function(l){var d=Ia();return WA(d,or.memoizedState,l)},useTransition:function(){var l=uy(md)[0],d=Ia().memoizedState;return[l,d]},useMutableSource:AA,useSyncExternalStore:EA,useId:HA,unstable_isNewReconciler:!1},D7={readContext:Ma,useCallback:qA,useContext:Ma,useEffect:fy,useImperativeHandle:BA,useInsertionEffect:LA,useLayoutEffect:FA,useMemo:UA,useReducer:dy,useRef:$A,useState:function(){return dy(md)},useDebugValue:py,useDeferredValue:function(l){var d=Ia();return or===null?d.memoizedState=l:WA(d,or.memoizedState,l)},useTransition:function(){var l=dy(md)[0],d=Ia().memoizedState;return[l,d]},useMutableSource:AA,useSyncExternalStore:EA,useId:HA,unstable_isNewReconciler:!1};function ps(l,d){if(l&&l.defaultProps){d=Q({},d),l=l.defaultProps;for(var g in l)d[g]===void 0&&(d[g]=l[g]);return d}return d}function hy(l,d,g,w){d=l.memoizedState,g=g(w,d),g=g==null?d:Q({},d,g),l.memoizedState=g,l.lanes===0&&(l.updateQueue.baseState=g)}var ih={isMounted:function(l){return(l=l._reactInternals)?zn(l)===l:!1},enqueueSetState:function(l,d,g){l=l._reactInternals;var w=Dr(),_=li(l),R=ho(w,_);R.payload=d,g!=null&&(R.callback=g),d=ai(l,R,_),d!==null&&(gs(d,l,_,w),Zp(d,l,_))},enqueueReplaceState:function(l,d,g){l=l._reactInternals;var w=Dr(),_=li(l),R=ho(w,_);R.tag=1,R.payload=d,g!=null&&(R.callback=g),d=ai(l,R,_),d!==null&&(gs(d,l,_,w),Zp(d,l,_))},enqueueForceUpdate:function(l,d){l=l._reactInternals;var g=Dr(),w=li(l),_=ho(g,w);_.tag=2,d!=null&&(_.callback=d),d=ai(l,_,w),d!==null&&(gs(d,l,w,g),Zp(d,l,w))}};function YA(l,d,g,w,_,R,D){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(w,R,D):d.prototype&&d.prototype.isPureReactComponent?!nd(g,w)||!nd(_,R):!0}function XA(l,d,g){var w=!1,_=ti,R=d.contextType;return typeof R=="object"&&R!==null?R=Ma(R):(_=Xr(d)?qi:Ar.current,w=d.contextTypes,R=(w=w!=null)?oc(l,_):ti),d=new d(g,R),l.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=ih,l.stateNode=d,d._reactInternals=l,w&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=_,l.__reactInternalMemoizedMaskedChildContext=R),d}function QA(l,d,g,w){l=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(g,w),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(g,w),d.state!==l&&ih.enqueueReplaceState(d,d.state,null)}function my(l,d,g,w){var _=l.stateNode;_.props=g,_.state=l.memoizedState,_.refs={},ty(l);var R=d.contextType;typeof R=="object"&&R!==null?_.context=Ma(R):(R=Xr(d)?qi:Ar.current,_.context=oc(l,R)),_.state=l.memoizedState,R=d.getDerivedStateFromProps,typeof R=="function"&&(hy(l,d,R,g),_.state=l.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(d=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),d!==_.state&&ih.enqueueReplaceState(_,_.state,null),eh(l,g,_,w),_.state=l.memoizedState),typeof _.componentDidMount=="function"&&(l.flags|=4194308)}function hc(l,d){try{var g="",w=d;do g+=ae(w),w=w.return;while(w);var _=g}catch(R){_=`
7
7
  Error generating stack: `+R.message+`
8
- `+R.stack}return{value:l,source:d,stack:_,digest:null}}function gy(l,d,g){return{value:l,source:null,stack:g??null,digest:d??null}}function vy(l,d){try{console.error(d.value)}catch(g){setTimeout(function(){throw g})}}var L7=typeof WeakMap=="function"?WeakMap:Map;function JA(l,d,g){g=ho(-1,g),g.tag=3,g.payload={element:null};var w=d.value;return g.callback=function(){hh||(hh=!0,Ty=w),vy(l,d)},g}function ZA(l,d,g){g=ho(-1,g),g.tag=3;var w=l.type.getDerivedStateFromError;if(typeof w=="function"){var _=d.value;g.payload=function(){return w(_)},g.callback=function(){vy(l,d)}}var R=l.stateNode;return R!==null&&typeof R.componentDidCatch=="function"&&(g.callback=function(){vy(l,d),typeof w!="function"&&(oi===null?oi=new Set([this]):oi.add(this));var D=d.stack;this.componentDidCatch(d.value,{componentStack:D!==null?D:""})}),g}function eE(l,d,g){var w=l.pingCache;if(w===null){w=l.pingCache=new L7;var _=new Set;w.set(d,_)}else _=w.get(d),_===void 0&&(_=new Set,w.set(d,_));_.has(g)||(_.add(g),l=J7.bind(null,l,d,g),d.then(l,l))}function tE(l){do{var d;if((d=l.tag===13)&&(d=l.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return l;l=l.return}while(l!==null);return null}function nE(l,d,g,w,_){return(l.mode&1)===0?(l===d?l.flags|=65536:(l.flags|=128,g.flags|=131072,g.flags&=-52805,g.tag===1&&(g.alternate===null?g.tag=17:(d=ho(-1,1),d.tag=2,ai(g,d,1))),g.lanes|=1),l):(l.flags|=65536,l.lanes=_,l)}var F7=k.ReactCurrentOwner,Qr=!1;function $r(l,d,g,w){d.child=l===null?jA(d,null,g,w):uc(d,l.child,g,w)}function rE(l,d,g,w,_){g=g.render;var R=d.ref;return fc(d,_),w=ly(l,d,g,w,R,_),g=cy(),l!==null&&!Qr?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~_,mo(l,d,_)):(Dn&&g&&Hx(d),d.flags|=1,$r(l,d,w,_),d.child)}function aE(l,d,g,w,_){if(l===null){var R=g.type;return typeof R=="function"&&!Fy(R)&&R.defaultProps===void 0&&g.compare===null&&g.defaultProps===void 0?(d.tag=15,d.type=R,sE(l,d,R,w,_)):(l=bh(g.type,null,w,d,d.mode,_),l.ref=d.ref,l.return=d,d.child=l)}if(R=l.child,(l.lanes&_)===0){var D=R.memoizedProps;if(g=g.compare,g=g!==null?g:nd,g(D,w)&&l.ref===d.ref)return mo(l,d,_)}return d.flags|=1,l=ui(R,w),l.ref=d.ref,l.return=d,d.child=l}function sE(l,d,g,w,_){if(l!==null){var R=l.memoizedProps;if(nd(R,w)&&l.ref===d.ref)if(Qr=!1,d.pendingProps=w=R,(l.lanes&_)!==0)(l.flags&131072)!==0&&(Qr=!0);else return d.lanes=l.lanes,mo(l,d,_)}return xy(l,d,g,w,_)}function oE(l,d,g){var w=d.pendingProps,_=w.children,R=l!==null?l.memoizedState:null;if(w.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},Sn(gc,va),va|=g;else{if((g&1073741824)===0)return l=R!==null?R.baseLanes|g:g,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:l,cachePool:null,transitions:null},d.updateQueue=null,Sn(gc,va),va|=l,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=R!==null?R.baseLanes:g,Sn(gc,va),va|=w}else R!==null?(w=R.baseLanes|g,d.memoizedState=null):w=g,Sn(gc,va),va|=w;return $r(l,d,_,g),d.child}function iE(l,d){var g=d.ref;(l===null&&g!==null||l!==null&&l.ref!==g)&&(d.flags|=512,d.flags|=2097152)}function xy(l,d,g,w,_){var R=Xr(g)?qi:Ar.current;return R=oc(d,R),fc(d,_),g=ly(l,d,g,w,R,_),w=cy(),l!==null&&!Qr?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~_,mo(l,d,_)):(Dn&&w&&Hx(d),d.flags|=1,$r(l,d,g,_),d.child)}function lE(l,d,g,w,_){if(Xr(g)){var R=!0;Hp(d)}else R=!1;if(fc(d,_),d.stateNode===null)ch(l,d),XA(d,g,w),my(d,g,w,_),w=!0;else if(l===null){var D=d.stateNode,re=d.memoizedProps;D.props=re;var ce=D.context,Se=g.contextType;typeof Se=="object"&&Se!==null?Se=Ma(Se):(Se=Xr(g)?qi:Ar.current,Se=oc(d,Se));var Be=g.getDerivedStateFromProps,He=typeof Be=="function"||typeof D.getSnapshotBeforeUpdate=="function";He||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(re!==w||ce!==Se)&&QA(d,D,w,Se),ri=!1;var Fe=d.memoizedState;D.state=Fe,eh(d,w,D,_),ce=d.memoizedState,re!==w||Fe!==ce||Yr.current||ri?(typeof Be=="function"&&(hy(d,g,Be,w),ce=d.memoizedState),(re=ri||YA(d,g,re,w,Fe,ce,Se))?(He||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(d.flags|=4194308)):(typeof D.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=w,d.memoizedState=ce),D.props=w,D.state=ce,D.context=Se,w=re):(typeof D.componentDidMount=="function"&&(d.flags|=4194308),w=!1)}else{D=d.stateNode,NA(l,d),re=d.memoizedProps,Se=d.type===d.elementType?re:ps(d.type,re),D.props=Se,He=d.pendingProps,Fe=D.context,ce=g.contextType,typeof ce=="object"&&ce!==null?ce=Ma(ce):(ce=Xr(g)?qi:Ar.current,ce=oc(d,ce));var dt=g.getDerivedStateFromProps;(Be=typeof dt=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(re!==He||Fe!==ce)&&QA(d,D,w,ce),ri=!1,Fe=d.memoizedState,D.state=Fe,eh(d,w,D,_);var xt=d.memoizedState;re!==He||Fe!==xt||Yr.current||ri?(typeof dt=="function"&&(hy(d,g,dt,w),xt=d.memoizedState),(Se=ri||YA(d,g,Se,w,Fe,xt,ce)||!1)?(Be||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(w,xt,ce),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(w,xt,ce)),typeof D.componentDidUpdate=="function"&&(d.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof D.componentDidUpdate!="function"||re===l.memoizedProps&&Fe===l.memoizedState||(d.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||re===l.memoizedProps&&Fe===l.memoizedState||(d.flags|=1024),d.memoizedProps=w,d.memoizedState=xt),D.props=w,D.state=xt,D.context=ce,w=Se):(typeof D.componentDidUpdate!="function"||re===l.memoizedProps&&Fe===l.memoizedState||(d.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||re===l.memoizedProps&&Fe===l.memoizedState||(d.flags|=1024),w=!1)}return yy(l,d,g,w,R,_)}function yy(l,d,g,w,_,R){iE(l,d);var D=(d.flags&128)!==0;if(!w&&!D)return _&&pA(d,g,!1),mo(l,d,R);w=d.stateNode,F7.current=d;var re=D&&typeof g.getDerivedStateFromError!="function"?null:w.render();return d.flags|=1,l!==null&&D?(d.child=uc(d,l.child,null,R),d.child=uc(d,null,re,R)):$r(l,d,re,R),d.memoizedState=w.state,_&&pA(d,g,!0),d.child}function cE(l){var d=l.stateNode;d.pendingContext?dA(l,d.pendingContext,d.pendingContext!==d.context):d.context&&dA(l,d.context,!1),ny(l,d.containerInfo)}function uE(l,d,g,w,_){return cc(),Yx(_),d.flags|=256,$r(l,d,g,w),d.child}var by={dehydrated:null,treeContext:null,retryLane:0};function wy(l){return{baseLanes:l,cachePool:null,transitions:null}}function dE(l,d,g){var w=d.pendingProps,_=Un.current,R=!1,D=(d.flags&128)!==0,re;if((re=D)||(re=l!==null&&l.memoizedState===null?!1:(_&2)!==0),re?(R=!0,d.flags&=-129):(l===null||l.memoizedState!==null)&&(_|=1),Sn(Un,_&1),l===null)return Gx(d),l=d.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((d.mode&1)===0?d.lanes=1:l.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(D=w.children,l=w.fallback,R?(w=d.mode,R=d.child,D={mode:"hidden",children:D},(w&1)===0&&R!==null?(R.childLanes=0,R.pendingProps=D):R=wh(D,w,0,null),l=Ji(l,w,g,null),R.return=d,l.return=d,R.sibling=l,d.child=R,d.child.memoizedState=wy(g),d.memoizedState=by,l):jy(d,D));if(_=l.memoizedState,_!==null&&(re=_.dehydrated,re!==null))return z7(l,d,D,w,re,_,g);if(R){R=w.fallback,D=d.mode,_=l.child,re=_.sibling;var ce={mode:"hidden",children:w.children};return(D&1)===0&&d.child!==_?(w=d.child,w.childLanes=0,w.pendingProps=ce,d.deletions=null):(w=ui(_,ce),w.subtreeFlags=_.subtreeFlags&14680064),re!==null?R=ui(re,R):(R=Ji(R,D,g,null),R.flags|=2),R.return=d,w.return=d,w.sibling=R,d.child=w,w=R,R=d.child,D=l.child.memoizedState,D=D===null?wy(g):{baseLanes:D.baseLanes|g,cachePool:null,transitions:D.transitions},R.memoizedState=D,R.childLanes=l.childLanes&~g,d.memoizedState=by,w}return R=l.child,l=R.sibling,w=ui(R,{mode:"visible",children:w.children}),(d.mode&1)===0&&(w.lanes=g),w.return=d,w.sibling=null,l!==null&&(g=d.deletions,g===null?(d.deletions=[l],d.flags|=16):g.push(l)),d.child=w,d.memoizedState=null,w}function jy(l,d){return d=wh({mode:"visible",children:d},l.mode,0,null),d.return=l,l.child=d}function lh(l,d,g,w){return w!==null&&Yx(w),uc(d,l.child,null,g),l=jy(d,d.pendingProps.children),l.flags|=2,d.memoizedState=null,l}function z7(l,d,g,w,_,R,D){if(g)return d.flags&256?(d.flags&=-257,w=gy(Error(n(422))),lh(l,d,D,w)):d.memoizedState!==null?(d.child=l.child,d.flags|=128,null):(R=w.fallback,_=d.mode,w=wh({mode:"visible",children:w.children},_,0,null),R=Ji(R,_,D,null),R.flags|=2,w.return=d,R.return=d,w.sibling=R,d.child=w,(d.mode&1)!==0&&uc(d,l.child,null,D),d.child.memoizedState=wy(D),d.memoizedState=by,R);if((d.mode&1)===0)return lh(l,d,D,null);if(_.data==="$!"){if(w=_.nextSibling&&_.nextSibling.dataset,w)var re=w.dgst;return w=re,R=Error(n(419)),w=gy(R,w,void 0),lh(l,d,D,w)}if(re=(D&l.childLanes)!==0,Qr||re){if(w=gr,w!==null){switch(D&-D){case 4:_=2;break;case 16:_=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:_=32;break;case 536870912:_=268435456;break;default:_=0}_=(_&(w.suspendedLanes|D))!==0?0:_,_!==0&&_!==R.retryLane&&(R.retryLane=_,po(l,_),gs(w,l,_,-1))}return Ly(),w=gy(Error(n(421))),lh(l,d,D,w)}return _.data==="$?"?(d.flags|=128,d.child=l.child,d=Z7.bind(null,l),_._reactRetry=d,null):(l=R.treeContext,ga=Zo(_.nextSibling),ma=d,Dn=!0,fs=null,l!==null&&(Ta[Oa++]=uo,Ta[Oa++]=fo,Ta[Oa++]=Ui,uo=l.id,fo=l.overflow,Ui=d),d=jy(d,w.children),d.flags|=4096,d)}function fE(l,d,g){l.lanes|=d;var w=l.alternate;w!==null&&(w.lanes|=d),Zx(l.return,d,g)}function Sy(l,d,g,w,_){var R=l.memoizedState;R===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:w,tail:g,tailMode:_}:(R.isBackwards=d,R.rendering=null,R.renderingStartTime=0,R.last=w,R.tail=g,R.tailMode=_)}function pE(l,d,g){var w=d.pendingProps,_=w.revealOrder,R=w.tail;if($r(l,d,w.children,g),w=Un.current,(w&2)!==0)w=w&1|2,d.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&fE(l,g,d);else if(l.tag===19)fE(l,g,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}w&=1}if(Sn(Un,w),(d.mode&1)===0)d.memoizedState=null;else switch(_){case"forwards":for(g=d.child,_=null;g!==null;)l=g.alternate,l!==null&&th(l)===null&&(_=g),g=g.sibling;g=_,g===null?(_=d.child,d.child=null):(_=g.sibling,g.sibling=null),Sy(d,!1,_,g,R);break;case"backwards":for(g=null,_=d.child,d.child=null;_!==null;){if(l=_.alternate,l!==null&&th(l)===null){d.child=_;break}l=_.sibling,_.sibling=g,g=_,_=l}Sy(d,!0,g,null,R);break;case"together":Sy(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function ch(l,d){(d.mode&1)===0&&l!==null&&(l.alternate=null,d.alternate=null,d.flags|=2)}function mo(l,d,g){if(l!==null&&(d.dependencies=l.dependencies),Gi|=d.lanes,(g&d.childLanes)===0)return null;if(l!==null&&d.child!==l.child)throw Error(n(153));if(d.child!==null){for(l=d.child,g=ui(l,l.pendingProps),d.child=g,g.return=d;l.sibling!==null;)l=l.sibling,g=g.sibling=ui(l,l.pendingProps),g.return=d;g.sibling=null}return d.child}function B7(l,d,g){switch(d.tag){case 3:cE(d),cc();break;case 5:kA(d);break;case 1:Xr(d.type)&&Hp(d);break;case 4:ny(d,d.stateNode.containerInfo);break;case 10:var w=d.type._context,_=d.memoizedProps.value;Sn(Qp,w._currentValue),w._currentValue=_;break;case 13:if(w=d.memoizedState,w!==null)return w.dehydrated!==null?(Sn(Un,Un.current&1),d.flags|=128,null):(g&d.child.childLanes)!==0?dE(l,d,g):(Sn(Un,Un.current&1),l=mo(l,d,g),l!==null?l.sibling:null);Sn(Un,Un.current&1);break;case 19:if(w=(g&d.childLanes)!==0,(l.flags&128)!==0){if(w)return pE(l,d,g);d.flags|=128}if(_=d.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),Sn(Un,Un.current),w)break;return null;case 22:case 23:return d.lanes=0,oE(l,d,g)}return mo(l,d,g)}var hE,Ny,mE,gE;hE=function(l,d){for(var g=d.child;g!==null;){if(g.tag===5||g.tag===6)l.appendChild(g.stateNode);else if(g.tag!==4&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===d)break;for(;g.sibling===null;){if(g.return===null||g.return===d)return;g=g.return}g.sibling.return=g.return,g=g.sibling}},Ny=function(){},mE=function(l,d,g,w){var _=l.memoizedProps;if(_!==w){l=d.stateNode,Vi(Fs.current);var R=null;switch(g){case"input":_=we(l,_),w=we(l,w),R=[];break;case"select":_=Q({},_,{value:void 0}),w=Q({},w,{value:void 0}),R=[];break;case"textarea":_=Ze(l,_),w=Ze(l,w),R=[];break;default:typeof _.onClick!="function"&&typeof w.onClick=="function"&&(l.onclick=qp)}kt(g,w);var D;g=null;for(Se in _)if(!w.hasOwnProperty(Se)&&_.hasOwnProperty(Se)&&_[Se]!=null)if(Se==="style"){var re=_[Se];for(D in re)re.hasOwnProperty(D)&&(g||(g={}),g[D]="")}else Se!=="dangerouslySetInnerHTML"&&Se!=="children"&&Se!=="suppressContentEditableWarning"&&Se!=="suppressHydrationWarning"&&Se!=="autoFocus"&&(s.hasOwnProperty(Se)?R||(R=[]):(R=R||[]).push(Se,null));for(Se in w){var ce=w[Se];if(re=_?.[Se],w.hasOwnProperty(Se)&&ce!==re&&(ce!=null||re!=null))if(Se==="style")if(re){for(D in re)!re.hasOwnProperty(D)||ce&&ce.hasOwnProperty(D)||(g||(g={}),g[D]="");for(D in ce)ce.hasOwnProperty(D)&&re[D]!==ce[D]&&(g||(g={}),g[D]=ce[D])}else g||(R||(R=[]),R.push(Se,g)),g=ce;else Se==="dangerouslySetInnerHTML"?(ce=ce?ce.__html:void 0,re=re?re.__html:void 0,ce!=null&&re!==ce&&(R=R||[]).push(Se,ce)):Se==="children"?typeof ce!="string"&&typeof ce!="number"||(R=R||[]).push(Se,""+ce):Se!=="suppressContentEditableWarning"&&Se!=="suppressHydrationWarning"&&(s.hasOwnProperty(Se)?(ce!=null&&Se==="onScroll"&&Pn("scroll",l),R||re===ce||(R=[])):(R=R||[]).push(Se,ce))}g&&(R=R||[]).push("style",g);var Se=R;(d.updateQueue=Se)&&(d.flags|=4)}},gE=function(l,d,g,w){g!==w&&(d.flags|=4)};function vd(l,d){if(!Dn)switch(l.tailMode){case"hidden":d=l.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?l.tail=null:g.sibling=null;break;case"collapsed":g=l.tail;for(var w=null;g!==null;)g.alternate!==null&&(w=g),g=g.sibling;w===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:w.sibling=null}}function Pr(l){var d=l.alternate!==null&&l.alternate.child===l.child,g=0,w=0;if(d)for(var _=l.child;_!==null;)g|=_.lanes|_.childLanes,w|=_.subtreeFlags&14680064,w|=_.flags&14680064,_.return=l,_=_.sibling;else for(_=l.child;_!==null;)g|=_.lanes|_.childLanes,w|=_.subtreeFlags,w|=_.flags,_.return=l,_=_.sibling;return l.subtreeFlags|=w,l.childLanes=g,d}function q7(l,d,g){var w=d.pendingProps;switch(Vx(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pr(d),null;case 1:return Xr(d.type)&&Wp(),Pr(d),null;case 3:return w=d.stateNode,pc(),Rn(Yr),Rn(Ar),sy(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(l===null||l.child===null)&&(Yp(d)?d.flags|=4:l===null||l.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,fs!==null&&(Iy(fs),fs=null))),Ny(l,d),Pr(d),null;case 5:ry(d);var _=Vi(fd.current);if(g=d.type,l!==null&&d.stateNode!=null)mE(l,d,g,w,_),l.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!w){if(d.stateNode===null)throw Error(n(166));return Pr(d),null}if(l=Vi(Fs.current),Yp(d)){w=d.stateNode,g=d.type;var R=d.memoizedProps;switch(w[Ls]=d,w[id]=R,l=(d.mode&1)!==0,g){case"dialog":Pn("cancel",w),Pn("close",w);break;case"iframe":case"object":case"embed":Pn("load",w);break;case"video":case"audio":for(_=0;_<ad.length;_++)Pn(ad[_],w);break;case"source":Pn("error",w);break;case"img":case"image":case"link":Pn("error",w),Pn("load",w);break;case"details":Pn("toggle",w);break;case"input":at(w,R),Pn("invalid",w);break;case"select":w._wrapperState={wasMultiple:!!R.multiple},Pn("invalid",w);break;case"textarea":ht(w,R),Pn("invalid",w)}kt(g,R),_=null;for(var D in R)if(R.hasOwnProperty(D)){var re=R[D];D==="children"?typeof re=="string"?w.textContent!==re&&(R.suppressHydrationWarning!==!0&&Bp(w.textContent,re,l),_=["children",re]):typeof re=="number"&&w.textContent!==""+re&&(R.suppressHydrationWarning!==!0&&Bp(w.textContent,re,l),_=["children",""+re]):s.hasOwnProperty(D)&&re!=null&&D==="onScroll"&&Pn("scroll",w)}switch(g){case"input":De(w),At(w,R,!0);break;case"textarea":De(w),zt(w);break;case"select":case"option":break;default:typeof R.onClick=="function"&&(w.onclick=qp)}w=_,d.updateQueue=w,w!==null&&(d.flags|=4)}else{D=_.nodeType===9?_:_.ownerDocument,l==="http://www.w3.org/1999/xhtml"&&(l=jt(g)),l==="http://www.w3.org/1999/xhtml"?g==="script"?(l=D.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild)):typeof w.is=="string"?l=D.createElement(g,{is:w.is}):(l=D.createElement(g),g==="select"&&(D=l,w.multiple?D.multiple=!0:w.size&&(D.size=w.size))):l=D.createElementNS(l,g),l[Ls]=d,l[id]=w,hE(l,d,!1,!1),d.stateNode=l;e:{switch(D=vt(g,w),g){case"dialog":Pn("cancel",l),Pn("close",l),_=w;break;case"iframe":case"object":case"embed":Pn("load",l),_=w;break;case"video":case"audio":for(_=0;_<ad.length;_++)Pn(ad[_],l);_=w;break;case"source":Pn("error",l),_=w;break;case"img":case"image":case"link":Pn("error",l),Pn("load",l),_=w;break;case"details":Pn("toggle",l),_=w;break;case"input":at(l,w),_=we(l,w),Pn("invalid",l);break;case"option":_=w;break;case"select":l._wrapperState={wasMultiple:!!w.multiple},_=Q({},w,{value:void 0}),Pn("invalid",l);break;case"textarea":ht(l,w),_=Ze(l,w),Pn("invalid",l);break;default:_=w}kt(g,_),re=_;for(R in re)if(re.hasOwnProperty(R)){var ce=re[R];R==="style"?ze(l,ce):R==="dangerouslySetInnerHTML"?(ce=ce?ce.__html:void 0,ce!=null&&qt(l,ce)):R==="children"?typeof ce=="string"?(g!=="textarea"||ce!=="")&&Zt(l,ce):typeof ce=="number"&&Zt(l,""+ce):R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&R!=="autoFocus"&&(s.hasOwnProperty(R)?ce!=null&&R==="onScroll"&&Pn("scroll",l):ce!=null&&C(l,R,ce,D))}switch(g){case"input":De(l),At(l,w,!1);break;case"textarea":De(l),zt(l);break;case"option":w.value!=null&&l.setAttribute("value",""+xe(w.value));break;case"select":l.multiple=!!w.multiple,R=w.value,R!=null?Re(l,!!w.multiple,R,!1):w.defaultValue!=null&&Re(l,!!w.multiple,w.defaultValue,!0);break;default:typeof _.onClick=="function"&&(l.onclick=qp)}switch(g){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}}w&&(d.flags|=4)}d.ref!==null&&(d.flags|=512,d.flags|=2097152)}return Pr(d),null;case 6:if(l&&d.stateNode!=null)gE(l,d,l.memoizedProps,w);else{if(typeof w!="string"&&d.stateNode===null)throw Error(n(166));if(g=Vi(fd.current),Vi(Fs.current),Yp(d)){if(w=d.stateNode,g=d.memoizedProps,w[Ls]=d,(R=w.nodeValue!==g)&&(l=ma,l!==null))switch(l.tag){case 3:Bp(w.nodeValue,g,(l.mode&1)!==0);break;case 5:l.memoizedProps.suppressHydrationWarning!==!0&&Bp(w.nodeValue,g,(l.mode&1)!==0)}R&&(d.flags|=4)}else w=(g.nodeType===9?g:g.ownerDocument).createTextNode(w),w[Ls]=d,d.stateNode=w}return Pr(d),null;case 13:if(Rn(Un),w=d.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(Dn&&ga!==null&&(d.mode&1)!==0&&(d.flags&128)===0)yA(),cc(),d.flags|=98560,R=!1;else if(R=Yp(d),w!==null&&w.dehydrated!==null){if(l===null){if(!R)throw Error(n(318));if(R=d.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(n(317));R[Ls]=d}else cc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Pr(d),R=!1}else fs!==null&&(Iy(fs),fs=null),R=!0;if(!R)return d.flags&65536?d:null}return(d.flags&128)!==0?(d.lanes=g,d):(w=w!==null,w!==(l!==null&&l.memoizedState!==null)&&w&&(d.child.flags|=8192,(d.mode&1)!==0&&(l===null||(Un.current&1)!==0?ir===0&&(ir=3):Ly())),d.updateQueue!==null&&(d.flags|=4),Pr(d),null);case 4:return pc(),Ny(l,d),l===null&&sd(d.stateNode.containerInfo),Pr(d),null;case 10:return Jx(d.type._context),Pr(d),null;case 17:return Xr(d.type)&&Wp(),Pr(d),null;case 19:if(Rn(Un),R=d.memoizedState,R===null)return Pr(d),null;if(w=(d.flags&128)!==0,D=R.rendering,D===null)if(w)vd(R,!1);else{if(ir!==0||l!==null&&(l.flags&128)!==0)for(l=d.child;l!==null;){if(D=th(l),D!==null){for(d.flags|=128,vd(R,!1),w=D.updateQueue,w!==null&&(d.updateQueue=w,d.flags|=4),d.subtreeFlags=0,w=g,g=d.child;g!==null;)R=g,l=w,R.flags&=14680066,D=R.alternate,D===null?(R.childLanes=0,R.lanes=l,R.child=null,R.subtreeFlags=0,R.memoizedProps=null,R.memoizedState=null,R.updateQueue=null,R.dependencies=null,R.stateNode=null):(R.childLanes=D.childLanes,R.lanes=D.lanes,R.child=D.child,R.subtreeFlags=0,R.deletions=null,R.memoizedProps=D.memoizedProps,R.memoizedState=D.memoizedState,R.updateQueue=D.updateQueue,R.type=D.type,l=D.dependencies,R.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),g=g.sibling;return Sn(Un,Un.current&1|2),d.child}l=l.sibling}R.tail!==null&&En()>vc&&(d.flags|=128,w=!0,vd(R,!1),d.lanes=4194304)}else{if(!w)if(l=th(D),l!==null){if(d.flags|=128,w=!0,g=l.updateQueue,g!==null&&(d.updateQueue=g,d.flags|=4),vd(R,!0),R.tail===null&&R.tailMode==="hidden"&&!D.alternate&&!Dn)return Pr(d),null}else 2*En()-R.renderingStartTime>vc&&g!==1073741824&&(d.flags|=128,w=!0,vd(R,!1),d.lanes=4194304);R.isBackwards?(D.sibling=d.child,d.child=D):(g=R.last,g!==null?g.sibling=D:d.child=D,R.last=D)}return R.tail!==null?(d=R.tail,R.rendering=d,R.tail=d.sibling,R.renderingStartTime=En(),d.sibling=null,g=Un.current,Sn(Un,w?g&1|2:g&1),d):(Pr(d),null);case 22:case 23:return Dy(),w=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==w&&(d.flags|=8192),w&&(d.mode&1)!==0?(va&1073741824)!==0&&(Pr(d),d.subtreeFlags&6&&(d.flags|=8192)):Pr(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function U7(l,d){switch(Vx(d),d.tag){case 1:return Xr(d.type)&&Wp(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return pc(),Rn(Yr),Rn(Ar),sy(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return ry(d),null;case 13:if(Rn(Un),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));cc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Rn(Un),null;case 4:return pc(),null;case 10:return Jx(d.type._context),null;case 22:case 23:return Dy(),null;case 24:return null;default:return null}}var uh=!1,Rr=!1,W7=typeof WeakSet=="function"?WeakSet:Set,mt=null;function mc(l,d){var g=l.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(w){Kn(l,d,w)}else g.current=null}function Cy(l,d,g){try{g()}catch(w){Kn(l,d,w)}}var vE=!1;function H7(l,d){if(Dx=Pp,l=Yk(),Ex(l)){if("selectionStart"in l)var g={start:l.selectionStart,end:l.selectionEnd};else e:{g=(g=l.ownerDocument)&&g.defaultView||window;var w=g.getSelection&&g.getSelection();if(w&&w.rangeCount!==0){g=w.anchorNode;var _=w.anchorOffset,R=w.focusNode;w=w.focusOffset;try{g.nodeType,R.nodeType}catch{g=null;break e}var D=0,re=-1,ce=-1,Se=0,Be=0,He=l,Fe=null;t:for(;;){for(var dt;He!==g||_!==0&&He.nodeType!==3||(re=D+_),He!==R||w!==0&&He.nodeType!==3||(ce=D+w),He.nodeType===3&&(D+=He.nodeValue.length),(dt=He.firstChild)!==null;)Fe=He,He=dt;for(;;){if(He===l)break t;if(Fe===g&&++Se===_&&(re=D),Fe===R&&++Be===w&&(ce=D),(dt=He.nextSibling)!==null)break;He=Fe,Fe=He.parentNode}He=dt}g=re===-1||ce===-1?null:{start:re,end:ce}}else g=null}g=g||{start:0,end:0}}else g=null;for(Lx={focusedElem:l,selectionRange:g},Pp=!1,mt=d;mt!==null;)if(d=mt,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,mt=l;else for(;mt!==null;){d=mt;try{var xt=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(xt!==null){var yt=xt.memoizedProps,Qn=xt.memoizedState,be=d.stateNode,he=be.getSnapshotBeforeUpdate(d.elementType===d.type?yt:ps(d.type,yt),Qn);be.__reactInternalSnapshotBeforeUpdate=he}break;case 3:var je=d.stateNode.containerInfo;je.nodeType===1?je.textContent="":je.nodeType===9&&je.documentElement&&je.removeChild(je.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ye){Kn(d,d.return,Ye)}if(l=d.sibling,l!==null){l.return=d.return,mt=l;break}mt=d.return}return xt=vE,vE=!1,xt}function xd(l,d,g){var w=d.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var _=w=w.next;do{if((_.tag&l)===l){var R=_.destroy;_.destroy=void 0,R!==void 0&&Cy(d,g,R)}_=_.next}while(_!==w)}}function dh(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var g=d=d.next;do{if((g.tag&l)===l){var w=g.create;g.destroy=w()}g=g.next}while(g!==d)}}function _y(l){var d=l.ref;if(d!==null){var g=l.stateNode;l.tag,l=g,typeof d=="function"?d(l):d.current=l}}function xE(l){var d=l.alternate;d!==null&&(l.alternate=null,xE(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Ls],delete d[id],delete d[qx],delete d[k7],delete d[A7])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function yE(l){return l.tag===5||l.tag===3||l.tag===4}function bE(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||yE(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function ky(l,d,g){var w=l.tag;if(w===5||w===6)l=l.stateNode,d?g.nodeType===8?g.parentNode.insertBefore(l,d):g.insertBefore(l,d):(g.nodeType===8?(d=g.parentNode,d.insertBefore(l,g)):(d=g,d.appendChild(l)),g=g._reactRootContainer,g!=null||d.onclick!==null||(d.onclick=qp));else if(w!==4&&(l=l.child,l!==null))for(ky(l,d,g),l=l.sibling;l!==null;)ky(l,d,g),l=l.sibling}function Ay(l,d,g){var w=l.tag;if(w===5||w===6)l=l.stateNode,d?g.insertBefore(l,d):g.appendChild(l);else if(w!==4&&(l=l.child,l!==null))for(Ay(l,d,g),l=l.sibling;l!==null;)Ay(l,d,g),l=l.sibling}var Sr=null,hs=!1;function si(l,d,g){for(g=g.child;g!==null;)wE(l,d,g),g=g.sibling}function wE(l,d,g){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Lt,g)}catch{}switch(g.tag){case 5:Rr||mc(g,d);case 6:var w=Sr,_=hs;Sr=null,si(l,d,g),Sr=w,hs=_,Sr!==null&&(hs?(l=Sr,g=g.stateNode,l.nodeType===8?l.parentNode.removeChild(g):l.removeChild(g)):Sr.removeChild(g.stateNode));break;case 18:Sr!==null&&(hs?(l=Sr,g=g.stateNode,l.nodeType===8?Bx(l.parentNode,g):l.nodeType===1&&Bx(l,g),Xu(l)):Bx(Sr,g.stateNode));break;case 4:w=Sr,_=hs,Sr=g.stateNode.containerInfo,hs=!0,si(l,d,g),Sr=w,hs=_;break;case 0:case 11:case 14:case 15:if(!Rr&&(w=g.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){_=w=w.next;do{var R=_,D=R.destroy;R=R.tag,D!==void 0&&((R&2)!==0||(R&4)!==0)&&Cy(g,d,D),_=_.next}while(_!==w)}si(l,d,g);break;case 1:if(!Rr&&(mc(g,d),w=g.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=g.memoizedProps,w.state=g.memoizedState,w.componentWillUnmount()}catch(re){Kn(g,d,re)}si(l,d,g);break;case 21:si(l,d,g);break;case 22:g.mode&1?(Rr=(w=Rr)||g.memoizedState!==null,si(l,d,g),Rr=w):si(l,d,g);break;default:si(l,d,g)}}function jE(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var g=l.stateNode;g===null&&(g=l.stateNode=new W7),d.forEach(function(w){var _=e9.bind(null,l,w);g.has(w)||(g.add(w),w.then(_,_))})}}function ms(l,d){var g=d.deletions;if(g!==null)for(var w=0;w<g.length;w++){var _=g[w];try{var R=l,D=d,re=D;e:for(;re!==null;){switch(re.tag){case 5:Sr=re.stateNode,hs=!1;break e;case 3:Sr=re.stateNode.containerInfo,hs=!0;break e;case 4:Sr=re.stateNode.containerInfo,hs=!0;break e}re=re.return}if(Sr===null)throw Error(n(160));wE(R,D,_),Sr=null,hs=!1;var ce=_.alternate;ce!==null&&(ce.return=null),_.return=null}catch(Se){Kn(_,d,Se)}}if(d.subtreeFlags&12854)for(d=d.child;d!==null;)SE(d,l),d=d.sibling}function SE(l,d){var g=l.alternate,w=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:if(ms(d,l),Bs(l),w&4){try{xd(3,l,l.return),dh(3,l)}catch(yt){Kn(l,l.return,yt)}try{xd(5,l,l.return)}catch(yt){Kn(l,l.return,yt)}}break;case 1:ms(d,l),Bs(l),w&512&&g!==null&&mc(g,g.return);break;case 5:if(ms(d,l),Bs(l),w&512&&g!==null&&mc(g,g.return),l.flags&32){var _=l.stateNode;try{Zt(_,"")}catch(yt){Kn(l,l.return,yt)}}if(w&4&&(_=l.stateNode,_!=null)){var R=l.memoizedProps,D=g!==null?g.memoizedProps:R,re=l.type,ce=l.updateQueue;if(l.updateQueue=null,ce!==null)try{re==="input"&&R.type==="radio"&&R.name!=null&&tt(_,R),vt(re,D);var Se=vt(re,R);for(D=0;D<ce.length;D+=2){var Be=ce[D],He=ce[D+1];Be==="style"?ze(_,He):Be==="dangerouslySetInnerHTML"?qt(_,He):Be==="children"?Zt(_,He):C(_,Be,He,Se)}switch(re){case"input":it(_,R);break;case"textarea":Ft(_,R);break;case"select":var Fe=_._wrapperState.wasMultiple;_._wrapperState.wasMultiple=!!R.multiple;var dt=R.value;dt!=null?Re(_,!!R.multiple,dt,!1):Fe!==!!R.multiple&&(R.defaultValue!=null?Re(_,!!R.multiple,R.defaultValue,!0):Re(_,!!R.multiple,R.multiple?[]:"",!1))}_[id]=R}catch(yt){Kn(l,l.return,yt)}}break;case 6:if(ms(d,l),Bs(l),w&4){if(l.stateNode===null)throw Error(n(162));_=l.stateNode,R=l.memoizedProps;try{_.nodeValue=R}catch(yt){Kn(l,l.return,yt)}}break;case 3:if(ms(d,l),Bs(l),w&4&&g!==null&&g.memoizedState.isDehydrated)try{Xu(d.containerInfo)}catch(yt){Kn(l,l.return,yt)}break;case 4:ms(d,l),Bs(l);break;case 13:ms(d,l),Bs(l),_=l.child,_.flags&8192&&(R=_.memoizedState!==null,_.stateNode.isHidden=R,!R||_.alternate!==null&&_.alternate.memoizedState!==null||(Ry=En())),w&4&&jE(l);break;case 22:if(Be=g!==null&&g.memoizedState!==null,l.mode&1?(Rr=(Se=Rr)||Be,ms(d,l),Rr=Se):ms(d,l),Bs(l),w&8192){if(Se=l.memoizedState!==null,(l.stateNode.isHidden=Se)&&!Be&&(l.mode&1)!==0)for(mt=l,Be=l.child;Be!==null;){for(He=mt=Be;mt!==null;){switch(Fe=mt,dt=Fe.child,Fe.tag){case 0:case 11:case 14:case 15:xd(4,Fe,Fe.return);break;case 1:mc(Fe,Fe.return);var xt=Fe.stateNode;if(typeof xt.componentWillUnmount=="function"){w=Fe,g=Fe.return;try{d=w,xt.props=d.memoizedProps,xt.state=d.memoizedState,xt.componentWillUnmount()}catch(yt){Kn(w,g,yt)}}break;case 5:mc(Fe,Fe.return);break;case 22:if(Fe.memoizedState!==null){_E(He);continue}}dt!==null?(dt.return=Fe,mt=dt):_E(He)}Be=Be.sibling}e:for(Be=null,He=l;;){if(He.tag===5){if(Be===null){Be=He;try{_=He.stateNode,Se?(R=_.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none"):(re=He.stateNode,ce=He.memoizedProps.style,D=ce!=null&&ce.hasOwnProperty("display")?ce.display:null,re.style.display=ke("display",D))}catch(yt){Kn(l,l.return,yt)}}}else if(He.tag===6){if(Be===null)try{He.stateNode.nodeValue=Se?"":He.memoizedProps}catch(yt){Kn(l,l.return,yt)}}else if((He.tag!==22&&He.tag!==23||He.memoizedState===null||He===l)&&He.child!==null){He.child.return=He,He=He.child;continue}if(He===l)break e;for(;He.sibling===null;){if(He.return===null||He.return===l)break e;Be===He&&(Be=null),He=He.return}Be===He&&(Be=null),He.sibling.return=He.return,He=He.sibling}}break;case 19:ms(d,l),Bs(l),w&4&&jE(l);break;case 21:break;default:ms(d,l),Bs(l)}}function Bs(l){var d=l.flags;if(d&2){try{e:{for(var g=l.return;g!==null;){if(yE(g)){var w=g;break e}g=g.return}throw Error(n(160))}switch(w.tag){case 5:var _=w.stateNode;w.flags&32&&(Zt(_,""),w.flags&=-33);var R=bE(l);Ay(l,R,_);break;case 3:case 4:var D=w.stateNode.containerInfo,re=bE(l);ky(l,re,D);break;default:throw Error(n(161))}}catch(ce){Kn(l,l.return,ce)}l.flags&=-3}d&4096&&(l.flags&=-4097)}function V7(l,d,g){mt=l,NE(l)}function NE(l,d,g){for(var w=(l.mode&1)!==0;mt!==null;){var _=mt,R=_.child;if(_.tag===22&&w){var D=_.memoizedState!==null||uh;if(!D){var re=_.alternate,ce=re!==null&&re.memoizedState!==null||Rr;re=uh;var Se=Rr;if(uh=D,(Rr=ce)&&!Se)for(mt=_;mt!==null;)D=mt,ce=D.child,D.tag===22&&D.memoizedState!==null?kE(_):ce!==null?(ce.return=D,mt=ce):kE(_);for(;R!==null;)mt=R,NE(R),R=R.sibling;mt=_,uh=re,Rr=Se}CE(l)}else(_.subtreeFlags&8772)!==0&&R!==null?(R.return=_,mt=R):CE(l)}}function CE(l){for(;mt!==null;){var d=mt;if((d.flags&8772)!==0){var g=d.alternate;try{if((d.flags&8772)!==0)switch(d.tag){case 0:case 11:case 15:Rr||dh(5,d);break;case 1:var w=d.stateNode;if(d.flags&4&&!Rr)if(g===null)w.componentDidMount();else{var _=d.elementType===d.type?g.memoizedProps:ps(d.type,g.memoizedProps);w.componentDidUpdate(_,g.memoizedState,w.__reactInternalSnapshotBeforeUpdate)}var R=d.updateQueue;R!==null&&_A(d,R,w);break;case 3:var D=d.updateQueue;if(D!==null){if(g=null,d.child!==null)switch(d.child.tag){case 5:g=d.child.stateNode;break;case 1:g=d.child.stateNode}_A(d,D,g)}break;case 5:var re=d.stateNode;if(g===null&&d.flags&4){g=re;var ce=d.memoizedProps;switch(d.type){case"button":case"input":case"select":case"textarea":ce.autoFocus&&g.focus();break;case"img":ce.src&&(g.src=ce.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(d.memoizedState===null){var Se=d.alternate;if(Se!==null){var Be=Se.memoizedState;if(Be!==null){var He=Be.dehydrated;He!==null&&Xu(He)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Rr||d.flags&512&&_y(d)}catch(Fe){Kn(d,d.return,Fe)}}if(d===l){mt=null;break}if(g=d.sibling,g!==null){g.return=d.return,mt=g;break}mt=d.return}}function _E(l){for(;mt!==null;){var d=mt;if(d===l){mt=null;break}var g=d.sibling;if(g!==null){g.return=d.return,mt=g;break}mt=d.return}}function kE(l){for(;mt!==null;){var d=mt;try{switch(d.tag){case 0:case 11:case 15:var g=d.return;try{dh(4,d)}catch(ce){Kn(d,g,ce)}break;case 1:var w=d.stateNode;if(typeof w.componentDidMount=="function"){var _=d.return;try{w.componentDidMount()}catch(ce){Kn(d,_,ce)}}var R=d.return;try{_y(d)}catch(ce){Kn(d,R,ce)}break;case 5:var D=d.return;try{_y(d)}catch(ce){Kn(d,D,ce)}}}catch(ce){Kn(d,d.return,ce)}if(d===l){mt=null;break}var re=d.sibling;if(re!==null){re.return=d.return,mt=re;break}mt=d.return}}var K7=Math.ceil,fh=k.ReactCurrentDispatcher,Ey=k.ReactCurrentOwner,$a=k.ReactCurrentBatchConfig,on=0,gr=null,er=null,Nr=0,va=0,gc=ei(0),ir=0,yd=null,Gi=0,ph=0,Py=0,bd=null,Jr=null,Ry=0,vc=1/0,go=null,hh=!1,Ty=null,oi=null,mh=!1,ii=null,gh=0,wd=0,Oy=null,vh=-1,xh=0;function Dr(){return(on&6)!==0?En():vh!==-1?vh:vh=En()}function li(l){return(l.mode&1)===0?1:(on&2)!==0&&Nr!==0?Nr&-Nr:P7.transition!==null?(xh===0&&(xh=Ir()),xh):(l=gn,l!==0||(l=window.event,l=l===void 0?16:Ek(l.type)),l)}function gs(l,d,g,w){if(50<wd)throw wd=0,Oy=null,Error(n(185));us(l,g,w),((on&2)===0||l!==gr)&&(l===gr&&((on&2)===0&&(ph|=g),ir===4&&ci(l,Nr)),Zr(l,w),g===1&&on===0&&(d.mode&1)===0&&(vc=En()+500,Vp&&ni()))}function Zr(l,d){var g=l.callbackNode;Zn(l,d);var w=sr(l,l===gr?Nr:0);if(w===0)g!==null&&io(g),l.callbackNode=null,l.callbackPriority=0;else if(d=w&-w,l.callbackPriority!==d){if(g!=null&&io(g),d===1)l.tag===0?E7(EE.bind(null,l)):hA(EE.bind(null,l)),C7(function(){(on&6)===0&&ni()}),g=null;else{switch(wk(w)){case 1:g=Vo;break;case 4:g=ie;break;case 16:g=rt;break;case 536870912:g=Pt;break;default:g=rt}g=DE(g,AE.bind(null,l))}l.callbackPriority=d,l.callbackNode=g}}function AE(l,d){if(vh=-1,xh=0,(on&6)!==0)throw Error(n(327));var g=l.callbackNode;if(xc()&&l.callbackNode!==g)return null;var w=sr(l,l===gr?Nr:0);if(w===0)return null;if((w&30)!==0||(w&l.expiredLanes)!==0||d)d=yh(l,w);else{d=w;var _=on;on|=2;var R=RE();(gr!==l||Nr!==d)&&(go=null,vc=En()+500,Xi(l,d));do try{X7();break}catch(re){PE(l,re)}while(!0);Qx(),fh.current=R,on=_,er!==null?d=0:(gr=null,Nr=0,d=ir)}if(d!==0){if(d===2&&(_=Vn(l),_!==0&&(w=_,d=My(l,_))),d===1)throw g=yd,Xi(l,0),ci(l,w),Zr(l,En()),g;if(d===6)ci(l,w);else{if(_=l.current.alternate,(w&30)===0&&!G7(_)&&(d=yh(l,w),d===2&&(R=Vn(l),R!==0&&(w=R,d=My(l,R))),d===1))throw g=yd,Xi(l,0),ci(l,w),Zr(l,En()),g;switch(l.finishedWork=_,l.finishedLanes=w,d){case 0:case 1:throw Error(n(345));case 2:Qi(l,Jr,go);break;case 3:if(ci(l,w),(w&130023424)===w&&(d=Ry+500-En(),10<d)){if(sr(l,0)!==0)break;if(_=l.suspendedLanes,(_&w)!==w){Dr(),l.pingedLanes|=l.suspendedLanes&_;break}l.timeoutHandle=zx(Qi.bind(null,l,Jr,go),d);break}Qi(l,Jr,go);break;case 4:if(ci(l,w),(w&4194240)===w)break;for(d=l.eventTimes,_=-1;0<w;){var D=31-Ne(w);R=1<<D,D=d[D],D>_&&(_=D),w&=~R}if(w=_,w=En()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*K7(w/1960))-w,10<w){l.timeoutHandle=zx(Qi.bind(null,l,Jr,go),w);break}Qi(l,Jr,go);break;case 5:Qi(l,Jr,go);break;default:throw Error(n(329))}}}return Zr(l,En()),l.callbackNode===g?AE.bind(null,l):null}function My(l,d){var g=bd;return l.current.memoizedState.isDehydrated&&(Xi(l,d).flags|=256),l=yh(l,d),l!==2&&(d=Jr,Jr=g,d!==null&&Iy(d)),l}function Iy(l){Jr===null?Jr=l:Jr.push.apply(Jr,l)}function G7(l){for(var d=l;;){if(d.flags&16384){var g=d.updateQueue;if(g!==null&&(g=g.stores,g!==null))for(var w=0;w<g.length;w++){var _=g[w],R=_.getSnapshot;_=_.value;try{if(!ds(R(),_))return!1}catch{return!1}}}if(g=d.child,d.subtreeFlags&16384&&g!==null)g.return=d,d=g;else{if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function ci(l,d){for(d&=~Py,d&=~ph,l.suspendedLanes|=d,l.pingedLanes&=~d,l=l.expirationTimes;0<d;){var g=31-Ne(d),w=1<<g;l[g]=-1,d&=~w}}function EE(l){if((on&6)!==0)throw Error(n(327));xc();var d=sr(l,0);if((d&1)===0)return Zr(l,En()),null;var g=yh(l,d);if(l.tag!==0&&g===2){var w=Vn(l);w!==0&&(d=w,g=My(l,w))}if(g===1)throw g=yd,Xi(l,0),ci(l,d),Zr(l,En()),g;if(g===6)throw Error(n(345));return l.finishedWork=l.current.alternate,l.finishedLanes=d,Qi(l,Jr,go),Zr(l,En()),null}function $y(l,d){var g=on;on|=1;try{return l(d)}finally{on=g,on===0&&(vc=En()+500,Vp&&ni())}}function Yi(l){ii!==null&&ii.tag===0&&(on&6)===0&&xc();var d=on;on|=1;var g=$a.transition,w=gn;try{if($a.transition=null,gn=1,l)return l()}finally{gn=w,$a.transition=g,on=d,(on&6)===0&&ni()}}function Dy(){va=gc.current,Rn(gc)}function Xi(l,d){l.finishedWork=null,l.finishedLanes=0;var g=l.timeoutHandle;if(g!==-1&&(l.timeoutHandle=-1,N7(g)),er!==null)for(g=er.return;g!==null;){var w=g;switch(Vx(w),w.tag){case 1:w=w.type.childContextTypes,w!=null&&Wp();break;case 3:pc(),Rn(Yr),Rn(Ar),sy();break;case 5:ry(w);break;case 4:pc();break;case 13:Rn(Un);break;case 19:Rn(Un);break;case 10:Jx(w.type._context);break;case 22:case 23:Dy()}g=g.return}if(gr=l,er=l=ui(l.current,null),Nr=va=d,ir=0,yd=null,Py=ph=Gi=0,Jr=bd=null,Hi!==null){for(d=0;d<Hi.length;d++)if(g=Hi[d],w=g.interleaved,w!==null){g.interleaved=null;var _=w.next,R=g.pending;if(R!==null){var D=R.next;R.next=_,w.next=D}g.pending=w}Hi=null}return l}function PE(l,d){do{var g=er;try{if(Qx(),nh.current=oh,rh){for(var w=Wn.memoizedState;w!==null;){var _=w.queue;_!==null&&(_.pending=null),w=w.next}rh=!1}if(Ki=0,mr=or=Wn=null,pd=!1,hd=0,Ey.current=null,g===null||g.return===null){ir=1,yd=d,er=null;break}e:{var R=l,D=g.return,re=g,ce=d;if(d=Nr,re.flags|=32768,ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var Se=ce,Be=re,He=Be.tag;if((Be.mode&1)===0&&(He===0||He===11||He===15)){var Fe=Be.alternate;Fe?(Be.updateQueue=Fe.updateQueue,Be.memoizedState=Fe.memoizedState,Be.lanes=Fe.lanes):(Be.updateQueue=null,Be.memoizedState=null)}var dt=tE(D);if(dt!==null){dt.flags&=-257,nE(dt,D,re,R,d),dt.mode&1&&eE(R,Se,d),d=dt,ce=Se;var xt=d.updateQueue;if(xt===null){var yt=new Set;yt.add(ce),d.updateQueue=yt}else xt.add(ce);break e}else{if((d&1)===0){eE(R,Se,d),Ly();break e}ce=Error(n(426))}}else if(Dn&&re.mode&1){var Qn=tE(D);if(Qn!==null){(Qn.flags&65536)===0&&(Qn.flags|=256),nE(Qn,D,re,R,d),Yx(hc(ce,re));break e}}R=ce=hc(ce,re),ir!==4&&(ir=2),bd===null?bd=[R]:bd.push(R),R=D;do{switch(R.tag){case 3:R.flags|=65536,d&=-d,R.lanes|=d;var be=JA(R,ce,d);CA(R,be);break e;case 1:re=ce;var he=R.type,je=R.stateNode;if((R.flags&128)===0&&(typeof he.getDerivedStateFromError=="function"||je!==null&&typeof je.componentDidCatch=="function"&&(oi===null||!oi.has(je)))){R.flags|=65536,d&=-d,R.lanes|=d;var Ye=ZA(R,re,d);CA(R,Ye);break e}}R=R.return}while(R!==null)}OE(g)}catch(bt){d=bt,er===g&&g!==null&&(er=g=g.return);continue}break}while(!0)}function RE(){var l=fh.current;return fh.current=oh,l===null?oh:l}function Ly(){(ir===0||ir===3||ir===2)&&(ir=4),gr===null||(Gi&268435455)===0&&(ph&268435455)===0||ci(gr,Nr)}function yh(l,d){var g=on;on|=2;var w=RE();(gr!==l||Nr!==d)&&(go=null,Xi(l,d));do try{Y7();break}catch(_){PE(l,_)}while(!0);if(Qx(),on=g,fh.current=w,er!==null)throw Error(n(261));return gr=null,Nr=0,ir}function Y7(){for(;er!==null;)TE(er)}function X7(){for(;er!==null&&!Fi();)TE(er)}function TE(l){var d=$E(l.alternate,l,va);l.memoizedProps=l.pendingProps,d===null?OE(l):er=d,Ey.current=null}function OE(l){var d=l;do{var g=d.alternate;if(l=d.return,(d.flags&32768)===0){if(g=q7(g,d,va),g!==null){er=g;return}}else{if(g=U7(g,d),g!==null){g.flags&=32767,er=g;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{ir=6,er=null;return}}if(d=d.sibling,d!==null){er=d;return}er=d=l}while(d!==null);ir===0&&(ir=5)}function Qi(l,d,g){var w=gn,_=$a.transition;try{$a.transition=null,gn=1,Q7(l,d,g,w)}finally{$a.transition=_,gn=w}return null}function Q7(l,d,g,w){do xc();while(ii!==null);if((on&6)!==0)throw Error(n(327));g=l.finishedWork;var _=l.finishedLanes;if(g===null)return null;if(l.finishedWork=null,l.finishedLanes=0,g===l.current)throw Error(n(177));l.callbackNode=null,l.callbackPriority=0;var R=g.lanes|g.childLanes;if(qn(l,R),l===gr&&(er=gr=null,Nr=0),(g.subtreeFlags&2064)===0&&(g.flags&2064)===0||mh||(mh=!0,DE(rt,function(){return xc(),null})),R=(g.flags&15990)!==0,(g.subtreeFlags&15990)!==0||R){R=$a.transition,$a.transition=null;var D=gn;gn=1;var re=on;on|=4,Ey.current=null,H7(l,g),SE(g,l),v7(Lx),Pp=!!Dx,Lx=Dx=null,l.current=g,V7(g),Wu(),on=re,gn=D,$a.transition=R}else l.current=g;if(mh&&(mh=!1,ii=l,gh=_),R=l.pendingLanes,R===0&&(oi=null),ne(g.stateNode),Zr(l,En()),d!==null)for(w=l.onRecoverableError,g=0;g<d.length;g++)_=d[g],w(_.value,{componentStack:_.stack,digest:_.digest});if(hh)throw hh=!1,l=Ty,Ty=null,l;return(gh&1)!==0&&l.tag!==0&&xc(),R=l.pendingLanes,(R&1)!==0?l===Oy?wd++:(wd=0,Oy=l):wd=0,ni(),null}function xc(){if(ii!==null){var l=wk(gh),d=$a.transition,g=gn;try{if($a.transition=null,gn=16>l?16:l,ii===null)var w=!1;else{if(l=ii,ii=null,gh=0,(on&6)!==0)throw Error(n(331));var _=on;for(on|=4,mt=l.current;mt!==null;){var R=mt,D=R.child;if((mt.flags&16)!==0){var re=R.deletions;if(re!==null){for(var ce=0;ce<re.length;ce++){var Se=re[ce];for(mt=Se;mt!==null;){var Be=mt;switch(Be.tag){case 0:case 11:case 15:xd(8,Be,R)}var He=Be.child;if(He!==null)He.return=Be,mt=He;else for(;mt!==null;){Be=mt;var Fe=Be.sibling,dt=Be.return;if(xE(Be),Be===Se){mt=null;break}if(Fe!==null){Fe.return=dt,mt=Fe;break}mt=dt}}}var xt=R.alternate;if(xt!==null){var yt=xt.child;if(yt!==null){xt.child=null;do{var Qn=yt.sibling;yt.sibling=null,yt=Qn}while(yt!==null)}}mt=R}}if((R.subtreeFlags&2064)!==0&&D!==null)D.return=R,mt=D;else e:for(;mt!==null;){if(R=mt,(R.flags&2048)!==0)switch(R.tag){case 0:case 11:case 15:xd(9,R,R.return)}var be=R.sibling;if(be!==null){be.return=R.return,mt=be;break e}mt=R.return}}var he=l.current;for(mt=he;mt!==null;){D=mt;var je=D.child;if((D.subtreeFlags&2064)!==0&&je!==null)je.return=D,mt=je;else e:for(D=he;mt!==null;){if(re=mt,(re.flags&2048)!==0)try{switch(re.tag){case 0:case 11:case 15:dh(9,re)}}catch(bt){Kn(re,re.return,bt)}if(re===D){mt=null;break e}var Ye=re.sibling;if(Ye!==null){Ye.return=re.return,mt=Ye;break e}mt=re.return}}if(on=_,ni(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Lt,l)}catch{}w=!0}return w}finally{gn=g,$a.transition=d}}return!1}function ME(l,d,g){d=hc(g,d),d=JA(l,d,1),l=ai(l,d,1),d=Dr(),l!==null&&(us(l,1,d),Zr(l,d))}function Kn(l,d,g){if(l.tag===3)ME(l,l,g);else for(;d!==null;){if(d.tag===3){ME(d,l,g);break}else if(d.tag===1){var w=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(oi===null||!oi.has(w))){l=hc(g,l),l=ZA(d,l,1),d=ai(d,l,1),l=Dr(),d!==null&&(us(d,1,l),Zr(d,l));break}}d=d.return}}function J7(l,d,g){var w=l.pingCache;w!==null&&w.delete(d),d=Dr(),l.pingedLanes|=l.suspendedLanes&g,gr===l&&(Nr&g)===g&&(ir===4||ir===3&&(Nr&130023424)===Nr&&500>En()-Ry?Xi(l,0):Py|=g),Zr(l,d)}function IE(l,d){d===0&&((l.mode&1)===0?d=1:(d=mn,mn<<=1,(mn&130023424)===0&&(mn=4194304)));var g=Dr();l=po(l,d),l!==null&&(us(l,d,g),Zr(l,g))}function Z7(l){var d=l.memoizedState,g=0;d!==null&&(g=d.retryLane),IE(l,g)}function e9(l,d){var g=0;switch(l.tag){case 13:var w=l.stateNode,_=l.memoizedState;_!==null&&(g=_.retryLane);break;case 19:w=l.stateNode;break;default:throw Error(n(314))}w!==null&&w.delete(d),IE(l,g)}var $E;$E=function(l,d,g){if(l!==null)if(l.memoizedProps!==d.pendingProps||Yr.current)Qr=!0;else{if((l.lanes&g)===0&&(d.flags&128)===0)return Qr=!1,B7(l,d,g);Qr=(l.flags&131072)!==0}else Qr=!1,Dn&&(d.flags&1048576)!==0&&mA(d,Gp,d.index);switch(d.lanes=0,d.tag){case 2:var w=d.type;ch(l,d),l=d.pendingProps;var _=oc(d,Ar.current);fc(d,g),_=ly(null,d,w,l,_,g);var R=cy();return d.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,Xr(w)?(R=!0,Hp(d)):R=!1,d.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,ty(d),_.updater=ih,d.stateNode=_,_._reactInternals=d,my(d,w,l,g),d=yy(null,d,w,!0,R,g)):(d.tag=0,Dn&&R&&Hx(d),$r(null,d,_,g),d=d.child),d;case 16:w=d.elementType;e:{switch(ch(l,d),l=d.pendingProps,_=w._init,w=_(w._payload),d.type=w,_=d.tag=n9(w),l=ps(w,l),_){case 0:d=xy(null,d,w,l,g);break e;case 1:d=lE(null,d,w,l,g);break e;case 11:d=rE(null,d,w,l,g);break e;case 14:d=aE(null,d,w,ps(w.type,l),g);break e}throw Error(n(306,w,""))}return d;case 0:return w=d.type,_=d.pendingProps,_=d.elementType===w?_:ps(w,_),xy(l,d,w,_,g);case 1:return w=d.type,_=d.pendingProps,_=d.elementType===w?_:ps(w,_),lE(l,d,w,_,g);case 3:e:{if(cE(d),l===null)throw Error(n(387));w=d.pendingProps,R=d.memoizedState,_=R.element,NA(l,d),eh(d,w,null,g);var D=d.memoizedState;if(w=D.element,R.isDehydrated)if(R={element:w,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},d.updateQueue.baseState=R,d.memoizedState=R,d.flags&256){_=hc(Error(n(423)),d),d=uE(l,d,w,g,_);break e}else if(w!==_){_=hc(Error(n(424)),d),d=uE(l,d,w,g,_);break e}else for(ga=Zo(d.stateNode.containerInfo.firstChild),ma=d,Dn=!0,fs=null,g=jA(d,null,w,g),d.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(cc(),w===_){d=mo(l,d,g);break e}$r(l,d,w,g)}d=d.child}return d;case 5:return kA(d),l===null&&Gx(d),w=d.type,_=d.pendingProps,R=l!==null?l.memoizedProps:null,D=_.children,Fx(w,_)?D=null:R!==null&&Fx(w,R)&&(d.flags|=32),iE(l,d),$r(l,d,D,g),d.child;case 6:return l===null&&Gx(d),null;case 13:return dE(l,d,g);case 4:return ny(d,d.stateNode.containerInfo),w=d.pendingProps,l===null?d.child=uc(d,null,w,g):$r(l,d,w,g),d.child;case 11:return w=d.type,_=d.pendingProps,_=d.elementType===w?_:ps(w,_),rE(l,d,w,_,g);case 7:return $r(l,d,d.pendingProps,g),d.child;case 8:return $r(l,d,d.pendingProps.children,g),d.child;case 12:return $r(l,d,d.pendingProps.children,g),d.child;case 10:e:{if(w=d.type._context,_=d.pendingProps,R=d.memoizedProps,D=_.value,Sn(Qp,w._currentValue),w._currentValue=D,R!==null)if(ds(R.value,D)){if(R.children===_.children&&!Yr.current){d=mo(l,d,g);break e}}else for(R=d.child,R!==null&&(R.return=d);R!==null;){var re=R.dependencies;if(re!==null){D=R.child;for(var ce=re.firstContext;ce!==null;){if(ce.context===w){if(R.tag===1){ce=ho(-1,g&-g),ce.tag=2;var Se=R.updateQueue;if(Se!==null){Se=Se.shared;var Be=Se.pending;Be===null?ce.next=ce:(ce.next=Be.next,Be.next=ce),Se.pending=ce}}R.lanes|=g,ce=R.alternate,ce!==null&&(ce.lanes|=g),Zx(R.return,g,d),re.lanes|=g;break}ce=ce.next}}else if(R.tag===10)D=R.type===d.type?null:R.child;else if(R.tag===18){if(D=R.return,D===null)throw Error(n(341));D.lanes|=g,re=D.alternate,re!==null&&(re.lanes|=g),Zx(D,g,d),D=R.sibling}else D=R.child;if(D!==null)D.return=R;else for(D=R;D!==null;){if(D===d){D=null;break}if(R=D.sibling,R!==null){R.return=D.return,D=R;break}D=D.return}R=D}$r(l,d,_.children,g),d=d.child}return d;case 9:return _=d.type,w=d.pendingProps.children,fc(d,g),_=Ma(_),w=w(_),d.flags|=1,$r(l,d,w,g),d.child;case 14:return w=d.type,_=ps(w,d.pendingProps),_=ps(w.type,_),aE(l,d,w,_,g);case 15:return sE(l,d,d.type,d.pendingProps,g);case 17:return w=d.type,_=d.pendingProps,_=d.elementType===w?_:ps(w,_),ch(l,d),d.tag=1,Xr(w)?(l=!0,Hp(d)):l=!1,fc(d,g),XA(d,w,_),my(d,w,_,g),yy(null,d,w,!0,l,g);case 19:return pE(l,d,g);case 22:return oE(l,d,g)}throw Error(n(156,d.tag))};function DE(l,d){return jr(l,d)}function t9(l,d,g,w){this.tag=l,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Da(l,d,g,w){return new t9(l,d,g,w)}function Fy(l){return l=l.prototype,!(!l||!l.isReactComponent)}function n9(l){if(typeof l=="function")return Fy(l)?1:0;if(l!=null){if(l=l.$$typeof,l===F)return 11;if(l===I)return 14}return 2}function ui(l,d){var g=l.alternate;return g===null?(g=Da(l.tag,d,l.key,l.mode),g.elementType=l.elementType,g.type=l.type,g.stateNode=l.stateNode,g.alternate=l,l.alternate=g):(g.pendingProps=d,g.type=l.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=l.flags&14680064,g.childLanes=l.childLanes,g.lanes=l.lanes,g.child=l.child,g.memoizedProps=l.memoizedProps,g.memoizedState=l.memoizedState,g.updateQueue=l.updateQueue,d=l.dependencies,g.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},g.sibling=l.sibling,g.index=l.index,g.ref=l.ref,g}function bh(l,d,g,w,_,R){var D=2;if(w=l,typeof l=="function")Fy(l)&&(D=1);else if(typeof l=="string")D=5;else e:switch(l){case P:return Ji(g.children,_,R,d);case T:D=8,_|=8;break;case $:return l=Da(12,g,d,_|2),l.elementType=$,l.lanes=R,l;case X:return l=Da(13,g,d,_),l.elementType=X,l.lanes=R,l;case L:return l=Da(19,g,d,_),l.elementType=L,l.lanes=R,l;case q:return wh(g,_,R,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case Y:D=10;break e;case H:D=9;break e;case F:D=11;break e;case I:D=14;break e;case M:D=16,w=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Da(D,g,d,_),d.elementType=l,d.type=w,d.lanes=R,d}function Ji(l,d,g,w){return l=Da(7,l,w,d),l.lanes=g,l}function wh(l,d,g,w){return l=Da(22,l,w,d),l.elementType=q,l.lanes=g,l.stateNode={isHidden:!1},l}function zy(l,d,g){return l=Da(6,l,null,d),l.lanes=g,l}function By(l,d,g){return d=Da(4,l.children!==null?l.children:[],l.key,d),d.lanes=g,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function r9(l,d,g,w,_){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ds(0),this.expirationTimes=Ds(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ds(0),this.identifierPrefix=w,this.onRecoverableError=_,this.mutableSourceEagerHydrationData=null}function qy(l,d,g,w,_,R,D,re,ce){return l=new r9(l,d,g,re,ce),d===1?(d=1,R===!0&&(d|=8)):d=0,R=Da(3,null,null,d),l.current=R,R.stateNode=l,R.memoizedState={element:w,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},ty(R),l}function a9(l,d,g){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:w==null?null:""+w,children:l,containerInfo:d,implementation:g}}function LE(l){if(!l)return ti;l=l._reactInternals;e:{if(zn(l)!==l||l.tag!==1)throw Error(n(170));var d=l;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if(Xr(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(n(171))}if(l.tag===1){var g=l.type;if(Xr(g))return fA(l,g,d)}return d}function FE(l,d,g,w,_,R,D,re,ce){return l=qy(g,w,!0,l,_,R,D,re,ce),l.context=LE(null),g=l.current,w=Dr(),_=li(g),R=ho(w,_),R.callback=d??null,ai(g,R,_),l.current.lanes=_,us(l,_,w),Zr(l,w),l}function jh(l,d,g,w){var _=d.current,R=Dr(),D=li(_);return g=LE(g),d.context===null?d.context=g:d.pendingContext=g,d=ho(R,D),d.payload={element:l},w=w===void 0?null:w,w!==null&&(d.callback=w),l=ai(_,d,D),l!==null&&(gs(l,_,D,R),Zp(l,_,D)),D}function Sh(l){return l=l.current,l.child?(l.child.tag===5,l.child.stateNode):null}function zE(l,d){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var g=l.retryLane;l.retryLane=g!==0&&g<d?g:d}}function Uy(l,d){zE(l,d),(l=l.alternate)&&zE(l,d)}function s9(){return null}var BE=typeof reportError=="function"?reportError:function(l){console.error(l)};function Wy(l){this._internalRoot=l}Nh.prototype.render=Wy.prototype.render=function(l){var d=this._internalRoot;if(d===null)throw Error(n(409));jh(l,d,null,null)},Nh.prototype.unmount=Wy.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var d=l.containerInfo;Yi(function(){jh(null,l,null,null)}),d[lo]=null}};function Nh(l){this._internalRoot=l}Nh.prototype.unstable_scheduleHydration=function(l){if(l){var d=Nk();l={blockedOn:null,target:l,priority:d};for(var g=0;g<Xo.length&&d!==0&&d<Xo[g].priority;g++);Xo.splice(g,0,l),g===0&&kk(l)}};function Hy(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Ch(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11&&(l.nodeType!==8||l.nodeValue!==" react-mount-point-unstable "))}function qE(){}function o9(l,d,g,w,_){if(_){if(typeof w=="function"){var R=w;w=function(){var Se=Sh(D);R.call(Se)}}var D=FE(d,w,l,0,null,!1,!1,"",qE);return l._reactRootContainer=D,l[lo]=D.current,sd(l.nodeType===8?l.parentNode:l),Yi(),D}for(;_=l.lastChild;)l.removeChild(_);if(typeof w=="function"){var re=w;w=function(){var Se=Sh(ce);re.call(Se)}}var ce=qy(l,0,!1,null,null,!1,!1,"",qE);return l._reactRootContainer=ce,l[lo]=ce.current,sd(l.nodeType===8?l.parentNode:l),Yi(function(){jh(d,ce,g,w)}),ce}function _h(l,d,g,w,_){var R=g._reactRootContainer;if(R){var D=R;if(typeof _=="function"){var re=_;_=function(){var ce=Sh(D);re.call(ce)}}jh(d,D,l,_)}else D=o9(g,d,l,_,w);return Sh(D)}jk=function(l){switch(l.tag){case 3:var d=l.stateNode;if(d.current.memoizedState.isDehydrated){var g=nn(d.pendingLanes);g!==0&&(zi(d,g|1),Zr(d,En()),(on&6)===0&&(vc=En()+500,ni()))}break;case 13:Yi(function(){var w=po(l,1);if(w!==null){var _=Dr();gs(w,l,1,_)}}),Uy(l,1)}},gx=function(l){if(l.tag===13){var d=po(l,134217728);if(d!==null){var g=Dr();gs(d,l,134217728,g)}Uy(l,134217728)}},Sk=function(l){if(l.tag===13){var d=li(l),g=po(l,d);if(g!==null){var w=Dr();gs(g,l,d,w)}Uy(l,d)}},Nk=function(){return gn},Ck=function(l,d){var g=gn;try{return gn=l,d()}finally{gn=g}},Ve=function(l,d,g){switch(d){case"input":if(it(l,g),d=g.name,g.type==="radio"&&d!=null){for(g=l;g.parentNode;)g=g.parentNode;for(g=g.querySelectorAll("input[name="+JSON.stringify(""+d)+'][type="radio"]'),d=0;d<g.length;d++){var w=g[d];if(w!==l&&w.form===l.form){var _=Up(w);if(!_)throw Error(n(90));me(w),it(w,_)}}}break;case"textarea":Ft(l,g);break;case"select":d=g.value,d!=null&&Re(l,!!g.multiple,d,!1)}},Ce=$y,_e=Yi;var i9={usingClientEntryPoint:!1,Events:[ld,ac,Up,ye,ve,$y]},jd={findFiberByHostInstance:Bi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},l9={bundleType:jd.bundleType,version:jd.version,rendererPackageName:jd.rendererPackageName,rendererConfig:jd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:k.ReactCurrentDispatcher,findHostInstanceByFiber:function(l){return l=Li(l),l===null?null:l.stateNode},findFiberByHostInstance:jd.findFiberByHostInstance||s9,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var kh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kh.isDisabled&&kh.supportsFiber)try{Lt=kh.inject(l9),tn=kh}catch{}}return ea.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i9,ea.createPortal=function(l,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Hy(d))throw Error(n(200));return a9(l,d,null,g)},ea.createRoot=function(l,d){if(!Hy(l))throw Error(n(299));var g=!1,w="",_=BE;return d!=null&&(d.unstable_strictMode===!0&&(g=!0),d.identifierPrefix!==void 0&&(w=d.identifierPrefix),d.onRecoverableError!==void 0&&(_=d.onRecoverableError)),d=qy(l,1,!1,null,null,g,!1,w,_),l[lo]=d.current,sd(l.nodeType===8?l.parentNode:l),new Wy(d)},ea.findDOMNode=function(l){if(l==null)return null;if(l.nodeType===1)return l;var d=l._reactInternals;if(d===void 0)throw typeof l.render=="function"?Error(n(188)):(l=Object.keys(l).join(","),Error(n(268,l)));return l=Li(d),l=l===null?null:l.stateNode,l},ea.flushSync=function(l){return Yi(l)},ea.hydrate=function(l,d,g){if(!Ch(d))throw Error(n(200));return _h(null,l,d,!0,g)},ea.hydrateRoot=function(l,d,g){if(!Hy(l))throw Error(n(405));var w=g!=null&&g.hydratedSources||null,_=!1,R="",D=BE;if(g!=null&&(g.unstable_strictMode===!0&&(_=!0),g.identifierPrefix!==void 0&&(R=g.identifierPrefix),g.onRecoverableError!==void 0&&(D=g.onRecoverableError)),d=FE(d,null,l,1,g??null,_,!1,R,D),l[lo]=d.current,sd(l),w)for(l=0;l<w.length;l++)g=w[l],_=g._getVersion,_=_(g._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[g,_]:d.mutableSourceEagerHydrationData.push(g,_);return new Nh(d)},ea.render=function(l,d,g){if(!Ch(d))throw Error(n(200));return _h(null,l,d,!1,g)},ea.unmountComponentAtNode=function(l){if(!Ch(l))throw Error(n(40));return l._reactRootContainer?(Yi(function(){_h(null,null,l,!1,function(){l._reactRootContainer=null,l[lo]=null})}),!0):!1},ea.unstable_batchedUpdates=$y,ea.unstable_renderSubtreeIntoContainer=function(l,d,g,w){if(!Ch(g))throw Error(n(200));if(l==null||l._reactInternals===void 0)throw Error(n(38));return _h(l,d,g,!1,w)},ea.version="18.3.1-next-f1338f8080-20240426",ea}var XE;function KD(){if(XE)return Gy.exports;XE=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Gy.exports=g9(),Gy.exports}var QE;function v9(){if(QE)return Eh;QE=1;var e=KD();return Eh.createRoot=e.createRoot,Eh.hydrateRoot=e.hydrateRoot,Eh}var x9=v9(),h=lC();const J=vn(h),cC=u9({__proto__:null,default:J},[h]),y9=1,b9=1e6;let Qy=0;function w9(){return Qy=(Qy+1)%Number.MAX_SAFE_INTEGER,Qy.toString()}const Jy=new Map,JE=e=>{if(Jy.has(e))return;const t=setTimeout(()=>{Jy.delete(e),Hd({type:"REMOVE_TOAST",toastId:e})},b9);Jy.set(e,t)},j9=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,y9)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?JE(n):e.toasts.forEach(r=>{JE(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},rm=[];let am={toasts:[]};function Hd(e){am=j9(am,e),rm.forEach(t=>{t(am)})}function $e({...e}){const t=w9(),n=s=>Hd({type:"UPDATE_TOAST",toast:{...s,id:t}}),r=()=>Hd({type:"DISMISS_TOAST",toastId:t});return Hd({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||r()}}}),{id:t,dismiss:r,update:n}}function S9(){const[e,t]=h.useState(am);return h.useEffect(()=>(rm.push(t),()=>{const n=rm.indexOf(t);n>-1&&rm.splice(n,1)}),[e]),{...e,toast:$e,dismiss:n=>Hd({type:"DISMISS_TOAST",toastId:n})}}var Nu=KD();const GD=vn(Nu);function Ue(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function ZE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Vr(...e){return t=>{let n=!1;const r=e.map(s=>{const o=ZE(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():ZE(e[s],null)}}}}function Ot(...e){return h.useCallback(Vr(...e),e)}function N9(e,t){const n=h.createContext(t),r=o=>{const{children:i,...c}=o,u=h.useMemo(()=>c,Object.values(c));return a.jsx(n.Provider,{value:u,children:i})};r.displayName=e+"Provider";function s(o){const i=h.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function kr(e,t=[]){let n=[];function r(o,i){const c=h.createContext(i),u=n.length;n=[...n,i];const f=p=>{const{scope:v,children:x,...j}=p,y=v?.[e]?.[u]||c,b=h.useMemo(()=>j,Object.values(j));return a.jsx(y.Provider,{value:b,children:x})};f.displayName=o+"Provider";function m(p,v){const x=v?.[e]?.[u]||c,j=h.useContext(x);if(j)return j;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[f,m]}const s=()=>{const o=n.map(i=>h.createContext(i));return function(c){const u=c?.[e]||o;return h.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return s.scopeName=e,[r,C9(s,...t)]}function C9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:u,scopeName:f})=>{const p=u(o)[`__scope${f}`];return{...c,...p}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function eP(e){const t=_9(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),u=c.find(A9);if(u){const f=u.props.children,m=c.map(p=>p===u?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function _9(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=P9(s),c=E9(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var k9=Symbol("radix.slottable");function A9(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===k9}function E9(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function P9(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 Qf(e){const t=e+"CollectionProvider",[n,r]=kr(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=y=>{const{scope:b,children:S}=y,N=J.useRef(null),C=J.useRef(new Map).current;return a.jsx(s,{scope:b,itemMap:C,collectionRef:N,children:S})};i.displayName=t;const c=e+"CollectionSlot",u=eP(c),f=J.forwardRef((y,b)=>{const{scope:S,children:N}=y,C=o(c,S),k=Ot(b,C.collectionRef);return a.jsx(u,{ref:k,children:N})});f.displayName=c;const m=e+"CollectionItemSlot",p="data-radix-collection-item",v=eP(m),x=J.forwardRef((y,b)=>{const{scope:S,children:N,...C}=y,k=J.useRef(null),A=Ot(b,k),E=o(m,S);return J.useEffect(()=>(E.itemMap.set(k,{ref:k,...C}),()=>{E.itemMap.delete(k)})),a.jsx(v,{[p]:"",ref:A,children:N})});x.displayName=m;function j(y){const b=o(e+"CollectionConsumer",y);return J.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const C=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(b.itemMap.values()).sort((E,P)=>C.indexOf(E.ref.current)-C.indexOf(P.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:i,Slot:f,ItemSlot:x},j,r]}function R9(e){const t=T9(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),u=c.find(M9);if(u){const f=u.props.children,m=c.map(p=>p===u?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function T9(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=$9(s),c=I9(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var O9=Symbol("radix.slottable");function M9(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===O9}function I9(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function $9(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 D9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lt=D9.reduce((e,t)=>{const n=R9(`Primitive.${t}`),r=h.forwardRef((s,o)=>{const{asChild:i,...c}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function uC(e,t){e&&Nu.flushSync(()=>e.dispatchEvent(t))}function Jn(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>t.current?.(...n),[])}function L9(e,t=globalThis?.document){const n=Jn(e);h.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var F9="DismissableLayer",WS="dismissableLayer.update",z9="dismissableLayer.pointerDownOutside",B9="dismissableLayer.focusOutside",tP,YD=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ll=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:c,...u}=e,f=h.useContext(YD),[m,p]=h.useState(null),v=m?.ownerDocument??globalThis?.document,[,x]=h.useState({}),j=Ot(t,P=>p(P)),y=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),S=y.indexOf(b),N=m?y.indexOf(m):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,k=N>=S,A=U9(P=>{const T=P.target,$=[...f.branches].some(Y=>Y.contains(T));!k||$||(s?.(P),i?.(P),P.defaultPrevented||c?.())},v),E=W9(P=>{const T=P.target;[...f.branches].some(Y=>Y.contains(T))||(o?.(P),i?.(P),P.defaultPrevented||c?.())},v);return L9(P=>{N===f.layers.size-1&&(r?.(P),!P.defaultPrevented&&c&&(P.preventDefault(),c()))},v),h.useEffect(()=>{if(m)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(tP=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),nP(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=tP)}},[m,v,n,f]),h.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),nP())},[m,f]),h.useEffect(()=>{const P=()=>x({});return document.addEventListener(WS,P),()=>document.removeEventListener(WS,P)},[]),a.jsx(lt.div,{...u,ref:j,style:{pointerEvents:C?k?"auto":"none":void 0,...e.style},onFocusCapture:Ue(e.onFocusCapture,E.onFocusCapture),onBlurCapture:Ue(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ue(e.onPointerDownCapture,A.onPointerDownCapture)})});Ll.displayName=F9;var q9="DismissableLayerBranch",XD=h.forwardRef((e,t)=>{const n=h.useContext(YD),r=h.useRef(null),s=Ot(t,r);return h.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(lt.div,{...e,ref:s})});XD.displayName=q9;function U9(e,t=globalThis?.document){const n=Jn(e),r=h.useRef(!1),s=h.useRef(()=>{});return h.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let u=function(){QD(z9,n,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=u,t.addEventListener("click",s.current,{once:!0})):u()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function W9(e,t=globalThis?.document){const n=Jn(e),r=h.useRef(!1);return h.useEffect(()=>{const s=o=>{o.target&&!r.current&&QD(B9,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function nP(){const e=new CustomEvent(WS);document.dispatchEvent(e)}function QD(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?uC(s,o):s.dispatchEvent(o)}var H9=Ll,V9=XD,pr=globalThis?.document?h.useLayoutEffect:()=>{},K9="Portal",Fl=h.forwardRef((e,t)=>{const{container:n,...r}=e,[s,o]=h.useState(!1);pr(()=>o(!0),[]);const i=n||s&&globalThis?.document?.body;return i?GD.createPortal(a.jsx(lt.div,{...r,ref:t}),i):null});Fl.displayName=K9;function G9(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var ar=e=>{const{present:t,children:n}=e,r=Y9(t),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),o=Ot(r.ref,X9(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:o}):null};ar.displayName="Presence";function Y9(e){const[t,n]=h.useState(),r=h.useRef(null),s=h.useRef(e),o=h.useRef("none"),i=e?"mounted":"unmounted",[c,u]=G9(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const f=Ph(r.current);o.current=c==="mounted"?f:"none"},[c]),pr(()=>{const f=r.current,m=s.current;if(m!==e){const v=o.current,x=Ph(f);e?u("MOUNT"):x==="none"||f?.display==="none"?u("UNMOUNT"):u(m&&v!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,u]),pr(()=>{if(t){let f;const m=t.ownerDocument.defaultView??window,p=x=>{const y=Ph(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&y&&(u("ANIMATION_END"),!s.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",f=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},v=x=>{x.target===t&&(o.current=Ph(r.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{m.clearTimeout(f),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:h.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Ph(e){return e?.animationName||"none"}function X9(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 Q9=cC[" useInsertionEffect ".trim().toString()]||pr;function Aa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=J9({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:s;{const m=h.useRef(e!==void 0);h.useEffect(()=>{const p=m.current;p!==c&&console.warn(`${r} 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.`),m.current=c},[c,r])}const f=h.useCallback(m=>{if(c){const p=Z9(m)?m(e):m;p!==e&&i.current?.(p)}else o(m)},[c,e,o,i]);return[u,f]}function J9({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),s=h.useRef(n),o=h.useRef(t);return Q9(()=>{o.current=t},[t]),h.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function Z9(e){return typeof e=="function"}var JD=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),eW="VisuallyHidden",Lg=h.forwardRef((e,t)=>a.jsx(lt.span,{...e,ref:t,style:{...JD,...e.style}}));Lg.displayName=eW;var tW=Lg,dC="ToastProvider",[fC,nW,rW]=Qf("Toast"),[ZD]=kr("Toast",[rW]),[aW,Fg]=ZD(dC),e5=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[c,u]=h.useState(null),[f,m]=h.useState(0),p=h.useRef(!1),v=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${dC}\`. Expected non-empty \`string\`.`),a.jsx(fC.Provider,{scope:t,children:a.jsx(aW,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:o,toastCount:f,viewport:c,onViewportChange:u,onToastAdd:h.useCallback(()=>m(x=>x+1),[]),onToastRemove:h.useCallback(()=>m(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:v,children:i})})};e5.displayName=dC;var t5="ToastViewport",sW=["F8"],HS="toast.viewportPause",VS="toast.viewportResume",n5=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=sW,label:s="Notifications ({hotkey})",...o}=e,i=Fg(t5,n),c=nW(n),u=h.useRef(null),f=h.useRef(null),m=h.useRef(null),p=h.useRef(null),v=Ot(t,p,i.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=i.toastCount>0;h.useEffect(()=>{const b=S=>{r.length!==0&&r.every(C=>S[C]||S.code===C)&&p.current?.focus()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),h.useEffect(()=>{const b=u.current,S=p.current;if(j&&b&&S){const N=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(HS);S.dispatchEvent(E),i.isClosePausedRef.current=!0}},C=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(VS);S.dispatchEvent(E),i.isClosePausedRef.current=!1}},k=E=>{!b.contains(E.relatedTarget)&&C()},A=()=>{b.contains(document.activeElement)||C()};return b.addEventListener("focusin",N),b.addEventListener("focusout",k),b.addEventListener("pointermove",N),b.addEventListener("pointerleave",A),window.addEventListener("blur",N),window.addEventListener("focus",C),()=>{b.removeEventListener("focusin",N),b.removeEventListener("focusout",k),b.removeEventListener("pointermove",N),b.removeEventListener("pointerleave",A),window.removeEventListener("blur",N),window.removeEventListener("focus",C)}}},[j,i.isClosePausedRef]);const y=h.useCallback(({tabbingDirection:b})=>{const N=c().map(C=>{const k=C.ref.current,A=[k,...xW(k)];return b==="forwards"?A:A.reverse()});return(b==="forwards"?N.reverse():N).flat()},[c]);return h.useEffect(()=>{const b=p.current;if(b){const S=N=>{const C=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!C){const A=document.activeElement,E=N.shiftKey;if(N.target===b&&E){f.current?.focus();return}const $=y({tabbingDirection:E?"backwards":"forwards"}),Y=$.findIndex(H=>H===A);Zy($.slice(Y+1))?N.preventDefault():E?f.current?.focus():m.current?.focus()}};return b.addEventListener("keydown",S),()=>b.removeEventListener("keydown",S)}},[c,y]),a.jsxs(V9,{ref:u,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:j?void 0:"none"},children:[j&&a.jsx(KS,{ref:f,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"forwards"});Zy(b)}}),a.jsx(fC.Slot,{scope:n,children:a.jsx(lt.ol,{tabIndex:-1,...o,ref:v})}),j&&a.jsx(KS,{ref:m,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"backwards"});Zy(b)}})]})});n5.displayName=t5;var r5="ToastFocusProxy",KS=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,o=Fg(r5,n);return a.jsx(Lg,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{const c=i.relatedTarget;!o.viewport?.contains(c)&&r()}})});KS.displayName=r5;var Jf="Toast",oW="toast.swipeStart",iW="toast.swipeMove",lW="toast.swipeCancel",cW="toast.swipeEnd",a5=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:o,...i}=e,[c,u]=Aa({prop:r,defaultProp:s??!0,onChange:o,caller:Jf});return a.jsx(ar,{present:n||c,children:a.jsx(fW,{open:c,...i,ref:t,onClose:()=>u(!1),onPause:Jn(e.onPause),onResume:Jn(e.onResume),onSwipeStart:Ue(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ue(e.onSwipeMove,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:Ue(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ue(e.onSwipeEnd,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),u(!1)})})})});a5.displayName=Jf;var[uW,dW]=ZD(Jf,{onClose(){}}),fW=h.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:c,onPause:u,onResume:f,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:v,onSwipeEnd:x,...j}=e,y=Fg(Jf,n),[b,S]=h.useState(null),N=Ot(t,L=>S(L)),C=h.useRef(null),k=h.useRef(null),A=s||y.duration,E=h.useRef(0),P=h.useRef(A),T=h.useRef(0),{onToastAdd:$,onToastRemove:Y}=y,H=Jn(()=>{b?.contains(document.activeElement)&&y.viewport?.focus(),i()}),F=h.useCallback(L=>{!L||L===1/0||(window.clearTimeout(T.current),E.current=new Date().getTime(),T.current=window.setTimeout(H,L))},[H]);h.useEffect(()=>{const L=y.viewport;if(L){const I=()=>{F(P.current),f?.()},M=()=>{const q=new Date().getTime()-E.current;P.current=P.current-q,window.clearTimeout(T.current),u?.()};return L.addEventListener(HS,M),L.addEventListener(VS,I),()=>{L.removeEventListener(HS,M),L.removeEventListener(VS,I)}}},[y.viewport,A,u,f,F]),h.useEffect(()=>{o&&!y.isClosePausedRef.current&&F(A)},[o,A,y.isClosePausedRef,F]),h.useEffect(()=>($(),()=>Y()),[$,Y]);const X=h.useMemo(()=>b?d5(b):null,[b]);return y.viewport?a.jsxs(a.Fragment,{children:[X&&a.jsx(pW,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:X}),a.jsx(uW,{scope:n,onClose:H,children:Nu.createPortal(a.jsx(fC.ItemSlot,{scope:n,children:a.jsx(H9,{asChild:!0,onEscapeKeyDown:Ue(c,()=>{y.isFocusedToastEscapeKeyDownRef.current||H(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(lt.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":y.swipeDirection,...j,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ue(e.onKeyDown,L=>{L.key==="Escape"&&(c?.(L.nativeEvent),L.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,H()))}),onPointerDown:Ue(e.onPointerDown,L=>{L.button===0&&(C.current={x:L.clientX,y:L.clientY})}),onPointerMove:Ue(e.onPointerMove,L=>{if(!C.current)return;const I=L.clientX-C.current.x,M=L.clientY-C.current.y,q=!!k.current,G=["left","right"].includes(y.swipeDirection),O=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,Q=G?O(0,I):0,B=G?0:O(0,M),z=L.pointerType==="touch"?10:2,V={x:Q,y:B},ee={originalEvent:L,delta:V};q?(k.current=V,Rh(iW,p,ee,{discrete:!1})):rP(V,y.swipeDirection,z)?(k.current=V,Rh(oW,m,ee,{discrete:!1}),L.target.setPointerCapture(L.pointerId)):(Math.abs(I)>z||Math.abs(M)>z)&&(C.current=null)}),onPointerUp:Ue(e.onPointerUp,L=>{const I=k.current,M=L.target;if(M.hasPointerCapture(L.pointerId)&&M.releasePointerCapture(L.pointerId),k.current=null,C.current=null,I){const q=L.currentTarget,G={originalEvent:L,delta:I};rP(I,y.swipeDirection,y.swipeThreshold)?Rh(cW,x,G,{discrete:!0}):Rh(lW,v,G,{discrete:!0}),q.addEventListener("click",O=>O.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),pW=e=>{const{__scopeToast:t,children:n,...r}=e,s=Fg(Jf,t),[o,i]=h.useState(!1),[c,u]=h.useState(!1);return gW(()=>i(!0)),h.useEffect(()=>{const f=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(f)},[]),c?null:a.jsx(Fl,{asChild:!0,children:a.jsx(Lg,{...r,children:o&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},hW="ToastTitle",s5=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});s5.displayName=hW;var mW="ToastDescription",o5=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});o5.displayName=mW;var i5="ToastAction",l5=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?a.jsx(u5,{altText:n,asChild:!0,children:a.jsx(pC,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${i5}\`. Expected non-empty \`string\`.`),null)});l5.displayName=i5;var c5="ToastClose",pC=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=dW(c5,n);return a.jsx(u5,{asChild:!0,children:a.jsx(lt.button,{type:"button",...r,ref:t,onClick:Ue(e.onClick,s.onClose)})})});pC.displayName=c5;var u5=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return a.jsx(lt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function d5(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),vW(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...d5(r))}}),t}function Rh(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?uC(s,o):s.dispatchEvent(o)}var rP=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),o=r>s;return t==="left"||t==="right"?o&&r>n:!o&&s>n};function gW(e=()=>{}){const t=Jn(e);pr(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function vW(e){return e.nodeType===e.ELEMENT_NODE}function xW(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Zy(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var yW=e5,f5=n5,p5=a5,h5=s5,m5=o5,g5=l5,v5=pC;function x5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=x5(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Kt(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=x5(e))&&(r&&(r+=" "),r+=t);return r}const aP=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,sP=Kt,zl=(e,t)=>n=>{var r;if(t?.variants==null)return sP(e,n?.class,n?.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(f=>{const m=n?.[f],p=o?.[f];if(m===null)return null;const v=aP(m)||aP(p);return s[f][v]}),c=n&&Object.entries(n).reduce((f,m)=>{let[p,v]=m;return v===void 0||(f[p]=v),f},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,m)=>{let{class:p,className:v,...x}=m;return Object.entries(x).every(j=>{let[y,b]=j;return Array.isArray(b)?b.includes({...o,...c}[y]):{...o,...c}[y]===b})?[...f,p,v]:f},[]);return sP(e,i,u,n?.class,n?.className)};const bW=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y5=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();var wW={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 jW=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...c},u)=>h.createElement("svg",{ref:u,...wW,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:y5("lucide",s),...c},[...i.map(([f,m])=>h.createElement(f,m)),...Array.isArray(o)?o:[o]]));const ft=(e,t)=>{const n=h.forwardRef(({className:r,...s},o)=>h.createElement(jW,{ref:o,iconNode:t,className:y5(`lucide-${bW(e)}`,r),...s}));return n.displayName=`${e}`,n};const hC=ft("Activity",[["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"}]]);const b5=ft("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);const Si=ft("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Wr=ft("Bot",[["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"}]]);const w5=ft("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);const bl=ft("ChartColumn",[["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"}]]);const Hc=ft("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Jt=ft("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const zg=ft("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const _s=ft("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Dc=ft("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);const eb=ft("CircleAlert",[["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"}]]);const Va=ft("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const SW=ft("CircleHelp",[["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"}]]);const ll=ft("CircleX",[["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"}]]);const NW=ft("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const oP=ft("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);const Ea=ft("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Hr=ft("Copy",[["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"}]]);const j5=ft("Database",[["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"}]]);const zr=ft("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const Bg=ft("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const Vc=ft("ExternalLink",[["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"}]]);const CW=ft("EyeOff",[["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"}]]);const S5=ft("Eye",[["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"}]]);const mC=ft("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);const _W=ft("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);const GS=ft("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const N5=ft("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);const kW=ft("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const C5=ft("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);const AW=ft("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const EW=ft("House",[["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-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);const PW=ft("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const gm=ft("Layers",[["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:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);const gC=ft("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);const RW=ft("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);const YS=ft("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);const TW=ft("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);const _r=ft("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const _5=ft("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);const OW=ft("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const k5=ft("NotebookTabs",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]]);const Rc=ft("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);const MW=ft("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);const XS=ft("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);const QS=ft("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);const iP=ft("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);const Zf=ft("Pencil",[["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"}]]);const ks=ft("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const To=ft("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const vC=ft("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);const Ya=ft("RefreshCw",[["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"}]]);const IW=ft("Save",[["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"}]]);const xC=ft("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const $W=ft("Send",[["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"}]]);const yC=ft("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const DW=ft("ShieldCheck",[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const sa=ft("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const LW=ft("SquarePen",[["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"}]]);const Vd=ft("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const bC=ft("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);const Xa=ft("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const sm=ft("TriangleAlert",[["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"}]]);const FW=ft("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const Kc=ft("User",[["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"}]]);const A5=ft("Wifi",[["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"}]]);const Ua=ft("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);const ca=ft("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),wC="-",zW=e=>{const t=qW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const c=i.split(wC);return c[0]===""&&c.length!==1&&c.shift(),E5(c,t)||BW(i)},getConflictingClassGroupIds:(i,c)=>{const u=n[i]||[];return c&&r[i]?[...u,...r[i]]:u}}},E5=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?E5(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(wC);return t.validators.find(({validator:i})=>i(o))?.classGroupId},lP=/^\[(.+)\]$/,BW=e=>{if(lP.test(e)){const t=lP.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},qW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return WW(Object.entries(e.classGroups),n).forEach(([o,i])=>{JS(i,r,o,t)}),r},JS=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:cP(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(UW(s)){JS(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{JS(i,cP(t,o),n,r)})})},cP=(e,t)=>{let n=e;return t.split(wC).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},UW=e=>e.isThemeGetter,WW=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,c])=>[t+i,c])):o);return[n,s]}):e,HW=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},P5="!",VW=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=c=>{const u=[];let f=0,m=0,p;for(let b=0;b<c.length;b++){let S=c[b];if(f===0){if(S===s&&(r||c.slice(b,b+o)===t)){u.push(c.slice(m,b)),m=b+o;continue}if(S==="/"){p=b;continue}}S==="["?f++:S==="]"&&f--}const v=u.length===0?c:c.substring(m),x=v.startsWith(P5),j=x?v.substring(1):v,y=p&&p>m?p-m:void 0;return{modifiers:u,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:y}};return n?c=>n({className:c,parseClassName:i}):i},KW=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},GW=e=>({cache:HW(e.cacheSize),parseClassName:VW(e),...zW(e)}),YW=/\s+/,XW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(YW);let c="";for(let u=i.length-1;u>=0;u-=1){const f=i[u],{modifiers:m,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:x}=n(f);let j=!!x,y=r(j?v.substring(0,x):v);if(!y){if(!j){c=f+(c.length>0?" "+c:c);continue}if(y=r(v),!y){c=f+(c.length>0?" "+c:c);continue}j=!1}const b=KW(m).join(":"),S=p?b+P5:b,N=S+y;if(o.includes(N))continue;o.push(N);const C=s(y,j);for(let k=0;k<C.length;++k){const A=C[k];o.push(S+A)}c=f+(c.length>0?" "+c:c)}return c};function QW(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=R5(t))&&(r&&(r+=" "),r+=n);return r}const R5=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=R5(e[r]))&&(n&&(n+=" "),n+=t);return n};function JW(e,...t){let n,r,s,o=i;function i(u){const f=t.reduce((m,p)=>p(m),e());return n=GW(f),r=n.cache.get,s=n.cache.set,o=c,c(u)}function c(u){const f=r(u);if(f)return f;const m=XW(u,n);return s(u,m),m}return function(){return o(QW.apply(null,arguments))}}const Tn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},T5=/^\[(?:([a-z-]+):)?(.+)\]$/i,ZW=/^\d+\/\d+$/,eH=new Set(["px","full","screen"]),tH=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nH=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rH=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,aH=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sH=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vo=e=>Lc(e)||eH.has(e)||ZW.test(e),fi=e=>Cu(e,"length",pH),Lc=e=>!!e&&!Number.isNaN(Number(e)),tb=e=>Cu(e,"number",Lc),Nd=e=>!!e&&Number.isInteger(Number(e)),oH=e=>e.endsWith("%")&&Lc(e.slice(0,-1)),Xt=e=>T5.test(e),pi=e=>tH.test(e),iH=new Set(["length","size","percentage"]),lH=e=>Cu(e,iH,O5),cH=e=>Cu(e,"position",O5),uH=new Set(["image","url"]),dH=e=>Cu(e,uH,mH),fH=e=>Cu(e,"",hH),Cd=()=>!0,Cu=(e,t,n)=>{const r=T5.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},pH=e=>nH.test(e)&&!rH.test(e),O5=()=>!1,hH=e=>aH.test(e),mH=e=>sH.test(e),gH=()=>{const e=Tn("colors"),t=Tn("spacing"),n=Tn("blur"),r=Tn("brightness"),s=Tn("borderColor"),o=Tn("borderRadius"),i=Tn("borderSpacing"),c=Tn("borderWidth"),u=Tn("contrast"),f=Tn("grayscale"),m=Tn("hueRotate"),p=Tn("invert"),v=Tn("gap"),x=Tn("gradientColorStops"),j=Tn("gradientColorStopPositions"),y=Tn("inset"),b=Tn("margin"),S=Tn("opacity"),N=Tn("padding"),C=Tn("saturate"),k=Tn("scale"),A=Tn("sepia"),E=Tn("skew"),P=Tn("space"),T=Tn("translate"),$=()=>["auto","contain","none"],Y=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto",Xt,t],F=()=>[Xt,t],X=()=>["",vo,fi],L=()=>["auto",Lc,Xt],I=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],M=()=>["solid","dashed","dotted","double","none"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],O=()=>["","0",Xt],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[Lc,Xt];return{cacheSize:500,separator:":",theme:{colors:[Cd],spacing:[vo,fi],blur:["none","",pi,Xt],brightness:B(),borderColor:[e],borderRadius:["none","","full",pi,Xt],borderSpacing:F(),borderWidth:X(),contrast:B(),grayscale:O(),hueRotate:B(),invert:O(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[oH,fi],inset:H(),margin:H(),opacity:B(),padding:F(),saturate:B(),scale:B(),sepia:O(),skew:B(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Xt]}],container:["container"],columns:[{columns:[pi]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...I(),Xt]}],overflow:[{overflow:Y()}],"overflow-x":[{"overflow-x":Y()}],"overflow-y":[{"overflow-y":Y()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Nd,Xt]}],basis:[{basis:H()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Xt]}],grow:[{grow:O()}],shrink:[{shrink:O()}],order:[{order:["first","last","none",Nd,Xt]}],"grid-cols":[{"grid-cols":[Cd]}],"col-start-end":[{col:["auto",{span:["full",Nd,Xt]},Xt]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Cd]}],"row-start-end":[{row:["auto",{span:[Nd,Xt]},Xt]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Xt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Xt]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Xt,t]}],"min-w":[{"min-w":[Xt,t,"min","max","fit"]}],"max-w":[{"max-w":[Xt,t,"none","full","min","max","fit","prose",{screen:[pi]},pi]}],h:[{h:[Xt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Xt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Xt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Xt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",pi,fi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tb]}],"font-family":[{font:[Cd]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Xt]}],"line-clamp":[{"line-clamp":["none",Lc,tb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",vo,Xt]}],"list-image":[{"list-image":["none",Xt]}],"list-style-type":[{list:["none","disc","decimal",Xt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",vo,fi]}],"underline-offset":[{"underline-offset":["auto",vo,Xt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Xt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...I(),cH]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",lH]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},dH]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[j]}],"gradient-via-pos":[{via:[j]}],"gradient-to-pos":[{to:[j]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...M(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}],"divide-style":[{divide:M()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...M()]}],"outline-offset":[{"outline-offset":[vo,Xt]}],"outline-w":[{outline:[vo,fi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[vo,fi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",pi,fH]}],"shadow-color":[{shadow:[Cd]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",pi,Xt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[C]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Xt]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",Xt]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",Xt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Nd,Xt]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Xt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Xt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Xt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[vo,fi,tb]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},vH=JW(gH);function Me(...e){return vH(Kt(e))}function Hn(e,t=""){return typeof e=="string"&&e.trim().length>0?e.trim():t}const xH=yW,M5=h.forwardRef(({className:e,...t},n)=>a.jsx(f5,{ref:n,className:Me("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));M5.displayName=f5.displayName;const yH=zl("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 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-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),I5=h.forwardRef(({className:e,variant:t,...n},r)=>a.jsx(p5,{ref:r,className:Me(yH({variant:t}),e),...n}));I5.displayName=p5.displayName;const bH=h.forwardRef(({className:e,...t},n)=>a.jsx(g5,{ref:n,className:Me("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));bH.displayName=g5.displayName;const $5=h.forwardRef(({className:e,...t},n)=>a.jsx(v5,{ref:n,className:Me("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:a.jsx(ca,{className:"h-4 w-4"})}));$5.displayName=v5.displayName;const D5=h.forwardRef(({className:e,...t},n)=>a.jsx(h5,{ref:n,className:Me("text-sm font-semibold",e),...t}));D5.displayName=h5.displayName;const L5=h.forwardRef(({className:e,...t},n)=>a.jsx(m5,{ref:n,className:Me("text-sm opacity-90",e),...t}));L5.displayName=m5.displayName;function wH(){const{toasts:e}=S9();return a.jsxs(xH,{children:[e.map(function({id:t,title:n,description:r,action:s,...o}){return a.jsxs(I5,{...o,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(D5,{children:n}),r&&a.jsx(L5,{children:r})]}),s,a.jsx($5,{})]},t)}),a.jsx(M5,{})]})}var uP=["light","dark"],jH="(prefers-color-scheme: dark)",SH=h.createContext(void 0),NH={setTheme:e=>{},themes:[]},CH=()=>{var e;return(e=h.useContext(SH))!=null?e:NH};h.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:o,value:i,attrs:c,nonce:u})=>{let f=o==="system",m=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${c.map(j=>`'${j}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,p=s?uP.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",v=(j,y=!1,b=!0)=>{let S=i?i[j]:j,N=y?j+"|| ''":`'${S}'`,C="";return s&&b&&!y&&uP.includes(j)&&(C+=`d.style.colorScheme = '${j}';`),n==="class"?y||S?C+=`c.add(${N})`:C+="null":S&&(C+=`d[s](n,${N})`),C},x=e?`!function(){${m}${v(e)}}()`:r?`!function(){try{${m}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${f})){var t='${jH}',m=window.matchMedia(t);if(m.media!==t||m.matches){${v("dark")}}else{${v("light")}}}else if(e){${i?`var x=${JSON.stringify(i)};`:""}${v(i?"x[e]":"e",!0)}}${f?"":"else{"+v(o,!1,!1)+"}"}${p}}catch(e){}}()`:`!function(){try{${m}var e=localStorage.getItem('${t}');if(e){${i?`var x=${JSON.stringify(i)};`:""}${v(i?"x[e]":"e",!0)}}else{${v(o,!1,!1)};}${p}}catch(t){}}();`;return h.createElement("script",{nonce:u,dangerouslySetInnerHTML:{__html:x}})});var _H=e=>{switch(e){case"success":return EH;case"info":return RH;case"warning":return PH;case"error":return TH;default:return null}},kH=Array(12).fill(0),AH=({visible:e,className:t})=>J.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},J.createElement("div",{className:"sonner-spinner"},kH.map((n,r)=>J.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),EH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),PH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),RH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),TH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),OH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),J.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),MH=()=>{let[e,t]=J.useState(document.hidden);return J.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},ZS=1,IH=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,s=typeof e?.id=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:ZS++,o=this.toasts.find(c=>c.id===s),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(c=>c.id===s?(this.publish({...c,...e,id:s,title:n}),{...c,...e,id:s,dismissible:i,title:n}):c):this.addToast({title:n,...r,dismissible:i,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),s=n!==void 0,o,i=r.then(async u=>{if(o=["resolve",u],J.isValidElement(u))s=!1,this.create({id:n,type:"default",message:u});else if(DH(u)&&!u.ok){s=!1;let f=typeof t.error=="function"?await t.error(`HTTP error! status: ${u.status}`):t.error,m=typeof t.description=="function"?await t.description(`HTTP error! status: ${u.status}`):t.description;this.create({id:n,type:"error",message:f,description:m})}else if(t.success!==void 0){s=!1;let f=typeof t.success=="function"?await t.success(u):t.success,m=typeof t.description=="function"?await t.description(u):t.description;this.create({id:n,type:"success",message:f,description:m})}}).catch(async u=>{if(o=["reject",u],t.error!==void 0){s=!1;let f=typeof t.error=="function"?await t.error(u):t.error,m=typeof t.description=="function"?await t.description(u):t.description;this.create({id:n,type:"error",message:f,description:m})}}).finally(()=>{var u;s&&(this.dismiss(n),n=void 0),(u=t.finally)==null||u.call(t)}),c=()=>new Promise((u,f)=>i.then(()=>o[0]==="reject"?f(o[1]):u(o[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,t)=>{let n=t?.id||ZS++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},na=new IH,$H=(e,t)=>{let n=t?.id||ZS++;return na.addToast({title:e,...t,id:n}),n},DH=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",LH=$H,FH=()=>na.toasts,zH=()=>na.getActiveToasts();Object.assign(LH,{success:na.success,info:na.info,warning:na.warning,error:na.error,custom:na.custom,message:na.message,promise:na.promise,dismiss:na.dismiss,loading:na.loading},{getHistory:FH,getToasts:zH});function BH(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}BH(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
9
- `);function Th(e){return e.label!==void 0}var qH=3,UH="32px",WH="16px",dP=4e3,HH=356,VH=14,KH=20,GH=200;function vs(...e){return e.filter(Boolean).join(" ")}function YH(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var XH=e=>{var t,n,r,s,o,i,c,u,f,m,p;let{invert:v,toast:x,unstyled:j,interacting:y,setHeights:b,visibleToasts:S,heights:N,index:C,toasts:k,expanded:A,removeToast:E,defaultRichColors:P,closeButton:T,style:$,cancelButtonStyle:Y,actionButtonStyle:H,className:F="",descriptionClassName:X="",duration:L,position:I,gap:M,loadingIcon:q,expandByDefault:G,classNames:O,icons:Q,closeButtonAriaLabel:B="Close toast",pauseWhenPageIsHidden:z}=e,[V,ee]=J.useState(null),[ae,ue]=J.useState(null),[se,xe]=J.useState(!1),[oe,de]=J.useState(!1),[De,me]=J.useState(!1),[ge,we]=J.useState(!1),[at,tt]=J.useState(!1),[it,At]=J.useState(0),[Ge,Ee]=J.useState(0),Re=J.useRef(x.duration||L||dP),Ze=J.useRef(null),ht=J.useRef(null),Ft=C===0,zt=C+1<=S,jt=x.type,rn=x.dismissible!==!1,an=x.className||"",qt=x.descriptionClassName||"",Zt=J.useMemo(()=>N.findIndex(ve=>ve.toastId===x.id)||0,[N,x.id]),sn=J.useMemo(()=>{var ve;return(ve=x.closeButton)!=null?ve:T},[x.closeButton,T]),ln=J.useMemo(()=>x.duration||L||dP,[x.duration,L]),ke=J.useRef(0),ze=J.useRef(0),Xe=J.useRef(0),kt=J.useRef(null),[vt,fe]=I.split("-"),Oe=J.useMemo(()=>N.reduce((ve,Ce,_e)=>_e>=Zt?ve:ve+Ce.height,0),[N,Zt]),Ve=MH(),U=x.invert||v,le=jt==="loading";ze.current=J.useMemo(()=>Zt*M+Oe,[Zt,Oe]),J.useEffect(()=>{Re.current=ln},[ln]),J.useEffect(()=>{xe(!0)},[]),J.useEffect(()=>{let ve=ht.current;if(ve){let Ce=ve.getBoundingClientRect().height;return Ee(Ce),b(_e=>[{toastId:x.id,height:Ce,position:x.position},..._e]),()=>b(_e=>_e.filter(K=>K.toastId!==x.id))}},[b,x.id]),J.useLayoutEffect(()=>{if(!se)return;let ve=ht.current,Ce=ve.style.height;ve.style.height="auto";let _e=ve.getBoundingClientRect().height;ve.style.height=Ce,Ee(_e),b(K=>K.find(pe=>pe.toastId===x.id)?K.map(pe=>pe.toastId===x.id?{...pe,height:_e}:pe):[{toastId:x.id,height:_e,position:x.position},...K])},[se,x.title,x.description,b,x.id]);let W=J.useCallback(()=>{de(!0),At(ze.current),b(ve=>ve.filter(Ce=>Ce.toastId!==x.id)),setTimeout(()=>{E(x)},GH)},[x,E,b,ze]);J.useEffect(()=>{if(x.promise&&jt==="loading"||x.duration===1/0||x.type==="loading")return;let ve;return A||y||z&&Ve?(()=>{if(Xe.current<ke.current){let Ce=new Date().getTime()-ke.current;Re.current=Re.current-Ce}Xe.current=new Date().getTime()})():Re.current!==1/0&&(ke.current=new Date().getTime(),ve=setTimeout(()=>{var Ce;(Ce=x.onAutoClose)==null||Ce.call(x,x),W()},Re.current)),()=>clearTimeout(ve)},[A,y,x,jt,z,Ve,W]),J.useEffect(()=>{x.delete&&W()},[W,x.delete]);function ye(){var ve,Ce,_e;return Q!=null&&Q.loading?J.createElement("div",{className:vs(O?.loader,(ve=x?.classNames)==null?void 0:ve.loader,"sonner-loader"),"data-visible":jt==="loading"},Q.loading):q?J.createElement("div",{className:vs(O?.loader,(Ce=x?.classNames)==null?void 0:Ce.loader,"sonner-loader"),"data-visible":jt==="loading"},q):J.createElement(AH,{className:vs(O?.loader,(_e=x?.classNames)==null?void 0:_e.loader),visible:jt==="loading"})}return J.createElement("li",{tabIndex:0,ref:ht,className:vs(F,an,O?.toast,(t=x?.classNames)==null?void 0:t.toast,O?.default,O?.[jt],(n=x?.classNames)==null?void 0:n[jt]),"data-sonner-toast":"","data-rich-colors":(r=x.richColors)!=null?r:P,"data-styled":!(x.jsx||x.unstyled||j),"data-mounted":se,"data-promise":!!x.promise,"data-swiped":at,"data-removed":oe,"data-visible":zt,"data-y-position":vt,"data-x-position":fe,"data-index":C,"data-front":Ft,"data-swiping":De,"data-dismissible":rn,"data-type":jt,"data-invert":U,"data-swipe-out":ge,"data-swipe-direction":ae,"data-expanded":!!(A||G&&se),style:{"--index":C,"--toasts-before":C,"--z-index":k.length-C,"--offset":`${oe?it:ze.current}px`,"--initial-height":G?"auto":`${Ge}px`,...$,...x.style},onDragEnd:()=>{me(!1),ee(null),kt.current=null},onPointerDown:ve=>{le||!rn||(Ze.current=new Date,At(ze.current),ve.target.setPointerCapture(ve.pointerId),ve.target.tagName!=="BUTTON"&&(me(!0),kt.current={x:ve.clientX,y:ve.clientY}))},onPointerUp:()=>{var ve,Ce,_e,K;if(ge||!rn)return;kt.current=null;let pe=Number(((ve=ht.current)==null?void 0:ve.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ae=Number(((Ce=ht.current)==null?void 0:Ce.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ke=new Date().getTime()-((_e=Ze.current)==null?void 0:_e.getTime()),te=V==="x"?pe:Ae,Le=Math.abs(te)/Ke;if(Math.abs(te)>=KH||Le>.11){At(ze.current),(K=x.onDismiss)==null||K.call(x,x),ue(V==="x"?pe>0?"right":"left":Ae>0?"down":"up"),W(),we(!0),tt(!1);return}me(!1),ee(null)},onPointerMove:ve=>{var Ce,_e,K,pe;if(!kt.current||!rn||((Ce=window.getSelection())==null?void 0:Ce.toString().length)>0)return;let Ae=ve.clientY-kt.current.y,Ke=ve.clientX-kt.current.x,te=(_e=e.swipeDirections)!=null?_e:YH(I);!V&&(Math.abs(Ke)>1||Math.abs(Ae)>1)&&ee(Math.abs(Ke)>Math.abs(Ae)?"x":"y");let Le={x:0,y:0};V==="y"?(te.includes("top")||te.includes("bottom"))&&(te.includes("top")&&Ae<0||te.includes("bottom")&&Ae>0)&&(Le.y=Ae):V==="x"&&(te.includes("left")||te.includes("right"))&&(te.includes("left")&&Ke<0||te.includes("right")&&Ke>0)&&(Le.x=Ke),(Math.abs(Le.x)>0||Math.abs(Le.y)>0)&&tt(!0),(K=ht.current)==null||K.style.setProperty("--swipe-amount-x",`${Le.x}px`),(pe=ht.current)==null||pe.style.setProperty("--swipe-amount-y",`${Le.y}px`)}},sn&&!x.jsx?J.createElement("button",{"aria-label":B,"data-disabled":le,"data-close-button":!0,onClick:le||!rn?()=>{}:()=>{var ve;W(),(ve=x.onDismiss)==null||ve.call(x,x)},className:vs(O?.closeButton,(s=x?.classNames)==null?void 0:s.closeButton)},(o=Q?.close)!=null?o:OH):null,x.jsx||h.isValidElement(x.title)?x.jsx?x.jsx:typeof x.title=="function"?x.title():x.title:J.createElement(J.Fragment,null,jt||x.icon||x.promise?J.createElement("div",{"data-icon":"",className:vs(O?.icon,(i=x?.classNames)==null?void 0:i.icon)},x.promise||x.type==="loading"&&!x.icon?x.icon||ye():null,x.type!=="loading"?x.icon||Q?.[jt]||_H(jt):null):null,J.createElement("div",{"data-content":"",className:vs(O?.content,(c=x?.classNames)==null?void 0:c.content)},J.createElement("div",{"data-title":"",className:vs(O?.title,(u=x?.classNames)==null?void 0:u.title)},typeof x.title=="function"?x.title():x.title),x.description?J.createElement("div",{"data-description":"",className:vs(X,qt,O?.description,(f=x?.classNames)==null?void 0:f.description)},typeof x.description=="function"?x.description():x.description):null),h.isValidElement(x.cancel)?x.cancel:x.cancel&&Th(x.cancel)?J.createElement("button",{"data-button":!0,"data-cancel":!0,style:x.cancelButtonStyle||Y,onClick:ve=>{var Ce,_e;Th(x.cancel)&&rn&&((_e=(Ce=x.cancel).onClick)==null||_e.call(Ce,ve),W())},className:vs(O?.cancelButton,(m=x?.classNames)==null?void 0:m.cancelButton)},x.cancel.label):null,h.isValidElement(x.action)?x.action:x.action&&Th(x.action)?J.createElement("button",{"data-button":!0,"data-action":!0,style:x.actionButtonStyle||H,onClick:ve=>{var Ce,_e;Th(x.action)&&((_e=(Ce=x.action).onClick)==null||_e.call(Ce,ve),!ve.defaultPrevented&&W())},className:vs(O?.actionButton,(p=x?.classNames)==null?void 0:p.actionButton)},x.action.label):null))};function fP(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function QH(e,t){let n={};return[e,t].forEach((r,s)=>{let o=s===1,i=o?"--mobile-offset":"--offset",c=o?WH:UH;function u(f){["top","right","bottom","left"].forEach(m=>{n[`${i}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?n[`${i}-${f}`]=c:n[`${i}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):u(c)}),n}var JH=h.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:o,closeButton:i,className:c,offset:u,mobileOffset:f,theme:m="light",richColors:p,duration:v,style:x,visibleToasts:j=qH,toastOptions:y,dir:b=fP(),gap:S=VH,loadingIcon:N,icons:C,containerAriaLabel:k="Notifications",pauseWhenPageIsHidden:A}=e,[E,P]=J.useState([]),T=J.useMemo(()=>Array.from(new Set([r].concat(E.filter(z=>z.position).map(z=>z.position)))),[E,r]),[$,Y]=J.useState([]),[H,F]=J.useState(!1),[X,L]=J.useState(!1),[I,M]=J.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=J.useRef(null),G=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),O=J.useRef(null),Q=J.useRef(!1),B=J.useCallback(z=>{P(V=>{var ee;return(ee=V.find(ae=>ae.id===z.id))!=null&&ee.delete||na.dismiss(z.id),V.filter(({id:ae})=>ae!==z.id)})},[]);return J.useEffect(()=>na.subscribe(z=>{if(z.dismiss){P(V=>V.map(ee=>ee.id===z.id?{...ee,delete:!0}:ee));return}setTimeout(()=>{GD.flushSync(()=>{P(V=>{let ee=V.findIndex(ae=>ae.id===z.id);return ee!==-1?[...V.slice(0,ee),{...V[ee],...z},...V.slice(ee+1)]:[z,...V]})})})}),[]),J.useEffect(()=>{if(m!=="system"){M(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light")),typeof window>"u")return;let z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:V})=>{M(V?"dark":"light")})}catch{z.addListener(({matches:ee})=>{try{M(ee?"dark":"light")}catch(ae){console.error(ae)}})}},[m]),J.useEffect(()=>{E.length<=1&&F(!1)},[E]),J.useEffect(()=>{let z=V=>{var ee,ae;s.every(ue=>V[ue]||V.code===ue)&&(F(!0),(ee=q.current)==null||ee.focus()),V.code==="Escape"&&(document.activeElement===q.current||(ae=q.current)!=null&&ae.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[s]),J.useEffect(()=>{if(q.current)return()=>{O.current&&(O.current.focus({preventScroll:!0}),O.current=null,Q.current=!1)}},[q.current]),J.createElement("section",{ref:t,"aria-label":`${k} ${G}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},T.map((z,V)=>{var ee;let[ae,ue]=z.split("-");return E.length?J.createElement("ol",{key:z,dir:b==="auto"?fP():b,tabIndex:-1,ref:q,className:c,"data-sonner-toaster":!0,"data-theme":I,"data-y-position":ae,"data-lifted":H&&E.length>1&&!o,"data-x-position":ue,style:{"--front-toast-height":`${((ee=$[0])==null?void 0:ee.height)||0}px`,"--width":`${HH}px`,"--gap":`${S}px`,...x,...QH(u,f)},onBlur:se=>{Q.current&&!se.currentTarget.contains(se.relatedTarget)&&(Q.current=!1,O.current&&(O.current.focus({preventScroll:!0}),O.current=null))},onFocus:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||Q.current||(Q.current=!0,O.current=se.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{X||F(!1)},onDragEnd:()=>F(!1),onPointerDown:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||L(!0)},onPointerUp:()=>L(!1)},E.filter(se=>!se.position&&V===0||se.position===z).map((se,xe)=>{var oe,de;return J.createElement(XH,{key:se.id,icons:C,index:xe,toast:se,defaultRichColors:p,duration:(oe=y?.duration)!=null?oe:v,className:y?.className,descriptionClassName:y?.descriptionClassName,invert:n,visibleToasts:j,closeButton:(de=y?.closeButton)!=null?de:i,interacting:X,position:z,style:y?.style,unstyled:y?.unstyled,classNames:y?.classNames,cancelButtonStyle:y?.cancelButtonStyle,actionButtonStyle:y?.actionButtonStyle,removeToast:B,toasts:E.filter(De=>De.position==se.position),heights:$.filter(De=>De.position==se.position),setHeights:Y,expandByDefault:o,gap:S,loadingIcon:N,expanded:H,pauseWhenPageIsHidden:A,swipeDirections:e.swipeDirections})})):null}))});const ZH=({...e})=>{const{theme:t="system"}=CH();return a.jsx(JH,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var eV=cC[" useId ".trim().toString()]||(()=>{}),tV=0;function fr(e){const[t,n]=h.useState(eV());return pr(()=>{n(r=>r??String(tV++))},[e]),e||(t?`radix-${t}`:"")}const nV=["top","right","bottom","left"],Ni=Math.min,wa=Math.max,vm=Math.round,Oh=Math.floor,Ks=e=>({x:e,y:e}),rV={left:"right",right:"left",bottom:"top",top:"bottom"},aV={start:"end",end:"start"};function e1(e,t,n){return wa(e,Ni(t,n))}function Oo(e,t){return typeof e=="function"?e(t):e}function Mo(e){return e.split("-")[0]}function _u(e){return e.split("-")[1]}function jC(e){return e==="x"?"y":"x"}function SC(e){return e==="y"?"height":"width"}const sV=new Set(["top","bottom"]);function Hs(e){return sV.has(Mo(e))?"y":"x"}function NC(e){return jC(Hs(e))}function oV(e,t,n){n===void 0&&(n=!1);const r=_u(e),s=NC(e),o=SC(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=xm(i)),[i,xm(i)]}function iV(e){const t=xm(e);return[t1(e),t,t1(t)]}function t1(e){return e.replace(/start|end/g,t=>aV[t])}const pP=["left","right"],hP=["right","left"],lV=["top","bottom"],cV=["bottom","top"];function uV(e,t,n){switch(e){case"top":case"bottom":return n?t?hP:pP:t?pP:hP;case"left":case"right":return t?lV:cV;default:return[]}}function dV(e,t,n,r){const s=_u(e);let o=uV(Mo(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(t1)))),o}function xm(e){return e.replace(/left|right|bottom|top/g,t=>rV[t])}function fV(e){return{top:0,right:0,bottom:0,left:0,...e}}function F5(e){return typeof e!="number"?fV(e):{top:e,right:e,bottom:e,left:e}}function ym(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function mP(e,t,n){let{reference:r,floating:s}=e;const o=Hs(t),i=NC(t),c=SC(i),u=Mo(t),f=o==="y",m=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,v=r[c]/2-s[c]/2;let x;switch(u){case"top":x={x:m,y:r.y-s.height};break;case"bottom":x={x:m,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:p};break;case"left":x={x:r.x-s.width,y:p};break;default:x={x:r.x,y:r.y}}switch(_u(t)){case"start":x[i]-=v*(n&&f?-1:1);break;case"end":x[i]+=v*(n&&f?-1:1);break}return x}async function pV(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:c,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:p="floating",altBoundary:v=!1,padding:x=0}=Oo(t,e),j=F5(x),b=c[v?p==="floating"?"reference":"floating":p],S=ym(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:f,rootBoundary:m,strategy:u})),N=p==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),k=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},A=ym(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:C,strategy:u}):N);return{top:(S.top-A.top+j.top)/k.y,bottom:(A.bottom-S.bottom+j.bottom)/k.y,left:(S.left-A.left+j.left)/k.x,right:(A.right-S.right+j.right)/k.x}}const hV=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,c=o.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:m,y:p}=mP(f,r,u),v=r,x={},j=0;for(let b=0;b<c.length;b++){var y;const{name:S,fn:N}=c[b],{x:C,y:k,data:A,reset:E}=await N({x:m,y:p,initialPlacement:r,placement:v,strategy:s,middlewareData:x,rects:f,platform:{...i,detectOverflow:(y=i.detectOverflow)!=null?y:pV},elements:{reference:e,floating:t}});m=C??m,p=k??p,x={...x,[S]:{...x[S],...A}},E&&j<=50&&(j++,typeof E=="object"&&(E.placement&&(v=E.placement),E.rects&&(f=E.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):E.rects),{x:m,y:p}=mP(f,v,u)),b=-1)}return{x:m,y:p,placement:v,strategy:s,middlewareData:x}},mV=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:c,middlewareData:u}=t,{element:f,padding:m=0}=Oo(e,t)||{};if(f==null)return{};const p=F5(m),v={x:n,y:r},x=NC(s),j=SC(x),y=await i.getDimensions(f),b=x==="y",S=b?"top":"left",N=b?"bottom":"right",C=b?"clientHeight":"clientWidth",k=o.reference[j]+o.reference[x]-v[x]-o.floating[j],A=v[x]-o.reference[x],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let P=E?E[C]:0;(!P||!await(i.isElement==null?void 0:i.isElement(E)))&&(P=c.floating[C]||o.floating[j]);const T=k/2-A/2,$=P/2-y[j]/2-1,Y=Ni(p[S],$),H=Ni(p[N],$),F=Y,X=P-y[j]-H,L=P/2-y[j]/2+T,I=e1(F,L,X),M=!u.arrow&&_u(s)!=null&&L!==I&&o.reference[j]/2-(L<F?Y:H)-y[j]/2<0,q=M?L<F?L-F:L-X:0;return{[x]:v[x]+q,data:{[x]:I,centerOffset:L-I-q,...M&&{alignmentOffset:q}},reset:M}}}),gV=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:c,platform:u,elements:f}=t,{mainAxis:m=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:y=!0,...b}=Oo(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const S=Mo(s),N=Hs(c),C=Mo(c)===c,k=await(u.isRTL==null?void 0:u.isRTL(f.floating)),A=v||(C||!y?[xm(c)]:iV(c)),E=j!=="none";!v&&E&&A.push(...dV(c,y,j,k));const P=[c,...A],T=await u.detectOverflow(t,b),$=[];let Y=((r=o.flip)==null?void 0:r.overflows)||[];if(m&&$.push(T[S]),p){const L=oV(s,i,k);$.push(T[L[0]],T[L[1]])}if(Y=[...Y,{placement:s,overflows:$}],!$.every(L=>L<=0)){var H,F;const L=(((H=o.flip)==null?void 0:H.index)||0)+1,I=P[L];if(I&&(!(p==="alignment"?N!==Hs(I):!1)||Y.every(G=>Hs(G.placement)===N?G.overflows[0]>0:!0)))return{data:{index:L,overflows:Y},reset:{placement:I}};let M=(F=Y.filter(q=>q.overflows[0]<=0).sort((q,G)=>q.overflows[1]-G.overflows[1])[0])==null?void 0:F.placement;if(!M)switch(x){case"bestFit":{var X;const q=(X=Y.filter(G=>{if(E){const O=Hs(G.placement);return O===N||O==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(O=>O>0).reduce((O,Q)=>O+Q,0)]).sort((G,O)=>G[1]-O[1])[0])==null?void 0:X[0];q&&(M=q);break}case"initialPlacement":M=c;break}if(s!==M)return{reset:{placement:M}}}return{}}}};function gP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vP(e){return nV.some(t=>e[t]>=0)}const vV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=Oo(e,t);switch(s){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),c=gP(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:vP(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),c=gP(i,n.floating);return{data:{escapedOffsets:c,escaped:vP(c)}}}default:return{}}}}},z5=new Set(["left","top"]);async function xV(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=Mo(n),c=_u(n),u=Hs(n)==="y",f=z5.has(i)?-1:1,m=o&&u?-1:1,p=Oo(t,e);let{mainAxis:v,crossAxis:x,alignmentAxis:j}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof j=="number"&&(x=c==="end"?j*-1:j),u?{x:x*m,y:v*f}:{x:v*f,y:x*m}}const yV=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:c}=t,u=await xV(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:o+u.y,data:{...u,placement:i}}}}},bV=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:u={fn:S=>{let{x:N,y:C}=S;return{x:N,y:C}}},...f}=Oo(e,t),m={x:n,y:r},p=await o.detectOverflow(t,f),v=Hs(Mo(s)),x=jC(v);let j=m[x],y=m[v];if(i){const S=x==="y"?"top":"left",N=x==="y"?"bottom":"right",C=j+p[S],k=j-p[N];j=e1(C,j,k)}if(c){const S=v==="y"?"top":"left",N=v==="y"?"bottom":"right",C=y+p[S],k=y-p[N];y=e1(C,y,k)}const b=u.fn({...t,[x]:j,[v]:y});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[x]:i,[v]:c}}}}}},wV=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:c=0,mainAxis:u=!0,crossAxis:f=!0}=Oo(e,t),m={x:n,y:r},p=Hs(s),v=jC(p);let x=m[v],j=m[p];const y=Oo(c,t),b=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(u){const C=v==="y"?"height":"width",k=o.reference[v]-o.floating[C]+b.mainAxis,A=o.reference[v]+o.reference[C]-b.mainAxis;x<k?x=k:x>A&&(x=A)}if(f){var S,N;const C=v==="y"?"width":"height",k=z5.has(Mo(s)),A=o.reference[p]-o.floating[C]+(k&&((S=i.offset)==null?void 0:S[p])||0)+(k?0:b.crossAxis),E=o.reference[p]+o.reference[C]+(k?0:((N=i.offset)==null?void 0:N[p])||0)-(k?b.crossAxis:0);j<A?j=A:j>E&&(j=E)}return{[v]:x,[p]:j}}}},jV=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:c}=t,{apply:u=()=>{},...f}=Oo(e,t),m=await i.detectOverflow(t,f),p=Mo(s),v=_u(s),x=Hs(s)==="y",{width:j,height:y}=o.floating;let b,S;p==="top"||p==="bottom"?(b=p,S=v===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(S=p,b=v==="end"?"top":"bottom");const N=y-m.top-m.bottom,C=j-m.left-m.right,k=Ni(y-m[b],N),A=Ni(j-m[S],C),E=!t.middlewareData.shift;let P=k,T=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=C),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=N),E&&!v){const Y=wa(m.left,0),H=wa(m.right,0),F=wa(m.top,0),X=wa(m.bottom,0);x?T=j-2*(Y!==0||H!==0?Y+H:wa(m.left,m.right)):P=y-2*(F!==0||X!==0?F+X:wa(m.top,m.bottom))}await u({...t,availableWidth:T,availableHeight:P});const $=await i.getDimensions(c.floating);return j!==$.width||y!==$.height?{reset:{rects:!0}}:{}}}};function qg(){return typeof window<"u"}function ku(e){return B5(e)?(e.nodeName||"").toLowerCase():"#document"}function Ca(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ro(e){var t;return(t=(B5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function B5(e){return qg()?e instanceof Node||e instanceof Ca(e).Node:!1}function Es(e){return qg()?e instanceof Element||e instanceof Ca(e).Element:!1}function Qs(e){return qg()?e instanceof HTMLElement||e instanceof Ca(e).HTMLElement:!1}function xP(e){return!qg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ca(e).ShadowRoot}const SV=new Set(["inline","contents"]);function ep(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Ps(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!SV.has(s)}const NV=new Set(["table","td","th"]);function CV(e){return NV.has(ku(e))}const _V=[":popover-open",":modal"];function Ug(e){return _V.some(t=>{try{return e.matches(t)}catch{return!1}})}const kV=["transform","translate","scale","rotate","perspective"],AV=["transform","translate","scale","rotate","perspective","filter"],EV=["paint","layout","strict","content"];function CC(e){const t=_C(),n=Es(e)?Ps(e):e;return kV.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||AV.some(r=>(n.willChange||"").includes(r))||EV.some(r=>(n.contain||"").includes(r))}function PV(e){let t=Ci(e);for(;Qs(t)&&!Gc(t);){if(CC(t))return t;if(Ug(t))return null;t=Ci(t)}return null}function _C(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const RV=new Set(["html","body","#document"]);function Gc(e){return RV.has(ku(e))}function Ps(e){return Ca(e).getComputedStyle(e)}function Wg(e){return Es(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ci(e){if(ku(e)==="html")return e;const t=e.assignedSlot||e.parentNode||xP(e)&&e.host||ro(e);return xP(t)?t.host:t}function q5(e){const t=Ci(e);return Gc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qs(t)&&ep(t)?t:q5(t)}function rf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=q5(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ca(s);if(o){const c=n1(i);return t.concat(i,i.visualViewport||[],ep(s)?s:[],c&&n?rf(c):[])}return t.concat(s,rf(s,[],n))}function n1(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function U5(e){const t=Ps(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Qs(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,c=vm(n)!==o||vm(r)!==i;return c&&(n=o,r=i),{width:n,height:r,$:c}}function kC(e){return Es(e)?e:e.contextElement}function Fc(e){const t=kC(e);if(!Qs(t))return Ks(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=U5(t);let i=(o?vm(n.width):n.width)/r,c=(o?vm(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const TV=Ks(0);function W5(e){const t=Ca(e);return!_C()||!t.visualViewport?TV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function OV(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ca(e)?!1:t}function wl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=kC(e);let i=Ks(1);t&&(r?Es(r)&&(i=Fc(r)):i=Fc(e));const c=OV(o,n,r)?W5(o):Ks(0);let u=(s.left+c.x)/i.x,f=(s.top+c.y)/i.y,m=s.width/i.x,p=s.height/i.y;if(o){const v=Ca(o),x=r&&Es(r)?Ca(r):r;let j=v,y=n1(j);for(;y&&r&&x!==j;){const b=Fc(y),S=y.getBoundingClientRect(),N=Ps(y),C=S.left+(y.clientLeft+parseFloat(N.paddingLeft))*b.x,k=S.top+(y.clientTop+parseFloat(N.paddingTop))*b.y;u*=b.x,f*=b.y,m*=b.x,p*=b.y,u+=C,f+=k,j=Ca(y),y=n1(j)}}return ym({width:m,height:p,x:u,y:f})}function Hg(e,t){const n=Wg(e).scrollLeft;return t?t.left+n:wl(ro(e)).left+n}function H5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Hg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function MV(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=ro(r),c=t?Ug(t.floating):!1;if(r===i||c&&o)return n;let u={scrollLeft:0,scrollTop:0},f=Ks(1);const m=Ks(0),p=Qs(r);if((p||!p&&!o)&&((ku(r)!=="body"||ep(i))&&(u=Wg(r)),Qs(r))){const x=wl(r);f=Fc(r),m.x=x.x+r.clientLeft,m.y=x.y+r.clientTop}const v=i&&!p&&!o?H5(i,u):Ks(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+m.x+v.x,y:n.y*f.y-u.scrollTop*f.y+m.y+v.y}}function IV(e){return Array.from(e.getClientRects())}function $V(e){const t=ro(e),n=Wg(e),r=e.ownerDocument.body,s=wa(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=wa(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Hg(e);const c=-n.scrollTop;return Ps(r).direction==="rtl"&&(i+=wa(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:c}}const yP=25;function DV(e,t){const n=Ca(e),r=ro(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,c=0,u=0;if(s){o=s.width,i=s.height;const m=_C();(!m||m&&t==="fixed")&&(c=s.offsetLeft,u=s.offsetTop)}const f=Hg(r);if(f<=0){const m=r.ownerDocument,p=m.body,v=getComputedStyle(p),x=m.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,j=Math.abs(r.clientWidth-p.clientWidth-x);j<=yP&&(o-=j)}else f<=yP&&(o+=f);return{width:o,height:i,x:c,y:u}}const LV=new Set(["absolute","fixed"]);function FV(e,t){const n=wl(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Qs(e)?Fc(e):Ks(1),i=e.clientWidth*o.x,c=e.clientHeight*o.y,u=s*o.x,f=r*o.y;return{width:i,height:c,x:u,y:f}}function bP(e,t,n){let r;if(t==="viewport")r=DV(e,n);else if(t==="document")r=$V(ro(e));else if(Es(t))r=FV(t,n);else{const s=W5(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ym(r)}function V5(e,t){const n=Ci(e);return n===t||!Es(n)||Gc(n)?!1:Ps(n).position==="fixed"||V5(n,t)}function zV(e,t){const n=t.get(e);if(n)return n;let r=rf(e,[],!1).filter(c=>Es(c)&&ku(c)!=="body"),s=null;const o=Ps(e).position==="fixed";let i=o?Ci(e):e;for(;Es(i)&&!Gc(i);){const c=Ps(i),u=CC(i);!u&&c.position==="fixed"&&(s=null),(o?!u&&!s:!u&&c.position==="static"&&!!s&&LV.has(s.position)||ep(i)&&!u&&V5(e,i))?r=r.filter(m=>m!==i):s=c,i=Ci(i)}return t.set(e,r),r}function BV(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Ug(t)?[]:zV(t,this._c):[].concat(n),r],c=i[0],u=i.reduce((f,m)=>{const p=bP(t,m,s);return f.top=wa(p.top,f.top),f.right=Ni(p.right,f.right),f.bottom=Ni(p.bottom,f.bottom),f.left=wa(p.left,f.left),f},bP(t,c,s));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function qV(e){const{width:t,height:n}=U5(e);return{width:t,height:n}}function UV(e,t,n){const r=Qs(t),s=ro(t),o=n==="fixed",i=wl(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const u=Ks(0);function f(){u.x=Hg(s)}if(r||!r&&!o)if((ku(t)!=="body"||ep(s))&&(c=Wg(t)),r){const x=wl(t,!0,o,t);u.x=x.x+t.clientLeft,u.y=x.y+t.clientTop}else s&&f();o&&!r&&s&&f();const m=s&&!r&&!o?H5(s,c):Ks(0),p=i.left+c.scrollLeft-u.x-m.x,v=i.top+c.scrollTop-u.y-m.y;return{x:p,y:v,width:i.width,height:i.height}}function nb(e){return Ps(e).position==="static"}function wP(e,t){if(!Qs(e)||Ps(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ro(e)===n&&(n=n.ownerDocument.body),n}function K5(e,t){const n=Ca(e);if(Ug(e))return n;if(!Qs(e)){let s=Ci(e);for(;s&&!Gc(s);){if(Es(s)&&!nb(s))return s;s=Ci(s)}return n}let r=wP(e,t);for(;r&&CV(r)&&nb(r);)r=wP(r,t);return r&&Gc(r)&&nb(r)&&!CC(r)?n:r||PV(e)||n}const WV=async function(e){const t=this.getOffsetParent||K5,n=this.getDimensions,r=await n(e.floating);return{reference:UV(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function HV(e){return Ps(e).direction==="rtl"}const VV={convertOffsetParentRelativeRectToViewportRelativeRect:MV,getDocumentElement:ro,getClippingRect:BV,getOffsetParent:K5,getElementRects:WV,getClientRects:IV,getDimensions:qV,getScale:Fc,isElement:Es,isRTL:HV};function G5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function KV(e,t){let n=null,r;const s=ro(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),o();const f=e.getBoundingClientRect(),{left:m,top:p,width:v,height:x}=f;if(c||t(),!v||!x)return;const j=Oh(p),y=Oh(s.clientWidth-(m+v)),b=Oh(s.clientHeight-(p+x)),S=Oh(m),C={rootMargin:-j+"px "+-y+"px "+-b+"px "+-S+"px",threshold:wa(0,Ni(1,u))||1};let k=!0;function A(E){const P=E[0].intersectionRatio;if(P!==u){if(!k)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!G5(f,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(A,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,C)}n.observe(e)}return i(!0),o}function GV(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=kC(e),m=s||o?[...f?rf(f):[],...rf(t)]:[];m.forEach(S=>{s&&S.addEventListener("scroll",n,{passive:!0}),o&&S.addEventListener("resize",n)});const p=f&&c?KV(f,n):null;let v=-1,x=null;i&&(x=new ResizeObserver(S=>{let[N]=S;N&&N.target===f&&x&&(x.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var C;(C=x)==null||C.observe(t)})),n()}),f&&!u&&x.observe(f),x.observe(t));let j,y=u?wl(e):null;u&&b();function b(){const S=wl(e);y&&!G5(y,S)&&n(),y=S,j=requestAnimationFrame(b)}return n(),()=>{var S;m.forEach(N=>{s&&N.removeEventListener("scroll",n),o&&N.removeEventListener("resize",n)}),p?.(),(S=x)==null||S.disconnect(),x=null,u&&cancelAnimationFrame(j)}}const YV=yV,XV=bV,QV=gV,JV=jV,ZV=vV,jP=mV,eK=wV,tK=(e,t,n)=>{const r=new Map,s={platform:VV,...n},o={...s.platform,_c:r};return hV(e,t,{...s,platform:o})};var nK=typeof document<"u",rK=function(){},om=nK?h.useLayoutEffect:rK;function bm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bm(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!bm(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Y5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function SP(e,t){const n=Y5(e);return Math.round(t*n)/n}function rb(e){const t=h.useRef(e);return om(()=>{t.current=e}),t}function aK(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:c=!0,whileElementsMounted:u,open:f}=e,[m,p]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,x]=h.useState(r);bm(v,r)||x(r);const[j,y]=h.useState(null),[b,S]=h.useState(null),N=h.useCallback(G=>{G!==E.current&&(E.current=G,y(G))},[]),C=h.useCallback(G=>{G!==P.current&&(P.current=G,S(G))},[]),k=o||j,A=i||b,E=h.useRef(null),P=h.useRef(null),T=h.useRef(m),$=u!=null,Y=rb(u),H=rb(s),F=rb(f),X=h.useCallback(()=>{if(!E.current||!P.current)return;const G={placement:t,strategy:n,middleware:v};H.current&&(G.platform=H.current),tK(E.current,P.current,G).then(O=>{const Q={...O,isPositioned:F.current!==!1};L.current&&!bm(T.current,Q)&&(T.current=Q,Nu.flushSync(()=>{p(Q)}))})},[v,t,n,H,F]);om(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,p(G=>({...G,isPositioned:!1})))},[f]);const L=h.useRef(!1);om(()=>(L.current=!0,()=>{L.current=!1}),[]),om(()=>{if(k&&(E.current=k),A&&(P.current=A),k&&A){if(Y.current)return Y.current(k,A,X);X()}},[k,A,X,Y,$]);const I=h.useMemo(()=>({reference:E,floating:P,setReference:N,setFloating:C}),[N,C]),M=h.useMemo(()=>({reference:k,floating:A}),[k,A]),q=h.useMemo(()=>{const G={position:n,left:0,top:0};if(!M.floating)return G;const O=SP(M.floating,m.x),Q=SP(M.floating,m.y);return c?{...G,transform:"translate("+O+"px, "+Q+"px)",...Y5(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:Q}},[n,c,M.floating,m.x,m.y]);return h.useMemo(()=>({...m,update:X,refs:I,elements:M,floatingStyles:q}),[m,X,I,M,q])}const sK=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?jP({element:r.current,padding:s}).fn(n):{}:r?jP({element:r,padding:s}).fn(n):{}}}},oK=(e,t)=>({...YV(e),options:[e,t]}),iK=(e,t)=>({...XV(e),options:[e,t]}),lK=(e,t)=>({...eK(e),options:[e,t]}),cK=(e,t)=>({...QV(e),options:[e,t]}),uK=(e,t)=>({...JV(e),options:[e,t]}),dK=(e,t)=>({...ZV(e),options:[e,t]}),fK=(e,t)=>({...sK(e),options:[e,t]});var pK="Arrow",X5=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return a.jsx(lt.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});X5.displayName=pK;var hK=X5;function Vg(e){const[t,n]=h.useState(void 0);return pr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,c;if("borderBoxSize"in o){const u=o.borderBoxSize,f=Array.isArray(u)?u[0]:u;i=f.inlineSize,c=f.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var AC="Popper",[Q5,Ei]=kr(AC),[mK,J5]=Q5(AC),Z5=e=>{const{__scopePopper:t,children:n}=e,[r,s]=h.useState(null);return a.jsx(mK,{scope:t,anchor:r,onAnchorChange:s,children:n})};Z5.displayName=AC;var e3="PopperAnchor",t3=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=J5(e3,n),i=h.useRef(null),c=Ot(t,i),u=h.useRef(null);return h.useEffect(()=>{const f=u.current;u.current=r?.current||i.current,f!==u.current&&o.onAnchorChange(u.current)}),r?null:a.jsx(lt.div,{...s,ref:c})});t3.displayName=e3;var EC="PopperContent",[gK,vK]=Q5(EC),n3=h.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:x="optimized",onPlaced:j,...y}=e,b=J5(EC,n),[S,N]=h.useState(null),C=Ot(t,se=>N(se)),[k,A]=h.useState(null),E=Vg(k),P=E?.width??0,T=E?.height??0,$=r+(o!=="center"?"-"+o:""),Y=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},H=Array.isArray(f)?f:[f],F=H.length>0,X={padding:Y,boundary:H.filter(yK),altBoundary:F},{refs:L,floatingStyles:I,placement:M,isPositioned:q,middlewareData:G}=aK({strategy:"fixed",placement:$,whileElementsMounted:(...se)=>GV(...se,{animationFrame:x==="always"}),elements:{reference:b.anchor},middleware:[oK({mainAxis:s+T,alignmentAxis:i}),u&&iK({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?lK():void 0,...X}),u&&cK({...X}),uK({...X,apply:({elements:se,rects:xe,availableWidth:oe,availableHeight:de})=>{const{width:De,height:me}=xe.reference,ge=se.floating.style;ge.setProperty("--radix-popper-available-width",`${oe}px`),ge.setProperty("--radix-popper-available-height",`${de}px`),ge.setProperty("--radix-popper-anchor-width",`${De}px`),ge.setProperty("--radix-popper-anchor-height",`${me}px`)}}),k&&fK({element:k,padding:c}),bK({arrowWidth:P,arrowHeight:T}),v&&dK({strategy:"referenceHidden",...X})]}),[O,Q]=s3(M),B=Jn(j);pr(()=>{q&&B?.()},[q,B]);const z=G.arrow?.x,V=G.arrow?.y,ee=G.arrow?.centerOffset!==0,[ae,ue]=h.useState();return pr(()=>{S&&ue(window.getComputedStyle(S).zIndex)},[S]),a.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:q?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[G.transformOrigin?.x,G.transformOrigin?.y].join(" "),...G.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(gK,{scope:n,placedSide:O,onArrowChange:A,arrowX:z,arrowY:V,shouldHideArrow:ee,children:a.jsx(lt.div,{"data-side":O,"data-align":Q,...y,ref:C,style:{...y.style,animation:q?void 0:"none"}})})})});n3.displayName=EC;var r3="PopperArrow",xK={top:"bottom",right:"left",bottom:"top",left:"right"},a3=h.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=vK(r3,r),i=xK[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(hK,{...s,ref:n,style:{...s.style,display:"block"}})})});a3.displayName=r3;function yK(e){return e!==null}var bK=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:s}=t,i=s.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[f,m]=s3(n),p={start:"0%",center:"50%",end:"100%"}[m],v=(s.arrow?.x??0)+c/2,x=(s.arrow?.y??0)+u/2;let j="",y="";return f==="bottom"?(j=i?p:`${v}px`,y=`${-u}px`):f==="top"?(j=i?p:`${v}px`,y=`${r.floating.height+u}px`):f==="right"?(j=`${-u}px`,y=i?p:`${x}px`):f==="left"&&(j=`${r.floating.width+u}px`,y=i?p:`${x}px`),{data:{x:j,y}}}});function s3(e){const[t,n="center"]=e.split("-");return[t,n]}var Kg=Z5,tp=t3,Gg=n3,Yg=a3,wK=Symbol("radix.slottable");function jK(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=wK,t}var[Xg]=kr("Tooltip",[Ei]),Qg=Ei(),o3="TooltipProvider",SK=700,r1="tooltip.open",[NK,PC]=Xg(o3),i3=e=>{const{__scopeTooltip:t,delayDuration:n=SK,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,i=h.useRef(!0),c=h.useRef(!1),u=h.useRef(0);return h.useEffect(()=>{const f=u.current;return()=>window.clearTimeout(f)},[]),a.jsx(NK,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(u.current),i.current=!1},[]),onClose:h.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:h.useCallback(f=>{c.current=f},[]),disableHoverableContent:s,children:o})};i3.displayName=o3;var af="Tooltip",[CK,np]=Xg(af),l3=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:i,delayDuration:c}=e,u=PC(af,e.__scopeTooltip),f=Qg(t),[m,p]=h.useState(null),v=fr(),x=h.useRef(0),j=i??u.disableHoverableContent,y=c??u.delayDuration,b=h.useRef(!1),[S,N]=Aa({prop:r,defaultProp:s??!1,onChange:P=>{P?(u.onOpen(),document.dispatchEvent(new CustomEvent(r1))):u.onClose(),o?.(P)},caller:af}),C=h.useMemo(()=>S?b.current?"delayed-open":"instant-open":"closed",[S]),k=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,b.current=!1,N(!0)},[N]),A=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),E=h.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{b.current=!0,N(!0),x.current=0},y)},[y,N]);return h.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),a.jsx(Kg,{...f,children:a.jsx(CK,{scope:t,contentId:v,open:S,stateAttribute:C,trigger:m,onTriggerChange:p,onTriggerEnter:h.useCallback(()=>{u.isOpenDelayedRef.current?E():k()},[u.isOpenDelayedRef,E,k]),onTriggerLeave:h.useCallback(()=>{j?A():(window.clearTimeout(x.current),x.current=0)},[A,j]),onOpen:k,onClose:A,disableHoverableContent:j,children:n})})};l3.displayName=af;var a1="TooltipTrigger",c3=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=np(a1,n),o=PC(a1,n),i=Qg(n),c=h.useRef(null),u=Ot(t,c,s.onTriggerChange),f=h.useRef(!1),m=h.useRef(!1),p=h.useCallback(()=>f.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(tp,{asChild:!0,...i,children:a.jsx(lt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:u,onPointerMove:Ue(e.onPointerMove,v=>{v.pointerType!=="touch"&&!m.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ue(e.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:Ue(e.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Ue(e.onFocus,()=>{f.current||s.onOpen()}),onBlur:Ue(e.onBlur,s.onClose),onClick:Ue(e.onClick,s.onClose)})})});c3.displayName=a1;var RC="TooltipPortal",[_K,kK]=Xg(RC,{forceMount:void 0}),u3=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=np(RC,t);return a.jsx(_K,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(Fl,{asChild:!0,container:s,children:r})})})};u3.displayName=RC;var Yc="TooltipContent",d3=h.forwardRef((e,t)=>{const n=kK(Yc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,i=np(Yc,e.__scopeTooltip);return a.jsx(ar,{present:r||i.open,children:i.disableHoverableContent?a.jsx(f3,{side:s,...o,ref:t}):a.jsx(AK,{side:s,...o,ref:t})})}),AK=h.forwardRef((e,t)=>{const n=np(Yc,e.__scopeTooltip),r=PC(Yc,e.__scopeTooltip),s=h.useRef(null),o=Ot(t,s),[i,c]=h.useState(null),{trigger:u,onClose:f}=n,m=s.current,{onPointerInTransitChange:p}=r,v=h.useCallback(()=>{c(null),p(!1)},[p]),x=h.useCallback((j,y)=>{const b=j.currentTarget,S={x:j.clientX,y:j.clientY},N=OK(S,b.getBoundingClientRect()),C=MK(S,N),k=IK(y.getBoundingClientRect()),A=DK([...C,...k]);c(A),p(!0)},[p]);return h.useEffect(()=>()=>v(),[v]),h.useEffect(()=>{if(u&&m){const j=b=>x(b,m),y=b=>x(b,u);return u.addEventListener("pointerleave",j),m.addEventListener("pointerleave",y),()=>{u.removeEventListener("pointerleave",j),m.removeEventListener("pointerleave",y)}}},[u,m,x,v]),h.useEffect(()=>{if(i){const j=y=>{const b=y.target,S={x:y.clientX,y:y.clientY},N=u?.contains(b)||m?.contains(b),C=!$K(S,i);N?v():C&&(v(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[u,m,i,f,v]),a.jsx(f3,{...e,ref:o})}),[EK,PK]=Xg(af,{isInside:!1}),RK=jK("TooltipContent"),f3=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...c}=e,u=np(Yc,n),f=Qg(n),{onClose:m}=u;return h.useEffect(()=>(document.addEventListener(r1,m),()=>document.removeEventListener(r1,m)),[m]),h.useEffect(()=>{if(u.trigger){const p=v=>{v.target?.contains(u.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[u.trigger,m]),a.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(Gg,{"data-state":u.stateAttribute,...f,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(RK,{children:r}),a.jsx(EK,{scope:n,isInside:!0,children:a.jsx(tW,{id:u.contentId,role:"tooltip",children:s||r})})]})})});d3.displayName=Yc;var p3="TooltipArrow",TK=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Qg(n);return PK(p3,n).isInside?null:a.jsx(Yg,{...s,...r,ref:t})});TK.displayName=p3;function OK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function MK(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function IK(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function $K(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const c=t[o],u=t[i],f=c.x,m=c.y,p=u.x,v=u.y;m>r!=v>r&&n<(p-f)*(r-m)/(v-m)+f&&(s=!s)}return s}function DK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),LK(t)}function LK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],i=n[n.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var FK=i3,zK=l3,BK=c3,qK=u3,h3=d3;const Js=FK,Zs=zK,eo=BK,Rs=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(qK,{children:a.jsx(h3,{ref:r,sideOffset:t,className:Me("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",e),...n})}));Rs.displayName=h3.displayName;var Jg=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},UK=class extends Jg{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},m3=new UK,WK={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},HK=class{#e=WK;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},s1=new HK;function VK(e){setTimeout(e,0)}var KK=typeof window>"u"||"Deno"in globalThis;function bs(){}function GK(e,t){return typeof e=="function"?e(t):e}function YK(e){return typeof e=="number"&&e>=0&&e!==1/0}function XK(e,t){return Math.max(e+(t||0)-Date.now(),0)}function o1(e,t){return typeof e=="function"?e(t):e}function QK(e,t){return typeof e=="function"?e(t):e}function NP(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:i,stale:c}=e;if(i){if(r){if(t.queryHash!==TC(i,t.options))return!1}else if(!of(t.queryKey,i))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||s&&s!==t.state.fetchStatus||o&&!o(t))}function CP(e,t){const{exact:n,status:r,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(sf(t.options.mutationKey)!==sf(o))return!1}else if(!of(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function TC(e,t){return(t?.queryKeyHashFn||sf)(e)}function sf(e){return JSON.stringify(e,(t,n)=>i1(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function of(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>of(e[n],t[n])):!1}var JK=Object.prototype.hasOwnProperty;function g3(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=_P(e)&&_P(t);if(!r&&!(i1(e)&&i1(t)))return t;const o=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),c=i.length,u=r?new Array(c):{};let f=0;for(let m=0;m<c;m++){const p=r?m:i[m],v=e[p],x=t[p];if(v===x){u[p]=v,(r?m<o:JK.call(e,p))&&f++;continue}if(v===null||x===null||typeof v!="object"||typeof x!="object"){u[p]=x;continue}const j=g3(v,x,n+1);u[p]=j,j===v&&f++}return o===c&&f===o?e:u}function _P(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function i1(e){if(!kP(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!kP(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function kP(e){return Object.prototype.toString.call(e)==="[object Object]"}function ZK(e){return new Promise(t=>{s1.setTimeout(t,e)})}function eG(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?g3(e,t):t}function tG(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function nG(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var OC=Symbol();function v3(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===OC?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rG(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var x3=(()=>{let e=()=>KK;return{isServer(){return e()},setIsServer(t){e=t}}})();function aG(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var sG=VK;function oG(){let e=[],t=0,n=c=>{c()},r=c=>{c()},s=sG;const o=c=>{t?e.push(c):s(()=>{n(c)})},i=()=>{const c=e;e=[],c.length&&s(()=>{r(()=>{c.forEach(u=>{n(u)})})})};return{batch:c=>{let u;t++;try{u=c()}finally{t--,t||i()}return u},batchCalls:c=>(...u)=>{o(()=>{c(...u)})},schedule:o,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{s=c}}}var Fr=oG(),iG=class extends Jg{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},wm=new iG;function lG(e){return Math.min(1e3*2**e,3e4)}function y3(e){return(e??"online")==="online"?wm.isOnline():!0}var l1=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function b3(e){let t=!1,n=0,r;const s=aG(),o=()=>s.status!=="pending",i=y=>{if(!o()){const b=new l1(y);v(b),e.onCancel?.(b)}},c=()=>{t=!0},u=()=>{t=!1},f=()=>m3.isFocused()&&(e.networkMode==="always"||wm.isOnline())&&e.canRun(),m=()=>y3(e.networkMode)&&e.canRun(),p=y=>{o()||(r?.(),s.resolve(y))},v=y=>{o()||(r?.(),s.reject(y))},x=()=>new Promise(y=>{r=b=>{(o()||f())&&y(b)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),j=()=>{if(o())return;let y;const b=n===0?e.initialPromise:void 0;try{y=b??e.fn()}catch(S){y=Promise.reject(S)}Promise.resolve(y).then(p).catch(S=>{if(o())return;const N=e.retry??(x3.isServer()?0:3),C=e.retryDelay??lG,k=typeof C=="function"?C(n,S):C,A=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,S);if(t||!A){v(S);return}n++,e.onFail?.(n,S),ZK(k).then(()=>f()?void 0:x()).then(()=>{t?v(S):j()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(r?.(),s),cancelRetry:c,continueRetry:u,canStart:m,start:()=>(m()?j():x().then(j),s)}}var w3=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),YK(this.gcTime)&&(this.#e=s1.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(x3.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(s1.clearTimeout(this.#e),this.#e=void 0)}};function cG(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let c={pages:[],pageParams:[]},u=0;const f=async()=>{let m=!1;const p=j=>{rG(j,()=>t.signal,()=>m=!0)},v=v3(t.options,t.fetchOptions),x=async(j,y,b)=>{if(m)return Promise.reject(t.signal.reason);if(y==null&&j.pages.length)return Promise.resolve(j);const N=(()=>{const E={client:t.client,queryKey:t.queryKey,pageParam:y,direction:b?"backward":"forward",meta:t.options.meta};return p(E),E})(),C=await v(N),{maxPages:k}=t.options,A=b?nG:tG;return{pages:A(j.pages,C,k),pageParams:A(j.pageParams,y,k)}};if(s&&o.length){const j=s==="backward",y=j?uG:AP,b={pages:o,pageParams:i},S=y(r,b);c=await x(b,S,j)}else{const j=e??o.length;do{const y=u===0?i[0]??r.initialPageParam:AP(r,c);if(u>0&&y==null)break;c=await x(c,y),u++}while(u<j)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=f}}}function AP(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function uG(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var dG=class extends w3{#e;#t;#n;#a;#s;#r;#l;#o;constructor(e){super(),this.#o=!1,this.#l=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#a=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=PP(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#l,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=PP(this.options);t.data!==void 0&&(this.setState(EP(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(e,t){const n=eG(this.state.data,e,this.options);return this.#i({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#i({type:"setState",state:e})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(bs).catch(bs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>QK(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===OC||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>o1(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!XK(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o||this.#c()?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const u=this.observers.find(f=>f.options.queryFn);u&&this.setOptions(u.options)}const n=new AbortController,r=u=>{Object.defineProperty(u,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const u=v3(this.options,t),m=(()=>{const p={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(p),p})();return this.#o=!1,this.options.persister?this.options.persister(u,m,this):u(m)},i=(()=>{const u={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return r(u),u})();(this.#e==="infinite"?cG(this.options.pages):this.options.behavior)?.onFetch(i,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#i({type:"fetch",meta:i.fetchOptions?.meta}),this.#r=b3({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:u=>{u instanceof l1&&u.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(u,f)=>{this.#i({type:"failed",failureCount:u,error:f})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0});try{const u=await this.#r.start();if(u===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(u),this.#a.config.onSuccess?.(u,this),this.#a.config.onSettled?.(u,this.state.error,this),u}catch(u){if(u instanceof l1){if(u.silent)return this.#r.promise;if(u.revert){if(this.state.data===void 0)throw u;return this.state.data}}throw this.#i({type:"error",error:u}),this.#a.config.onError?.(u,this),this.#a.config.onSettled?.(this.state.data,u,this),u}finally{this.scheduleGc()}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...fG(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...EP(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),Fr.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:e})})}};function fG(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:y3(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function EP(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function PP(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var pG=class extends w3{#e;#t;#n;#a;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||hG(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#s({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=b3({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,i)=>{this.#s({type:"failed",failureCount:o,error:i})},onPause:()=>{this.#s({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#a.canStart();try{if(r)t();else{this.#s({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const i=await this.options.onMutate?.(e,n);i!==this.state.context&&this.#s({type:"pending",context:i,variables:e,isPaused:s})}const o=await this.#a.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#s({type:"success",data:o}),o}catch(o){try{await this.#n.config.onError?.(o,e,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onError?.(o,e,this.state.context,n)}catch(i){Promise.reject(i)}try{await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onSettled?.(void 0,o,e,this.state.context,n)}catch(i){Promise.reject(i)}throw this.#s({type:"error",error:o}),o}finally{this.#n.runNext(this)}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Fr.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function hG(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var mG=class extends Jg{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new pG({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Mh(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Mh(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Mh(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Mh(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Fr.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>CP(t,n))}findAll(e={}){return this.getAll().filter(t=>CP(e,t))}notify(e){Fr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Fr.batch(()=>Promise.all(e.map(t=>t.continue().catch(bs))))}};function Mh(e){return e.options.scope?.id}var gG=class extends Jg{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??TC(r,t);let o=this.get(s);return o||(o=new dG({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Fr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>NP(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>NP(e,n)):t}notify(e){Fr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Fr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vG=class{#e;#t;#n;#a;#s;#r;#l;#o;constructor(e={}){this.#e=e.queryCache||new gG,this.#t=e.mutationCache||new mG,this.#n=e.defaultOptions||{},this.#a=new Map,this.#s=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#l=m3.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=wm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#l?.(),this.#l=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(o1(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(r.queryHash)?.state.data,i=GK(t,o);if(i!==void 0)return this.#e.build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Fr.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;Fr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return Fr.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fr.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(bs).catch(bs)}invalidateQueries(e,t={}){return Fr.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Fr.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(bs)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(bs)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(o1(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bs).catch(bs)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bs).catch(bs)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return wm.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#a.set(sf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#a.values()],n={};return t.forEach(r=>{of(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#s.set(sf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(r=>{of(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=TC(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===OC&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},xG=h.createContext(void 0),yG=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(xG.Provider,{value:e,children:t}));var MC=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,j3=/^[\\/]{2}/;function bG(e,t){return t+e.replace(/\\/g,"/")}var RP="popstate";function TP(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function wG(e={}){function t(r,s){let o=s.state?.masked,{pathname:i,search:c,hash:u}=o||r.location;return c1("",{pathname:i,search:c,hash:u},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:lf(s)}return SG(t,n,null,e)}function Fn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Qa(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function jG(){return Math.random().toString(36).substring(2,10)}function OP(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function c1(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Au(t):t,state:n,key:t&&t.key||r||jG(),mask:s}}function lf({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Au(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function SG(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,c="POP",u=null,f=m();f==null&&(f=0,i.replaceState({...i.state,idx:f},""));function m(){return(i.state||{idx:null}).idx}function p(){c="POP";let b=m(),S=b==null?null:b-f;f=b,u&&u({action:c,location:y.location,delta:S})}function v(b,S){c="PUSH";let N=TP(b)?b:c1(y.location,b,S);f=m()+1;let C=OP(N,f),k=y.createHref(N.mask||N);try{i.pushState(C,"",k)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;s.location.assign(k)}o&&u&&u({action:c,location:y.location,delta:1})}function x(b,S){c="REPLACE";let N=TP(b)?b:c1(y.location,b,S);f=m();let C=OP(N,f),k=y.createHref(N.mask||N);i.replaceState(C,"",k),o&&u&&u({action:c,location:y.location,delta:0})}function j(b){return NG(s,b)}let y={get action(){return c},get location(){return e(s,i)},listen(b){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(RP,p),u=b,()=>{s.removeEventListener(RP,p),u=null}},createHref(b){return t(s,b)},createURL:j,encodeLocation(b){let S=j(b);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:v,replace:x,go(b){return i.go(b)}};return y}function NG(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Fn(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:lf(t);return s=s.replace(/ $/,"%20"),!n&&j3.test(s)&&(s=r+s),new URL(s,r)}function S3(e,t,n="/"){return CG(e,t,n,!1)}function CG(e,t,n,r,s){let o=typeof t=="string"?Au(t):t,i=Io(o.pathname||"/",n);if(i==null)return null;let c=_G(e),u=null,f=DG(i);for(let m=0;u==null&&m<c.length;++m)u=$G(c[m],f,r);return u}function _G(e){let t=N3(e);return kG(t),t}function N3(e,t=[],n=[],r="",s=!1){let o=(i,c,u=s,f)=>{let m={relativePath:f===void 0?i.path||"":f,caseSensitive:i.caseSensitive===!0,childrenIndex:c,route:i};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(r)&&u)return;Fn(m.relativePath.startsWith(r),`Absolute route path "${m.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(r.length)}let p=As([r,m.relativePath]),v=n.concat(m);i.children&&i.children.length>0&&(Fn(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),N3(i.children,t,v,p,u)),!(i.path==null&&!i.index)&&t.push({path:p,score:MG(p,i.index),routesMeta:v.map((x,j)=>{let[y,b]=k3(x.relativePath,x.caseSensitive,j===v.length-1);return{...x,matcher:y,compiledParams:b}})})};return e.forEach((i,c)=>{if(i.path===""||!i.path?.includes("?"))o(i,c);else for(let u of C3(i.path))o(i,c,!0,u)}),t}function C3(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=C3(r.join("/")),c=[];return c.push(...i.map(u=>u===""?o:[o,u].join("/"))),s&&c.push(...i),c.map(u=>e.startsWith("/")&&u===""?"/":u)}function kG(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:IG(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var AG=/^:[\w-]+$/,EG=3,PG=2,RG=1,TG=10,OG=-2,MP=e=>e==="*";function MG(e,t){let n=e.split("/"),r=n.length;return n.some(MP)&&(r+=OG),t&&(r+=PG),n.filter(s=>!MP(s)).reduce((s,o)=>s+(AG.test(o)?EG:o===""?RG:TG),r)}function IG(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function $G(e,t,n=!1){let{routesMeta:r}=e,s={},o="/",i=[];for(let c=0;c<r.length;++c){let u=r[c],f=c===r.length-1,m=o==="/"?t:t.slice(o.length)||"/",p={path:u.relativePath,caseSensitive:u.caseSensitive,end:f},v=u.matcher&&u.compiledParams?_3(p,m,u.matcher,u.compiledParams):hn(p,m),x=u.route;if(!v&&f&&n&&!r[r.length-1].route.index&&(v=hn({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},m)),!v)return null;Object.assign(s,v.params),i.push({params:s,pathname:As([o,v.pathname]),pathnameBase:zG(As([o,v.pathnameBase])),route:x}),v.pathnameBase!=="/"&&(o=As([o,v.pathnameBase]))}return i}function hn(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=k3(e.path,e.caseSensitive,e.end);return _3(e,t,n,r)}function _3(e,t,n,r){let s=t.match(n);if(!s)return null;let o=s[0],i=o.replace(/(.)\/+$/,"$1"),c=s.slice(1);return{params:r.reduce((f,{paramName:m,isOptional:p},v)=>{if(m==="*"){let j=c[v]||"";i=o.slice(0,o.length-j.length).replace(/(.)\/+$/,"$1")}const x=c[v];return p&&!x?f[m]=void 0:f[m]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:i,pattern:e}}function k3(e,t=!1,n=!0){Qa(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,c,u,f,m)=>{if(r.push({paramName:c,isOptional:u!=null}),u){let p=m.charAt(f+i.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function DG(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Qa(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Io(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function LG(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Au(e):e,o;return n?(n=A3(n),n.startsWith("/")?o=IP(n.substring(1),"/"):o=IP(n,t)):o=t,{pathname:o,search:BG(r),hash:qG(s)}}function IP(e,t){let n=jm(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function ab(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function FG(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function IC(e){let t=FG(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Zg(e,t,n,r=!1){let s;typeof e=="string"?s=Au(e):(s={...e},Fn(!s.pathname||!s.pathname.includes("?"),ab("?","pathname","search",s)),Fn(!s.pathname||!s.pathname.includes("#"),ab("#","pathname","hash",s)),Fn(!s.search||!s.search.includes("#"),ab("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,c;if(i==null)c=n;else{let p=t.length-1;if(!r&&i.startsWith("..")){let v=i.split("/");for(;v[0]==="..";)v.shift(),p-=1;s.pathname=v.join("/")}c=p>=0?t[p]:"/"}let u=LG(s,c),f=i&&i!=="/"&&i.endsWith("/"),m=(o||i===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(f||m)&&(u.pathname+="/"),u}var A3=e=>e.replace(/[\\/]{2,}/g,"/"),As=e=>A3(e.join("/")),jm=e=>e.replace(/\/+$/,""),zG=e=>jm(e).replace(/^\/*/,"/"),BG=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,qG=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,UG=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function WG(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function HG(e){let t=e.map(n=>n.route.path).filter(Boolean);return As(t)||"/"}var E3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function P3(e,t){let n=e;if(typeof n!="string"||!MC.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(E3)try{let o=new URL(window.location.href),i=j3.test(n)?new URL(bG(n,o.protocol)):new URL(n),c=Io(i.pathname,t);i.origin===o.origin&&c!=null?n=c+i.search+i.hash:s=!0}catch{Qa(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var R3=["POST","PUT","PATCH","DELETE"];new Set(R3);var VG=["GET",...R3];new Set(VG);var KG=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function GG(e){try{return KG.includes(new URL(e).protocol)}catch{return!1}}var Eu=h.createContext(null);Eu.displayName="DataRouter";var ev=h.createContext(null);ev.displayName="DataRouterState";var T3=h.createContext(!1);function YG(){return h.useContext(T3)}var O3=h.createContext({isTransitioning:!1});O3.displayName="ViewTransition";var XG=h.createContext(new Map);XG.displayName="Fetchers";var QG=h.createContext(null);QG.displayName="Await";var Pa=h.createContext(null);Pa.displayName="Navigation";var rp=h.createContext(null);rp.displayName="Location";var os=h.createContext({outlet:null,matches:[],isDataRoute:!1});os.displayName="Route";var $C=h.createContext(null);$C.displayName="RouteError";var M3="REACT_ROUTER_ERROR",JG="REDIRECT",ZG="ROUTE_ERROR_RESPONSE";function eY(e){if(e.startsWith(`${M3}:${JG}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function tY(e){if(e.startsWith(`${M3}:${ZG}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new UG(t.status,t.statusText,t.data)}catch{}}function nY(e,{relative:t}={}){Fn(Pu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=h.useContext(Pa),{hash:s,pathname:o,search:i}=ap(e,{relative:t}),c=o;return n!=="/"&&(c=o==="/"?n:As([n,o])),r.createHref({pathname:c,search:i,hash:s})}function Pu(){return h.useContext(rp)!=null}function Kr(){return Fn(Pu(),"useLocation() may be used only in the context of a <Router> component."),h.useContext(rp).location}var I3="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function $3(e){h.useContext(Pa).static||h.useLayoutEffect(e)}function is(){let{isDataRoute:e}=h.useContext(os);return e?vY():rY()}function rY(){Fn(Pu(),"useNavigate() may be used only in the context of a <Router> component.");let e=h.useContext(Eu),{basename:t,navigator:n}=h.useContext(Pa),{matches:r}=h.useContext(os),{pathname:s}=Kr(),o=JSON.stringify(IC(r)),i=h.useRef(!1);return $3(()=>{i.current=!0}),h.useCallback((u,f={})=>{if(Qa(i.current,I3),!i.current)return;if(typeof u=="number"){n.go(u);return}let m=Zg(u,JSON.parse(o),s,f.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:As([t,m.pathname])),(f.replace?n.replace:n.push)(m,f.state,f)},[t,n,o,s,e])}var aY=h.createContext(null);function sY(e){let t=h.useContext(os).outlet;return h.useMemo(()=>t&&h.createElement(aY.Provider,{value:e},t),[t,e])}function Bl(){let{matches:e}=h.useContext(os);return e[e.length-1]?.params??{}}function ap(e,{relative:t}={}){let{matches:n}=h.useContext(os),{pathname:r}=Kr(),s=JSON.stringify(IC(n));return h.useMemo(()=>Zg(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function oY(e,t){return D3(e,t)}function D3(e,t,n){Fn(Pu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=h.useContext(Pa),{matches:s}=h.useContext(os),o=s[s.length-1],i=o?o.params:{},c=o?o.pathname:"/",u=o?o.pathnameBase:"/",f=o&&o.route;{let b=f&&f.path||"";F3(c,!f||b.endsWith("*")||b.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${b}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
8
+ `+R.stack}return{value:l,source:d,stack:_,digest:null}}function gy(l,d,g){return{value:l,source:null,stack:g??null,digest:d??null}}function vy(l,d){try{console.error(d.value)}catch(g){setTimeout(function(){throw g})}}var L7=typeof WeakMap=="function"?WeakMap:Map;function JA(l,d,g){g=ho(-1,g),g.tag=3,g.payload={element:null};var w=d.value;return g.callback=function(){hh||(hh=!0,Ty=w),vy(l,d)},g}function ZA(l,d,g){g=ho(-1,g),g.tag=3;var w=l.type.getDerivedStateFromError;if(typeof w=="function"){var _=d.value;g.payload=function(){return w(_)},g.callback=function(){vy(l,d)}}var R=l.stateNode;return R!==null&&typeof R.componentDidCatch=="function"&&(g.callback=function(){vy(l,d),typeof w!="function"&&(oi===null?oi=new Set([this]):oi.add(this));var D=d.stack;this.componentDidCatch(d.value,{componentStack:D!==null?D:""})}),g}function eE(l,d,g){var w=l.pingCache;if(w===null){w=l.pingCache=new L7;var _=new Set;w.set(d,_)}else _=w.get(d),_===void 0&&(_=new Set,w.set(d,_));_.has(g)||(_.add(g),l=J7.bind(null,l,d,g),d.then(l,l))}function tE(l){do{var d;if((d=l.tag===13)&&(d=l.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return l;l=l.return}while(l!==null);return null}function nE(l,d,g,w,_){return(l.mode&1)===0?(l===d?l.flags|=65536:(l.flags|=128,g.flags|=131072,g.flags&=-52805,g.tag===1&&(g.alternate===null?g.tag=17:(d=ho(-1,1),d.tag=2,ai(g,d,1))),g.lanes|=1),l):(l.flags|=65536,l.lanes=_,l)}var F7=k.ReactCurrentOwner,Qr=!1;function $r(l,d,g,w){d.child=l===null?jA(d,null,g,w):uc(d,l.child,g,w)}function rE(l,d,g,w,_){g=g.render;var R=d.ref;return fc(d,_),w=ly(l,d,g,w,R,_),g=cy(),l!==null&&!Qr?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~_,mo(l,d,_)):(Dn&&g&&Hx(d),d.flags|=1,$r(l,d,w,_),d.child)}function aE(l,d,g,w,_){if(l===null){var R=g.type;return typeof R=="function"&&!Fy(R)&&R.defaultProps===void 0&&g.compare===null&&g.defaultProps===void 0?(d.tag=15,d.type=R,sE(l,d,R,w,_)):(l=bh(g.type,null,w,d,d.mode,_),l.ref=d.ref,l.return=d,d.child=l)}if(R=l.child,(l.lanes&_)===0){var D=R.memoizedProps;if(g=g.compare,g=g!==null?g:nd,g(D,w)&&l.ref===d.ref)return mo(l,d,_)}return d.flags|=1,l=ui(R,w),l.ref=d.ref,l.return=d,d.child=l}function sE(l,d,g,w,_){if(l!==null){var R=l.memoizedProps;if(nd(R,w)&&l.ref===d.ref)if(Qr=!1,d.pendingProps=w=R,(l.lanes&_)!==0)(l.flags&131072)!==0&&(Qr=!0);else return d.lanes=l.lanes,mo(l,d,_)}return xy(l,d,g,w,_)}function oE(l,d,g){var w=d.pendingProps,_=w.children,R=l!==null?l.memoizedState:null;if(w.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},Sn(gc,va),va|=g;else{if((g&1073741824)===0)return l=R!==null?R.baseLanes|g:g,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:l,cachePool:null,transitions:null},d.updateQueue=null,Sn(gc,va),va|=l,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=R!==null?R.baseLanes:g,Sn(gc,va),va|=w}else R!==null?(w=R.baseLanes|g,d.memoizedState=null):w=g,Sn(gc,va),va|=w;return $r(l,d,_,g),d.child}function iE(l,d){var g=d.ref;(l===null&&g!==null||l!==null&&l.ref!==g)&&(d.flags|=512,d.flags|=2097152)}function xy(l,d,g,w,_){var R=Xr(g)?qi:Ar.current;return R=oc(d,R),fc(d,_),g=ly(l,d,g,w,R,_),w=cy(),l!==null&&!Qr?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~_,mo(l,d,_)):(Dn&&w&&Hx(d),d.flags|=1,$r(l,d,g,_),d.child)}function lE(l,d,g,w,_){if(Xr(g)){var R=!0;Hp(d)}else R=!1;if(fc(d,_),d.stateNode===null)ch(l,d),XA(d,g,w),my(d,g,w,_),w=!0;else if(l===null){var D=d.stateNode,re=d.memoizedProps;D.props=re;var ce=D.context,Se=g.contextType;typeof Se=="object"&&Se!==null?Se=Ma(Se):(Se=Xr(g)?qi:Ar.current,Se=oc(d,Se));var Be=g.getDerivedStateFromProps,He=typeof Be=="function"||typeof D.getSnapshotBeforeUpdate=="function";He||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(re!==w||ce!==Se)&&QA(d,D,w,Se),ri=!1;var Fe=d.memoizedState;D.state=Fe,eh(d,w,D,_),ce=d.memoizedState,re!==w||Fe!==ce||Yr.current||ri?(typeof Be=="function"&&(hy(d,g,Be,w),ce=d.memoizedState),(re=ri||YA(d,g,re,w,Fe,ce,Se))?(He||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(d.flags|=4194308)):(typeof D.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=w,d.memoizedState=ce),D.props=w,D.state=ce,D.context=Se,w=re):(typeof D.componentDidMount=="function"&&(d.flags|=4194308),w=!1)}else{D=d.stateNode,NA(l,d),re=d.memoizedProps,Se=d.type===d.elementType?re:ps(d.type,re),D.props=Se,He=d.pendingProps,Fe=D.context,ce=g.contextType,typeof ce=="object"&&ce!==null?ce=Ma(ce):(ce=Xr(g)?qi:Ar.current,ce=oc(d,ce));var dt=g.getDerivedStateFromProps;(Be=typeof dt=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(re!==He||Fe!==ce)&&QA(d,D,w,ce),ri=!1,Fe=d.memoizedState,D.state=Fe,eh(d,w,D,_);var xt=d.memoizedState;re!==He||Fe!==xt||Yr.current||ri?(typeof dt=="function"&&(hy(d,g,dt,w),xt=d.memoizedState),(Se=ri||YA(d,g,Se,w,Fe,xt,ce)||!1)?(Be||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(w,xt,ce),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(w,xt,ce)),typeof D.componentDidUpdate=="function"&&(d.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof D.componentDidUpdate!="function"||re===l.memoizedProps&&Fe===l.memoizedState||(d.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||re===l.memoizedProps&&Fe===l.memoizedState||(d.flags|=1024),d.memoizedProps=w,d.memoizedState=xt),D.props=w,D.state=xt,D.context=ce,w=Se):(typeof D.componentDidUpdate!="function"||re===l.memoizedProps&&Fe===l.memoizedState||(d.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||re===l.memoizedProps&&Fe===l.memoizedState||(d.flags|=1024),w=!1)}return yy(l,d,g,w,R,_)}function yy(l,d,g,w,_,R){iE(l,d);var D=(d.flags&128)!==0;if(!w&&!D)return _&&pA(d,g,!1),mo(l,d,R);w=d.stateNode,F7.current=d;var re=D&&typeof g.getDerivedStateFromError!="function"?null:w.render();return d.flags|=1,l!==null&&D?(d.child=uc(d,l.child,null,R),d.child=uc(d,null,re,R)):$r(l,d,re,R),d.memoizedState=w.state,_&&pA(d,g,!0),d.child}function cE(l){var d=l.stateNode;d.pendingContext?dA(l,d.pendingContext,d.pendingContext!==d.context):d.context&&dA(l,d.context,!1),ny(l,d.containerInfo)}function uE(l,d,g,w,_){return cc(),Yx(_),d.flags|=256,$r(l,d,g,w),d.child}var by={dehydrated:null,treeContext:null,retryLane:0};function wy(l){return{baseLanes:l,cachePool:null,transitions:null}}function dE(l,d,g){var w=d.pendingProps,_=Un.current,R=!1,D=(d.flags&128)!==0,re;if((re=D)||(re=l!==null&&l.memoizedState===null?!1:(_&2)!==0),re?(R=!0,d.flags&=-129):(l===null||l.memoizedState!==null)&&(_|=1),Sn(Un,_&1),l===null)return Gx(d),l=d.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((d.mode&1)===0?d.lanes=1:l.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(D=w.children,l=w.fallback,R?(w=d.mode,R=d.child,D={mode:"hidden",children:D},(w&1)===0&&R!==null?(R.childLanes=0,R.pendingProps=D):R=wh(D,w,0,null),l=Ji(l,w,g,null),R.return=d,l.return=d,R.sibling=l,d.child=R,d.child.memoizedState=wy(g),d.memoizedState=by,l):jy(d,D));if(_=l.memoizedState,_!==null&&(re=_.dehydrated,re!==null))return z7(l,d,D,w,re,_,g);if(R){R=w.fallback,D=d.mode,_=l.child,re=_.sibling;var ce={mode:"hidden",children:w.children};return(D&1)===0&&d.child!==_?(w=d.child,w.childLanes=0,w.pendingProps=ce,d.deletions=null):(w=ui(_,ce),w.subtreeFlags=_.subtreeFlags&14680064),re!==null?R=ui(re,R):(R=Ji(R,D,g,null),R.flags|=2),R.return=d,w.return=d,w.sibling=R,d.child=w,w=R,R=d.child,D=l.child.memoizedState,D=D===null?wy(g):{baseLanes:D.baseLanes|g,cachePool:null,transitions:D.transitions},R.memoizedState=D,R.childLanes=l.childLanes&~g,d.memoizedState=by,w}return R=l.child,l=R.sibling,w=ui(R,{mode:"visible",children:w.children}),(d.mode&1)===0&&(w.lanes=g),w.return=d,w.sibling=null,l!==null&&(g=d.deletions,g===null?(d.deletions=[l],d.flags|=16):g.push(l)),d.child=w,d.memoizedState=null,w}function jy(l,d){return d=wh({mode:"visible",children:d},l.mode,0,null),d.return=l,l.child=d}function lh(l,d,g,w){return w!==null&&Yx(w),uc(d,l.child,null,g),l=jy(d,d.pendingProps.children),l.flags|=2,d.memoizedState=null,l}function z7(l,d,g,w,_,R,D){if(g)return d.flags&256?(d.flags&=-257,w=gy(Error(n(422))),lh(l,d,D,w)):d.memoizedState!==null?(d.child=l.child,d.flags|=128,null):(R=w.fallback,_=d.mode,w=wh({mode:"visible",children:w.children},_,0,null),R=Ji(R,_,D,null),R.flags|=2,w.return=d,R.return=d,w.sibling=R,d.child=w,(d.mode&1)!==0&&uc(d,l.child,null,D),d.child.memoizedState=wy(D),d.memoizedState=by,R);if((d.mode&1)===0)return lh(l,d,D,null);if(_.data==="$!"){if(w=_.nextSibling&&_.nextSibling.dataset,w)var re=w.dgst;return w=re,R=Error(n(419)),w=gy(R,w,void 0),lh(l,d,D,w)}if(re=(D&l.childLanes)!==0,Qr||re){if(w=gr,w!==null){switch(D&-D){case 4:_=2;break;case 16:_=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:_=32;break;case 536870912:_=268435456;break;default:_=0}_=(_&(w.suspendedLanes|D))!==0?0:_,_!==0&&_!==R.retryLane&&(R.retryLane=_,po(l,_),gs(w,l,_,-1))}return Ly(),w=gy(Error(n(421))),lh(l,d,D,w)}return _.data==="$?"?(d.flags|=128,d.child=l.child,d=Z7.bind(null,l),_._reactRetry=d,null):(l=R.treeContext,ga=Zo(_.nextSibling),ma=d,Dn=!0,fs=null,l!==null&&(Ta[Oa++]=uo,Ta[Oa++]=fo,Ta[Oa++]=Ui,uo=l.id,fo=l.overflow,Ui=d),d=jy(d,w.children),d.flags|=4096,d)}function fE(l,d,g){l.lanes|=d;var w=l.alternate;w!==null&&(w.lanes|=d),Zx(l.return,d,g)}function Sy(l,d,g,w,_){var R=l.memoizedState;R===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:w,tail:g,tailMode:_}:(R.isBackwards=d,R.rendering=null,R.renderingStartTime=0,R.last=w,R.tail=g,R.tailMode=_)}function pE(l,d,g){var w=d.pendingProps,_=w.revealOrder,R=w.tail;if($r(l,d,w.children,g),w=Un.current,(w&2)!==0)w=w&1|2,d.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&fE(l,g,d);else if(l.tag===19)fE(l,g,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}w&=1}if(Sn(Un,w),(d.mode&1)===0)d.memoizedState=null;else switch(_){case"forwards":for(g=d.child,_=null;g!==null;)l=g.alternate,l!==null&&th(l)===null&&(_=g),g=g.sibling;g=_,g===null?(_=d.child,d.child=null):(_=g.sibling,g.sibling=null),Sy(d,!1,_,g,R);break;case"backwards":for(g=null,_=d.child,d.child=null;_!==null;){if(l=_.alternate,l!==null&&th(l)===null){d.child=_;break}l=_.sibling,_.sibling=g,g=_,_=l}Sy(d,!0,g,null,R);break;case"together":Sy(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function ch(l,d){(d.mode&1)===0&&l!==null&&(l.alternate=null,d.alternate=null,d.flags|=2)}function mo(l,d,g){if(l!==null&&(d.dependencies=l.dependencies),Gi|=d.lanes,(g&d.childLanes)===0)return null;if(l!==null&&d.child!==l.child)throw Error(n(153));if(d.child!==null){for(l=d.child,g=ui(l,l.pendingProps),d.child=g,g.return=d;l.sibling!==null;)l=l.sibling,g=g.sibling=ui(l,l.pendingProps),g.return=d;g.sibling=null}return d.child}function B7(l,d,g){switch(d.tag){case 3:cE(d),cc();break;case 5:kA(d);break;case 1:Xr(d.type)&&Hp(d);break;case 4:ny(d,d.stateNode.containerInfo);break;case 10:var w=d.type._context,_=d.memoizedProps.value;Sn(Qp,w._currentValue),w._currentValue=_;break;case 13:if(w=d.memoizedState,w!==null)return w.dehydrated!==null?(Sn(Un,Un.current&1),d.flags|=128,null):(g&d.child.childLanes)!==0?dE(l,d,g):(Sn(Un,Un.current&1),l=mo(l,d,g),l!==null?l.sibling:null);Sn(Un,Un.current&1);break;case 19:if(w=(g&d.childLanes)!==0,(l.flags&128)!==0){if(w)return pE(l,d,g);d.flags|=128}if(_=d.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),Sn(Un,Un.current),w)break;return null;case 22:case 23:return d.lanes=0,oE(l,d,g)}return mo(l,d,g)}var hE,Ny,mE,gE;hE=function(l,d){for(var g=d.child;g!==null;){if(g.tag===5||g.tag===6)l.appendChild(g.stateNode);else if(g.tag!==4&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===d)break;for(;g.sibling===null;){if(g.return===null||g.return===d)return;g=g.return}g.sibling.return=g.return,g=g.sibling}},Ny=function(){},mE=function(l,d,g,w){var _=l.memoizedProps;if(_!==w){l=d.stateNode,Vi(Fs.current);var R=null;switch(g){case"input":_=we(l,_),w=we(l,w),R=[];break;case"select":_=Q({},_,{value:void 0}),w=Q({},w,{value:void 0}),R=[];break;case"textarea":_=Ze(l,_),w=Ze(l,w),R=[];break;default:typeof _.onClick!="function"&&typeof w.onClick=="function"&&(l.onclick=qp)}kt(g,w);var D;g=null;for(Se in _)if(!w.hasOwnProperty(Se)&&_.hasOwnProperty(Se)&&_[Se]!=null)if(Se==="style"){var re=_[Se];for(D in re)re.hasOwnProperty(D)&&(g||(g={}),g[D]="")}else Se!=="dangerouslySetInnerHTML"&&Se!=="children"&&Se!=="suppressContentEditableWarning"&&Se!=="suppressHydrationWarning"&&Se!=="autoFocus"&&(s.hasOwnProperty(Se)?R||(R=[]):(R=R||[]).push(Se,null));for(Se in w){var ce=w[Se];if(re=_?.[Se],w.hasOwnProperty(Se)&&ce!==re&&(ce!=null||re!=null))if(Se==="style")if(re){for(D in re)!re.hasOwnProperty(D)||ce&&ce.hasOwnProperty(D)||(g||(g={}),g[D]="");for(D in ce)ce.hasOwnProperty(D)&&re[D]!==ce[D]&&(g||(g={}),g[D]=ce[D])}else g||(R||(R=[]),R.push(Se,g)),g=ce;else Se==="dangerouslySetInnerHTML"?(ce=ce?ce.__html:void 0,re=re?re.__html:void 0,ce!=null&&re!==ce&&(R=R||[]).push(Se,ce)):Se==="children"?typeof ce!="string"&&typeof ce!="number"||(R=R||[]).push(Se,""+ce):Se!=="suppressContentEditableWarning"&&Se!=="suppressHydrationWarning"&&(s.hasOwnProperty(Se)?(ce!=null&&Se==="onScroll"&&Pn("scroll",l),R||re===ce||(R=[])):(R=R||[]).push(Se,ce))}g&&(R=R||[]).push("style",g);var Se=R;(d.updateQueue=Se)&&(d.flags|=4)}},gE=function(l,d,g,w){g!==w&&(d.flags|=4)};function vd(l,d){if(!Dn)switch(l.tailMode){case"hidden":d=l.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?l.tail=null:g.sibling=null;break;case"collapsed":g=l.tail;for(var w=null;g!==null;)g.alternate!==null&&(w=g),g=g.sibling;w===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:w.sibling=null}}function Pr(l){var d=l.alternate!==null&&l.alternate.child===l.child,g=0,w=0;if(d)for(var _=l.child;_!==null;)g|=_.lanes|_.childLanes,w|=_.subtreeFlags&14680064,w|=_.flags&14680064,_.return=l,_=_.sibling;else for(_=l.child;_!==null;)g|=_.lanes|_.childLanes,w|=_.subtreeFlags,w|=_.flags,_.return=l,_=_.sibling;return l.subtreeFlags|=w,l.childLanes=g,d}function q7(l,d,g){var w=d.pendingProps;switch(Vx(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pr(d),null;case 1:return Xr(d.type)&&Wp(),Pr(d),null;case 3:return w=d.stateNode,pc(),Rn(Yr),Rn(Ar),sy(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(l===null||l.child===null)&&(Yp(d)?d.flags|=4:l===null||l.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,fs!==null&&(Iy(fs),fs=null))),Ny(l,d),Pr(d),null;case 5:ry(d);var _=Vi(fd.current);if(g=d.type,l!==null&&d.stateNode!=null)mE(l,d,g,w,_),l.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!w){if(d.stateNode===null)throw Error(n(166));return Pr(d),null}if(l=Vi(Fs.current),Yp(d)){w=d.stateNode,g=d.type;var R=d.memoizedProps;switch(w[Ls]=d,w[id]=R,l=(d.mode&1)!==0,g){case"dialog":Pn("cancel",w),Pn("close",w);break;case"iframe":case"object":case"embed":Pn("load",w);break;case"video":case"audio":for(_=0;_<ad.length;_++)Pn(ad[_],w);break;case"source":Pn("error",w);break;case"img":case"image":case"link":Pn("error",w),Pn("load",w);break;case"details":Pn("toggle",w);break;case"input":at(w,R),Pn("invalid",w);break;case"select":w._wrapperState={wasMultiple:!!R.multiple},Pn("invalid",w);break;case"textarea":ht(w,R),Pn("invalid",w)}kt(g,R),_=null;for(var D in R)if(R.hasOwnProperty(D)){var re=R[D];D==="children"?typeof re=="string"?w.textContent!==re&&(R.suppressHydrationWarning!==!0&&Bp(w.textContent,re,l),_=["children",re]):typeof re=="number"&&w.textContent!==""+re&&(R.suppressHydrationWarning!==!0&&Bp(w.textContent,re,l),_=["children",""+re]):s.hasOwnProperty(D)&&re!=null&&D==="onScroll"&&Pn("scroll",w)}switch(g){case"input":De(w),At(w,R,!0);break;case"textarea":De(w),zt(w);break;case"select":case"option":break;default:typeof R.onClick=="function"&&(w.onclick=qp)}w=_,d.updateQueue=w,w!==null&&(d.flags|=4)}else{D=_.nodeType===9?_:_.ownerDocument,l==="http://www.w3.org/1999/xhtml"&&(l=jt(g)),l==="http://www.w3.org/1999/xhtml"?g==="script"?(l=D.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild)):typeof w.is=="string"?l=D.createElement(g,{is:w.is}):(l=D.createElement(g),g==="select"&&(D=l,w.multiple?D.multiple=!0:w.size&&(D.size=w.size))):l=D.createElementNS(l,g),l[Ls]=d,l[id]=w,hE(l,d,!1,!1),d.stateNode=l;e:{switch(D=vt(g,w),g){case"dialog":Pn("cancel",l),Pn("close",l),_=w;break;case"iframe":case"object":case"embed":Pn("load",l),_=w;break;case"video":case"audio":for(_=0;_<ad.length;_++)Pn(ad[_],l);_=w;break;case"source":Pn("error",l),_=w;break;case"img":case"image":case"link":Pn("error",l),Pn("load",l),_=w;break;case"details":Pn("toggle",l),_=w;break;case"input":at(l,w),_=we(l,w),Pn("invalid",l);break;case"option":_=w;break;case"select":l._wrapperState={wasMultiple:!!w.multiple},_=Q({},w,{value:void 0}),Pn("invalid",l);break;case"textarea":ht(l,w),_=Ze(l,w),Pn("invalid",l);break;default:_=w}kt(g,_),re=_;for(R in re)if(re.hasOwnProperty(R)){var ce=re[R];R==="style"?ze(l,ce):R==="dangerouslySetInnerHTML"?(ce=ce?ce.__html:void 0,ce!=null&&qt(l,ce)):R==="children"?typeof ce=="string"?(g!=="textarea"||ce!=="")&&Zt(l,ce):typeof ce=="number"&&Zt(l,""+ce):R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&R!=="autoFocus"&&(s.hasOwnProperty(R)?ce!=null&&R==="onScroll"&&Pn("scroll",l):ce!=null&&C(l,R,ce,D))}switch(g){case"input":De(l),At(l,w,!1);break;case"textarea":De(l),zt(l);break;case"option":w.value!=null&&l.setAttribute("value",""+xe(w.value));break;case"select":l.multiple=!!w.multiple,R=w.value,R!=null?Re(l,!!w.multiple,R,!1):w.defaultValue!=null&&Re(l,!!w.multiple,w.defaultValue,!0);break;default:typeof _.onClick=="function"&&(l.onclick=qp)}switch(g){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}}w&&(d.flags|=4)}d.ref!==null&&(d.flags|=512,d.flags|=2097152)}return Pr(d),null;case 6:if(l&&d.stateNode!=null)gE(l,d,l.memoizedProps,w);else{if(typeof w!="string"&&d.stateNode===null)throw Error(n(166));if(g=Vi(fd.current),Vi(Fs.current),Yp(d)){if(w=d.stateNode,g=d.memoizedProps,w[Ls]=d,(R=w.nodeValue!==g)&&(l=ma,l!==null))switch(l.tag){case 3:Bp(w.nodeValue,g,(l.mode&1)!==0);break;case 5:l.memoizedProps.suppressHydrationWarning!==!0&&Bp(w.nodeValue,g,(l.mode&1)!==0)}R&&(d.flags|=4)}else w=(g.nodeType===9?g:g.ownerDocument).createTextNode(w),w[Ls]=d,d.stateNode=w}return Pr(d),null;case 13:if(Rn(Un),w=d.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(Dn&&ga!==null&&(d.mode&1)!==0&&(d.flags&128)===0)yA(),cc(),d.flags|=98560,R=!1;else if(R=Yp(d),w!==null&&w.dehydrated!==null){if(l===null){if(!R)throw Error(n(318));if(R=d.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(n(317));R[Ls]=d}else cc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Pr(d),R=!1}else fs!==null&&(Iy(fs),fs=null),R=!0;if(!R)return d.flags&65536?d:null}return(d.flags&128)!==0?(d.lanes=g,d):(w=w!==null,w!==(l!==null&&l.memoizedState!==null)&&w&&(d.child.flags|=8192,(d.mode&1)!==0&&(l===null||(Un.current&1)!==0?ir===0&&(ir=3):Ly())),d.updateQueue!==null&&(d.flags|=4),Pr(d),null);case 4:return pc(),Ny(l,d),l===null&&sd(d.stateNode.containerInfo),Pr(d),null;case 10:return Jx(d.type._context),Pr(d),null;case 17:return Xr(d.type)&&Wp(),Pr(d),null;case 19:if(Rn(Un),R=d.memoizedState,R===null)return Pr(d),null;if(w=(d.flags&128)!==0,D=R.rendering,D===null)if(w)vd(R,!1);else{if(ir!==0||l!==null&&(l.flags&128)!==0)for(l=d.child;l!==null;){if(D=th(l),D!==null){for(d.flags|=128,vd(R,!1),w=D.updateQueue,w!==null&&(d.updateQueue=w,d.flags|=4),d.subtreeFlags=0,w=g,g=d.child;g!==null;)R=g,l=w,R.flags&=14680066,D=R.alternate,D===null?(R.childLanes=0,R.lanes=l,R.child=null,R.subtreeFlags=0,R.memoizedProps=null,R.memoizedState=null,R.updateQueue=null,R.dependencies=null,R.stateNode=null):(R.childLanes=D.childLanes,R.lanes=D.lanes,R.child=D.child,R.subtreeFlags=0,R.deletions=null,R.memoizedProps=D.memoizedProps,R.memoizedState=D.memoizedState,R.updateQueue=D.updateQueue,R.type=D.type,l=D.dependencies,R.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),g=g.sibling;return Sn(Un,Un.current&1|2),d.child}l=l.sibling}R.tail!==null&&En()>vc&&(d.flags|=128,w=!0,vd(R,!1),d.lanes=4194304)}else{if(!w)if(l=th(D),l!==null){if(d.flags|=128,w=!0,g=l.updateQueue,g!==null&&(d.updateQueue=g,d.flags|=4),vd(R,!0),R.tail===null&&R.tailMode==="hidden"&&!D.alternate&&!Dn)return Pr(d),null}else 2*En()-R.renderingStartTime>vc&&g!==1073741824&&(d.flags|=128,w=!0,vd(R,!1),d.lanes=4194304);R.isBackwards?(D.sibling=d.child,d.child=D):(g=R.last,g!==null?g.sibling=D:d.child=D,R.last=D)}return R.tail!==null?(d=R.tail,R.rendering=d,R.tail=d.sibling,R.renderingStartTime=En(),d.sibling=null,g=Un.current,Sn(Un,w?g&1|2:g&1),d):(Pr(d),null);case 22:case 23:return Dy(),w=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==w&&(d.flags|=8192),w&&(d.mode&1)!==0?(va&1073741824)!==0&&(Pr(d),d.subtreeFlags&6&&(d.flags|=8192)):Pr(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function U7(l,d){switch(Vx(d),d.tag){case 1:return Xr(d.type)&&Wp(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return pc(),Rn(Yr),Rn(Ar),sy(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return ry(d),null;case 13:if(Rn(Un),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));cc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Rn(Un),null;case 4:return pc(),null;case 10:return Jx(d.type._context),null;case 22:case 23:return Dy(),null;case 24:return null;default:return null}}var uh=!1,Rr=!1,W7=typeof WeakSet=="function"?WeakSet:Set,mt=null;function mc(l,d){var g=l.ref;if(g!==null)if(typeof g=="function")try{g(null)}catch(w){Kn(l,d,w)}else g.current=null}function Cy(l,d,g){try{g()}catch(w){Kn(l,d,w)}}var vE=!1;function H7(l,d){if(Dx=Pp,l=Yk(),Ex(l)){if("selectionStart"in l)var g={start:l.selectionStart,end:l.selectionEnd};else e:{g=(g=l.ownerDocument)&&g.defaultView||window;var w=g.getSelection&&g.getSelection();if(w&&w.rangeCount!==0){g=w.anchorNode;var _=w.anchorOffset,R=w.focusNode;w=w.focusOffset;try{g.nodeType,R.nodeType}catch{g=null;break e}var D=0,re=-1,ce=-1,Se=0,Be=0,He=l,Fe=null;t:for(;;){for(var dt;He!==g||_!==0&&He.nodeType!==3||(re=D+_),He!==R||w!==0&&He.nodeType!==3||(ce=D+w),He.nodeType===3&&(D+=He.nodeValue.length),(dt=He.firstChild)!==null;)Fe=He,He=dt;for(;;){if(He===l)break t;if(Fe===g&&++Se===_&&(re=D),Fe===R&&++Be===w&&(ce=D),(dt=He.nextSibling)!==null)break;He=Fe,Fe=He.parentNode}He=dt}g=re===-1||ce===-1?null:{start:re,end:ce}}else g=null}g=g||{start:0,end:0}}else g=null;for(Lx={focusedElem:l,selectionRange:g},Pp=!1,mt=d;mt!==null;)if(d=mt,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,mt=l;else for(;mt!==null;){d=mt;try{var xt=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(xt!==null){var yt=xt.memoizedProps,Qn=xt.memoizedState,be=d.stateNode,he=be.getSnapshotBeforeUpdate(d.elementType===d.type?yt:ps(d.type,yt),Qn);be.__reactInternalSnapshotBeforeUpdate=he}break;case 3:var je=d.stateNode.containerInfo;je.nodeType===1?je.textContent="":je.nodeType===9&&je.documentElement&&je.removeChild(je.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ye){Kn(d,d.return,Ye)}if(l=d.sibling,l!==null){l.return=d.return,mt=l;break}mt=d.return}return xt=vE,vE=!1,xt}function xd(l,d,g){var w=d.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var _=w=w.next;do{if((_.tag&l)===l){var R=_.destroy;_.destroy=void 0,R!==void 0&&Cy(d,g,R)}_=_.next}while(_!==w)}}function dh(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var g=d=d.next;do{if((g.tag&l)===l){var w=g.create;g.destroy=w()}g=g.next}while(g!==d)}}function _y(l){var d=l.ref;if(d!==null){var g=l.stateNode;l.tag,l=g,typeof d=="function"?d(l):d.current=l}}function xE(l){var d=l.alternate;d!==null&&(l.alternate=null,xE(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Ls],delete d[id],delete d[qx],delete d[k7],delete d[A7])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function yE(l){return l.tag===5||l.tag===3||l.tag===4}function bE(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||yE(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function ky(l,d,g){var w=l.tag;if(w===5||w===6)l=l.stateNode,d?g.nodeType===8?g.parentNode.insertBefore(l,d):g.insertBefore(l,d):(g.nodeType===8?(d=g.parentNode,d.insertBefore(l,g)):(d=g,d.appendChild(l)),g=g._reactRootContainer,g!=null||d.onclick!==null||(d.onclick=qp));else if(w!==4&&(l=l.child,l!==null))for(ky(l,d,g),l=l.sibling;l!==null;)ky(l,d,g),l=l.sibling}function Ay(l,d,g){var w=l.tag;if(w===5||w===6)l=l.stateNode,d?g.insertBefore(l,d):g.appendChild(l);else if(w!==4&&(l=l.child,l!==null))for(Ay(l,d,g),l=l.sibling;l!==null;)Ay(l,d,g),l=l.sibling}var Sr=null,hs=!1;function si(l,d,g){for(g=g.child;g!==null;)wE(l,d,g),g=g.sibling}function wE(l,d,g){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Lt,g)}catch{}switch(g.tag){case 5:Rr||mc(g,d);case 6:var w=Sr,_=hs;Sr=null,si(l,d,g),Sr=w,hs=_,Sr!==null&&(hs?(l=Sr,g=g.stateNode,l.nodeType===8?l.parentNode.removeChild(g):l.removeChild(g)):Sr.removeChild(g.stateNode));break;case 18:Sr!==null&&(hs?(l=Sr,g=g.stateNode,l.nodeType===8?Bx(l.parentNode,g):l.nodeType===1&&Bx(l,g),Xu(l)):Bx(Sr,g.stateNode));break;case 4:w=Sr,_=hs,Sr=g.stateNode.containerInfo,hs=!0,si(l,d,g),Sr=w,hs=_;break;case 0:case 11:case 14:case 15:if(!Rr&&(w=g.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){_=w=w.next;do{var R=_,D=R.destroy;R=R.tag,D!==void 0&&((R&2)!==0||(R&4)!==0)&&Cy(g,d,D),_=_.next}while(_!==w)}si(l,d,g);break;case 1:if(!Rr&&(mc(g,d),w=g.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=g.memoizedProps,w.state=g.memoizedState,w.componentWillUnmount()}catch(re){Kn(g,d,re)}si(l,d,g);break;case 21:si(l,d,g);break;case 22:g.mode&1?(Rr=(w=Rr)||g.memoizedState!==null,si(l,d,g),Rr=w):si(l,d,g);break;default:si(l,d,g)}}function jE(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var g=l.stateNode;g===null&&(g=l.stateNode=new W7),d.forEach(function(w){var _=e9.bind(null,l,w);g.has(w)||(g.add(w),w.then(_,_))})}}function ms(l,d){var g=d.deletions;if(g!==null)for(var w=0;w<g.length;w++){var _=g[w];try{var R=l,D=d,re=D;e:for(;re!==null;){switch(re.tag){case 5:Sr=re.stateNode,hs=!1;break e;case 3:Sr=re.stateNode.containerInfo,hs=!0;break e;case 4:Sr=re.stateNode.containerInfo,hs=!0;break e}re=re.return}if(Sr===null)throw Error(n(160));wE(R,D,_),Sr=null,hs=!1;var ce=_.alternate;ce!==null&&(ce.return=null),_.return=null}catch(Se){Kn(_,d,Se)}}if(d.subtreeFlags&12854)for(d=d.child;d!==null;)SE(d,l),d=d.sibling}function SE(l,d){var g=l.alternate,w=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:if(ms(d,l),Bs(l),w&4){try{xd(3,l,l.return),dh(3,l)}catch(yt){Kn(l,l.return,yt)}try{xd(5,l,l.return)}catch(yt){Kn(l,l.return,yt)}}break;case 1:ms(d,l),Bs(l),w&512&&g!==null&&mc(g,g.return);break;case 5:if(ms(d,l),Bs(l),w&512&&g!==null&&mc(g,g.return),l.flags&32){var _=l.stateNode;try{Zt(_,"")}catch(yt){Kn(l,l.return,yt)}}if(w&4&&(_=l.stateNode,_!=null)){var R=l.memoizedProps,D=g!==null?g.memoizedProps:R,re=l.type,ce=l.updateQueue;if(l.updateQueue=null,ce!==null)try{re==="input"&&R.type==="radio"&&R.name!=null&&tt(_,R),vt(re,D);var Se=vt(re,R);for(D=0;D<ce.length;D+=2){var Be=ce[D],He=ce[D+1];Be==="style"?ze(_,He):Be==="dangerouslySetInnerHTML"?qt(_,He):Be==="children"?Zt(_,He):C(_,Be,He,Se)}switch(re){case"input":it(_,R);break;case"textarea":Ft(_,R);break;case"select":var Fe=_._wrapperState.wasMultiple;_._wrapperState.wasMultiple=!!R.multiple;var dt=R.value;dt!=null?Re(_,!!R.multiple,dt,!1):Fe!==!!R.multiple&&(R.defaultValue!=null?Re(_,!!R.multiple,R.defaultValue,!0):Re(_,!!R.multiple,R.multiple?[]:"",!1))}_[id]=R}catch(yt){Kn(l,l.return,yt)}}break;case 6:if(ms(d,l),Bs(l),w&4){if(l.stateNode===null)throw Error(n(162));_=l.stateNode,R=l.memoizedProps;try{_.nodeValue=R}catch(yt){Kn(l,l.return,yt)}}break;case 3:if(ms(d,l),Bs(l),w&4&&g!==null&&g.memoizedState.isDehydrated)try{Xu(d.containerInfo)}catch(yt){Kn(l,l.return,yt)}break;case 4:ms(d,l),Bs(l);break;case 13:ms(d,l),Bs(l),_=l.child,_.flags&8192&&(R=_.memoizedState!==null,_.stateNode.isHidden=R,!R||_.alternate!==null&&_.alternate.memoizedState!==null||(Ry=En())),w&4&&jE(l);break;case 22:if(Be=g!==null&&g.memoizedState!==null,l.mode&1?(Rr=(Se=Rr)||Be,ms(d,l),Rr=Se):ms(d,l),Bs(l),w&8192){if(Se=l.memoizedState!==null,(l.stateNode.isHidden=Se)&&!Be&&(l.mode&1)!==0)for(mt=l,Be=l.child;Be!==null;){for(He=mt=Be;mt!==null;){switch(Fe=mt,dt=Fe.child,Fe.tag){case 0:case 11:case 14:case 15:xd(4,Fe,Fe.return);break;case 1:mc(Fe,Fe.return);var xt=Fe.stateNode;if(typeof xt.componentWillUnmount=="function"){w=Fe,g=Fe.return;try{d=w,xt.props=d.memoizedProps,xt.state=d.memoizedState,xt.componentWillUnmount()}catch(yt){Kn(w,g,yt)}}break;case 5:mc(Fe,Fe.return);break;case 22:if(Fe.memoizedState!==null){_E(He);continue}}dt!==null?(dt.return=Fe,mt=dt):_E(He)}Be=Be.sibling}e:for(Be=null,He=l;;){if(He.tag===5){if(Be===null){Be=He;try{_=He.stateNode,Se?(R=_.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none"):(re=He.stateNode,ce=He.memoizedProps.style,D=ce!=null&&ce.hasOwnProperty("display")?ce.display:null,re.style.display=_e("display",D))}catch(yt){Kn(l,l.return,yt)}}}else if(He.tag===6){if(Be===null)try{He.stateNode.nodeValue=Se?"":He.memoizedProps}catch(yt){Kn(l,l.return,yt)}}else if((He.tag!==22&&He.tag!==23||He.memoizedState===null||He===l)&&He.child!==null){He.child.return=He,He=He.child;continue}if(He===l)break e;for(;He.sibling===null;){if(He.return===null||He.return===l)break e;Be===He&&(Be=null),He=He.return}Be===He&&(Be=null),He.sibling.return=He.return,He=He.sibling}}break;case 19:ms(d,l),Bs(l),w&4&&jE(l);break;case 21:break;default:ms(d,l),Bs(l)}}function Bs(l){var d=l.flags;if(d&2){try{e:{for(var g=l.return;g!==null;){if(yE(g)){var w=g;break e}g=g.return}throw Error(n(160))}switch(w.tag){case 5:var _=w.stateNode;w.flags&32&&(Zt(_,""),w.flags&=-33);var R=bE(l);Ay(l,R,_);break;case 3:case 4:var D=w.stateNode.containerInfo,re=bE(l);ky(l,re,D);break;default:throw Error(n(161))}}catch(ce){Kn(l,l.return,ce)}l.flags&=-3}d&4096&&(l.flags&=-4097)}function V7(l,d,g){mt=l,NE(l)}function NE(l,d,g){for(var w=(l.mode&1)!==0;mt!==null;){var _=mt,R=_.child;if(_.tag===22&&w){var D=_.memoizedState!==null||uh;if(!D){var re=_.alternate,ce=re!==null&&re.memoizedState!==null||Rr;re=uh;var Se=Rr;if(uh=D,(Rr=ce)&&!Se)for(mt=_;mt!==null;)D=mt,ce=D.child,D.tag===22&&D.memoizedState!==null?kE(_):ce!==null?(ce.return=D,mt=ce):kE(_);for(;R!==null;)mt=R,NE(R),R=R.sibling;mt=_,uh=re,Rr=Se}CE(l)}else(_.subtreeFlags&8772)!==0&&R!==null?(R.return=_,mt=R):CE(l)}}function CE(l){for(;mt!==null;){var d=mt;if((d.flags&8772)!==0){var g=d.alternate;try{if((d.flags&8772)!==0)switch(d.tag){case 0:case 11:case 15:Rr||dh(5,d);break;case 1:var w=d.stateNode;if(d.flags&4&&!Rr)if(g===null)w.componentDidMount();else{var _=d.elementType===d.type?g.memoizedProps:ps(d.type,g.memoizedProps);w.componentDidUpdate(_,g.memoizedState,w.__reactInternalSnapshotBeforeUpdate)}var R=d.updateQueue;R!==null&&_A(d,R,w);break;case 3:var D=d.updateQueue;if(D!==null){if(g=null,d.child!==null)switch(d.child.tag){case 5:g=d.child.stateNode;break;case 1:g=d.child.stateNode}_A(d,D,g)}break;case 5:var re=d.stateNode;if(g===null&&d.flags&4){g=re;var ce=d.memoizedProps;switch(d.type){case"button":case"input":case"select":case"textarea":ce.autoFocus&&g.focus();break;case"img":ce.src&&(g.src=ce.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(d.memoizedState===null){var Se=d.alternate;if(Se!==null){var Be=Se.memoizedState;if(Be!==null){var He=Be.dehydrated;He!==null&&Xu(He)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Rr||d.flags&512&&_y(d)}catch(Fe){Kn(d,d.return,Fe)}}if(d===l){mt=null;break}if(g=d.sibling,g!==null){g.return=d.return,mt=g;break}mt=d.return}}function _E(l){for(;mt!==null;){var d=mt;if(d===l){mt=null;break}var g=d.sibling;if(g!==null){g.return=d.return,mt=g;break}mt=d.return}}function kE(l){for(;mt!==null;){var d=mt;try{switch(d.tag){case 0:case 11:case 15:var g=d.return;try{dh(4,d)}catch(ce){Kn(d,g,ce)}break;case 1:var w=d.stateNode;if(typeof w.componentDidMount=="function"){var _=d.return;try{w.componentDidMount()}catch(ce){Kn(d,_,ce)}}var R=d.return;try{_y(d)}catch(ce){Kn(d,R,ce)}break;case 5:var D=d.return;try{_y(d)}catch(ce){Kn(d,D,ce)}}}catch(ce){Kn(d,d.return,ce)}if(d===l){mt=null;break}var re=d.sibling;if(re!==null){re.return=d.return,mt=re;break}mt=d.return}}var K7=Math.ceil,fh=k.ReactCurrentDispatcher,Ey=k.ReactCurrentOwner,$a=k.ReactCurrentBatchConfig,on=0,gr=null,er=null,Nr=0,va=0,gc=ei(0),ir=0,yd=null,Gi=0,ph=0,Py=0,bd=null,Jr=null,Ry=0,vc=1/0,go=null,hh=!1,Ty=null,oi=null,mh=!1,ii=null,gh=0,wd=0,Oy=null,vh=-1,xh=0;function Dr(){return(on&6)!==0?En():vh!==-1?vh:vh=En()}function li(l){return(l.mode&1)===0?1:(on&2)!==0&&Nr!==0?Nr&-Nr:P7.transition!==null?(xh===0&&(xh=Ir()),xh):(l=gn,l!==0||(l=window.event,l=l===void 0?16:Ek(l.type)),l)}function gs(l,d,g,w){if(50<wd)throw wd=0,Oy=null,Error(n(185));us(l,g,w),((on&2)===0||l!==gr)&&(l===gr&&((on&2)===0&&(ph|=g),ir===4&&ci(l,Nr)),Zr(l,w),g===1&&on===0&&(d.mode&1)===0&&(vc=En()+500,Vp&&ni()))}function Zr(l,d){var g=l.callbackNode;Zn(l,d);var w=sr(l,l===gr?Nr:0);if(w===0)g!==null&&io(g),l.callbackNode=null,l.callbackPriority=0;else if(d=w&-w,l.callbackPriority!==d){if(g!=null&&io(g),d===1)l.tag===0?E7(EE.bind(null,l)):hA(EE.bind(null,l)),C7(function(){(on&6)===0&&ni()}),g=null;else{switch(wk(w)){case 1:g=Vo;break;case 4:g=ie;break;case 16:g=rt;break;case 536870912:g=Pt;break;default:g=rt}g=DE(g,AE.bind(null,l))}l.callbackPriority=d,l.callbackNode=g}}function AE(l,d){if(vh=-1,xh=0,(on&6)!==0)throw Error(n(327));var g=l.callbackNode;if(xc()&&l.callbackNode!==g)return null;var w=sr(l,l===gr?Nr:0);if(w===0)return null;if((w&30)!==0||(w&l.expiredLanes)!==0||d)d=yh(l,w);else{d=w;var _=on;on|=2;var R=RE();(gr!==l||Nr!==d)&&(go=null,vc=En()+500,Xi(l,d));do try{X7();break}catch(re){PE(l,re)}while(!0);Qx(),fh.current=R,on=_,er!==null?d=0:(gr=null,Nr=0,d=ir)}if(d!==0){if(d===2&&(_=Vn(l),_!==0&&(w=_,d=My(l,_))),d===1)throw g=yd,Xi(l,0),ci(l,w),Zr(l,En()),g;if(d===6)ci(l,w);else{if(_=l.current.alternate,(w&30)===0&&!G7(_)&&(d=yh(l,w),d===2&&(R=Vn(l),R!==0&&(w=R,d=My(l,R))),d===1))throw g=yd,Xi(l,0),ci(l,w),Zr(l,En()),g;switch(l.finishedWork=_,l.finishedLanes=w,d){case 0:case 1:throw Error(n(345));case 2:Qi(l,Jr,go);break;case 3:if(ci(l,w),(w&130023424)===w&&(d=Ry+500-En(),10<d)){if(sr(l,0)!==0)break;if(_=l.suspendedLanes,(_&w)!==w){Dr(),l.pingedLanes|=l.suspendedLanes&_;break}l.timeoutHandle=zx(Qi.bind(null,l,Jr,go),d);break}Qi(l,Jr,go);break;case 4:if(ci(l,w),(w&4194240)===w)break;for(d=l.eventTimes,_=-1;0<w;){var D=31-Ne(w);R=1<<D,D=d[D],D>_&&(_=D),w&=~R}if(w=_,w=En()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*K7(w/1960))-w,10<w){l.timeoutHandle=zx(Qi.bind(null,l,Jr,go),w);break}Qi(l,Jr,go);break;case 5:Qi(l,Jr,go);break;default:throw Error(n(329))}}}return Zr(l,En()),l.callbackNode===g?AE.bind(null,l):null}function My(l,d){var g=bd;return l.current.memoizedState.isDehydrated&&(Xi(l,d).flags|=256),l=yh(l,d),l!==2&&(d=Jr,Jr=g,d!==null&&Iy(d)),l}function Iy(l){Jr===null?Jr=l:Jr.push.apply(Jr,l)}function G7(l){for(var d=l;;){if(d.flags&16384){var g=d.updateQueue;if(g!==null&&(g=g.stores,g!==null))for(var w=0;w<g.length;w++){var _=g[w],R=_.getSnapshot;_=_.value;try{if(!ds(R(),_))return!1}catch{return!1}}}if(g=d.child,d.subtreeFlags&16384&&g!==null)g.return=d,d=g;else{if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function ci(l,d){for(d&=~Py,d&=~ph,l.suspendedLanes|=d,l.pingedLanes&=~d,l=l.expirationTimes;0<d;){var g=31-Ne(d),w=1<<g;l[g]=-1,d&=~w}}function EE(l){if((on&6)!==0)throw Error(n(327));xc();var d=sr(l,0);if((d&1)===0)return Zr(l,En()),null;var g=yh(l,d);if(l.tag!==0&&g===2){var w=Vn(l);w!==0&&(d=w,g=My(l,w))}if(g===1)throw g=yd,Xi(l,0),ci(l,d),Zr(l,En()),g;if(g===6)throw Error(n(345));return l.finishedWork=l.current.alternate,l.finishedLanes=d,Qi(l,Jr,go),Zr(l,En()),null}function $y(l,d){var g=on;on|=1;try{return l(d)}finally{on=g,on===0&&(vc=En()+500,Vp&&ni())}}function Yi(l){ii!==null&&ii.tag===0&&(on&6)===0&&xc();var d=on;on|=1;var g=$a.transition,w=gn;try{if($a.transition=null,gn=1,l)return l()}finally{gn=w,$a.transition=g,on=d,(on&6)===0&&ni()}}function Dy(){va=gc.current,Rn(gc)}function Xi(l,d){l.finishedWork=null,l.finishedLanes=0;var g=l.timeoutHandle;if(g!==-1&&(l.timeoutHandle=-1,N7(g)),er!==null)for(g=er.return;g!==null;){var w=g;switch(Vx(w),w.tag){case 1:w=w.type.childContextTypes,w!=null&&Wp();break;case 3:pc(),Rn(Yr),Rn(Ar),sy();break;case 5:ry(w);break;case 4:pc();break;case 13:Rn(Un);break;case 19:Rn(Un);break;case 10:Jx(w.type._context);break;case 22:case 23:Dy()}g=g.return}if(gr=l,er=l=ui(l.current,null),Nr=va=d,ir=0,yd=null,Py=ph=Gi=0,Jr=bd=null,Hi!==null){for(d=0;d<Hi.length;d++)if(g=Hi[d],w=g.interleaved,w!==null){g.interleaved=null;var _=w.next,R=g.pending;if(R!==null){var D=R.next;R.next=_,w.next=D}g.pending=w}Hi=null}return l}function PE(l,d){do{var g=er;try{if(Qx(),nh.current=oh,rh){for(var w=Wn.memoizedState;w!==null;){var _=w.queue;_!==null&&(_.pending=null),w=w.next}rh=!1}if(Ki=0,mr=or=Wn=null,pd=!1,hd=0,Ey.current=null,g===null||g.return===null){ir=1,yd=d,er=null;break}e:{var R=l,D=g.return,re=g,ce=d;if(d=Nr,re.flags|=32768,ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var Se=ce,Be=re,He=Be.tag;if((Be.mode&1)===0&&(He===0||He===11||He===15)){var Fe=Be.alternate;Fe?(Be.updateQueue=Fe.updateQueue,Be.memoizedState=Fe.memoizedState,Be.lanes=Fe.lanes):(Be.updateQueue=null,Be.memoizedState=null)}var dt=tE(D);if(dt!==null){dt.flags&=-257,nE(dt,D,re,R,d),dt.mode&1&&eE(R,Se,d),d=dt,ce=Se;var xt=d.updateQueue;if(xt===null){var yt=new Set;yt.add(ce),d.updateQueue=yt}else xt.add(ce);break e}else{if((d&1)===0){eE(R,Se,d),Ly();break e}ce=Error(n(426))}}else if(Dn&&re.mode&1){var Qn=tE(D);if(Qn!==null){(Qn.flags&65536)===0&&(Qn.flags|=256),nE(Qn,D,re,R,d),Yx(hc(ce,re));break e}}R=ce=hc(ce,re),ir!==4&&(ir=2),bd===null?bd=[R]:bd.push(R),R=D;do{switch(R.tag){case 3:R.flags|=65536,d&=-d,R.lanes|=d;var be=JA(R,ce,d);CA(R,be);break e;case 1:re=ce;var he=R.type,je=R.stateNode;if((R.flags&128)===0&&(typeof he.getDerivedStateFromError=="function"||je!==null&&typeof je.componentDidCatch=="function"&&(oi===null||!oi.has(je)))){R.flags|=65536,d&=-d,R.lanes|=d;var Ye=ZA(R,re,d);CA(R,Ye);break e}}R=R.return}while(R!==null)}OE(g)}catch(bt){d=bt,er===g&&g!==null&&(er=g=g.return);continue}break}while(!0)}function RE(){var l=fh.current;return fh.current=oh,l===null?oh:l}function Ly(){(ir===0||ir===3||ir===2)&&(ir=4),gr===null||(Gi&268435455)===0&&(ph&268435455)===0||ci(gr,Nr)}function yh(l,d){var g=on;on|=2;var w=RE();(gr!==l||Nr!==d)&&(go=null,Xi(l,d));do try{Y7();break}catch(_){PE(l,_)}while(!0);if(Qx(),on=g,fh.current=w,er!==null)throw Error(n(261));return gr=null,Nr=0,ir}function Y7(){for(;er!==null;)TE(er)}function X7(){for(;er!==null&&!Fi();)TE(er)}function TE(l){var d=$E(l.alternate,l,va);l.memoizedProps=l.pendingProps,d===null?OE(l):er=d,Ey.current=null}function OE(l){var d=l;do{var g=d.alternate;if(l=d.return,(d.flags&32768)===0){if(g=q7(g,d,va),g!==null){er=g;return}}else{if(g=U7(g,d),g!==null){g.flags&=32767,er=g;return}if(l!==null)l.flags|=32768,l.subtreeFlags=0,l.deletions=null;else{ir=6,er=null;return}}if(d=d.sibling,d!==null){er=d;return}er=d=l}while(d!==null);ir===0&&(ir=5)}function Qi(l,d,g){var w=gn,_=$a.transition;try{$a.transition=null,gn=1,Q7(l,d,g,w)}finally{$a.transition=_,gn=w}return null}function Q7(l,d,g,w){do xc();while(ii!==null);if((on&6)!==0)throw Error(n(327));g=l.finishedWork;var _=l.finishedLanes;if(g===null)return null;if(l.finishedWork=null,l.finishedLanes=0,g===l.current)throw Error(n(177));l.callbackNode=null,l.callbackPriority=0;var R=g.lanes|g.childLanes;if(qn(l,R),l===gr&&(er=gr=null,Nr=0),(g.subtreeFlags&2064)===0&&(g.flags&2064)===0||mh||(mh=!0,DE(rt,function(){return xc(),null})),R=(g.flags&15990)!==0,(g.subtreeFlags&15990)!==0||R){R=$a.transition,$a.transition=null;var D=gn;gn=1;var re=on;on|=4,Ey.current=null,H7(l,g),SE(g,l),v7(Lx),Pp=!!Dx,Lx=Dx=null,l.current=g,V7(g),Wu(),on=re,gn=D,$a.transition=R}else l.current=g;if(mh&&(mh=!1,ii=l,gh=_),R=l.pendingLanes,R===0&&(oi=null),ne(g.stateNode),Zr(l,En()),d!==null)for(w=l.onRecoverableError,g=0;g<d.length;g++)_=d[g],w(_.value,{componentStack:_.stack,digest:_.digest});if(hh)throw hh=!1,l=Ty,Ty=null,l;return(gh&1)!==0&&l.tag!==0&&xc(),R=l.pendingLanes,(R&1)!==0?l===Oy?wd++:(wd=0,Oy=l):wd=0,ni(),null}function xc(){if(ii!==null){var l=wk(gh),d=$a.transition,g=gn;try{if($a.transition=null,gn=16>l?16:l,ii===null)var w=!1;else{if(l=ii,ii=null,gh=0,(on&6)!==0)throw Error(n(331));var _=on;for(on|=4,mt=l.current;mt!==null;){var R=mt,D=R.child;if((mt.flags&16)!==0){var re=R.deletions;if(re!==null){for(var ce=0;ce<re.length;ce++){var Se=re[ce];for(mt=Se;mt!==null;){var Be=mt;switch(Be.tag){case 0:case 11:case 15:xd(8,Be,R)}var He=Be.child;if(He!==null)He.return=Be,mt=He;else for(;mt!==null;){Be=mt;var Fe=Be.sibling,dt=Be.return;if(xE(Be),Be===Se){mt=null;break}if(Fe!==null){Fe.return=dt,mt=Fe;break}mt=dt}}}var xt=R.alternate;if(xt!==null){var yt=xt.child;if(yt!==null){xt.child=null;do{var Qn=yt.sibling;yt.sibling=null,yt=Qn}while(yt!==null)}}mt=R}}if((R.subtreeFlags&2064)!==0&&D!==null)D.return=R,mt=D;else e:for(;mt!==null;){if(R=mt,(R.flags&2048)!==0)switch(R.tag){case 0:case 11:case 15:xd(9,R,R.return)}var be=R.sibling;if(be!==null){be.return=R.return,mt=be;break e}mt=R.return}}var he=l.current;for(mt=he;mt!==null;){D=mt;var je=D.child;if((D.subtreeFlags&2064)!==0&&je!==null)je.return=D,mt=je;else e:for(D=he;mt!==null;){if(re=mt,(re.flags&2048)!==0)try{switch(re.tag){case 0:case 11:case 15:dh(9,re)}}catch(bt){Kn(re,re.return,bt)}if(re===D){mt=null;break e}var Ye=re.sibling;if(Ye!==null){Ye.return=re.return,mt=Ye;break e}mt=re.return}}if(on=_,ni(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Lt,l)}catch{}w=!0}return w}finally{gn=g,$a.transition=d}}return!1}function ME(l,d,g){d=hc(g,d),d=JA(l,d,1),l=ai(l,d,1),d=Dr(),l!==null&&(us(l,1,d),Zr(l,d))}function Kn(l,d,g){if(l.tag===3)ME(l,l,g);else for(;d!==null;){if(d.tag===3){ME(d,l,g);break}else if(d.tag===1){var w=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(oi===null||!oi.has(w))){l=hc(g,l),l=ZA(d,l,1),d=ai(d,l,1),l=Dr(),d!==null&&(us(d,1,l),Zr(d,l));break}}d=d.return}}function J7(l,d,g){var w=l.pingCache;w!==null&&w.delete(d),d=Dr(),l.pingedLanes|=l.suspendedLanes&g,gr===l&&(Nr&g)===g&&(ir===4||ir===3&&(Nr&130023424)===Nr&&500>En()-Ry?Xi(l,0):Py|=g),Zr(l,d)}function IE(l,d){d===0&&((l.mode&1)===0?d=1:(d=mn,mn<<=1,(mn&130023424)===0&&(mn=4194304)));var g=Dr();l=po(l,d),l!==null&&(us(l,d,g),Zr(l,g))}function Z7(l){var d=l.memoizedState,g=0;d!==null&&(g=d.retryLane),IE(l,g)}function e9(l,d){var g=0;switch(l.tag){case 13:var w=l.stateNode,_=l.memoizedState;_!==null&&(g=_.retryLane);break;case 19:w=l.stateNode;break;default:throw Error(n(314))}w!==null&&w.delete(d),IE(l,g)}var $E;$E=function(l,d,g){if(l!==null)if(l.memoizedProps!==d.pendingProps||Yr.current)Qr=!0;else{if((l.lanes&g)===0&&(d.flags&128)===0)return Qr=!1,B7(l,d,g);Qr=(l.flags&131072)!==0}else Qr=!1,Dn&&(d.flags&1048576)!==0&&mA(d,Gp,d.index);switch(d.lanes=0,d.tag){case 2:var w=d.type;ch(l,d),l=d.pendingProps;var _=oc(d,Ar.current);fc(d,g),_=ly(null,d,w,l,_,g);var R=cy();return d.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,Xr(w)?(R=!0,Hp(d)):R=!1,d.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,ty(d),_.updater=ih,d.stateNode=_,_._reactInternals=d,my(d,w,l,g),d=yy(null,d,w,!0,R,g)):(d.tag=0,Dn&&R&&Hx(d),$r(null,d,_,g),d=d.child),d;case 16:w=d.elementType;e:{switch(ch(l,d),l=d.pendingProps,_=w._init,w=_(w._payload),d.type=w,_=d.tag=n9(w),l=ps(w,l),_){case 0:d=xy(null,d,w,l,g);break e;case 1:d=lE(null,d,w,l,g);break e;case 11:d=rE(null,d,w,l,g);break e;case 14:d=aE(null,d,w,ps(w.type,l),g);break e}throw Error(n(306,w,""))}return d;case 0:return w=d.type,_=d.pendingProps,_=d.elementType===w?_:ps(w,_),xy(l,d,w,_,g);case 1:return w=d.type,_=d.pendingProps,_=d.elementType===w?_:ps(w,_),lE(l,d,w,_,g);case 3:e:{if(cE(d),l===null)throw Error(n(387));w=d.pendingProps,R=d.memoizedState,_=R.element,NA(l,d),eh(d,w,null,g);var D=d.memoizedState;if(w=D.element,R.isDehydrated)if(R={element:w,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},d.updateQueue.baseState=R,d.memoizedState=R,d.flags&256){_=hc(Error(n(423)),d),d=uE(l,d,w,g,_);break e}else if(w!==_){_=hc(Error(n(424)),d),d=uE(l,d,w,g,_);break e}else for(ga=Zo(d.stateNode.containerInfo.firstChild),ma=d,Dn=!0,fs=null,g=jA(d,null,w,g),d.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling;else{if(cc(),w===_){d=mo(l,d,g);break e}$r(l,d,w,g)}d=d.child}return d;case 5:return kA(d),l===null&&Gx(d),w=d.type,_=d.pendingProps,R=l!==null?l.memoizedProps:null,D=_.children,Fx(w,_)?D=null:R!==null&&Fx(w,R)&&(d.flags|=32),iE(l,d),$r(l,d,D,g),d.child;case 6:return l===null&&Gx(d),null;case 13:return dE(l,d,g);case 4:return ny(d,d.stateNode.containerInfo),w=d.pendingProps,l===null?d.child=uc(d,null,w,g):$r(l,d,w,g),d.child;case 11:return w=d.type,_=d.pendingProps,_=d.elementType===w?_:ps(w,_),rE(l,d,w,_,g);case 7:return $r(l,d,d.pendingProps,g),d.child;case 8:return $r(l,d,d.pendingProps.children,g),d.child;case 12:return $r(l,d,d.pendingProps.children,g),d.child;case 10:e:{if(w=d.type._context,_=d.pendingProps,R=d.memoizedProps,D=_.value,Sn(Qp,w._currentValue),w._currentValue=D,R!==null)if(ds(R.value,D)){if(R.children===_.children&&!Yr.current){d=mo(l,d,g);break e}}else for(R=d.child,R!==null&&(R.return=d);R!==null;){var re=R.dependencies;if(re!==null){D=R.child;for(var ce=re.firstContext;ce!==null;){if(ce.context===w){if(R.tag===1){ce=ho(-1,g&-g),ce.tag=2;var Se=R.updateQueue;if(Se!==null){Se=Se.shared;var Be=Se.pending;Be===null?ce.next=ce:(ce.next=Be.next,Be.next=ce),Se.pending=ce}}R.lanes|=g,ce=R.alternate,ce!==null&&(ce.lanes|=g),Zx(R.return,g,d),re.lanes|=g;break}ce=ce.next}}else if(R.tag===10)D=R.type===d.type?null:R.child;else if(R.tag===18){if(D=R.return,D===null)throw Error(n(341));D.lanes|=g,re=D.alternate,re!==null&&(re.lanes|=g),Zx(D,g,d),D=R.sibling}else D=R.child;if(D!==null)D.return=R;else for(D=R;D!==null;){if(D===d){D=null;break}if(R=D.sibling,R!==null){R.return=D.return,D=R;break}D=D.return}R=D}$r(l,d,_.children,g),d=d.child}return d;case 9:return _=d.type,w=d.pendingProps.children,fc(d,g),_=Ma(_),w=w(_),d.flags|=1,$r(l,d,w,g),d.child;case 14:return w=d.type,_=ps(w,d.pendingProps),_=ps(w.type,_),aE(l,d,w,_,g);case 15:return sE(l,d,d.type,d.pendingProps,g);case 17:return w=d.type,_=d.pendingProps,_=d.elementType===w?_:ps(w,_),ch(l,d),d.tag=1,Xr(w)?(l=!0,Hp(d)):l=!1,fc(d,g),XA(d,w,_),my(d,w,_,g),yy(null,d,w,!0,l,g);case 19:return pE(l,d,g);case 22:return oE(l,d,g)}throw Error(n(156,d.tag))};function DE(l,d){return jr(l,d)}function t9(l,d,g,w){this.tag=l,this.key=g,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Da(l,d,g,w){return new t9(l,d,g,w)}function Fy(l){return l=l.prototype,!(!l||!l.isReactComponent)}function n9(l){if(typeof l=="function")return Fy(l)?1:0;if(l!=null){if(l=l.$$typeof,l===F)return 11;if(l===I)return 14}return 2}function ui(l,d){var g=l.alternate;return g===null?(g=Da(l.tag,d,l.key,l.mode),g.elementType=l.elementType,g.type=l.type,g.stateNode=l.stateNode,g.alternate=l,l.alternate=g):(g.pendingProps=d,g.type=l.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=l.flags&14680064,g.childLanes=l.childLanes,g.lanes=l.lanes,g.child=l.child,g.memoizedProps=l.memoizedProps,g.memoizedState=l.memoizedState,g.updateQueue=l.updateQueue,d=l.dependencies,g.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},g.sibling=l.sibling,g.index=l.index,g.ref=l.ref,g}function bh(l,d,g,w,_,R){var D=2;if(w=l,typeof l=="function")Fy(l)&&(D=1);else if(typeof l=="string")D=5;else e:switch(l){case P:return Ji(g.children,_,R,d);case T:D=8,_|=8;break;case $:return l=Da(12,g,d,_|2),l.elementType=$,l.lanes=R,l;case X:return l=Da(13,g,d,_),l.elementType=X,l.lanes=R,l;case L:return l=Da(19,g,d,_),l.elementType=L,l.lanes=R,l;case q:return wh(g,_,R,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case Y:D=10;break e;case H:D=9;break e;case F:D=11;break e;case I:D=14;break e;case M:D=16,w=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Da(D,g,d,_),d.elementType=l,d.type=w,d.lanes=R,d}function Ji(l,d,g,w){return l=Da(7,l,w,d),l.lanes=g,l}function wh(l,d,g,w){return l=Da(22,l,w,d),l.elementType=q,l.lanes=g,l.stateNode={isHidden:!1},l}function zy(l,d,g){return l=Da(6,l,null,d),l.lanes=g,l}function By(l,d,g){return d=Da(4,l.children!==null?l.children:[],l.key,d),d.lanes=g,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function r9(l,d,g,w,_){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ds(0),this.expirationTimes=Ds(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ds(0),this.identifierPrefix=w,this.onRecoverableError=_,this.mutableSourceEagerHydrationData=null}function qy(l,d,g,w,_,R,D,re,ce){return l=new r9(l,d,g,re,ce),d===1?(d=1,R===!0&&(d|=8)):d=0,R=Da(3,null,null,d),l.current=R,R.stateNode=l,R.memoizedState={element:w,isDehydrated:g,cache:null,transitions:null,pendingSuspenseBoundaries:null},ty(R),l}function a9(l,d,g){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:w==null?null:""+w,children:l,containerInfo:d,implementation:g}}function LE(l){if(!l)return ti;l=l._reactInternals;e:{if(zn(l)!==l||l.tag!==1)throw Error(n(170));var d=l;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if(Xr(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(n(171))}if(l.tag===1){var g=l.type;if(Xr(g))return fA(l,g,d)}return d}function FE(l,d,g,w,_,R,D,re,ce){return l=qy(g,w,!0,l,_,R,D,re,ce),l.context=LE(null),g=l.current,w=Dr(),_=li(g),R=ho(w,_),R.callback=d??null,ai(g,R,_),l.current.lanes=_,us(l,_,w),Zr(l,w),l}function jh(l,d,g,w){var _=d.current,R=Dr(),D=li(_);return g=LE(g),d.context===null?d.context=g:d.pendingContext=g,d=ho(R,D),d.payload={element:l},w=w===void 0?null:w,w!==null&&(d.callback=w),l=ai(_,d,D),l!==null&&(gs(l,_,D,R),Zp(l,_,D)),D}function Sh(l){return l=l.current,l.child?(l.child.tag===5,l.child.stateNode):null}function zE(l,d){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var g=l.retryLane;l.retryLane=g!==0&&g<d?g:d}}function Uy(l,d){zE(l,d),(l=l.alternate)&&zE(l,d)}function s9(){return null}var BE=typeof reportError=="function"?reportError:function(l){console.error(l)};function Wy(l){this._internalRoot=l}Nh.prototype.render=Wy.prototype.render=function(l){var d=this._internalRoot;if(d===null)throw Error(n(409));jh(l,d,null,null)},Nh.prototype.unmount=Wy.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var d=l.containerInfo;Yi(function(){jh(null,l,null,null)}),d[lo]=null}};function Nh(l){this._internalRoot=l}Nh.prototype.unstable_scheduleHydration=function(l){if(l){var d=Nk();l={blockedOn:null,target:l,priority:d};for(var g=0;g<Xo.length&&d!==0&&d<Xo[g].priority;g++);Xo.splice(g,0,l),g===0&&kk(l)}};function Hy(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Ch(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11&&(l.nodeType!==8||l.nodeValue!==" react-mount-point-unstable "))}function qE(){}function o9(l,d,g,w,_){if(_){if(typeof w=="function"){var R=w;w=function(){var Se=Sh(D);R.call(Se)}}var D=FE(d,w,l,0,null,!1,!1,"",qE);return l._reactRootContainer=D,l[lo]=D.current,sd(l.nodeType===8?l.parentNode:l),Yi(),D}for(;_=l.lastChild;)l.removeChild(_);if(typeof w=="function"){var re=w;w=function(){var Se=Sh(ce);re.call(Se)}}var ce=qy(l,0,!1,null,null,!1,!1,"",qE);return l._reactRootContainer=ce,l[lo]=ce.current,sd(l.nodeType===8?l.parentNode:l),Yi(function(){jh(d,ce,g,w)}),ce}function _h(l,d,g,w,_){var R=g._reactRootContainer;if(R){var D=R;if(typeof _=="function"){var re=_;_=function(){var ce=Sh(D);re.call(ce)}}jh(d,D,l,_)}else D=o9(g,d,l,_,w);return Sh(D)}jk=function(l){switch(l.tag){case 3:var d=l.stateNode;if(d.current.memoizedState.isDehydrated){var g=nn(d.pendingLanes);g!==0&&(zi(d,g|1),Zr(d,En()),(on&6)===0&&(vc=En()+500,ni()))}break;case 13:Yi(function(){var w=po(l,1);if(w!==null){var _=Dr();gs(w,l,1,_)}}),Uy(l,1)}},gx=function(l){if(l.tag===13){var d=po(l,134217728);if(d!==null){var g=Dr();gs(d,l,134217728,g)}Uy(l,134217728)}},Sk=function(l){if(l.tag===13){var d=li(l),g=po(l,d);if(g!==null){var w=Dr();gs(g,l,d,w)}Uy(l,d)}},Nk=function(){return gn},Ck=function(l,d){var g=gn;try{return gn=l,d()}finally{gn=g}},Ve=function(l,d,g){switch(d){case"input":if(it(l,g),d=g.name,g.type==="radio"&&d!=null){for(g=l;g.parentNode;)g=g.parentNode;for(g=g.querySelectorAll("input[name="+JSON.stringify(""+d)+'][type="radio"]'),d=0;d<g.length;d++){var w=g[d];if(w!==l&&w.form===l.form){var _=Up(w);if(!_)throw Error(n(90));me(w),it(w,_)}}}break;case"textarea":Ft(l,g);break;case"select":d=g.value,d!=null&&Re(l,!!g.multiple,d,!1)}},ke=$y,Ce=Yi;var i9={usingClientEntryPoint:!1,Events:[ld,ac,Up,ye,ve,$y]},jd={findFiberByHostInstance:Bi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},l9={bundleType:jd.bundleType,version:jd.version,rendererPackageName:jd.rendererPackageName,rendererConfig:jd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:k.ReactCurrentDispatcher,findHostInstanceByFiber:function(l){return l=Li(l),l===null?null:l.stateNode},findFiberByHostInstance:jd.findFiberByHostInstance||s9,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var kh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kh.isDisabled&&kh.supportsFiber)try{Lt=kh.inject(l9),tn=kh}catch{}}return ea.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i9,ea.createPortal=function(l,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Hy(d))throw Error(n(200));return a9(l,d,null,g)},ea.createRoot=function(l,d){if(!Hy(l))throw Error(n(299));var g=!1,w="",_=BE;return d!=null&&(d.unstable_strictMode===!0&&(g=!0),d.identifierPrefix!==void 0&&(w=d.identifierPrefix),d.onRecoverableError!==void 0&&(_=d.onRecoverableError)),d=qy(l,1,!1,null,null,g,!1,w,_),l[lo]=d.current,sd(l.nodeType===8?l.parentNode:l),new Wy(d)},ea.findDOMNode=function(l){if(l==null)return null;if(l.nodeType===1)return l;var d=l._reactInternals;if(d===void 0)throw typeof l.render=="function"?Error(n(188)):(l=Object.keys(l).join(","),Error(n(268,l)));return l=Li(d),l=l===null?null:l.stateNode,l},ea.flushSync=function(l){return Yi(l)},ea.hydrate=function(l,d,g){if(!Ch(d))throw Error(n(200));return _h(null,l,d,!0,g)},ea.hydrateRoot=function(l,d,g){if(!Hy(l))throw Error(n(405));var w=g!=null&&g.hydratedSources||null,_=!1,R="",D=BE;if(g!=null&&(g.unstable_strictMode===!0&&(_=!0),g.identifierPrefix!==void 0&&(R=g.identifierPrefix),g.onRecoverableError!==void 0&&(D=g.onRecoverableError)),d=FE(d,null,l,1,g??null,_,!1,R,D),l[lo]=d.current,sd(l),w)for(l=0;l<w.length;l++)g=w[l],_=g._getVersion,_=_(g._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[g,_]:d.mutableSourceEagerHydrationData.push(g,_);return new Nh(d)},ea.render=function(l,d,g){if(!Ch(d))throw Error(n(200));return _h(null,l,d,!1,g)},ea.unmountComponentAtNode=function(l){if(!Ch(l))throw Error(n(40));return l._reactRootContainer?(Yi(function(){_h(null,null,l,!1,function(){l._reactRootContainer=null,l[lo]=null})}),!0):!1},ea.unstable_batchedUpdates=$y,ea.unstable_renderSubtreeIntoContainer=function(l,d,g,w){if(!Ch(g))throw Error(n(200));if(l==null||l._reactInternals===void 0)throw Error(n(38));return _h(l,d,g,!1,w)},ea.version="18.3.1-next-f1338f8080-20240426",ea}var XE;function KD(){if(XE)return Gy.exports;XE=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Gy.exports=g9(),Gy.exports}var QE;function v9(){if(QE)return Eh;QE=1;var e=KD();return Eh.createRoot=e.createRoot,Eh.hydrateRoot=e.hydrateRoot,Eh}var x9=v9(),h=lC();const J=vn(h),cC=u9({__proto__:null,default:J},[h]),y9=1,b9=1e6;let Qy=0;function w9(){return Qy=(Qy+1)%Number.MAX_SAFE_INTEGER,Qy.toString()}const Jy=new Map,JE=e=>{if(Jy.has(e))return;const t=setTimeout(()=>{Jy.delete(e),Hd({type:"REMOVE_TOAST",toastId:e})},b9);Jy.set(e,t)},j9=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,y9)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?JE(n):e.toasts.forEach(r=>{JE(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},rm=[];let am={toasts:[]};function Hd(e){am=j9(am,e),rm.forEach(t=>{t(am)})}function $e({...e}){const t=w9(),n=s=>Hd({type:"UPDATE_TOAST",toast:{...s,id:t}}),r=()=>Hd({type:"DISMISS_TOAST",toastId:t});return Hd({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||r()}}}),{id:t,dismiss:r,update:n}}function S9(){const[e,t]=h.useState(am);return h.useEffect(()=>(rm.push(t),()=>{const n=rm.indexOf(t);n>-1&&rm.splice(n,1)}),[e]),{...e,toast:$e,dismiss:n=>Hd({type:"DISMISS_TOAST",toastId:n})}}var Nu=KD();const GD=vn(Nu);function Ue(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function ZE(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Vr(...e){return t=>{let n=!1;const r=e.map(s=>{const o=ZE(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():ZE(e[s],null)}}}}function Ot(...e){return h.useCallback(Vr(...e),e)}function N9(e,t){const n=h.createContext(t),r=o=>{const{children:i,...c}=o,u=h.useMemo(()=>c,Object.values(c));return a.jsx(n.Provider,{value:u,children:i})};r.displayName=e+"Provider";function s(o){const i=h.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function kr(e,t=[]){let n=[];function r(o,i){const c=h.createContext(i),u=n.length;n=[...n,i];const f=p=>{const{scope:v,children:x,...j}=p,y=v?.[e]?.[u]||c,b=h.useMemo(()=>j,Object.values(j));return a.jsx(y.Provider,{value:b,children:x})};f.displayName=o+"Provider";function m(p,v){const x=v?.[e]?.[u]||c,j=h.useContext(x);if(j)return j;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[f,m]}const s=()=>{const o=n.map(i=>h.createContext(i));return function(c){const u=c?.[e]||o;return h.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return s.scopeName=e,[r,C9(s,...t)]}function C9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:u,scopeName:f})=>{const p=u(o)[`__scope${f}`];return{...c,...p}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function eP(e){const t=_9(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),u=c.find(A9);if(u){const f=u.props.children,m=c.map(p=>p===u?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function _9(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=P9(s),c=E9(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var k9=Symbol("radix.slottable");function A9(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===k9}function E9(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function P9(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 Qf(e){const t=e+"CollectionProvider",[n,r]=kr(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=y=>{const{scope:b,children:S}=y,N=J.useRef(null),C=J.useRef(new Map).current;return a.jsx(s,{scope:b,itemMap:C,collectionRef:N,children:S})};i.displayName=t;const c=e+"CollectionSlot",u=eP(c),f=J.forwardRef((y,b)=>{const{scope:S,children:N}=y,C=o(c,S),k=Ot(b,C.collectionRef);return a.jsx(u,{ref:k,children:N})});f.displayName=c;const m=e+"CollectionItemSlot",p="data-radix-collection-item",v=eP(m),x=J.forwardRef((y,b)=>{const{scope:S,children:N,...C}=y,k=J.useRef(null),A=Ot(b,k),E=o(m,S);return J.useEffect(()=>(E.itemMap.set(k,{ref:k,...C}),()=>{E.itemMap.delete(k)})),a.jsx(v,{[p]:"",ref:A,children:N})});x.displayName=m;function j(y){const b=o(e+"CollectionConsumer",y);return J.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const C=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(b.itemMap.values()).sort((E,P)=>C.indexOf(E.ref.current)-C.indexOf(P.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:i,Slot:f,ItemSlot:x},j,r]}function R9(e){const t=T9(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),u=c.find(M9);if(u){const f=u.props.children,m=c.map(p=>p===u?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function T9(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=$9(s),c=I9(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var O9=Symbol("radix.slottable");function M9(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===O9}function I9(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function $9(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 D9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lt=D9.reduce((e,t)=>{const n=R9(`Primitive.${t}`),r=h.forwardRef((s,o)=>{const{asChild:i,...c}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function uC(e,t){e&&Nu.flushSync(()=>e.dispatchEvent(t))}function Jn(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>t.current?.(...n),[])}function L9(e,t=globalThis?.document){const n=Jn(e);h.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var F9="DismissableLayer",WS="dismissableLayer.update",z9="dismissableLayer.pointerDownOutside",B9="dismissableLayer.focusOutside",tP,YD=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ll=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:c,...u}=e,f=h.useContext(YD),[m,p]=h.useState(null),v=m?.ownerDocument??globalThis?.document,[,x]=h.useState({}),j=Ot(t,P=>p(P)),y=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),S=y.indexOf(b),N=m?y.indexOf(m):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,k=N>=S,A=U9(P=>{const T=P.target,$=[...f.branches].some(Y=>Y.contains(T));!k||$||(s?.(P),i?.(P),P.defaultPrevented||c?.())},v),E=W9(P=>{const T=P.target;[...f.branches].some(Y=>Y.contains(T))||(o?.(P),i?.(P),P.defaultPrevented||c?.())},v);return L9(P=>{N===f.layers.size-1&&(r?.(P),!P.defaultPrevented&&c&&(P.preventDefault(),c()))},v),h.useEffect(()=>{if(m)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(tP=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),nP(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=tP)}},[m,v,n,f]),h.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),nP())},[m,f]),h.useEffect(()=>{const P=()=>x({});return document.addEventListener(WS,P),()=>document.removeEventListener(WS,P)},[]),a.jsx(lt.div,{...u,ref:j,style:{pointerEvents:C?k?"auto":"none":void 0,...e.style},onFocusCapture:Ue(e.onFocusCapture,E.onFocusCapture),onBlurCapture:Ue(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ue(e.onPointerDownCapture,A.onPointerDownCapture)})});Ll.displayName=F9;var q9="DismissableLayerBranch",XD=h.forwardRef((e,t)=>{const n=h.useContext(YD),r=h.useRef(null),s=Ot(t,r);return h.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(lt.div,{...e,ref:s})});XD.displayName=q9;function U9(e,t=globalThis?.document){const n=Jn(e),r=h.useRef(!1),s=h.useRef(()=>{});return h.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let u=function(){QD(z9,n,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=u,t.addEventListener("click",s.current,{once:!0})):u()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function W9(e,t=globalThis?.document){const n=Jn(e),r=h.useRef(!1);return h.useEffect(()=>{const s=o=>{o.target&&!r.current&&QD(B9,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function nP(){const e=new CustomEvent(WS);document.dispatchEvent(e)}function QD(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?uC(s,o):s.dispatchEvent(o)}var H9=Ll,V9=XD,pr=globalThis?.document?h.useLayoutEffect:()=>{},K9="Portal",Fl=h.forwardRef((e,t)=>{const{container:n,...r}=e,[s,o]=h.useState(!1);pr(()=>o(!0),[]);const i=n||s&&globalThis?.document?.body;return i?GD.createPortal(a.jsx(lt.div,{...r,ref:t}),i):null});Fl.displayName=K9;function G9(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var ar=e=>{const{present:t,children:n}=e,r=Y9(t),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),o=Ot(r.ref,X9(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:o}):null};ar.displayName="Presence";function Y9(e){const[t,n]=h.useState(),r=h.useRef(null),s=h.useRef(e),o=h.useRef("none"),i=e?"mounted":"unmounted",[c,u]=G9(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const f=Ph(r.current);o.current=c==="mounted"?f:"none"},[c]),pr(()=>{const f=r.current,m=s.current;if(m!==e){const v=o.current,x=Ph(f);e?u("MOUNT"):x==="none"||f?.display==="none"?u("UNMOUNT"):u(m&&v!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,u]),pr(()=>{if(t){let f;const m=t.ownerDocument.defaultView??window,p=x=>{const y=Ph(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&y&&(u("ANIMATION_END"),!s.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",f=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},v=x=>{x.target===t&&(o.current=Ph(r.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{m.clearTimeout(f),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:h.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Ph(e){return e?.animationName||"none"}function X9(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 Q9=cC[" useInsertionEffect ".trim().toString()]||pr;function Aa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=J9({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:s;{const m=h.useRef(e!==void 0);h.useEffect(()=>{const p=m.current;p!==c&&console.warn(`${r} 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.`),m.current=c},[c,r])}const f=h.useCallback(m=>{if(c){const p=Z9(m)?m(e):m;p!==e&&i.current?.(p)}else o(m)},[c,e,o,i]);return[u,f]}function J9({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),s=h.useRef(n),o=h.useRef(t);return Q9(()=>{o.current=t},[t]),h.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function Z9(e){return typeof e=="function"}var JD=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),eW="VisuallyHidden",Lg=h.forwardRef((e,t)=>a.jsx(lt.span,{...e,ref:t,style:{...JD,...e.style}}));Lg.displayName=eW;var tW=Lg,dC="ToastProvider",[fC,nW,rW]=Qf("Toast"),[ZD]=kr("Toast",[rW]),[aW,Fg]=ZD(dC),e5=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[c,u]=h.useState(null),[f,m]=h.useState(0),p=h.useRef(!1),v=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${dC}\`. Expected non-empty \`string\`.`),a.jsx(fC.Provider,{scope:t,children:a.jsx(aW,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:o,toastCount:f,viewport:c,onViewportChange:u,onToastAdd:h.useCallback(()=>m(x=>x+1),[]),onToastRemove:h.useCallback(()=>m(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:v,children:i})})};e5.displayName=dC;var t5="ToastViewport",sW=["F8"],HS="toast.viewportPause",VS="toast.viewportResume",n5=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=sW,label:s="Notifications ({hotkey})",...o}=e,i=Fg(t5,n),c=nW(n),u=h.useRef(null),f=h.useRef(null),m=h.useRef(null),p=h.useRef(null),v=Ot(t,p,i.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=i.toastCount>0;h.useEffect(()=>{const b=S=>{r.length!==0&&r.every(C=>S[C]||S.code===C)&&p.current?.focus()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),h.useEffect(()=>{const b=u.current,S=p.current;if(j&&b&&S){const N=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(HS);S.dispatchEvent(E),i.isClosePausedRef.current=!0}},C=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(VS);S.dispatchEvent(E),i.isClosePausedRef.current=!1}},k=E=>{!b.contains(E.relatedTarget)&&C()},A=()=>{b.contains(document.activeElement)||C()};return b.addEventListener("focusin",N),b.addEventListener("focusout",k),b.addEventListener("pointermove",N),b.addEventListener("pointerleave",A),window.addEventListener("blur",N),window.addEventListener("focus",C),()=>{b.removeEventListener("focusin",N),b.removeEventListener("focusout",k),b.removeEventListener("pointermove",N),b.removeEventListener("pointerleave",A),window.removeEventListener("blur",N),window.removeEventListener("focus",C)}}},[j,i.isClosePausedRef]);const y=h.useCallback(({tabbingDirection:b})=>{const N=c().map(C=>{const k=C.ref.current,A=[k,...xW(k)];return b==="forwards"?A:A.reverse()});return(b==="forwards"?N.reverse():N).flat()},[c]);return h.useEffect(()=>{const b=p.current;if(b){const S=N=>{const C=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!C){const A=document.activeElement,E=N.shiftKey;if(N.target===b&&E){f.current?.focus();return}const $=y({tabbingDirection:E?"backwards":"forwards"}),Y=$.findIndex(H=>H===A);Zy($.slice(Y+1))?N.preventDefault():E?f.current?.focus():m.current?.focus()}};return b.addEventListener("keydown",S),()=>b.removeEventListener("keydown",S)}},[c,y]),a.jsxs(V9,{ref:u,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:j?void 0:"none"},children:[j&&a.jsx(KS,{ref:f,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"forwards"});Zy(b)}}),a.jsx(fC.Slot,{scope:n,children:a.jsx(lt.ol,{tabIndex:-1,...o,ref:v})}),j&&a.jsx(KS,{ref:m,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"backwards"});Zy(b)}})]})});n5.displayName=t5;var r5="ToastFocusProxy",KS=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,o=Fg(r5,n);return a.jsx(Lg,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{const c=i.relatedTarget;!o.viewport?.contains(c)&&r()}})});KS.displayName=r5;var Jf="Toast",oW="toast.swipeStart",iW="toast.swipeMove",lW="toast.swipeCancel",cW="toast.swipeEnd",a5=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:o,...i}=e,[c,u]=Aa({prop:r,defaultProp:s??!0,onChange:o,caller:Jf});return a.jsx(ar,{present:n||c,children:a.jsx(fW,{open:c,...i,ref:t,onClose:()=>u(!1),onPause:Jn(e.onPause),onResume:Jn(e.onResume),onSwipeStart:Ue(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ue(e.onSwipeMove,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:Ue(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ue(e.onSwipeEnd,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),u(!1)})})})});a5.displayName=Jf;var[uW,dW]=ZD(Jf,{onClose(){}}),fW=h.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:c,onPause:u,onResume:f,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:v,onSwipeEnd:x,...j}=e,y=Fg(Jf,n),[b,S]=h.useState(null),N=Ot(t,L=>S(L)),C=h.useRef(null),k=h.useRef(null),A=s||y.duration,E=h.useRef(0),P=h.useRef(A),T=h.useRef(0),{onToastAdd:$,onToastRemove:Y}=y,H=Jn(()=>{b?.contains(document.activeElement)&&y.viewport?.focus(),i()}),F=h.useCallback(L=>{!L||L===1/0||(window.clearTimeout(T.current),E.current=new Date().getTime(),T.current=window.setTimeout(H,L))},[H]);h.useEffect(()=>{const L=y.viewport;if(L){const I=()=>{F(P.current),f?.()},M=()=>{const q=new Date().getTime()-E.current;P.current=P.current-q,window.clearTimeout(T.current),u?.()};return L.addEventListener(HS,M),L.addEventListener(VS,I),()=>{L.removeEventListener(HS,M),L.removeEventListener(VS,I)}}},[y.viewport,A,u,f,F]),h.useEffect(()=>{o&&!y.isClosePausedRef.current&&F(A)},[o,A,y.isClosePausedRef,F]),h.useEffect(()=>($(),()=>Y()),[$,Y]);const X=h.useMemo(()=>b?d5(b):null,[b]);return y.viewport?a.jsxs(a.Fragment,{children:[X&&a.jsx(pW,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:X}),a.jsx(uW,{scope:n,onClose:H,children:Nu.createPortal(a.jsx(fC.ItemSlot,{scope:n,children:a.jsx(H9,{asChild:!0,onEscapeKeyDown:Ue(c,()=>{y.isFocusedToastEscapeKeyDownRef.current||H(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(lt.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":y.swipeDirection,...j,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ue(e.onKeyDown,L=>{L.key==="Escape"&&(c?.(L.nativeEvent),L.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,H()))}),onPointerDown:Ue(e.onPointerDown,L=>{L.button===0&&(C.current={x:L.clientX,y:L.clientY})}),onPointerMove:Ue(e.onPointerMove,L=>{if(!C.current)return;const I=L.clientX-C.current.x,M=L.clientY-C.current.y,q=!!k.current,G=["left","right"].includes(y.swipeDirection),O=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,Q=G?O(0,I):0,B=G?0:O(0,M),z=L.pointerType==="touch"?10:2,V={x:Q,y:B},ee={originalEvent:L,delta:V};q?(k.current=V,Rh(iW,p,ee,{discrete:!1})):rP(V,y.swipeDirection,z)?(k.current=V,Rh(oW,m,ee,{discrete:!1}),L.target.setPointerCapture(L.pointerId)):(Math.abs(I)>z||Math.abs(M)>z)&&(C.current=null)}),onPointerUp:Ue(e.onPointerUp,L=>{const I=k.current,M=L.target;if(M.hasPointerCapture(L.pointerId)&&M.releasePointerCapture(L.pointerId),k.current=null,C.current=null,I){const q=L.currentTarget,G={originalEvent:L,delta:I};rP(I,y.swipeDirection,y.swipeThreshold)?Rh(cW,x,G,{discrete:!0}):Rh(lW,v,G,{discrete:!0}),q.addEventListener("click",O=>O.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),pW=e=>{const{__scopeToast:t,children:n,...r}=e,s=Fg(Jf,t),[o,i]=h.useState(!1),[c,u]=h.useState(!1);return gW(()=>i(!0)),h.useEffect(()=>{const f=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(f)},[]),c?null:a.jsx(Fl,{asChild:!0,children:a.jsx(Lg,{...r,children:o&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},hW="ToastTitle",s5=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});s5.displayName=hW;var mW="ToastDescription",o5=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});o5.displayName=mW;var i5="ToastAction",l5=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?a.jsx(u5,{altText:n,asChild:!0,children:a.jsx(pC,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${i5}\`. Expected non-empty \`string\`.`),null)});l5.displayName=i5;var c5="ToastClose",pC=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=dW(c5,n);return a.jsx(u5,{asChild:!0,children:a.jsx(lt.button,{type:"button",...r,ref:t,onClick:Ue(e.onClick,s.onClose)})})});pC.displayName=c5;var u5=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return a.jsx(lt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function d5(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),vW(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...d5(r))}}),t}function Rh(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?uC(s,o):s.dispatchEvent(o)}var rP=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),o=r>s;return t==="left"||t==="right"?o&&r>n:!o&&s>n};function gW(e=()=>{}){const t=Jn(e);pr(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function vW(e){return e.nodeType===e.ELEMENT_NODE}function xW(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Zy(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var yW=e5,f5=n5,p5=a5,h5=s5,m5=o5,g5=l5,v5=pC;function x5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=x5(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Kt(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=x5(e))&&(r&&(r+=" "),r+=t);return r}const aP=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,sP=Kt,zl=(e,t)=>n=>{var r;if(t?.variants==null)return sP(e,n?.class,n?.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(f=>{const m=n?.[f],p=o?.[f];if(m===null)return null;const v=aP(m)||aP(p);return s[f][v]}),c=n&&Object.entries(n).reduce((f,m)=>{let[p,v]=m;return v===void 0||(f[p]=v),f},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,m)=>{let{class:p,className:v,...x}=m;return Object.entries(x).every(j=>{let[y,b]=j;return Array.isArray(b)?b.includes({...o,...c}[y]):{...o,...c}[y]===b})?[...f,p,v]:f},[]);return sP(e,i,u,n?.class,n?.className)};const bW=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y5=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();var wW={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 jW=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...c},u)=>h.createElement("svg",{ref:u,...wW,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:y5("lucide",s),...c},[...i.map(([f,m])=>h.createElement(f,m)),...Array.isArray(o)?o:[o]]));const ft=(e,t)=>{const n=h.forwardRef(({className:r,...s},o)=>h.createElement(jW,{ref:o,iconNode:t,className:y5(`lucide-${bW(e)}`,r),...s}));return n.displayName=`${e}`,n};const hC=ft("Activity",[["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"}]]);const b5=ft("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);const Si=ft("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Wr=ft("Bot",[["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"}]]);const w5=ft("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);const bl=ft("ChartColumn",[["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"}]]);const Hc=ft("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Jt=ft("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const zg=ft("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const _s=ft("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Dc=ft("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);const eb=ft("CircleAlert",[["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"}]]);const Va=ft("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const SW=ft("CircleHelp",[["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"}]]);const ll=ft("CircleX",[["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"}]]);const NW=ft("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const oP=ft("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);const Ea=ft("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Hr=ft("Copy",[["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"}]]);const j5=ft("Database",[["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"}]]);const zr=ft("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const Bg=ft("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const Vc=ft("ExternalLink",[["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"}]]);const CW=ft("EyeOff",[["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"}]]);const S5=ft("Eye",[["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"}]]);const mC=ft("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);const _W=ft("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);const GS=ft("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const N5=ft("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);const kW=ft("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const C5=ft("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);const AW=ft("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const EW=ft("House",[["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-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);const PW=ft("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const gm=ft("Layers",[["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:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);const gC=ft("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);const RW=ft("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);const YS=ft("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);const TW=ft("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);const _r=ft("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const _5=ft("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);const OW=ft("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);const k5=ft("NotebookTabs",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]]);const Rc=ft("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);const MW=ft("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);const XS=ft("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);const QS=ft("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);const iP=ft("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);const Zf=ft("Pencil",[["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"}]]);const ks=ft("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const To=ft("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const vC=ft("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);const Ya=ft("RefreshCw",[["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"}]]);const IW=ft("Save",[["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"}]]);const xC=ft("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const $W=ft("Send",[["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"}]]);const yC=ft("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const DW=ft("ShieldCheck",[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const sa=ft("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const LW=ft("SquarePen",[["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"}]]);const Vd=ft("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const bC=ft("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);const Xa=ft("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const sm=ft("TriangleAlert",[["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"}]]);const FW=ft("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const Kc=ft("User",[["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"}]]);const A5=ft("Wifi",[["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"}]]);const Ua=ft("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);const ca=ft("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),wC="-",zW=e=>{const t=qW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const c=i.split(wC);return c[0]===""&&c.length!==1&&c.shift(),E5(c,t)||BW(i)},getConflictingClassGroupIds:(i,c)=>{const u=n[i]||[];return c&&r[i]?[...u,...r[i]]:u}}},E5=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?E5(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(wC);return t.validators.find(({validator:i})=>i(o))?.classGroupId},lP=/^\[(.+)\]$/,BW=e=>{if(lP.test(e)){const t=lP.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},qW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return WW(Object.entries(e.classGroups),n).forEach(([o,i])=>{JS(i,r,o,t)}),r},JS=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:cP(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(UW(s)){JS(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{JS(i,cP(t,o),n,r)})})},cP=(e,t)=>{let n=e;return t.split(wC).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},UW=e=>e.isThemeGetter,WW=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,c])=>[t+i,c])):o);return[n,s]}):e,HW=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},P5="!",VW=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=c=>{const u=[];let f=0,m=0,p;for(let b=0;b<c.length;b++){let S=c[b];if(f===0){if(S===s&&(r||c.slice(b,b+o)===t)){u.push(c.slice(m,b)),m=b+o;continue}if(S==="/"){p=b;continue}}S==="["?f++:S==="]"&&f--}const v=u.length===0?c:c.substring(m),x=v.startsWith(P5),j=x?v.substring(1):v,y=p&&p>m?p-m:void 0;return{modifiers:u,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:y}};return n?c=>n({className:c,parseClassName:i}):i},KW=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},GW=e=>({cache:HW(e.cacheSize),parseClassName:VW(e),...zW(e)}),YW=/\s+/,XW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(YW);let c="";for(let u=i.length-1;u>=0;u-=1){const f=i[u],{modifiers:m,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:x}=n(f);let j=!!x,y=r(j?v.substring(0,x):v);if(!y){if(!j){c=f+(c.length>0?" "+c:c);continue}if(y=r(v),!y){c=f+(c.length>0?" "+c:c);continue}j=!1}const b=KW(m).join(":"),S=p?b+P5:b,N=S+y;if(o.includes(N))continue;o.push(N);const C=s(y,j);for(let k=0;k<C.length;++k){const A=C[k];o.push(S+A)}c=f+(c.length>0?" "+c:c)}return c};function QW(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=R5(t))&&(r&&(r+=" "),r+=n);return r}const R5=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=R5(e[r]))&&(n&&(n+=" "),n+=t);return n};function JW(e,...t){let n,r,s,o=i;function i(u){const f=t.reduce((m,p)=>p(m),e());return n=GW(f),r=n.cache.get,s=n.cache.set,o=c,c(u)}function c(u){const f=r(u);if(f)return f;const m=XW(u,n);return s(u,m),m}return function(){return o(QW.apply(null,arguments))}}const Tn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},T5=/^\[(?:([a-z-]+):)?(.+)\]$/i,ZW=/^\d+\/\d+$/,eH=new Set(["px","full","screen"]),tH=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nH=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rH=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,aH=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sH=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vo=e=>Lc(e)||eH.has(e)||ZW.test(e),fi=e=>Cu(e,"length",pH),Lc=e=>!!e&&!Number.isNaN(Number(e)),tb=e=>Cu(e,"number",Lc),Nd=e=>!!e&&Number.isInteger(Number(e)),oH=e=>e.endsWith("%")&&Lc(e.slice(0,-1)),Xt=e=>T5.test(e),pi=e=>tH.test(e),iH=new Set(["length","size","percentage"]),lH=e=>Cu(e,iH,O5),cH=e=>Cu(e,"position",O5),uH=new Set(["image","url"]),dH=e=>Cu(e,uH,mH),fH=e=>Cu(e,"",hH),Cd=()=>!0,Cu=(e,t,n)=>{const r=T5.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},pH=e=>nH.test(e)&&!rH.test(e),O5=()=>!1,hH=e=>aH.test(e),mH=e=>sH.test(e),gH=()=>{const e=Tn("colors"),t=Tn("spacing"),n=Tn("blur"),r=Tn("brightness"),s=Tn("borderColor"),o=Tn("borderRadius"),i=Tn("borderSpacing"),c=Tn("borderWidth"),u=Tn("contrast"),f=Tn("grayscale"),m=Tn("hueRotate"),p=Tn("invert"),v=Tn("gap"),x=Tn("gradientColorStops"),j=Tn("gradientColorStopPositions"),y=Tn("inset"),b=Tn("margin"),S=Tn("opacity"),N=Tn("padding"),C=Tn("saturate"),k=Tn("scale"),A=Tn("sepia"),E=Tn("skew"),P=Tn("space"),T=Tn("translate"),$=()=>["auto","contain","none"],Y=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto",Xt,t],F=()=>[Xt,t],X=()=>["",vo,fi],L=()=>["auto",Lc,Xt],I=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],M=()=>["solid","dashed","dotted","double","none"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],O=()=>["","0",Xt],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[Lc,Xt];return{cacheSize:500,separator:":",theme:{colors:[Cd],spacing:[vo,fi],blur:["none","",pi,Xt],brightness:B(),borderColor:[e],borderRadius:["none","","full",pi,Xt],borderSpacing:F(),borderWidth:X(),contrast:B(),grayscale:O(),hueRotate:B(),invert:O(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[oH,fi],inset:H(),margin:H(),opacity:B(),padding:F(),saturate:B(),scale:B(),sepia:O(),skew:B(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Xt]}],container:["container"],columns:[{columns:[pi]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...I(),Xt]}],overflow:[{overflow:Y()}],"overflow-x":[{"overflow-x":Y()}],"overflow-y":[{"overflow-y":Y()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Nd,Xt]}],basis:[{basis:H()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Xt]}],grow:[{grow:O()}],shrink:[{shrink:O()}],order:[{order:["first","last","none",Nd,Xt]}],"grid-cols":[{"grid-cols":[Cd]}],"col-start-end":[{col:["auto",{span:["full",Nd,Xt]},Xt]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Cd]}],"row-start-end":[{row:["auto",{span:[Nd,Xt]},Xt]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Xt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Xt]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Xt,t]}],"min-w":[{"min-w":[Xt,t,"min","max","fit"]}],"max-w":[{"max-w":[Xt,t,"none","full","min","max","fit","prose",{screen:[pi]},pi]}],h:[{h:[Xt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Xt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Xt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Xt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",pi,fi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tb]}],"font-family":[{font:[Cd]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Xt]}],"line-clamp":[{"line-clamp":["none",Lc,tb]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",vo,Xt]}],"list-image":[{"list-image":["none",Xt]}],"list-style-type":[{list:["none","disc","decimal",Xt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",vo,fi]}],"underline-offset":[{"underline-offset":["auto",vo,Xt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Xt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...I(),cH]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",lH]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},dH]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[j]}],"gradient-via-pos":[{via:[j]}],"gradient-to-pos":[{to:[j]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...M(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}],"divide-style":[{divide:M()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...M()]}],"outline-offset":[{"outline-offset":[vo,Xt]}],"outline-w":[{outline:[vo,fi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[vo,fi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",pi,fH]}],"shadow-color":[{shadow:[Cd]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",pi,Xt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[C]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Xt]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",Xt]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",Xt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Nd,Xt]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Xt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Xt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Xt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[vo,fi,tb]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},vH=JW(gH);function Me(...e){return vH(Kt(e))}function Hn(e,t=""){return typeof e=="string"&&e.trim().length>0?e.trim():t}const xH=yW,M5=h.forwardRef(({className:e,...t},n)=>a.jsx(f5,{ref:n,className:Me("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));M5.displayName=f5.displayName;const yH=zl("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 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-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),I5=h.forwardRef(({className:e,variant:t,...n},r)=>a.jsx(p5,{ref:r,className:Me(yH({variant:t}),e),...n}));I5.displayName=p5.displayName;const bH=h.forwardRef(({className:e,...t},n)=>a.jsx(g5,{ref:n,className:Me("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));bH.displayName=g5.displayName;const $5=h.forwardRef(({className:e,...t},n)=>a.jsx(v5,{ref:n,className:Me("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:a.jsx(ca,{className:"h-4 w-4"})}));$5.displayName=v5.displayName;const D5=h.forwardRef(({className:e,...t},n)=>a.jsx(h5,{ref:n,className:Me("text-sm font-semibold",e),...t}));D5.displayName=h5.displayName;const L5=h.forwardRef(({className:e,...t},n)=>a.jsx(m5,{ref:n,className:Me("text-sm opacity-90",e),...t}));L5.displayName=m5.displayName;function wH(){const{toasts:e}=S9();return a.jsxs(xH,{children:[e.map(function({id:t,title:n,description:r,action:s,...o}){return a.jsxs(I5,{...o,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(D5,{children:n}),r&&a.jsx(L5,{children:r})]}),s,a.jsx($5,{})]},t)}),a.jsx(M5,{})]})}var uP=["light","dark"],jH="(prefers-color-scheme: dark)",SH=h.createContext(void 0),NH={setTheme:e=>{},themes:[]},CH=()=>{var e;return(e=h.useContext(SH))!=null?e:NH};h.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:o,value:i,attrs:c,nonce:u})=>{let f=o==="system",m=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${c.map(j=>`'${j}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,p=s?uP.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",v=(j,y=!1,b=!0)=>{let S=i?i[j]:j,N=y?j+"|| ''":`'${S}'`,C="";return s&&b&&!y&&uP.includes(j)&&(C+=`d.style.colorScheme = '${j}';`),n==="class"?y||S?C+=`c.add(${N})`:C+="null":S&&(C+=`d[s](n,${N})`),C},x=e?`!function(){${m}${v(e)}}()`:r?`!function(){try{${m}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${f})){var t='${jH}',m=window.matchMedia(t);if(m.media!==t||m.matches){${v("dark")}}else{${v("light")}}}else if(e){${i?`var x=${JSON.stringify(i)};`:""}${v(i?"x[e]":"e",!0)}}${f?"":"else{"+v(o,!1,!1)+"}"}${p}}catch(e){}}()`:`!function(){try{${m}var e=localStorage.getItem('${t}');if(e){${i?`var x=${JSON.stringify(i)};`:""}${v(i?"x[e]":"e",!0)}}else{${v(o,!1,!1)};}${p}}catch(t){}}();`;return h.createElement("script",{nonce:u,dangerouslySetInnerHTML:{__html:x}})});var _H=e=>{switch(e){case"success":return EH;case"info":return RH;case"warning":return PH;case"error":return TH;default:return null}},kH=Array(12).fill(0),AH=({visible:e,className:t})=>J.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},J.createElement("div",{className:"sonner-spinner"},kH.map((n,r)=>J.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),EH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),PH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),RH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),TH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},J.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),OH=J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),J.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),MH=()=>{let[e,t]=J.useState(document.hidden);return J.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},ZS=1,IH=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,s=typeof e?.id=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:ZS++,o=this.toasts.find(c=>c.id===s),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(c=>c.id===s?(this.publish({...c,...e,id:s,title:n}),{...c,...e,id:s,dismissible:i,title:n}):c):this.addToast({title:n,...r,dismissible:i,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),s=n!==void 0,o,i=r.then(async u=>{if(o=["resolve",u],J.isValidElement(u))s=!1,this.create({id:n,type:"default",message:u});else if(DH(u)&&!u.ok){s=!1;let f=typeof t.error=="function"?await t.error(`HTTP error! status: ${u.status}`):t.error,m=typeof t.description=="function"?await t.description(`HTTP error! status: ${u.status}`):t.description;this.create({id:n,type:"error",message:f,description:m})}else if(t.success!==void 0){s=!1;let f=typeof t.success=="function"?await t.success(u):t.success,m=typeof t.description=="function"?await t.description(u):t.description;this.create({id:n,type:"success",message:f,description:m})}}).catch(async u=>{if(o=["reject",u],t.error!==void 0){s=!1;let f=typeof t.error=="function"?await t.error(u):t.error,m=typeof t.description=="function"?await t.description(u):t.description;this.create({id:n,type:"error",message:f,description:m})}}).finally(()=>{var u;s&&(this.dismiss(n),n=void 0),(u=t.finally)==null||u.call(t)}),c=()=>new Promise((u,f)=>i.then(()=>o[0]==="reject"?f(o[1]):u(o[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,t)=>{let n=t?.id||ZS++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},na=new IH,$H=(e,t)=>{let n=t?.id||ZS++;return na.addToast({title:e,...t,id:n}),n},DH=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",LH=$H,FH=()=>na.toasts,zH=()=>na.getActiveToasts();Object.assign(LH,{success:na.success,info:na.info,warning:na.warning,error:na.error,custom:na.custom,message:na.message,promise:na.promise,dismiss:na.dismiss,loading:na.loading},{getHistory:FH,getToasts:zH});function BH(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}BH(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
9
+ `);function Th(e){return e.label!==void 0}var qH=3,UH="32px",WH="16px",dP=4e3,HH=356,VH=14,KH=20,GH=200;function vs(...e){return e.filter(Boolean).join(" ")}function YH(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var XH=e=>{var t,n,r,s,o,i,c,u,f,m,p;let{invert:v,toast:x,unstyled:j,interacting:y,setHeights:b,visibleToasts:S,heights:N,index:C,toasts:k,expanded:A,removeToast:E,defaultRichColors:P,closeButton:T,style:$,cancelButtonStyle:Y,actionButtonStyle:H,className:F="",descriptionClassName:X="",duration:L,position:I,gap:M,loadingIcon:q,expandByDefault:G,classNames:O,icons:Q,closeButtonAriaLabel:B="Close toast",pauseWhenPageIsHidden:z}=e,[V,ee]=J.useState(null),[ae,ue]=J.useState(null),[se,xe]=J.useState(!1),[oe,de]=J.useState(!1),[De,me]=J.useState(!1),[ge,we]=J.useState(!1),[at,tt]=J.useState(!1),[it,At]=J.useState(0),[Ge,Ee]=J.useState(0),Re=J.useRef(x.duration||L||dP),Ze=J.useRef(null),ht=J.useRef(null),Ft=C===0,zt=C+1<=S,jt=x.type,rn=x.dismissible!==!1,an=x.className||"",qt=x.descriptionClassName||"",Zt=J.useMemo(()=>N.findIndex(ve=>ve.toastId===x.id)||0,[N,x.id]),sn=J.useMemo(()=>{var ve;return(ve=x.closeButton)!=null?ve:T},[x.closeButton,T]),ln=J.useMemo(()=>x.duration||L||dP,[x.duration,L]),_e=J.useRef(0),ze=J.useRef(0),Xe=J.useRef(0),kt=J.useRef(null),[vt,fe]=I.split("-"),Oe=J.useMemo(()=>N.reduce((ve,ke,Ce)=>Ce>=Zt?ve:ve+ke.height,0),[N,Zt]),Ve=MH(),U=x.invert||v,le=jt==="loading";ze.current=J.useMemo(()=>Zt*M+Oe,[Zt,Oe]),J.useEffect(()=>{Re.current=ln},[ln]),J.useEffect(()=>{xe(!0)},[]),J.useEffect(()=>{let ve=ht.current;if(ve){let ke=ve.getBoundingClientRect().height;return Ee(ke),b(Ce=>[{toastId:x.id,height:ke,position:x.position},...Ce]),()=>b(Ce=>Ce.filter(K=>K.toastId!==x.id))}},[b,x.id]),J.useLayoutEffect(()=>{if(!se)return;let ve=ht.current,ke=ve.style.height;ve.style.height="auto";let Ce=ve.getBoundingClientRect().height;ve.style.height=ke,Ee(Ce),b(K=>K.find(pe=>pe.toastId===x.id)?K.map(pe=>pe.toastId===x.id?{...pe,height:Ce}:pe):[{toastId:x.id,height:Ce,position:x.position},...K])},[se,x.title,x.description,b,x.id]);let W=J.useCallback(()=>{de(!0),At(ze.current),b(ve=>ve.filter(ke=>ke.toastId!==x.id)),setTimeout(()=>{E(x)},GH)},[x,E,b,ze]);J.useEffect(()=>{if(x.promise&&jt==="loading"||x.duration===1/0||x.type==="loading")return;let ve;return A||y||z&&Ve?(()=>{if(Xe.current<_e.current){let ke=new Date().getTime()-_e.current;Re.current=Re.current-ke}Xe.current=new Date().getTime()})():Re.current!==1/0&&(_e.current=new Date().getTime(),ve=setTimeout(()=>{var ke;(ke=x.onAutoClose)==null||ke.call(x,x),W()},Re.current)),()=>clearTimeout(ve)},[A,y,x,jt,z,Ve,W]),J.useEffect(()=>{x.delete&&W()},[W,x.delete]);function ye(){var ve,ke,Ce;return Q!=null&&Q.loading?J.createElement("div",{className:vs(O?.loader,(ve=x?.classNames)==null?void 0:ve.loader,"sonner-loader"),"data-visible":jt==="loading"},Q.loading):q?J.createElement("div",{className:vs(O?.loader,(ke=x?.classNames)==null?void 0:ke.loader,"sonner-loader"),"data-visible":jt==="loading"},q):J.createElement(AH,{className:vs(O?.loader,(Ce=x?.classNames)==null?void 0:Ce.loader),visible:jt==="loading"})}return J.createElement("li",{tabIndex:0,ref:ht,className:vs(F,an,O?.toast,(t=x?.classNames)==null?void 0:t.toast,O?.default,O?.[jt],(n=x?.classNames)==null?void 0:n[jt]),"data-sonner-toast":"","data-rich-colors":(r=x.richColors)!=null?r:P,"data-styled":!(x.jsx||x.unstyled||j),"data-mounted":se,"data-promise":!!x.promise,"data-swiped":at,"data-removed":oe,"data-visible":zt,"data-y-position":vt,"data-x-position":fe,"data-index":C,"data-front":Ft,"data-swiping":De,"data-dismissible":rn,"data-type":jt,"data-invert":U,"data-swipe-out":ge,"data-swipe-direction":ae,"data-expanded":!!(A||G&&se),style:{"--index":C,"--toasts-before":C,"--z-index":k.length-C,"--offset":`${oe?it:ze.current}px`,"--initial-height":G?"auto":`${Ge}px`,...$,...x.style},onDragEnd:()=>{me(!1),ee(null),kt.current=null},onPointerDown:ve=>{le||!rn||(Ze.current=new Date,At(ze.current),ve.target.setPointerCapture(ve.pointerId),ve.target.tagName!=="BUTTON"&&(me(!0),kt.current={x:ve.clientX,y:ve.clientY}))},onPointerUp:()=>{var ve,ke,Ce,K;if(ge||!rn)return;kt.current=null;let pe=Number(((ve=ht.current)==null?void 0:ve.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ae=Number(((ke=ht.current)==null?void 0:ke.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ke=new Date().getTime()-((Ce=Ze.current)==null?void 0:Ce.getTime()),te=V==="x"?pe:Ae,Le=Math.abs(te)/Ke;if(Math.abs(te)>=KH||Le>.11){At(ze.current),(K=x.onDismiss)==null||K.call(x,x),ue(V==="x"?pe>0?"right":"left":Ae>0?"down":"up"),W(),we(!0),tt(!1);return}me(!1),ee(null)},onPointerMove:ve=>{var ke,Ce,K,pe;if(!kt.current||!rn||((ke=window.getSelection())==null?void 0:ke.toString().length)>0)return;let Ae=ve.clientY-kt.current.y,Ke=ve.clientX-kt.current.x,te=(Ce=e.swipeDirections)!=null?Ce:YH(I);!V&&(Math.abs(Ke)>1||Math.abs(Ae)>1)&&ee(Math.abs(Ke)>Math.abs(Ae)?"x":"y");let Le={x:0,y:0};V==="y"?(te.includes("top")||te.includes("bottom"))&&(te.includes("top")&&Ae<0||te.includes("bottom")&&Ae>0)&&(Le.y=Ae):V==="x"&&(te.includes("left")||te.includes("right"))&&(te.includes("left")&&Ke<0||te.includes("right")&&Ke>0)&&(Le.x=Ke),(Math.abs(Le.x)>0||Math.abs(Le.y)>0)&&tt(!0),(K=ht.current)==null||K.style.setProperty("--swipe-amount-x",`${Le.x}px`),(pe=ht.current)==null||pe.style.setProperty("--swipe-amount-y",`${Le.y}px`)}},sn&&!x.jsx?J.createElement("button",{"aria-label":B,"data-disabled":le,"data-close-button":!0,onClick:le||!rn?()=>{}:()=>{var ve;W(),(ve=x.onDismiss)==null||ve.call(x,x)},className:vs(O?.closeButton,(s=x?.classNames)==null?void 0:s.closeButton)},(o=Q?.close)!=null?o:OH):null,x.jsx||h.isValidElement(x.title)?x.jsx?x.jsx:typeof x.title=="function"?x.title():x.title:J.createElement(J.Fragment,null,jt||x.icon||x.promise?J.createElement("div",{"data-icon":"",className:vs(O?.icon,(i=x?.classNames)==null?void 0:i.icon)},x.promise||x.type==="loading"&&!x.icon?x.icon||ye():null,x.type!=="loading"?x.icon||Q?.[jt]||_H(jt):null):null,J.createElement("div",{"data-content":"",className:vs(O?.content,(c=x?.classNames)==null?void 0:c.content)},J.createElement("div",{"data-title":"",className:vs(O?.title,(u=x?.classNames)==null?void 0:u.title)},typeof x.title=="function"?x.title():x.title),x.description?J.createElement("div",{"data-description":"",className:vs(X,qt,O?.description,(f=x?.classNames)==null?void 0:f.description)},typeof x.description=="function"?x.description():x.description):null),h.isValidElement(x.cancel)?x.cancel:x.cancel&&Th(x.cancel)?J.createElement("button",{"data-button":!0,"data-cancel":!0,style:x.cancelButtonStyle||Y,onClick:ve=>{var ke,Ce;Th(x.cancel)&&rn&&((Ce=(ke=x.cancel).onClick)==null||Ce.call(ke,ve),W())},className:vs(O?.cancelButton,(m=x?.classNames)==null?void 0:m.cancelButton)},x.cancel.label):null,h.isValidElement(x.action)?x.action:x.action&&Th(x.action)?J.createElement("button",{"data-button":!0,"data-action":!0,style:x.actionButtonStyle||H,onClick:ve=>{var ke,Ce;Th(x.action)&&((Ce=(ke=x.action).onClick)==null||Ce.call(ke,ve),!ve.defaultPrevented&&W())},className:vs(O?.actionButton,(p=x?.classNames)==null?void 0:p.actionButton)},x.action.label):null))};function fP(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function QH(e,t){let n={};return[e,t].forEach((r,s)=>{let o=s===1,i=o?"--mobile-offset":"--offset",c=o?WH:UH;function u(f){["top","right","bottom","left"].forEach(m=>{n[`${i}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?n[`${i}-${f}`]=c:n[`${i}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):u(c)}),n}var JH=h.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:o,closeButton:i,className:c,offset:u,mobileOffset:f,theme:m="light",richColors:p,duration:v,style:x,visibleToasts:j=qH,toastOptions:y,dir:b=fP(),gap:S=VH,loadingIcon:N,icons:C,containerAriaLabel:k="Notifications",pauseWhenPageIsHidden:A}=e,[E,P]=J.useState([]),T=J.useMemo(()=>Array.from(new Set([r].concat(E.filter(z=>z.position).map(z=>z.position)))),[E,r]),[$,Y]=J.useState([]),[H,F]=J.useState(!1),[X,L]=J.useState(!1),[I,M]=J.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=J.useRef(null),G=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),O=J.useRef(null),Q=J.useRef(!1),B=J.useCallback(z=>{P(V=>{var ee;return(ee=V.find(ae=>ae.id===z.id))!=null&&ee.delete||na.dismiss(z.id),V.filter(({id:ae})=>ae!==z.id)})},[]);return J.useEffect(()=>na.subscribe(z=>{if(z.dismiss){P(V=>V.map(ee=>ee.id===z.id?{...ee,delete:!0}:ee));return}setTimeout(()=>{GD.flushSync(()=>{P(V=>{let ee=V.findIndex(ae=>ae.id===z.id);return ee!==-1?[...V.slice(0,ee),{...V[ee],...z},...V.slice(ee+1)]:[z,...V]})})})}),[]),J.useEffect(()=>{if(m!=="system"){M(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light")),typeof window>"u")return;let z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:V})=>{M(V?"dark":"light")})}catch{z.addListener(({matches:ee})=>{try{M(ee?"dark":"light")}catch(ae){console.error(ae)}})}},[m]),J.useEffect(()=>{E.length<=1&&F(!1)},[E]),J.useEffect(()=>{let z=V=>{var ee,ae;s.every(ue=>V[ue]||V.code===ue)&&(F(!0),(ee=q.current)==null||ee.focus()),V.code==="Escape"&&(document.activeElement===q.current||(ae=q.current)!=null&&ae.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[s]),J.useEffect(()=>{if(q.current)return()=>{O.current&&(O.current.focus({preventScroll:!0}),O.current=null,Q.current=!1)}},[q.current]),J.createElement("section",{ref:t,"aria-label":`${k} ${G}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},T.map((z,V)=>{var ee;let[ae,ue]=z.split("-");return E.length?J.createElement("ol",{key:z,dir:b==="auto"?fP():b,tabIndex:-1,ref:q,className:c,"data-sonner-toaster":!0,"data-theme":I,"data-y-position":ae,"data-lifted":H&&E.length>1&&!o,"data-x-position":ue,style:{"--front-toast-height":`${((ee=$[0])==null?void 0:ee.height)||0}px`,"--width":`${HH}px`,"--gap":`${S}px`,...x,...QH(u,f)},onBlur:se=>{Q.current&&!se.currentTarget.contains(se.relatedTarget)&&(Q.current=!1,O.current&&(O.current.focus({preventScroll:!0}),O.current=null))},onFocus:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||Q.current||(Q.current=!0,O.current=se.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{X||F(!1)},onDragEnd:()=>F(!1),onPointerDown:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||L(!0)},onPointerUp:()=>L(!1)},E.filter(se=>!se.position&&V===0||se.position===z).map((se,xe)=>{var oe,de;return J.createElement(XH,{key:se.id,icons:C,index:xe,toast:se,defaultRichColors:p,duration:(oe=y?.duration)!=null?oe:v,className:y?.className,descriptionClassName:y?.descriptionClassName,invert:n,visibleToasts:j,closeButton:(de=y?.closeButton)!=null?de:i,interacting:X,position:z,style:y?.style,unstyled:y?.unstyled,classNames:y?.classNames,cancelButtonStyle:y?.cancelButtonStyle,actionButtonStyle:y?.actionButtonStyle,removeToast:B,toasts:E.filter(De=>De.position==se.position),heights:$.filter(De=>De.position==se.position),setHeights:Y,expandByDefault:o,gap:S,loadingIcon:N,expanded:H,pauseWhenPageIsHidden:A,swipeDirections:e.swipeDirections})})):null}))});const ZH=({...e})=>{const{theme:t="system"}=CH();return a.jsx(JH,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var eV=cC[" useId ".trim().toString()]||(()=>{}),tV=0;function fr(e){const[t,n]=h.useState(eV());return pr(()=>{n(r=>r??String(tV++))},[e]),e||(t?`radix-${t}`:"")}const nV=["top","right","bottom","left"],Ni=Math.min,wa=Math.max,vm=Math.round,Oh=Math.floor,Ks=e=>({x:e,y:e}),rV={left:"right",right:"left",bottom:"top",top:"bottom"},aV={start:"end",end:"start"};function e1(e,t,n){return wa(e,Ni(t,n))}function Oo(e,t){return typeof e=="function"?e(t):e}function Mo(e){return e.split("-")[0]}function _u(e){return e.split("-")[1]}function jC(e){return e==="x"?"y":"x"}function SC(e){return e==="y"?"height":"width"}const sV=new Set(["top","bottom"]);function Hs(e){return sV.has(Mo(e))?"y":"x"}function NC(e){return jC(Hs(e))}function oV(e,t,n){n===void 0&&(n=!1);const r=_u(e),s=NC(e),o=SC(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=xm(i)),[i,xm(i)]}function iV(e){const t=xm(e);return[t1(e),t,t1(t)]}function t1(e){return e.replace(/start|end/g,t=>aV[t])}const pP=["left","right"],hP=["right","left"],lV=["top","bottom"],cV=["bottom","top"];function uV(e,t,n){switch(e){case"top":case"bottom":return n?t?hP:pP:t?pP:hP;case"left":case"right":return t?lV:cV;default:return[]}}function dV(e,t,n,r){const s=_u(e);let o=uV(Mo(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(t1)))),o}function xm(e){return e.replace(/left|right|bottom|top/g,t=>rV[t])}function fV(e){return{top:0,right:0,bottom:0,left:0,...e}}function F5(e){return typeof e!="number"?fV(e):{top:e,right:e,bottom:e,left:e}}function ym(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function mP(e,t,n){let{reference:r,floating:s}=e;const o=Hs(t),i=NC(t),c=SC(i),u=Mo(t),f=o==="y",m=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,v=r[c]/2-s[c]/2;let x;switch(u){case"top":x={x:m,y:r.y-s.height};break;case"bottom":x={x:m,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:p};break;case"left":x={x:r.x-s.width,y:p};break;default:x={x:r.x,y:r.y}}switch(_u(t)){case"start":x[i]-=v*(n&&f?-1:1);break;case"end":x[i]+=v*(n&&f?-1:1);break}return x}async function pV(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:c,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:p="floating",altBoundary:v=!1,padding:x=0}=Oo(t,e),j=F5(x),b=c[v?p==="floating"?"reference":"floating":p],S=ym(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:f,rootBoundary:m,strategy:u})),N=p==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),k=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},A=ym(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:C,strategy:u}):N);return{top:(S.top-A.top+j.top)/k.y,bottom:(A.bottom-S.bottom+j.bottom)/k.y,left:(S.left-A.left+j.left)/k.x,right:(A.right-S.right+j.right)/k.x}}const hV=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,c=o.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:m,y:p}=mP(f,r,u),v=r,x={},j=0;for(let b=0;b<c.length;b++){var y;const{name:S,fn:N}=c[b],{x:C,y:k,data:A,reset:E}=await N({x:m,y:p,initialPlacement:r,placement:v,strategy:s,middlewareData:x,rects:f,platform:{...i,detectOverflow:(y=i.detectOverflow)!=null?y:pV},elements:{reference:e,floating:t}});m=C??m,p=k??p,x={...x,[S]:{...x[S],...A}},E&&j<=50&&(j++,typeof E=="object"&&(E.placement&&(v=E.placement),E.rects&&(f=E.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):E.rects),{x:m,y:p}=mP(f,v,u)),b=-1)}return{x:m,y:p,placement:v,strategy:s,middlewareData:x}},mV=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:c,middlewareData:u}=t,{element:f,padding:m=0}=Oo(e,t)||{};if(f==null)return{};const p=F5(m),v={x:n,y:r},x=NC(s),j=SC(x),y=await i.getDimensions(f),b=x==="y",S=b?"top":"left",N=b?"bottom":"right",C=b?"clientHeight":"clientWidth",k=o.reference[j]+o.reference[x]-v[x]-o.floating[j],A=v[x]-o.reference[x],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let P=E?E[C]:0;(!P||!await(i.isElement==null?void 0:i.isElement(E)))&&(P=c.floating[C]||o.floating[j]);const T=k/2-A/2,$=P/2-y[j]/2-1,Y=Ni(p[S],$),H=Ni(p[N],$),F=Y,X=P-y[j]-H,L=P/2-y[j]/2+T,I=e1(F,L,X),M=!u.arrow&&_u(s)!=null&&L!==I&&o.reference[j]/2-(L<F?Y:H)-y[j]/2<0,q=M?L<F?L-F:L-X:0;return{[x]:v[x]+q,data:{[x]:I,centerOffset:L-I-q,...M&&{alignmentOffset:q}},reset:M}}}),gV=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:c,platform:u,elements:f}=t,{mainAxis:m=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:y=!0,...b}=Oo(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const S=Mo(s),N=Hs(c),C=Mo(c)===c,k=await(u.isRTL==null?void 0:u.isRTL(f.floating)),A=v||(C||!y?[xm(c)]:iV(c)),E=j!=="none";!v&&E&&A.push(...dV(c,y,j,k));const P=[c,...A],T=await u.detectOverflow(t,b),$=[];let Y=((r=o.flip)==null?void 0:r.overflows)||[];if(m&&$.push(T[S]),p){const L=oV(s,i,k);$.push(T[L[0]],T[L[1]])}if(Y=[...Y,{placement:s,overflows:$}],!$.every(L=>L<=0)){var H,F;const L=(((H=o.flip)==null?void 0:H.index)||0)+1,I=P[L];if(I&&(!(p==="alignment"?N!==Hs(I):!1)||Y.every(G=>Hs(G.placement)===N?G.overflows[0]>0:!0)))return{data:{index:L,overflows:Y},reset:{placement:I}};let M=(F=Y.filter(q=>q.overflows[0]<=0).sort((q,G)=>q.overflows[1]-G.overflows[1])[0])==null?void 0:F.placement;if(!M)switch(x){case"bestFit":{var X;const q=(X=Y.filter(G=>{if(E){const O=Hs(G.placement);return O===N||O==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(O=>O>0).reduce((O,Q)=>O+Q,0)]).sort((G,O)=>G[1]-O[1])[0])==null?void 0:X[0];q&&(M=q);break}case"initialPlacement":M=c;break}if(s!==M)return{reset:{placement:M}}}return{}}}};function gP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vP(e){return nV.some(t=>e[t]>=0)}const vV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=Oo(e,t);switch(s){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),c=gP(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:vP(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),c=gP(i,n.floating);return{data:{escapedOffsets:c,escaped:vP(c)}}}default:return{}}}}},z5=new Set(["left","top"]);async function xV(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=Mo(n),c=_u(n),u=Hs(n)==="y",f=z5.has(i)?-1:1,m=o&&u?-1:1,p=Oo(t,e);let{mainAxis:v,crossAxis:x,alignmentAxis:j}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof j=="number"&&(x=c==="end"?j*-1:j),u?{x:x*m,y:v*f}:{x:v*f,y:x*m}}const yV=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:c}=t,u=await xV(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:o+u.y,data:{...u,placement:i}}}}},bV=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:u={fn:S=>{let{x:N,y:C}=S;return{x:N,y:C}}},...f}=Oo(e,t),m={x:n,y:r},p=await o.detectOverflow(t,f),v=Hs(Mo(s)),x=jC(v);let j=m[x],y=m[v];if(i){const S=x==="y"?"top":"left",N=x==="y"?"bottom":"right",C=j+p[S],k=j-p[N];j=e1(C,j,k)}if(c){const S=v==="y"?"top":"left",N=v==="y"?"bottom":"right",C=y+p[S],k=y-p[N];y=e1(C,y,k)}const b=u.fn({...t,[x]:j,[v]:y});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[x]:i,[v]:c}}}}}},wV=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:c=0,mainAxis:u=!0,crossAxis:f=!0}=Oo(e,t),m={x:n,y:r},p=Hs(s),v=jC(p);let x=m[v],j=m[p];const y=Oo(c,t),b=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(u){const C=v==="y"?"height":"width",k=o.reference[v]-o.floating[C]+b.mainAxis,A=o.reference[v]+o.reference[C]-b.mainAxis;x<k?x=k:x>A&&(x=A)}if(f){var S,N;const C=v==="y"?"width":"height",k=z5.has(Mo(s)),A=o.reference[p]-o.floating[C]+(k&&((S=i.offset)==null?void 0:S[p])||0)+(k?0:b.crossAxis),E=o.reference[p]+o.reference[C]+(k?0:((N=i.offset)==null?void 0:N[p])||0)-(k?b.crossAxis:0);j<A?j=A:j>E&&(j=E)}return{[v]:x,[p]:j}}}},jV=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:c}=t,{apply:u=()=>{},...f}=Oo(e,t),m=await i.detectOverflow(t,f),p=Mo(s),v=_u(s),x=Hs(s)==="y",{width:j,height:y}=o.floating;let b,S;p==="top"||p==="bottom"?(b=p,S=v===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(S=p,b=v==="end"?"top":"bottom");const N=y-m.top-m.bottom,C=j-m.left-m.right,k=Ni(y-m[b],N),A=Ni(j-m[S],C),E=!t.middlewareData.shift;let P=k,T=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=C),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=N),E&&!v){const Y=wa(m.left,0),H=wa(m.right,0),F=wa(m.top,0),X=wa(m.bottom,0);x?T=j-2*(Y!==0||H!==0?Y+H:wa(m.left,m.right)):P=y-2*(F!==0||X!==0?F+X:wa(m.top,m.bottom))}await u({...t,availableWidth:T,availableHeight:P});const $=await i.getDimensions(c.floating);return j!==$.width||y!==$.height?{reset:{rects:!0}}:{}}}};function qg(){return typeof window<"u"}function ku(e){return B5(e)?(e.nodeName||"").toLowerCase():"#document"}function Ca(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ro(e){var t;return(t=(B5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function B5(e){return qg()?e instanceof Node||e instanceof Ca(e).Node:!1}function Es(e){return qg()?e instanceof Element||e instanceof Ca(e).Element:!1}function Qs(e){return qg()?e instanceof HTMLElement||e instanceof Ca(e).HTMLElement:!1}function xP(e){return!qg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ca(e).ShadowRoot}const SV=new Set(["inline","contents"]);function ep(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Ps(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!SV.has(s)}const NV=new Set(["table","td","th"]);function CV(e){return NV.has(ku(e))}const _V=[":popover-open",":modal"];function Ug(e){return _V.some(t=>{try{return e.matches(t)}catch{return!1}})}const kV=["transform","translate","scale","rotate","perspective"],AV=["transform","translate","scale","rotate","perspective","filter"],EV=["paint","layout","strict","content"];function CC(e){const t=_C(),n=Es(e)?Ps(e):e;return kV.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||AV.some(r=>(n.willChange||"").includes(r))||EV.some(r=>(n.contain||"").includes(r))}function PV(e){let t=Ci(e);for(;Qs(t)&&!Gc(t);){if(CC(t))return t;if(Ug(t))return null;t=Ci(t)}return null}function _C(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const RV=new Set(["html","body","#document"]);function Gc(e){return RV.has(ku(e))}function Ps(e){return Ca(e).getComputedStyle(e)}function Wg(e){return Es(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ci(e){if(ku(e)==="html")return e;const t=e.assignedSlot||e.parentNode||xP(e)&&e.host||ro(e);return xP(t)?t.host:t}function q5(e){const t=Ci(e);return Gc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qs(t)&&ep(t)?t:q5(t)}function rf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=q5(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ca(s);if(o){const c=n1(i);return t.concat(i,i.visualViewport||[],ep(s)?s:[],c&&n?rf(c):[])}return t.concat(s,rf(s,[],n))}function n1(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function U5(e){const t=Ps(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Qs(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,c=vm(n)!==o||vm(r)!==i;return c&&(n=o,r=i),{width:n,height:r,$:c}}function kC(e){return Es(e)?e:e.contextElement}function Fc(e){const t=kC(e);if(!Qs(t))return Ks(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=U5(t);let i=(o?vm(n.width):n.width)/r,c=(o?vm(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const TV=Ks(0);function W5(e){const t=Ca(e);return!_C()||!t.visualViewport?TV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function OV(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ca(e)?!1:t}function wl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=kC(e);let i=Ks(1);t&&(r?Es(r)&&(i=Fc(r)):i=Fc(e));const c=OV(o,n,r)?W5(o):Ks(0);let u=(s.left+c.x)/i.x,f=(s.top+c.y)/i.y,m=s.width/i.x,p=s.height/i.y;if(o){const v=Ca(o),x=r&&Es(r)?Ca(r):r;let j=v,y=n1(j);for(;y&&r&&x!==j;){const b=Fc(y),S=y.getBoundingClientRect(),N=Ps(y),C=S.left+(y.clientLeft+parseFloat(N.paddingLeft))*b.x,k=S.top+(y.clientTop+parseFloat(N.paddingTop))*b.y;u*=b.x,f*=b.y,m*=b.x,p*=b.y,u+=C,f+=k,j=Ca(y),y=n1(j)}}return ym({width:m,height:p,x:u,y:f})}function Hg(e,t){const n=Wg(e).scrollLeft;return t?t.left+n:wl(ro(e)).left+n}function H5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Hg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function MV(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=ro(r),c=t?Ug(t.floating):!1;if(r===i||c&&o)return n;let u={scrollLeft:0,scrollTop:0},f=Ks(1);const m=Ks(0),p=Qs(r);if((p||!p&&!o)&&((ku(r)!=="body"||ep(i))&&(u=Wg(r)),Qs(r))){const x=wl(r);f=Fc(r),m.x=x.x+r.clientLeft,m.y=x.y+r.clientTop}const v=i&&!p&&!o?H5(i,u):Ks(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+m.x+v.x,y:n.y*f.y-u.scrollTop*f.y+m.y+v.y}}function IV(e){return Array.from(e.getClientRects())}function $V(e){const t=ro(e),n=Wg(e),r=e.ownerDocument.body,s=wa(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=wa(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Hg(e);const c=-n.scrollTop;return Ps(r).direction==="rtl"&&(i+=wa(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:c}}const yP=25;function DV(e,t){const n=Ca(e),r=ro(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,c=0,u=0;if(s){o=s.width,i=s.height;const m=_C();(!m||m&&t==="fixed")&&(c=s.offsetLeft,u=s.offsetTop)}const f=Hg(r);if(f<=0){const m=r.ownerDocument,p=m.body,v=getComputedStyle(p),x=m.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,j=Math.abs(r.clientWidth-p.clientWidth-x);j<=yP&&(o-=j)}else f<=yP&&(o+=f);return{width:o,height:i,x:c,y:u}}const LV=new Set(["absolute","fixed"]);function FV(e,t){const n=wl(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Qs(e)?Fc(e):Ks(1),i=e.clientWidth*o.x,c=e.clientHeight*o.y,u=s*o.x,f=r*o.y;return{width:i,height:c,x:u,y:f}}function bP(e,t,n){let r;if(t==="viewport")r=DV(e,n);else if(t==="document")r=$V(ro(e));else if(Es(t))r=FV(t,n);else{const s=W5(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ym(r)}function V5(e,t){const n=Ci(e);return n===t||!Es(n)||Gc(n)?!1:Ps(n).position==="fixed"||V5(n,t)}function zV(e,t){const n=t.get(e);if(n)return n;let r=rf(e,[],!1).filter(c=>Es(c)&&ku(c)!=="body"),s=null;const o=Ps(e).position==="fixed";let i=o?Ci(e):e;for(;Es(i)&&!Gc(i);){const c=Ps(i),u=CC(i);!u&&c.position==="fixed"&&(s=null),(o?!u&&!s:!u&&c.position==="static"&&!!s&&LV.has(s.position)||ep(i)&&!u&&V5(e,i))?r=r.filter(m=>m!==i):s=c,i=Ci(i)}return t.set(e,r),r}function BV(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Ug(t)?[]:zV(t,this._c):[].concat(n),r],c=i[0],u=i.reduce((f,m)=>{const p=bP(t,m,s);return f.top=wa(p.top,f.top),f.right=Ni(p.right,f.right),f.bottom=Ni(p.bottom,f.bottom),f.left=wa(p.left,f.left),f},bP(t,c,s));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function qV(e){const{width:t,height:n}=U5(e);return{width:t,height:n}}function UV(e,t,n){const r=Qs(t),s=ro(t),o=n==="fixed",i=wl(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const u=Ks(0);function f(){u.x=Hg(s)}if(r||!r&&!o)if((ku(t)!=="body"||ep(s))&&(c=Wg(t)),r){const x=wl(t,!0,o,t);u.x=x.x+t.clientLeft,u.y=x.y+t.clientTop}else s&&f();o&&!r&&s&&f();const m=s&&!r&&!o?H5(s,c):Ks(0),p=i.left+c.scrollLeft-u.x-m.x,v=i.top+c.scrollTop-u.y-m.y;return{x:p,y:v,width:i.width,height:i.height}}function nb(e){return Ps(e).position==="static"}function wP(e,t){if(!Qs(e)||Ps(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ro(e)===n&&(n=n.ownerDocument.body),n}function K5(e,t){const n=Ca(e);if(Ug(e))return n;if(!Qs(e)){let s=Ci(e);for(;s&&!Gc(s);){if(Es(s)&&!nb(s))return s;s=Ci(s)}return n}let r=wP(e,t);for(;r&&CV(r)&&nb(r);)r=wP(r,t);return r&&Gc(r)&&nb(r)&&!CC(r)?n:r||PV(e)||n}const WV=async function(e){const t=this.getOffsetParent||K5,n=this.getDimensions,r=await n(e.floating);return{reference:UV(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function HV(e){return Ps(e).direction==="rtl"}const VV={convertOffsetParentRelativeRectToViewportRelativeRect:MV,getDocumentElement:ro,getClippingRect:BV,getOffsetParent:K5,getElementRects:WV,getClientRects:IV,getDimensions:qV,getScale:Fc,isElement:Es,isRTL:HV};function G5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function KV(e,t){let n=null,r;const s=ro(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),o();const f=e.getBoundingClientRect(),{left:m,top:p,width:v,height:x}=f;if(c||t(),!v||!x)return;const j=Oh(p),y=Oh(s.clientWidth-(m+v)),b=Oh(s.clientHeight-(p+x)),S=Oh(m),C={rootMargin:-j+"px "+-y+"px "+-b+"px "+-S+"px",threshold:wa(0,Ni(1,u))||1};let k=!0;function A(E){const P=E[0].intersectionRatio;if(P!==u){if(!k)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!G5(f,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(A,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,C)}n.observe(e)}return i(!0),o}function GV(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=kC(e),m=s||o?[...f?rf(f):[],...rf(t)]:[];m.forEach(S=>{s&&S.addEventListener("scroll",n,{passive:!0}),o&&S.addEventListener("resize",n)});const p=f&&c?KV(f,n):null;let v=-1,x=null;i&&(x=new ResizeObserver(S=>{let[N]=S;N&&N.target===f&&x&&(x.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var C;(C=x)==null||C.observe(t)})),n()}),f&&!u&&x.observe(f),x.observe(t));let j,y=u?wl(e):null;u&&b();function b(){const S=wl(e);y&&!G5(y,S)&&n(),y=S,j=requestAnimationFrame(b)}return n(),()=>{var S;m.forEach(N=>{s&&N.removeEventListener("scroll",n),o&&N.removeEventListener("resize",n)}),p?.(),(S=x)==null||S.disconnect(),x=null,u&&cancelAnimationFrame(j)}}const YV=yV,XV=bV,QV=gV,JV=jV,ZV=vV,jP=mV,eK=wV,tK=(e,t,n)=>{const r=new Map,s={platform:VV,...n},o={...s.platform,_c:r};return hV(e,t,{...s,platform:o})};var nK=typeof document<"u",rK=function(){},om=nK?h.useLayoutEffect:rK;function bm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bm(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!bm(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Y5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function SP(e,t){const n=Y5(e);return Math.round(t*n)/n}function rb(e){const t=h.useRef(e);return om(()=>{t.current=e}),t}function aK(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:c=!0,whileElementsMounted:u,open:f}=e,[m,p]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,x]=h.useState(r);bm(v,r)||x(r);const[j,y]=h.useState(null),[b,S]=h.useState(null),N=h.useCallback(G=>{G!==E.current&&(E.current=G,y(G))},[]),C=h.useCallback(G=>{G!==P.current&&(P.current=G,S(G))},[]),k=o||j,A=i||b,E=h.useRef(null),P=h.useRef(null),T=h.useRef(m),$=u!=null,Y=rb(u),H=rb(s),F=rb(f),X=h.useCallback(()=>{if(!E.current||!P.current)return;const G={placement:t,strategy:n,middleware:v};H.current&&(G.platform=H.current),tK(E.current,P.current,G).then(O=>{const Q={...O,isPositioned:F.current!==!1};L.current&&!bm(T.current,Q)&&(T.current=Q,Nu.flushSync(()=>{p(Q)}))})},[v,t,n,H,F]);om(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,p(G=>({...G,isPositioned:!1})))},[f]);const L=h.useRef(!1);om(()=>(L.current=!0,()=>{L.current=!1}),[]),om(()=>{if(k&&(E.current=k),A&&(P.current=A),k&&A){if(Y.current)return Y.current(k,A,X);X()}},[k,A,X,Y,$]);const I=h.useMemo(()=>({reference:E,floating:P,setReference:N,setFloating:C}),[N,C]),M=h.useMemo(()=>({reference:k,floating:A}),[k,A]),q=h.useMemo(()=>{const G={position:n,left:0,top:0};if(!M.floating)return G;const O=SP(M.floating,m.x),Q=SP(M.floating,m.y);return c?{...G,transform:"translate("+O+"px, "+Q+"px)",...Y5(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:Q}},[n,c,M.floating,m.x,m.y]);return h.useMemo(()=>({...m,update:X,refs:I,elements:M,floatingStyles:q}),[m,X,I,M,q])}const sK=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?jP({element:r.current,padding:s}).fn(n):{}:r?jP({element:r,padding:s}).fn(n):{}}}},oK=(e,t)=>({...YV(e),options:[e,t]}),iK=(e,t)=>({...XV(e),options:[e,t]}),lK=(e,t)=>({...eK(e),options:[e,t]}),cK=(e,t)=>({...QV(e),options:[e,t]}),uK=(e,t)=>({...JV(e),options:[e,t]}),dK=(e,t)=>({...ZV(e),options:[e,t]}),fK=(e,t)=>({...sK(e),options:[e,t]});var pK="Arrow",X5=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return a.jsx(lt.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});X5.displayName=pK;var hK=X5;function Vg(e){const[t,n]=h.useState(void 0);return pr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,c;if("borderBoxSize"in o){const u=o.borderBoxSize,f=Array.isArray(u)?u[0]:u;i=f.inlineSize,c=f.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var AC="Popper",[Q5,Ei]=kr(AC),[mK,J5]=Q5(AC),Z5=e=>{const{__scopePopper:t,children:n}=e,[r,s]=h.useState(null);return a.jsx(mK,{scope:t,anchor:r,onAnchorChange:s,children:n})};Z5.displayName=AC;var e3="PopperAnchor",t3=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=J5(e3,n),i=h.useRef(null),c=Ot(t,i),u=h.useRef(null);return h.useEffect(()=>{const f=u.current;u.current=r?.current||i.current,f!==u.current&&o.onAnchorChange(u.current)}),r?null:a.jsx(lt.div,{...s,ref:c})});t3.displayName=e3;var EC="PopperContent",[gK,vK]=Q5(EC),n3=h.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:x="optimized",onPlaced:j,...y}=e,b=J5(EC,n),[S,N]=h.useState(null),C=Ot(t,se=>N(se)),[k,A]=h.useState(null),E=Vg(k),P=E?.width??0,T=E?.height??0,$=r+(o!=="center"?"-"+o:""),Y=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},H=Array.isArray(f)?f:[f],F=H.length>0,X={padding:Y,boundary:H.filter(yK),altBoundary:F},{refs:L,floatingStyles:I,placement:M,isPositioned:q,middlewareData:G}=aK({strategy:"fixed",placement:$,whileElementsMounted:(...se)=>GV(...se,{animationFrame:x==="always"}),elements:{reference:b.anchor},middleware:[oK({mainAxis:s+T,alignmentAxis:i}),u&&iK({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?lK():void 0,...X}),u&&cK({...X}),uK({...X,apply:({elements:se,rects:xe,availableWidth:oe,availableHeight:de})=>{const{width:De,height:me}=xe.reference,ge=se.floating.style;ge.setProperty("--radix-popper-available-width",`${oe}px`),ge.setProperty("--radix-popper-available-height",`${de}px`),ge.setProperty("--radix-popper-anchor-width",`${De}px`),ge.setProperty("--radix-popper-anchor-height",`${me}px`)}}),k&&fK({element:k,padding:c}),bK({arrowWidth:P,arrowHeight:T}),v&&dK({strategy:"referenceHidden",...X})]}),[O,Q]=s3(M),B=Jn(j);pr(()=>{q&&B?.()},[q,B]);const z=G.arrow?.x,V=G.arrow?.y,ee=G.arrow?.centerOffset!==0,[ae,ue]=h.useState();return pr(()=>{S&&ue(window.getComputedStyle(S).zIndex)},[S]),a.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:q?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[G.transformOrigin?.x,G.transformOrigin?.y].join(" "),...G.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(gK,{scope:n,placedSide:O,onArrowChange:A,arrowX:z,arrowY:V,shouldHideArrow:ee,children:a.jsx(lt.div,{"data-side":O,"data-align":Q,...y,ref:C,style:{...y.style,animation:q?void 0:"none"}})})})});n3.displayName=EC;var r3="PopperArrow",xK={top:"bottom",right:"left",bottom:"top",left:"right"},a3=h.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=vK(r3,r),i=xK[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(hK,{...s,ref:n,style:{...s.style,display:"block"}})})});a3.displayName=r3;function yK(e){return e!==null}var bK=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:s}=t,i=s.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[f,m]=s3(n),p={start:"0%",center:"50%",end:"100%"}[m],v=(s.arrow?.x??0)+c/2,x=(s.arrow?.y??0)+u/2;let j="",y="";return f==="bottom"?(j=i?p:`${v}px`,y=`${-u}px`):f==="top"?(j=i?p:`${v}px`,y=`${r.floating.height+u}px`):f==="right"?(j=`${-u}px`,y=i?p:`${x}px`):f==="left"&&(j=`${r.floating.width+u}px`,y=i?p:`${x}px`),{data:{x:j,y}}}});function s3(e){const[t,n="center"]=e.split("-");return[t,n]}var Kg=Z5,tp=t3,Gg=n3,Yg=a3,wK=Symbol("radix.slottable");function jK(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=wK,t}var[Xg]=kr("Tooltip",[Ei]),Qg=Ei(),o3="TooltipProvider",SK=700,r1="tooltip.open",[NK,PC]=Xg(o3),i3=e=>{const{__scopeTooltip:t,delayDuration:n=SK,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,i=h.useRef(!0),c=h.useRef(!1),u=h.useRef(0);return h.useEffect(()=>{const f=u.current;return()=>window.clearTimeout(f)},[]),a.jsx(NK,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(u.current),i.current=!1},[]),onClose:h.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:h.useCallback(f=>{c.current=f},[]),disableHoverableContent:s,children:o})};i3.displayName=o3;var af="Tooltip",[CK,np]=Xg(af),l3=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:i,delayDuration:c}=e,u=PC(af,e.__scopeTooltip),f=Qg(t),[m,p]=h.useState(null),v=fr(),x=h.useRef(0),j=i??u.disableHoverableContent,y=c??u.delayDuration,b=h.useRef(!1),[S,N]=Aa({prop:r,defaultProp:s??!1,onChange:P=>{P?(u.onOpen(),document.dispatchEvent(new CustomEvent(r1))):u.onClose(),o?.(P)},caller:af}),C=h.useMemo(()=>S?b.current?"delayed-open":"instant-open":"closed",[S]),k=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,b.current=!1,N(!0)},[N]),A=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),E=h.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{b.current=!0,N(!0),x.current=0},y)},[y,N]);return h.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),a.jsx(Kg,{...f,children:a.jsx(CK,{scope:t,contentId:v,open:S,stateAttribute:C,trigger:m,onTriggerChange:p,onTriggerEnter:h.useCallback(()=>{u.isOpenDelayedRef.current?E():k()},[u.isOpenDelayedRef,E,k]),onTriggerLeave:h.useCallback(()=>{j?A():(window.clearTimeout(x.current),x.current=0)},[A,j]),onOpen:k,onClose:A,disableHoverableContent:j,children:n})})};l3.displayName=af;var a1="TooltipTrigger",c3=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=np(a1,n),o=PC(a1,n),i=Qg(n),c=h.useRef(null),u=Ot(t,c,s.onTriggerChange),f=h.useRef(!1),m=h.useRef(!1),p=h.useCallback(()=>f.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(tp,{asChild:!0,...i,children:a.jsx(lt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:u,onPointerMove:Ue(e.onPointerMove,v=>{v.pointerType!=="touch"&&!m.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ue(e.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:Ue(e.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Ue(e.onFocus,()=>{f.current||s.onOpen()}),onBlur:Ue(e.onBlur,s.onClose),onClick:Ue(e.onClick,s.onClose)})})});c3.displayName=a1;var RC="TooltipPortal",[_K,kK]=Xg(RC,{forceMount:void 0}),u3=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=np(RC,t);return a.jsx(_K,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(Fl,{asChild:!0,container:s,children:r})})})};u3.displayName=RC;var Yc="TooltipContent",d3=h.forwardRef((e,t)=>{const n=kK(Yc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,i=np(Yc,e.__scopeTooltip);return a.jsx(ar,{present:r||i.open,children:i.disableHoverableContent?a.jsx(f3,{side:s,...o,ref:t}):a.jsx(AK,{side:s,...o,ref:t})})}),AK=h.forwardRef((e,t)=>{const n=np(Yc,e.__scopeTooltip),r=PC(Yc,e.__scopeTooltip),s=h.useRef(null),o=Ot(t,s),[i,c]=h.useState(null),{trigger:u,onClose:f}=n,m=s.current,{onPointerInTransitChange:p}=r,v=h.useCallback(()=>{c(null),p(!1)},[p]),x=h.useCallback((j,y)=>{const b=j.currentTarget,S={x:j.clientX,y:j.clientY},N=OK(S,b.getBoundingClientRect()),C=MK(S,N),k=IK(y.getBoundingClientRect()),A=DK([...C,...k]);c(A),p(!0)},[p]);return h.useEffect(()=>()=>v(),[v]),h.useEffect(()=>{if(u&&m){const j=b=>x(b,m),y=b=>x(b,u);return u.addEventListener("pointerleave",j),m.addEventListener("pointerleave",y),()=>{u.removeEventListener("pointerleave",j),m.removeEventListener("pointerleave",y)}}},[u,m,x,v]),h.useEffect(()=>{if(i){const j=y=>{const b=y.target,S={x:y.clientX,y:y.clientY},N=u?.contains(b)||m?.contains(b),C=!$K(S,i);N?v():C&&(v(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[u,m,i,f,v]),a.jsx(f3,{...e,ref:o})}),[EK,PK]=Xg(af,{isInside:!1}),RK=jK("TooltipContent"),f3=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...c}=e,u=np(Yc,n),f=Qg(n),{onClose:m}=u;return h.useEffect(()=>(document.addEventListener(r1,m),()=>document.removeEventListener(r1,m)),[m]),h.useEffect(()=>{if(u.trigger){const p=v=>{v.target?.contains(u.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[u.trigger,m]),a.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(Gg,{"data-state":u.stateAttribute,...f,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(RK,{children:r}),a.jsx(EK,{scope:n,isInside:!0,children:a.jsx(tW,{id:u.contentId,role:"tooltip",children:s||r})})]})})});d3.displayName=Yc;var p3="TooltipArrow",TK=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Qg(n);return PK(p3,n).isInside?null:a.jsx(Yg,{...s,...r,ref:t})});TK.displayName=p3;function OK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function MK(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function IK(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function $K(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const c=t[o],u=t[i],f=c.x,m=c.y,p=u.x,v=u.y;m>r!=v>r&&n<(p-f)*(r-m)/(v-m)+f&&(s=!s)}return s}function DK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),LK(t)}function LK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],i=n[n.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var FK=i3,zK=l3,BK=c3,qK=u3,h3=d3;const Js=FK,Zs=zK,eo=BK,Rs=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(qK,{children:a.jsx(h3,{ref:r,sideOffset:t,className:Me("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",e),...n})}));Rs.displayName=h3.displayName;var Jg=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},UK=class extends Jg{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},m3=new UK,WK={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},HK=class{#e=WK;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},s1=new HK;function VK(e){setTimeout(e,0)}var KK=typeof window>"u"||"Deno"in globalThis;function bs(){}function GK(e,t){return typeof e=="function"?e(t):e}function YK(e){return typeof e=="number"&&e>=0&&e!==1/0}function XK(e,t){return Math.max(e+(t||0)-Date.now(),0)}function o1(e,t){return typeof e=="function"?e(t):e}function QK(e,t){return typeof e=="function"?e(t):e}function NP(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:i,stale:c}=e;if(i){if(r){if(t.queryHash!==TC(i,t.options))return!1}else if(!of(t.queryKey,i))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||s&&s!==t.state.fetchStatus||o&&!o(t))}function CP(e,t){const{exact:n,status:r,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(sf(t.options.mutationKey)!==sf(o))return!1}else if(!of(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function TC(e,t){return(t?.queryKeyHashFn||sf)(e)}function sf(e){return JSON.stringify(e,(t,n)=>i1(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function of(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>of(e[n],t[n])):!1}var JK=Object.prototype.hasOwnProperty;function g3(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=_P(e)&&_P(t);if(!r&&!(i1(e)&&i1(t)))return t;const o=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),c=i.length,u=r?new Array(c):{};let f=0;for(let m=0;m<c;m++){const p=r?m:i[m],v=e[p],x=t[p];if(v===x){u[p]=v,(r?m<o:JK.call(e,p))&&f++;continue}if(v===null||x===null||typeof v!="object"||typeof x!="object"){u[p]=x;continue}const j=g3(v,x,n+1);u[p]=j,j===v&&f++}return o===c&&f===o?e:u}function _P(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function i1(e){if(!kP(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!kP(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function kP(e){return Object.prototype.toString.call(e)==="[object Object]"}function ZK(e){return new Promise(t=>{s1.setTimeout(t,e)})}function eG(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?g3(e,t):t}function tG(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function nG(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var OC=Symbol();function v3(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===OC?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rG(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var x3=(()=>{let e=()=>KK;return{isServer(){return e()},setIsServer(t){e=t}}})();function aG(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var sG=VK;function oG(){let e=[],t=0,n=c=>{c()},r=c=>{c()},s=sG;const o=c=>{t?e.push(c):s(()=>{n(c)})},i=()=>{const c=e;e=[],c.length&&s(()=>{r(()=>{c.forEach(u=>{n(u)})})})};return{batch:c=>{let u;t++;try{u=c()}finally{t--,t||i()}return u},batchCalls:c=>(...u)=>{o(()=>{c(...u)})},schedule:o,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{s=c}}}var Fr=oG(),iG=class extends Jg{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},wm=new iG;function lG(e){return Math.min(1e3*2**e,3e4)}function y3(e){return(e??"online")==="online"?wm.isOnline():!0}var l1=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function b3(e){let t=!1,n=0,r;const s=aG(),o=()=>s.status!=="pending",i=y=>{if(!o()){const b=new l1(y);v(b),e.onCancel?.(b)}},c=()=>{t=!0},u=()=>{t=!1},f=()=>m3.isFocused()&&(e.networkMode==="always"||wm.isOnline())&&e.canRun(),m=()=>y3(e.networkMode)&&e.canRun(),p=y=>{o()||(r?.(),s.resolve(y))},v=y=>{o()||(r?.(),s.reject(y))},x=()=>new Promise(y=>{r=b=>{(o()||f())&&y(b)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),j=()=>{if(o())return;let y;const b=n===0?e.initialPromise:void 0;try{y=b??e.fn()}catch(S){y=Promise.reject(S)}Promise.resolve(y).then(p).catch(S=>{if(o())return;const N=e.retry??(x3.isServer()?0:3),C=e.retryDelay??lG,k=typeof C=="function"?C(n,S):C,A=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,S);if(t||!A){v(S);return}n++,e.onFail?.(n,S),ZK(k).then(()=>f()?void 0:x()).then(()=>{t?v(S):j()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(r?.(),s),cancelRetry:c,continueRetry:u,canStart:m,start:()=>(m()?j():x().then(j),s)}}var w3=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),YK(this.gcTime)&&(this.#e=s1.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(x3.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(s1.clearTimeout(this.#e),this.#e=void 0)}};function cG(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let c={pages:[],pageParams:[]},u=0;const f=async()=>{let m=!1;const p=j=>{rG(j,()=>t.signal,()=>m=!0)},v=v3(t.options,t.fetchOptions),x=async(j,y,b)=>{if(m)return Promise.reject(t.signal.reason);if(y==null&&j.pages.length)return Promise.resolve(j);const N=(()=>{const E={client:t.client,queryKey:t.queryKey,pageParam:y,direction:b?"backward":"forward",meta:t.options.meta};return p(E),E})(),C=await v(N),{maxPages:k}=t.options,A=b?nG:tG;return{pages:A(j.pages,C,k),pageParams:A(j.pageParams,y,k)}};if(s&&o.length){const j=s==="backward",y=j?uG:AP,b={pages:o,pageParams:i},S=y(r,b);c=await x(b,S,j)}else{const j=e??o.length;do{const y=u===0?i[0]??r.initialPageParam:AP(r,c);if(u>0&&y==null)break;c=await x(c,y),u++}while(u<j)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=f}}}function AP(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function uG(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var dG=class extends w3{#e;#t;#n;#a;#s;#r;#l;#o;constructor(e){super(),this.#o=!1,this.#l=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#a=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=PP(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#l,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=PP(this.options);t.data!==void 0&&(this.setState(EP(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(e,t){const n=eG(this.state.data,e,this.options);return this.#i({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#i({type:"setState",state:e})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(bs).catch(bs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>QK(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===OC||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>o1(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!XK(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o||this.#c()?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const u=this.observers.find(f=>f.options.queryFn);u&&this.setOptions(u.options)}const n=new AbortController,r=u=>{Object.defineProperty(u,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const u=v3(this.options,t),m=(()=>{const p={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(p),p})();return this.#o=!1,this.options.persister?this.options.persister(u,m,this):u(m)},i=(()=>{const u={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return r(u),u})();(this.#e==="infinite"?cG(this.options.pages):this.options.behavior)?.onFetch(i,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#i({type:"fetch",meta:i.fetchOptions?.meta}),this.#r=b3({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:u=>{u instanceof l1&&u.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(u,f)=>{this.#i({type:"failed",failureCount:u,error:f})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0});try{const u=await this.#r.start();if(u===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(u),this.#a.config.onSuccess?.(u,this),this.#a.config.onSettled?.(u,this.state.error,this),u}catch(u){if(u instanceof l1){if(u.silent)return this.#r.promise;if(u.revert){if(this.state.data===void 0)throw u;return this.state.data}}throw this.#i({type:"error",error:u}),this.#a.config.onError?.(u,this),this.#a.config.onSettled?.(this.state.data,u,this),u}finally{this.scheduleGc()}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...fG(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...EP(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),Fr.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:e})})}};function fG(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:y3(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function EP(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function PP(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var pG=class extends w3{#e;#t;#n;#a;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||hG(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#s({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=b3({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,i)=>{this.#s({type:"failed",failureCount:o,error:i})},onPause:()=>{this.#s({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#a.canStart();try{if(r)t();else{this.#s({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const i=await this.options.onMutate?.(e,n);i!==this.state.context&&this.#s({type:"pending",context:i,variables:e,isPaused:s})}const o=await this.#a.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#s({type:"success",data:o}),o}catch(o){try{await this.#n.config.onError?.(o,e,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onError?.(o,e,this.state.context,n)}catch(i){Promise.reject(i)}try{await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n)}catch(i){Promise.reject(i)}try{await this.options.onSettled?.(void 0,o,e,this.state.context,n)}catch(i){Promise.reject(i)}throw this.#s({type:"error",error:o}),o}finally{this.#n.runNext(this)}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Fr.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function hG(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var mG=class extends Jg{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new pG({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Mh(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Mh(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Mh(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Mh(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Fr.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>CP(t,n))}findAll(e={}){return this.getAll().filter(t=>CP(e,t))}notify(e){Fr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Fr.batch(()=>Promise.all(e.map(t=>t.continue().catch(bs))))}};function Mh(e){return e.options.scope?.id}var gG=class extends Jg{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??TC(r,t);let o=this.get(s);return o||(o=new dG({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Fr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>NP(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>NP(e,n)):t}notify(e){Fr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Fr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vG=class{#e;#t;#n;#a;#s;#r;#l;#o;constructor(e={}){this.#e=e.queryCache||new gG,this.#t=e.mutationCache||new mG,this.#n=e.defaultOptions||{},this.#a=new Map,this.#s=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#l=m3.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=wm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#l?.(),this.#l=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(o1(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(r.queryHash)?.state.data,i=GK(t,o);if(i!==void 0)return this.#e.build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Fr.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;Fr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return Fr.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fr.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(bs).catch(bs)}invalidateQueries(e,t={}){return Fr.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Fr.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(bs)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(bs)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(o1(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bs).catch(bs)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bs).catch(bs)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return wm.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#a.set(sf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#a.values()],n={};return t.forEach(r=>{of(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#s.set(sf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(r=>{of(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=TC(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===OC&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},xG=h.createContext(void 0),yG=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(xG.Provider,{value:e,children:t}));var MC=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,j3=/^[\\/]{2}/;function bG(e,t){return t+e.replace(/\\/g,"/")}var RP="popstate";function TP(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function wG(e={}){function t(r,s){let o=s.state?.masked,{pathname:i,search:c,hash:u}=o||r.location;return c1("",{pathname:i,search:c,hash:u},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:lf(s)}return SG(t,n,null,e)}function Fn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Qa(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function jG(){return Math.random().toString(36).substring(2,10)}function OP(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function c1(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Au(t):t,state:n,key:t&&t.key||r||jG(),mask:s}}function lf({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Au(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function SG(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,c="POP",u=null,f=m();f==null&&(f=0,i.replaceState({...i.state,idx:f},""));function m(){return(i.state||{idx:null}).idx}function p(){c="POP";let b=m(),S=b==null?null:b-f;f=b,u&&u({action:c,location:y.location,delta:S})}function v(b,S){c="PUSH";let N=TP(b)?b:c1(y.location,b,S);f=m()+1;let C=OP(N,f),k=y.createHref(N.mask||N);try{i.pushState(C,"",k)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;s.location.assign(k)}o&&u&&u({action:c,location:y.location,delta:1})}function x(b,S){c="REPLACE";let N=TP(b)?b:c1(y.location,b,S);f=m();let C=OP(N,f),k=y.createHref(N.mask||N);i.replaceState(C,"",k),o&&u&&u({action:c,location:y.location,delta:0})}function j(b){return NG(s,b)}let y={get action(){return c},get location(){return e(s,i)},listen(b){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(RP,p),u=b,()=>{s.removeEventListener(RP,p),u=null}},createHref(b){return t(s,b)},createURL:j,encodeLocation(b){let S=j(b);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:v,replace:x,go(b){return i.go(b)}};return y}function NG(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Fn(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:lf(t);return s=s.replace(/ $/,"%20"),!n&&j3.test(s)&&(s=r+s),new URL(s,r)}function S3(e,t,n="/"){return CG(e,t,n,!1)}function CG(e,t,n,r,s){let o=typeof t=="string"?Au(t):t,i=Io(o.pathname||"/",n);if(i==null)return null;let c=_G(e),u=null,f=DG(i);for(let m=0;u==null&&m<c.length;++m)u=$G(c[m],f,r);return u}function _G(e){let t=N3(e);return kG(t),t}function N3(e,t=[],n=[],r="",s=!1){let o=(i,c,u=s,f)=>{let m={relativePath:f===void 0?i.path||"":f,caseSensitive:i.caseSensitive===!0,childrenIndex:c,route:i};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(r)&&u)return;Fn(m.relativePath.startsWith(r),`Absolute route path "${m.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(r.length)}let p=As([r,m.relativePath]),v=n.concat(m);i.children&&i.children.length>0&&(Fn(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),N3(i.children,t,v,p,u)),!(i.path==null&&!i.index)&&t.push({path:p,score:MG(p,i.index),routesMeta:v.map((x,j)=>{let[y,b]=k3(x.relativePath,x.caseSensitive,j===v.length-1);return{...x,matcher:y,compiledParams:b}})})};return e.forEach((i,c)=>{if(i.path===""||!i.path?.includes("?"))o(i,c);else for(let u of C3(i.path))o(i,c,!0,u)}),t}function C3(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=C3(r.join("/")),c=[];return c.push(...i.map(u=>u===""?o:[o,u].join("/"))),s&&c.push(...i),c.map(u=>e.startsWith("/")&&u===""?"/":u)}function kG(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:IG(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var AG=/^:[\w-]+$/,EG=3,PG=2,RG=1,TG=10,OG=-2,MP=e=>e==="*";function MG(e,t){let n=e.split("/"),r=n.length;return n.some(MP)&&(r+=OG),t&&(r+=PG),n.filter(s=>!MP(s)).reduce((s,o)=>s+(AG.test(o)?EG:o===""?RG:TG),r)}function IG(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function $G(e,t,n=!1){let{routesMeta:r}=e,s={},o="/",i=[];for(let c=0;c<r.length;++c){let u=r[c],f=c===r.length-1,m=o==="/"?t:t.slice(o.length)||"/",p={path:u.relativePath,caseSensitive:u.caseSensitive,end:f},v=u.matcher&&u.compiledParams?_3(p,m,u.matcher,u.compiledParams):hn(p,m),x=u.route;if(!v&&f&&n&&!r[r.length-1].route.index&&(v=hn({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},m)),!v)return null;Object.assign(s,v.params),i.push({params:s,pathname:As([o,v.pathname]),pathnameBase:zG(As([o,v.pathnameBase])),route:x}),v.pathnameBase!=="/"&&(o=As([o,v.pathnameBase]))}return i}function hn(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=k3(e.path,e.caseSensitive,e.end);return _3(e,t,n,r)}function _3(e,t,n,r){let s=t.match(n);if(!s)return null;let o=s[0],i=o.replace(/(.)\/+$/,"$1"),c=s.slice(1);return{params:r.reduce((f,{paramName:m,isOptional:p},v)=>{if(m==="*"){let j=c[v]||"";i=o.slice(0,o.length-j.length).replace(/(.)\/+$/,"$1")}const x=c[v];return p&&!x?f[m]=void 0:f[m]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:i,pattern:e}}function k3(e,t=!1,n=!0){Qa(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,c,u,f,m)=>{if(r.push({paramName:c,isOptional:u!=null}),u){let p=m.charAt(f+i.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function DG(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Qa(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Io(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function LG(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Au(e):e,o;return n?(n=A3(n),n.startsWith("/")?o=IP(n.substring(1),"/"):o=IP(n,t)):o=t,{pathname:o,search:BG(r),hash:qG(s)}}function IP(e,t){let n=jm(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function ab(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function FG(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function IC(e){let t=FG(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Zg(e,t,n,r=!1){let s;typeof e=="string"?s=Au(e):(s={...e},Fn(!s.pathname||!s.pathname.includes("?"),ab("?","pathname","search",s)),Fn(!s.pathname||!s.pathname.includes("#"),ab("#","pathname","hash",s)),Fn(!s.search||!s.search.includes("#"),ab("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,c;if(i==null)c=n;else{let p=t.length-1;if(!r&&i.startsWith("..")){let v=i.split("/");for(;v[0]==="..";)v.shift(),p-=1;s.pathname=v.join("/")}c=p>=0?t[p]:"/"}let u=LG(s,c),f=i&&i!=="/"&&i.endsWith("/"),m=(o||i===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(f||m)&&(u.pathname+="/"),u}var A3=e=>e.replace(/[\\/]{2,}/g,"/"),As=e=>A3(e.join("/")),jm=e=>e.replace(/\/+$/,""),zG=e=>jm(e).replace(/^\/*/,"/"),BG=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,qG=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,UG=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function WG(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function HG(e){let t=e.map(n=>n.route.path).filter(Boolean);return As(t)||"/"}var E3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function P3(e,t){let n=e;if(typeof n!="string"||!MC.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(E3)try{let o=new URL(window.location.href),i=j3.test(n)?new URL(bG(n,o.protocol)):new URL(n),c=Io(i.pathname,t);i.origin===o.origin&&c!=null?n=c+i.search+i.hash:s=!0}catch{Qa(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var R3=["POST","PUT","PATCH","DELETE"];new Set(R3);var VG=["GET",...R3];new Set(VG);var KG=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function GG(e){try{return KG.includes(new URL(e).protocol)}catch{return!1}}var Eu=h.createContext(null);Eu.displayName="DataRouter";var ev=h.createContext(null);ev.displayName="DataRouterState";var T3=h.createContext(!1);function YG(){return h.useContext(T3)}var O3=h.createContext({isTransitioning:!1});O3.displayName="ViewTransition";var XG=h.createContext(new Map);XG.displayName="Fetchers";var QG=h.createContext(null);QG.displayName="Await";var Pa=h.createContext(null);Pa.displayName="Navigation";var rp=h.createContext(null);rp.displayName="Location";var os=h.createContext({outlet:null,matches:[],isDataRoute:!1});os.displayName="Route";var $C=h.createContext(null);$C.displayName="RouteError";var M3="REACT_ROUTER_ERROR",JG="REDIRECT",ZG="ROUTE_ERROR_RESPONSE";function eY(e){if(e.startsWith(`${M3}:${JG}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function tY(e){if(e.startsWith(`${M3}:${ZG}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new UG(t.status,t.statusText,t.data)}catch{}}function nY(e,{relative:t}={}){Fn(Pu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=h.useContext(Pa),{hash:s,pathname:o,search:i}=ap(e,{relative:t}),c=o;return n!=="/"&&(c=o==="/"?n:As([n,o])),r.createHref({pathname:c,search:i,hash:s})}function Pu(){return h.useContext(rp)!=null}function Kr(){return Fn(Pu(),"useLocation() may be used only in the context of a <Router> component."),h.useContext(rp).location}var I3="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function $3(e){h.useContext(Pa).static||h.useLayoutEffect(e)}function is(){let{isDataRoute:e}=h.useContext(os);return e?vY():rY()}function rY(){Fn(Pu(),"useNavigate() may be used only in the context of a <Router> component.");let e=h.useContext(Eu),{basename:t,navigator:n}=h.useContext(Pa),{matches:r}=h.useContext(os),{pathname:s}=Kr(),o=JSON.stringify(IC(r)),i=h.useRef(!1);return $3(()=>{i.current=!0}),h.useCallback((u,f={})=>{if(Qa(i.current,I3),!i.current)return;if(typeof u=="number"){n.go(u);return}let m=Zg(u,JSON.parse(o),s,f.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:As([t,m.pathname])),(f.replace?n.replace:n.push)(m,f.state,f)},[t,n,o,s,e])}var aY=h.createContext(null);function sY(e){let t=h.useContext(os).outlet;return h.useMemo(()=>t&&h.createElement(aY.Provider,{value:e},t),[t,e])}function Bl(){let{matches:e}=h.useContext(os);return e[e.length-1]?.params??{}}function ap(e,{relative:t}={}){let{matches:n}=h.useContext(os),{pathname:r}=Kr(),s=JSON.stringify(IC(n));return h.useMemo(()=>Zg(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function oY(e,t){return D3(e,t)}function D3(e,t,n){Fn(Pu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=h.useContext(Pa),{matches:s}=h.useContext(os),o=s[s.length-1],i=o?o.params:{},c=o?o.pathname:"/",u=o?o.pathnameBase:"/",f=o&&o.route;{let b=f&&f.path||"";F3(c,!f||b.endsWith("*")||b.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${b}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
10
 
11
11
  Please change the parent <Route path="${b}"> to <Route path="${b==="/"?"*":`${b}/*`}">.`)}let m=Kr(),p;if(t){let b=typeof t=="string"?Au(t):t;Fn(u==="/"||b.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${b.pathname}" was given in the \`location\` prop.`),p=b}else p=m;let v=p.pathname||"/",x=v;if(u!=="/"){let b=u.replace(/^\//,"").split("/");x="/"+v.replace(/^\//,"").split("/").slice(b.length).join("/")}let j=n&&n.state.matches.length?n.state.matches.map(b=>Object.assign(b,{route:n.manifest[b.route.id]||b.route})):S3(e,{pathname:x});Qa(f||j!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Qa(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let y=dY(j&&j.map(b=>Object.assign({},b,{params:Object.assign({},i,b.params),pathname:As([u,r.encodeLocation?r.encodeLocation(b.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?u:As([u,r.encodeLocation?r.encodeLocation(b.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathnameBase])})),s,n);return t&&y?h.createElement(rp.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...p},navigationType:"POP"}},y):y}function iY(){let e=gY(),t=WG(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=h.createElement(h.Fragment,null,h.createElement("p",null,"💿 Hey developer 👋"),h.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",h.createElement("code",{style:o},"ErrorBoundary")," or"," ",h.createElement("code",{style:o},"errorElement")," prop on your route.")),h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:s},n):null,i)}var lY=h.createElement(iY,null),L3=class extends h.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=tY(e.digest);n&&(e=n)}let t=e!==void 0?h.createElement(os.Provider,{value:this.props.routeContext},h.createElement($C.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?h.createElement(cY,{error:e},t):t}};L3.contextType=T3;var sb=new WeakMap;function cY({children:e,error:t}){let{basename:n}=h.useContext(Pa);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=eY(t.digest);if(r){let s=sb.get(t);if(s)throw s;let o=P3(r.location,n),i=o.absoluteURL||o.to;if(GG(i))throw new Error("Invalid redirect location");if(E3&&!sb.get(t))if(o.isExternal||r.reloadDocument)window.location.href=i;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw sb.set(t,c),c}return h.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i}`})}}return e}function uY({routeContext:e,match:t,children:n}){let r=h.useContext(Eu);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),h.createElement(os.Provider,{value:e},n)}function dY(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,o=r?.errors;if(o!=null){let m=s.findIndex(p=>p.route.id&&o?.[p.route.id]!==void 0);Fn(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,m+1))}let i=!1,c=-1;if(n&&r){i=r.renderFallback;for(let m=0;m<s.length;m++){let p=s[m];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(c=m),p.route.id){let{loaderData:v,errors:x}=r,j=p.route.loader&&!v.hasOwnProperty(p.route.id)&&(!x||x[p.route.id]===void 0);if(p.route.lazy||j){n.isStatic&&(i=!0),c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}}let u=n?.onError,f=r&&u?(m,p)=>{u(m,{location:r.location,params:r.matches?.[0]?.params??{},pattern:HG(r.matches),errorInfo:p})}:void 0;return s.reduceRight((m,p,v)=>{let x,j=!1,y=null,b=null;r&&(x=o&&p.route.id?o[p.route.id]:void 0,y=p.route.errorElement||lY,i&&(c<0&&v===0?(F3("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,b=null):c===v&&(j=!0,b=p.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,v+1)),N=()=>{let C;return x?C=y:j?C=b:p.route.Component?C=h.createElement(p.route.Component,null):p.route.element?C=p.route.element:C=m,h.createElement(uY,{match:p,routeContext:{outlet:m,matches:S,isDataRoute:r!=null},children:C})};return r&&(p.route.ErrorBoundary||p.route.errorElement||v===0)?h.createElement(L3,{location:r.location,revalidation:r.revalidation,component:y,error:x,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:f}):N()},null)}function DC(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fY(e){let t=h.useContext(Eu);return Fn(t,DC(e)),t}function pY(e){let t=h.useContext(ev);return Fn(t,DC(e)),t}function hY(e){let t=h.useContext(os);return Fn(t,DC(e)),t}function LC(e){let t=hY(e),n=t.matches[t.matches.length-1];return Fn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function mY(){return LC("useRouteId")}function gY(){let e=h.useContext($C),t=pY("useRouteError"),n=LC("useRouteError");return e!==void 0?e:t.errors?.[n]}function vY(){let{router:e}=fY("useNavigate"),t=LC("useNavigate"),n=h.useRef(!1);return $3(()=>{n.current=!0}),h.useCallback(async(s,o={})=>{Qa(n.current,I3),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var $P={};function F3(e,t,n){!t&&!$P[e]&&($P[e]=!0,Qa(!1,n))}h.memo(xY);function xY({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:o}){return D3(e,void 0,{manifest:t,state:r,isStatic:s,onError:o})}function z3({to:e,replace:t,state:n,relative:r}){Fn(Pu(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=h.useContext(Pa);Qa(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=h.useContext(os),{pathname:i}=Kr(),c=is(),u=Zg(e,IC(o),i,r==="path"),f=JSON.stringify(u);return h.useEffect(()=>{c(JSON.parse(f),{replace:t,state:n,relative:r})},[c,f,r,t,n]),null}function DP(e){return sY(e.context)}function xn(e){Fn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function yY({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:o=!1,useTransitions:i}){Fn(!Pu(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),u=h.useMemo(()=>({basename:c,navigator:s,static:o,useTransitions:i,future:{}}),[c,s,o,i]);typeof n=="string"&&(n=Au(n));let{pathname:f="/",search:m="",hash:p="",state:v=null,key:x="default",mask:j}=n,y=h.useMemo(()=>{let b=Io(f,c);return b==null?null:{location:{pathname:b,search:m,hash:p,state:v,key:x,mask:j},navigationType:r}},[c,f,m,p,v,x,r,j]);return Qa(y!=null,`<Router basename="${c}"> is not able to match the URL "${f}${m}${p}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:h.createElement(Pa.Provider,{value:u},h.createElement(rp.Provider,{children:t,value:y}))}function bY({children:e,location:t}){return oY(u1(e),t)}function u1(e,t=[]){let n=[];return h.Children.forEach(e,(r,s)=>{if(!h.isValidElement(r))return;let o=[...t,s];if(r.type===h.Fragment){n.push.apply(n,u1(r.props.children,o));return}Fn(r.type===xn,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Fn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=u1(r.props.children,o)),n.push(i)}),n}var im="get",lm="application/x-www-form-urlencoded";function tv(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function wY(e){return tv(e)&&e.tagName.toLowerCase()==="button"}function jY(e){return tv(e)&&e.tagName.toLowerCase()==="form"}function SY(e){return tv(e)&&e.tagName.toLowerCase()==="input"}function NY(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function CY(e,t){return e.button===0&&(!t||t==="_self")&&!NY(e)}function d1(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function _Y(e,t){let n=d1(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var Ih=null;function kY(){if(Ih===null)try{new FormData(document.createElement("form"),0),Ih=!1}catch{Ih=!0}return Ih}var AY=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ob(e){return e!=null&&!AY.has(e)?(Qa(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${lm}"`),null):e}function EY(e,t){let n,r,s,o,i;if(jY(e)){let c=e.getAttribute("action");r=c?Io(c,t):null,n=e.getAttribute("method")||im,s=ob(e.getAttribute("enctype"))||lm,o=new FormData(e)}else if(wY(e)||SY(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(r=u?Io(u,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||im,s=ob(e.getAttribute("formenctype"))||ob(c.getAttribute("enctype"))||lm,o=new FormData(c,e),!kY()){let{name:f,type:m,value:p}=e;if(m==="image"){let v=f?`${f}.`:"";o.append(`${v}x`,"0"),o.append(`${v}y`,"0")}else f&&o.append(f,p)}}else{if(tv(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=im,r=null,s=lm,i=e}return o&&s==="text/plain"&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:o,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function FC(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function B3(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&Io(s.pathname,t)==="/"?s.pathname=`${jm(t)}/_root.${r}`:s.pathname=`${jm(s.pathname)}.${r}`,s}async function PY(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function RY(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function TY(e,t,n){let r=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let i=await PY(o,n);return i.links?i.links():[]}return[]}));return $Y(r.flat(1).filter(RY).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function LP(e,t,n,r,s,o){let i=(u,f)=>n[f]?u.route.id!==n[f].route.id:!0,c=(u,f)=>n[f].pathname!==u.pathname||n[f].route.path?.endsWith("*")&&n[f].params["*"]!==u.params["*"];return o==="assets"?t.filter((u,f)=>i(u,f)||c(u,f)):o==="data"?t.filter((u,f)=>{let m=r.routes[u.route.id];if(!m||!m.hasLoader)return!1;if(i(u,f)||c(u,f))return!0;if(u.route.shouldRevalidate){let p=u.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function OY(e,t,{includeHydrateFallback:n}={}){return MY(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function MY(e){return[...new Set(e)]}function IY(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function $Y(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let o=JSON.stringify(IY(s));return n.has(o)||(n.add(o),r.push({key:o,link:s})),r},[])}function zC(){let e=h.useContext(Eu);return FC(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function DY(){let e=h.useContext(ev);return FC(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var BC=h.createContext(void 0);BC.displayName="FrameworkContext";function nv(){let e=h.useContext(BC);return FC(e,"You must render this element inside a <HydratedRouter> element"),e}function LY(e,t){let n=h.useContext(BC),[r,s]=h.useState(!1),[o,i]=h.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:f,onMouseLeave:m,onTouchStart:p}=t,v=h.useRef(null);h.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let y=S=>{S.forEach(N=>{i(N.isIntersecting)})},b=new IntersectionObserver(y,{threshold:.5});return v.current&&b.observe(v.current),()=>{b.disconnect()}}},[e]),h.useEffect(()=>{if(r){let y=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(y)}}},[r]);let x=()=>{s(!0)},j=()=>{s(!1),i(!1)};return n?e!=="intent"?[o,v,{}]:[o,v,{onFocus:_d(c,x),onBlur:_d(u,j),onMouseEnter:_d(f,x),onMouseLeave:_d(m,j),onTouchStart:_d(p,x)}]:[!1,v,{}]}function _d(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function FY({page:e,...t}){let n=YG(),{nonce:r}=nv(),{router:s}=zC(),o=h.useMemo(()=>S3(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?(t.nonce==null&&r&&(t={...t,nonce:r}),n?h.createElement(BY,{page:e,matches:o,...t}):h.createElement(qY,{page:e,matches:o,...t})):null}function zY(e){let{manifest:t,routeModules:n}=nv(),[r,s]=h.useState([]);return h.useEffect(()=>{let o=!1;return TY(e,t,n).then(i=>{o||s(i)}),()=>{o=!0}},[e,t,n]),r}function BY({page:e,matches:t,...n}){let r=Kr(),{future:s}=nv(),{basename:o}=zC(),i=h.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let c=B3(e,o,s.v8_trailingSlashAwareDataRequests,"rsc"),u=!1,f=[];for(let m of t)typeof m.route.shouldRevalidate=="function"?u=!0:f.push(m.route.id);return u&&f.length>0&&c.searchParams.set("_routes",f.join(",")),[c.pathname+c.search]},[o,s.v8_trailingSlashAwareDataRequests,e,r,t]);return h.createElement(h.Fragment,null,i.map(c=>h.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...n})))}function qY({page:e,matches:t,...n}){let r=Kr(),{future:s,manifest:o,routeModules:i}=nv(),{basename:c}=zC(),{loaderData:u,matches:f}=DY(),m=h.useMemo(()=>LP(e,t,f,o,r,"data"),[e,t,f,o,r]),p=h.useMemo(()=>LP(e,t,f,o,r,"assets"),[e,t,f,o,r]),v=h.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let y=new Set,b=!1;if(t.forEach(N=>{let C=o.routes[N.route.id];!C||!C.hasLoader||(!m.some(k=>k.route.id===N.route.id)&&N.route.id in u&&i[N.route.id]?.shouldRevalidate||C.hasClientLoader?b=!0:y.add(N.route.id))}),y.size===0)return[];let S=B3(e,c,s.v8_trailingSlashAwareDataRequests,"data");return b&&y.size>0&&S.searchParams.set("_routes",t.filter(N=>y.has(N.route.id)).map(N=>N.route.id).join(",")),[S.pathname+S.search]},[c,s.v8_trailingSlashAwareDataRequests,u,r,o,m,t,e,i]),x=h.useMemo(()=>OY(p,o),[p,o]),j=zY(p);return h.createElement(h.Fragment,null,v.map(y=>h.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...n})),x.map(y=>h.createElement("link",{key:y,rel:"modulepreload",href:y,...n})),j.map(({key:y,link:b})=>h.createElement("link",{key:y,nonce:n.nonce,...b,crossOrigin:b.crossOrigin??n.crossOrigin})))}function UY(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var WY=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{WY&&(window.__reactRouterVersion="7.18.2")}catch{}function HY({basename:e,children:t,useTransitions:n,window:r}){let s=h.useRef();s.current==null&&(s.current=wG({window:r,v5Compat:!0}));let o=s.current,[i,c]=h.useState({action:o.action,location:o.location}),u=h.useCallback(f=>{n===!1?c(f):h.startTransition(()=>c(f))},[n]);return h.useLayoutEffect(()=>o.listen(u),[o,u]),h.createElement(yY,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:n})}var Et=h.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:o,replace:i,mask:c,state:u,target:f,to:m,preventScrollReset:p,viewTransition:v,defaultShouldRevalidate:x,...j},y){let{basename:b,navigator:S,useTransitions:N}=h.useContext(Pa),C=typeof m=="string"&&MC.test(m),k=P3(m,b);m=k.to;let A=nY(m,{relative:s}),E=Kr(),P=null;if(c){let I=Zg(c,[],E.mask?E.mask.pathname:"/",!0);b!=="/"&&(I.pathname=I.pathname==="/"?b:As([b,I.pathname])),P=S.createHref(I)}let[T,$,Y]=LY(r,j),H=GY(m,{replace:i,mask:c,state:u,target:f,preventScrollReset:p,relative:s,viewTransition:v,defaultShouldRevalidate:x,useTransitions:N});function F(I){t&&t(I),I.defaultPrevented||H(I)}let X=!(k.isExternal||o),L=h.createElement("a",{...j,...Y,href:(X?P:void 0)||k.absoluteURL||A,onClick:X?F:t,ref:UY(y,$),target:f,"data-discover":!C&&n==="render"?"true":void 0});return T&&!C?h.createElement(h.Fragment,null,L,h.createElement(FY,{page:A})):L});Et.displayName="Link";var q3=h.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:o,to:i,viewTransition:c,children:u,...f},m){let p=ap(i,{relative:f.relative}),v=Kr(),x=h.useContext(ev),{navigator:j,basename:y}=h.useContext(Pa),b=x!=null&&ZY(p)&&c===!0,S=j.encodeLocation?j.encodeLocation(p).pathname:p.pathname,N=v.pathname,C=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(N=N.toLowerCase(),C=C?C.toLowerCase():null,S=S.toLowerCase()),C&&y&&(C=Io(C,y)||C);const k=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let A=N===S||!s&&N.startsWith(S)&&N.charAt(k)==="/",E=C!=null&&(C===S||!s&&C.startsWith(S)&&C.charAt(S.length)==="/"),P={isActive:A,isPending:E,isTransitioning:b},T=A?t:void 0,$;typeof r=="function"?$=r(P):$=[r,A?"active":null,E?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let Y=typeof o=="function"?o(P):o;return h.createElement(Et,{...f,"aria-current":T,className:$,ref:m,style:Y,to:i,viewTransition:c},typeof u=="function"?u(P):u)});q3.displayName="NavLink";var VY=h.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:o,method:i=im,action:c,onSubmit:u,relative:f,preventScrollReset:m,viewTransition:p,defaultShouldRevalidate:v,...x},j)=>{let{useTransitions:y}=h.useContext(Pa),b=QY(),S=JY(c,{relative:f}),N=i.toLowerCase()==="get"?"get":"post",C=typeof c=="string"&&MC.test(c),k=A=>{if(u&&u(A),A.defaultPrevented)return;A.preventDefault();let E=A.nativeEvent.submitter,P=E?.getAttribute("formmethod")||i,T=()=>b(E||A.currentTarget,{fetcherKey:t,method:P,navigate:n,replace:s,state:o,relative:f,preventScrollReset:m,viewTransition:p,defaultShouldRevalidate:v});y&&n!==!1?h.startTransition(()=>T()):T()};return h.createElement("form",{ref:j,method:N,action:S,onSubmit:r?u:k,...x,"data-discover":!C&&e==="render"?"true":void 0})});VY.displayName="Form";function KY(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function U3(e){let t=h.useContext(Eu);return Fn(t,KY(e)),t}function GY(e,{target:t,replace:n,mask:r,state:s,preventScrollReset:o,relative:i,viewTransition:c,defaultShouldRevalidate:u,useTransitions:f}={}){let m=is(),p=Kr(),v=ap(e,{relative:i});return h.useCallback(x=>{if(CY(x,t)){x.preventDefault();let j=n!==void 0?n:lf(p)===lf(v),y=()=>m(e,{replace:j,mask:r,state:s,preventScrollReset:o,relative:i,viewTransition:c,defaultShouldRevalidate:u});f?h.startTransition(()=>y()):y()}},[p,m,v,n,r,s,t,e,o,i,c,u,f])}function zo(e){Qa(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=h.useRef(d1(e)),n=h.useRef(!1),r=Kr(),s=h.useMemo(()=>_Y(r.search,n.current?null:t.current),[r.search]),o=is(),i=h.useCallback((c,u)=>{const f=d1(typeof c=="function"?c(new URLSearchParams(s)):c);n.current=!0,o("?"+f,u)},[o,s]);return[s,i]}var YY=0,XY=()=>`__${String(++YY)}__`;function QY(){let{router:e}=U3("useSubmit"),{basename:t}=h.useContext(Pa),n=mY(),r=e.fetch,s=e.navigate;return h.useCallback(async(o,i={})=>{let{action:c,method:u,encType:f,formData:m,body:p}=EY(o,t);if(i.navigate===!1){let v=i.fetcherKey||XY();await r(v,n,i.action||c,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:m,body:p,formMethod:i.method||u,formEncType:i.encType||f,flushSync:i.flushSync})}else await s(i.action||c,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:m,body:p,formMethod:i.method||u,formEncType:i.encType||f,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,s,t,n])}function JY(e,{relative:t}={}){let{basename:n}=h.useContext(Pa),r=h.useContext(os);Fn(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),o={...ap(e||".",{relative:t})},i=Kr();if(e==null){o.search=i.search;let c=new URLSearchParams(o.search),u=c.getAll("index");if(u.some(m=>m==="")){c.delete("index"),u.filter(p=>p).forEach(p=>c.append("index",p));let m=c.toString();o.search=m?`?${m}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:As([n,o.pathname])),lf(o)}function ZY(e,{relative:t}={}){let n=h.useContext(O3);Fn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=U3("useViewTransitionState"),s=ap(e,{relative:t});if(!n.isTransitioning)return!1;let o=Io(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Io(n.nextLocation.pathname,r)||n.nextLocation.pathname;return hn(s.pathname,i)!=null||hn(s.pathname,o)!=null}var eX=Symbol.for("react.lazy"),Sm=cC[" use ".trim().toString()];function tX(e){return typeof e=="object"&&e!==null&&"then"in e}function W3(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===eX&&"_payload"in e&&tX(e._payload)}function rv(e){const t=nX(e),n=h.forwardRef((r,s)=>{let{children:o,...i}=r;W3(o)&&typeof Sm=="function"&&(o=Sm(o._payload));const c=h.Children.toArray(o),u=c.find(aX);if(u){const f=u.props.children,m=c.map(p=>p===u?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var Pi=rv("Slot");function nX(e){const t=h.forwardRef((n,r)=>{let{children:s,...o}=n;if(W3(s)&&typeof Sm=="function"&&(s=Sm(s._payload)),h.isValidElement(s)){const i=oX(s),c=sX(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rX=Symbol("radix.slottable");function aX(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rX}function sX(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function oX(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)}const ib=768;function iX(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ib-1}px)`),r=()=>{t(window.innerWidth<ib)};return n.addEventListener("change",r),t(window.innerWidth<ib),()=>n.removeEventListener("change",r)},[]),!!e}const qC=zl("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 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 hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Z=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?Pi:"button";return a.jsx(i,{className:Me(qC({variant:t,size:n,className:e})),ref:o,...s})});Z.displayName="Button";const _t=h.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:Me("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));_t.displayName="Input";var lX=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cX=lX.reduce((e,t)=>{const n=rv(`Primitive.${t}`),r=h.forwardRef((s,o)=>{const{asChild:i,...c}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),uX="Separator",FP="horizontal",dX=["horizontal","vertical"],H3=h.forwardRef((e,t)=>{const{decorative:n,orientation:r=FP,...s}=e,o=fX(r)?r:FP,c=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return a.jsx(cX.div,{"data-orientation":o,...c,...s,ref:t})});H3.displayName=uX;function fX(e){return dX.includes(e)}var V3=H3;const K3=h.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},s)=>a.jsx(V3,{ref:s,decorative:n,orientation:t,className:Me("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));K3.displayName=V3.displayName;var lb="focusScope.autoFocusOnMount",cb="focusScope.autoFocusOnUnmount",zP={bubbles:!1,cancelable:!0},pX="FocusScope",sp=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[c,u]=h.useState(null),f=Jn(s),m=Jn(o),p=h.useRef(null),v=Ot(t,y=>u(y)),x=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let y=function(C){if(x.paused||!c)return;const k=C.target;c.contains(k)?p.current=k:mi(p.current,{select:!0})},b=function(C){if(x.paused||!c)return;const k=C.relatedTarget;k!==null&&(c.contains(k)||mi(p.current,{select:!0}))},S=function(C){if(document.activeElement===document.body)for(const A of C)A.removedNodes.length>0&&mi(c)};document.addEventListener("focusin",y),document.addEventListener("focusout",b);const N=new MutationObserver(S);return c&&N.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",b),N.disconnect()}}},[r,c,x.paused]),h.useEffect(()=>{if(c){qP.add(x);const y=document.activeElement;if(!c.contains(y)){const S=new CustomEvent(lb,zP);c.addEventListener(lb,f),c.dispatchEvent(S),S.defaultPrevented||(hX(yX(G3(c)),{select:!0}),document.activeElement===y&&mi(c))}return()=>{c.removeEventListener(lb,f),setTimeout(()=>{const S=new CustomEvent(cb,zP);c.addEventListener(cb,m),c.dispatchEvent(S),S.defaultPrevented||mi(y??document.body,{select:!0}),c.removeEventListener(cb,m),qP.remove(x)},0)}}},[c,f,m,x]);const j=h.useCallback(y=>{if(!n&&!r||x.paused)return;const b=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,S=document.activeElement;if(b&&S){const N=y.currentTarget,[C,k]=mX(N);C&&k?!y.shiftKey&&S===k?(y.preventDefault(),n&&mi(C,{select:!0})):y.shiftKey&&S===C&&(y.preventDefault(),n&&mi(k,{select:!0})):S===N&&y.preventDefault()}},[n,r,x.paused]);return a.jsx(lt.div,{tabIndex:-1,...i,ref:v,onKeyDown:j})});sp.displayName=pX;function hX(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(mi(r,{select:t}),document.activeElement!==n)return}function mX(e){const t=G3(e),n=BP(t,e),r=BP(t.reverse(),e);return[n,r]}function G3(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function BP(e,t){for(const n of e)if(!gX(n,{upTo:t}))return n}function gX(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 vX(e){return e instanceof HTMLInputElement&&"select"in e}function mi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vX(e)&&t&&e.select()}}var qP=xX();function xX(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=UP(e,t),e.unshift(t)},remove(t){e=UP(e,t),e[0]?.resume()}}}function UP(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yX(e){return e.filter(t=>t.tagName!=="A")}var ub=0;function av(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??WP()),document.body.insertAdjacentElement("beforeend",e[1]??WP()),ub++,()=>{ub===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ub--}},[])}function WP(){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 qs=function(){return qs=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},qs.apply(this,arguments)};function Y3(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function bX(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var cm="right-scroll-bar-position",um="width-before-scroll-bar",wX="with-scroll-bars-hidden",jX="--removed-body-scroll-bar-size";function db(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function SX(e,t){var n=h.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var NX=typeof window<"u"?h.useLayoutEffect:h.useEffect,HP=new WeakMap;function CX(e,t){var n=SX(null,function(r){return e.forEach(function(s){return db(s,r)})});return NX(function(){var r=HP.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(c){o.has(c)||db(c,null)}),o.forEach(function(c){s.has(c)||db(c,i)})}HP.set(n,e)},[e]),n}function _X(e){return e}function kX(e,t){t===void 0&&(t=_X);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(o),i=n}var u=function(){var m=i;i=[],m.forEach(o)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(m){i.push(m),f()},filter:function(m){return i=i.filter(m),n}}}};return s}function AX(e){e===void 0&&(e={});var t=kX(null);return t.options=qs({async:!0,ssr:!1},e),t}var X3=function(e){var t=e.sideCar,n=Y3(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return h.createElement(r,qs({},n))};X3.isSideCarExport=!0;function EX(e,t){return e.useMedium(t),X3}var Q3=AX(),fb=function(){},sv=h.forwardRef(function(e,t){var n=h.useRef(null),r=h.useState({onScrollCapture:fb,onWheelCapture:fb,onTouchMoveCapture:fb}),s=r[0],o=r[1],i=e.forwardProps,c=e.children,u=e.className,f=e.removeScrollBar,m=e.enabled,p=e.shards,v=e.sideCar,x=e.noRelative,j=e.noIsolation,y=e.inert,b=e.allowPinchZoom,S=e.as,N=S===void 0?"div":S,C=e.gapMode,k=Y3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=v,E=CX([n,t]),P=qs(qs({},k),s);return h.createElement(h.Fragment,null,m&&h.createElement(A,{sideCar:Q3,removeScrollBar:f,shards:p,noRelative:x,noIsolation:j,inert:y,setCallbacks:o,allowPinchZoom:!!b,lockRef:n,gapMode:C}),i?h.cloneElement(h.Children.only(c),qs(qs({},P),{ref:E})):h.createElement(N,qs({},P,{className:u,ref:E}),c))});sv.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};sv.classNames={fullWidth:um,zeroRight:cm};var PX=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function RX(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=PX();return t&&e.setAttribute("nonce",t),e}function TX(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function OX(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var MX=function(){var e=0,t=null;return{add:function(n){e==0&&(t=RX())&&(TX(t,n),OX(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},IX=function(){var e=MX();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},J3=function(){var e=IX(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},$X={left:0,top:0,right:0,gap:0},pb=function(e){return parseInt(e||"",10)||0},DX=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[pb(n),pb(r),pb(s)]},LX=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $X;var t=DX(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},FX=J3(),zc="data-scroll-locked",zX=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
12
12
  .`.concat(wX,` {
@@ -120,17 +120,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
120
120
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fhe(e,t){if(e){if(typeof e=="string")return CN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return CN(e,t)}}function zhe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Bhe(e){if(Array.isArray(e))return CN(e)}function CN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q$(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,oB(r.key),r)}}function Uhe(e,t,n){return t&&q$(e.prototype,t),n&&q$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Whe(e,t,n){return t=wg(t),Hhe(e,sB()?Reflect.construct(t,n||[],wg(e).constructor):t.apply(e,n))}function Hhe(e,t){if(t&&(gu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Vhe(e)}function Vhe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sB=function(){return!!e})()}function wg(e){return wg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},wg(e)}function Khe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_N(e,t)}function _N(e,t){return _N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},_N(e,t)}function js(e,t,n){return t=oB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oB(e){var t=Ghe(e,"string");return gu(t)=="symbol"?t:t+""}function Ghe(e,t){if(gu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Al=(function(e){function t(){var n;qhe(this,t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return n=Whe(this,t,[].concat(s)),js(n,"state",{isAnimationFinished:!0,totalLength:0}),js(n,"generateSimpleStrokeDasharray",function(i,c){return"".concat(c,"px ").concat(i-c,"px")}),js(n,"getStrokeDasharray",function(i,c,u){var f=u.reduce(function(S,N){return S+N});if(!f)return n.generateSimpleStrokeDasharray(c,i);for(var m=Math.floor(i/f),p=i%f,v=c-i,x=[],j=0,y=0;j<u.length;y+=u[j],++j)if(y+u[j]>p){x=[].concat(Nc(u.slice(0,j)),[p-y]);break}var b=x.length%2===0?[0,v]:[v];return[].concat(Nc(t.repeat(u,m)),Nc(x),b).map(function(S){return"".concat(S,"px")}).join(", ")}),js(n,"id",Iu("recharts-line-")),js(n,"pathRef",function(i){n.mainCurve=i}),js(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),js(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return Khe(t,e),Uhe(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.points,c=o.xAxis,u=o.yAxis,f=o.layout,m=o.children,p=ka(m,yp);if(!p)return null;var v=function(y,b){return{x:y.x,y:y.y,value:y.value,errorVal:ur(y.payload,b)}},x={clipPath:r?"url(#clipPath-".concat(s,")"):null};return J.createElement(un,x,p.map(function(j){return J.cloneElement(j,{key:"bar-".concat(j.props.dataKey),data:i,xAxis:c,yAxis:u,layout:f,dataPointFormatter:v})}))}},{key:"renderDots",value:function(r,s,o){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var c=this.props,u=c.dot,f=c.points,m=c.dataKey,p=Mt(this.props,!1),v=Mt(u,!0),x=f.map(function(y,b){var S=xa(xa(xa({key:"dot-".concat(b),r:3},p),v),{},{index:b,cx:y.x,cy:y.y,value:y.value,dataKey:m,payload:y.payload,points:f});return t.renderDotItem(u,S)}),j={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(o,")"):null};return J.createElement(un,ef({className:"recharts-line-dots",key:"dots"},j),x)}},{key:"renderCurveStatically",value:function(r,s,o,i){var c=this.props,u=c.type,f=c.layout,m=c.connectNulls;c.ref;var p=z$(c,Ihe),v=xa(xa(xa({},Mt(p,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(o,")"):null,points:r},i),{},{type:u,layout:f,connectNulls:m});return J.createElement(eg,ef({},v,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,s){var o=this,i=this.props,c=i.points,u=i.strokeDasharray,f=i.isAnimationActive,m=i.animationBegin,p=i.animationDuration,v=i.animationEasing,x=i.animationId,j=i.animateNewValues,y=i.width,b=i.height,S=this.state,N=S.prevPoints,C=S.totalLength;return J.createElement(no,{begin:m,duration:p,isActive:f,easing:v,from:{t:0},to:{t:1},key:"line-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(k){var A=k.t;if(N){var E=N.length/c.length,P=c.map(function(F,X){var L=Math.floor(X*E);if(N[L]){var I=N[L],M=ja(I.x,F.x),q=ja(I.y,F.y);return xa(xa({},F),{},{x:M(A),y:q(A)})}if(j){var G=ja(y*2,F.x),O=ja(b/2,F.y);return xa(xa({},F),{},{x:G(A),y:O(A)})}return xa(xa({},F),{},{x:F.x,y:F.y})});return o.renderCurveStatically(P,r,s)}var T=ja(0,C),$=T(A),Y;if(u){var H="".concat(u).split(/[,\s]+/gim).map(function(F){return parseFloat(F)});Y=o.getStrokeDasharray($,C,H)}else Y=o.generateSimpleStrokeDasharray(C,$);return o.renderCurveStatically(c,r,s,{strokeDasharray:Y})})}},{key:"renderCurve",value:function(r,s){var o=this.props,i=o.points,c=o.isAnimationActive,u=this.state,f=u.prevPoints,m=u.totalLength;return c&&i&&i.length&&(!f&&m>0||!xp(f,i))?this.renderCurveWithAnimation(r,s):this.renderCurveStatically(i,r,s)}},{key:"render",value:function(){var r,s=this.props,o=s.hide,i=s.dot,c=s.points,u=s.className,f=s.xAxis,m=s.yAxis,p=s.top,v=s.left,x=s.width,j=s.height,y=s.isAnimationActive,b=s.id;if(o||!c||!c.length)return null;var S=this.state.isAnimationFinished,N=c.length===1,C=Kt("recharts-line",u),k=f&&f.allowDataOverflow,A=m&&m.allowDataOverflow,E=k||A,P=Vt(b)?this.id:b,T=(r=Mt(i,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},$=T.r,Y=$===void 0?3:$,H=T.strokeWidth,F=H===void 0?2:H,X=LZ(i)?i:{},L=X.clipDot,I=L===void 0?!0:L,M=Y*2+F;return J.createElement(un,{className:C},k||A?J.createElement("defs",null,J.createElement("clipPath",{id:"clipPath-".concat(P)},J.createElement("rect",{x:k?v:v-x/2,y:A?p:p-j/2,width:k?x:x*2,height:A?j:j*2})),!I&&J.createElement("clipPath",{id:"clipPath-dots-".concat(P)},J.createElement("rect",{x:v-M/2,y:p-M/2,width:x+M,height:j+M}))):null,!N&&this.renderCurve(E,P),this.renderErrorBar(E,P),(N||i)&&this.renderDots(E,I,P),(!y||S)&&Eo.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,s){for(var o=r.length%2!==0?[].concat(Nc(r),[0]):r,i=[],c=0;c<s;++c)i=[].concat(Nc(i),Nc(o));return i}},{key:"renderDotItem",value:function(r,s){var o;if(J.isValidElement(r))o=J.cloneElement(r,s);else if(Ht(r))o=r(s);else{var i=s.key,c=z$(s,$he),u=Kt("recharts-line-dot",typeof r!="boolean"?r.className:"");o=J.createElement(Iv,ef({key:i},c,{className:u}))}return o}}])})(h.PureComponent);js(Al,"displayName","Line");js(Al,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Ul.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});js(Al,"getComposedData",function(e){var t=e.props,n=e.xAxis,r=e.yAxis,s=e.xAxisTicks,o=e.yAxisTicks,i=e.dataKey,c=e.bandSize,u=e.displayedData,f=e.offset,m=t.layout,p=u.map(function(v,x){var j=ur(v,i);return m==="horizontal"?{x:YM({axis:n,ticks:s,bandSize:c,entry:v,index:x}),y:Vt(j)?null:r.scale(j),value:j,payload:v}:{x:Vt(j)?null:n.scale(j),y:YM({axis:r,ticks:o,bandSize:c,entry:v,index:x}),value:j,payload:v}});return xa({points:p,layout:m},f)});function vu(e){"@babel/helpers - typeof";return vu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vu(e)}function Yhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xhe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,cB(r.key),r)}}function Qhe(e,t,n){return t&&Xhe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jhe(e,t,n){return t=jg(t),Zhe(e,iB()?Reflect.construct(t,n||[],jg(e).constructor):t.apply(e,n))}function Zhe(e,t){if(t&&(vu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eme(e)}function eme(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function iB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(iB=function(){return!!e})()}function jg(e){return jg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},jg(e)}function tme(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&kN(e,t)}function kN(e,t){return kN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},kN(e,t)}function lB(e,t,n){return t=cB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cB(e){var t=nme(e,"string");return vu(t)=="symbol"?t:t+""}function nme(e,t){if(vu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(vu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function AN(){return AN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},AN.apply(this,arguments)}function rme(e){var t=e.xAxisId,n=Gz(),r=Yz(),s=Vz(t);return s==null?null:h.createElement(Kv,AN({},s,{className:Kt("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(i){return fl(i,!0)}}))}var _i=(function(e){function t(){return Yhe(this,t),Jhe(this,t,arguments)}return tme(t,e),Qhe(t,[{key:"render",value:function(){return h.createElement(rme,this.props)}}])})(h.Component);lB(_i,"displayName","XAxis");lB(_i,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function xu(e){"@babel/helpers - typeof";return xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(e)}function ame(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,fB(r.key),r)}}function ome(e,t,n){return t&&sme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ime(e,t,n){return t=Sg(t),lme(e,uB()?Reflect.construct(t,n||[],Sg(e).constructor):t.apply(e,n))}function lme(e,t){if(t&&(xu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cme(e)}function cme(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uB=function(){return!!e})()}function Sg(e){return Sg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sg(e)}function ume(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&EN(e,t)}function EN(e,t){return EN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},EN(e,t)}function dB(e,t,n){return t=fB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fB(e){var t=dme(e,"string");return xu(t)=="symbol"?t:t+""}function dme(e,t){if(xu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(xu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function PN(){return PN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},PN.apply(this,arguments)}var fme=function(t){var n=t.yAxisId,r=Gz(),s=Yz(),o=Kz(n);return o==null?null:h.createElement(Kv,PN({},o,{className:Kt("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:r,height:s},ticksGenerator:function(c){return fl(c,!0)}}))},ki=(function(e){function t(){return ame(this,t),ime(this,t,arguments)}return ume(t,e),ome(t,[{key:"render",value:function(){return h.createElement(fme,this.props)}}])})(h.Component);dB(ki,"displayName","YAxis");dB(ki,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function U$(e){return gme(e)||mme(e)||hme(e)||pme()}function pme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
121
121
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hme(e,t){if(e){if(typeof e=="string")return RN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return RN(e,t)}}function mme(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function gme(e){if(Array.isArray(e))return RN(e)}function RN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var TN=function(t,n,r,s,o){var i=ka(t,H_),c=ka(t,Wv),u=[].concat(U$(i),U$(c)),f=ka(t,Vv),m="".concat(s,"Id"),p=s[0],v=n;if(u.length&&(v=u.reduce(function(y,b){if(b.props[m]===r&&Ys(b.props,"extendDomain")&&nt(b.props[p])){var S=b.props[p];return[Math.min(y[0],S),Math.max(y[1],S)]}return y},v)),f.length){var x="".concat(p,"1"),j="".concat(p,"2");v=f.reduce(function(y,b){if(b.props[m]===r&&Ys(b.props,"extendDomain")&&nt(b.props[x])&&nt(b.props[j])){var S=b.props[x],N=b.props[j];return[Math.min(y[0],S,N),Math.max(y[1],S,N)]}return y},v)}return o&&o.length&&(v=o.reduce(function(y,b){return nt(b)?[Math.min(y[0],b),Math.max(y[1],b)]:y},v)),v},yS={exports:{}},W$;function vme(){return W$||(W$=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(u,f,m){this.fn=u,this.context=f,this.once=m||!1}function o(u,f,m,p,v){if(typeof m!="function")throw new TypeError("The listener must be a function");var x=new s(m,p||u,v),j=n?n+f:f;return u._events[j]?u._events[j].fn?u._events[j]=[u._events[j],x]:u._events[j].push(x):(u._events[j]=x,u._eventsCount++),u}function i(u,f){--u._eventsCount===0?u._events=new r:delete u._events[f]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var f=[],m,p;if(this._eventsCount===0)return f;for(p in m=this._events)t.call(m,p)&&f.push(n?p.slice(1):p);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(m)):f},c.prototype.listeners=function(f){var m=n?n+f:f,p=this._events[m];if(!p)return[];if(p.fn)return[p.fn];for(var v=0,x=p.length,j=new Array(x);v<x;v++)j[v]=p[v].fn;return j},c.prototype.listenerCount=function(f){var m=n?n+f:f,p=this._events[m];return p?p.fn?1:p.length:0},c.prototype.emit=function(f,m,p,v,x,j){var y=n?n+f:f;if(!this._events[y])return!1;var b=this._events[y],S=arguments.length,N,C;if(b.fn){switch(b.once&&this.removeListener(f,b.fn,void 0,!0),S){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,m),!0;case 3:return b.fn.call(b.context,m,p),!0;case 4:return b.fn.call(b.context,m,p,v),!0;case 5:return b.fn.call(b.context,m,p,v,x),!0;case 6:return b.fn.call(b.context,m,p,v,x,j),!0}for(C=1,N=new Array(S-1);C<S;C++)N[C-1]=arguments[C];b.fn.apply(b.context,N)}else{var k=b.length,A;for(C=0;C<k;C++)switch(b[C].once&&this.removeListener(f,b[C].fn,void 0,!0),S){case 1:b[C].fn.call(b[C].context);break;case 2:b[C].fn.call(b[C].context,m);break;case 3:b[C].fn.call(b[C].context,m,p);break;case 4:b[C].fn.call(b[C].context,m,p,v);break;default:if(!N)for(A=1,N=new Array(S-1);A<S;A++)N[A-1]=arguments[A];b[C].fn.apply(b[C].context,N)}}return!0},c.prototype.on=function(f,m,p){return o(this,f,m,p,!1)},c.prototype.once=function(f,m,p){return o(this,f,m,p,!0)},c.prototype.removeListener=function(f,m,p,v){var x=n?n+f:f;if(!this._events[x])return this;if(!m)return i(this,x),this;var j=this._events[x];if(j.fn)j.fn===m&&(!v||j.once)&&(!p||j.context===p)&&i(this,x);else{for(var y=0,b=[],S=j.length;y<S;y++)(j[y].fn!==m||v&&!j[y].once||p&&j[y].context!==p)&&b.push(j[y]);b.length?this._events[x]=b.length===1?b[0]:b:i(this,x)}return this},c.prototype.removeAllListeners=function(f){var m;return f?(m=n?n+f:f,this._events[m]&&i(this,m)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c})(yS)),yS.exports}var xme=vme();const yme=vn(xme);var bS=new yme,wS="recharts.syncMouseEvents";function Uf(e){"@babel/helpers - typeof";return Uf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uf(e)}function bme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,pB(r.key),r)}}function jme(e,t,n){return t&&wme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function jS(e,t,n){return t=pB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pB(e){var t=Sme(e,"string");return Uf(t)=="symbol"?t:t+""}function Sme(e,t){if(Uf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Uf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Nme=(function(){function e(){bme(this,e),jS(this,"activeIndex",0),jS(this,"coordinateList",[]),jS(this,"layout","horizontal")}return jme(e,[{key:"setDetails",value:function(n){var r,s=n.coordinateList,o=s===void 0?null:s,i=n.container,c=i===void 0?null:i,u=n.layout,f=u===void 0?null:u,m=n.offset,p=m===void 0?null:m,v=n.mouseHandlerCallback,x=v===void 0?null:v;this.coordinateList=(r=o??this.coordinateList)!==null&&r!==void 0?r:[],this.container=c??this.container,this.layout=f??this.layout,this.offset=p??this.offset,this.mouseHandlerCallback=x??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var s=this.container.getBoundingClientRect(),o=s.x,i=s.y,c=s.height,u=this.coordinateList[this.activeIndex].coordinate,f=((n=window)===null||n===void 0?void 0:n.scrollX)||0,m=((r=window)===null||r===void 0?void 0:r.scrollY)||0,p=o+u+f,v=i+this.offset.top+c/2+m;this.mouseHandlerCallback({pageX:p,pageY:v})}}}])})();function Cme(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e?.[0],s=e?.[1];if(r&&s&&nt(r)&&nt(s))return!0}return!1}function _me(e,t,n,r){var s=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-s:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-s,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function hB(e){var t=e.cx,n=e.cy,r=e.radius,s=e.startAngle,o=e.endAngle,i=An(t,n,r,s),c=An(t,n,r,o);return{points:[i,c],cx:t,cy:n,radius:r,startAngle:s,endAngle:o}}function kme(e,t,n){var r,s,o,i;if(e==="horizontal")r=t.x,o=r,s=n.top,i=n.top+n.height;else if(e==="vertical")s=t.y,i=s,r=n.left,o=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var c=t.cx,u=t.cy,f=t.innerRadius,m=t.outerRadius,p=t.angle,v=An(c,u,f,p),x=An(c,u,m,p);r=v.x,s=v.y,o=x.x,i=x.y}else return hB(t);return[{x:r,y:s},{x:o,y:i}]}function Wf(e){"@babel/helpers - typeof";return Wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wf(e)}function H$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Qh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?H$(Object(n),!0).forEach(function(r){Ame(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ame(e,t,n){return t=Eme(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Eme(e){var t=Pme(e,"string");return Wf(t)=="symbol"?t:t+""}function Pme(e,t){if(Wf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rme(e){var t,n,r=e.element,s=e.tooltipEventType,o=e.isActive,i=e.activeCoordinate,c=e.activePayload,u=e.offset,f=e.activeTooltipIndex,m=e.tooltipAxisBandSize,p=e.layout,v=e.chartName,x=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!x||!o||!i||v!=="ScatterChart"&&s!=="axis")return null;var j,y=eg;if(v==="ScatterChart")j=i,y=hde;else if(v==="BarChart")j=_me(p,i,u,m),y=q_;else if(p==="radial"){var b=hB(i),S=b.cx,N=b.cy,C=b.radius,k=b.startAngle,A=b.endAngle;j={cx:S,cy:N,startAngle:k,endAngle:A,innerRadius:C,outerRadius:C},y=hz}else j={points:kme(p,i,u)},y=eg;var E=Qh(Qh(Qh(Qh({stroke:"#ccc",pointerEvents:"none"},u),j),Mt(x,!1)),{},{payload:c,payloadIndex:f,className:Kt("recharts-tooltip-cursor",x.className)});return h.isValidElement(x)?h.cloneElement(x,E):h.createElement(y,E)}var Tme=["item"],Ome=["children","className","width","height","style","compact","title","desc"];function yu(e){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yu(e)}function $c(){return $c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$c.apply(this,arguments)}function V$(e,t){return $me(e)||Ime(e,t)||gB(e,t)||Mme()}function Mme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
122
122
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ime(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,o,i,c=[],u=!0,f=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(u=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(m){f=!0,s=m}finally{try{if(!u&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(f)throw s}}return c}}function $me(e){if(Array.isArray(e))return e}function K$(e,t){if(e==null)return{};var n=Dme(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Dme(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Lme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,vB(r.key),r)}}function zme(e,t,n){return t&&Fme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bme(e,t,n){return t=Ng(t),qme(e,mB()?Reflect.construct(t,n||[],Ng(e).constructor):t.apply(e,n))}function qme(e,t){if(t&&(yu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ume(e)}function Ume(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mB(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mB=function(){return!!e})()}function Ng(e){return Ng=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ng(e)}function Wme(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ON(e,t)}function ON(e,t){return ON=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},ON(e,t)}function bu(e){return Kme(e)||Vme(e)||gB(e)||Hme()}function Hme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
123
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gB(e,t){if(e){if(typeof e=="string")return MN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return MN(e,t)}}function Vme(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Kme(e){if(Array.isArray(e))return MN(e)}function MN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function G$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ie(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?G$(Object(n),!0).forEach(function(r){It(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function It(e,t,n){return t=vB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vB(e){var t=Gme(e,"string");return yu(t)=="symbol"?t:t+""}function Gme(e,t){if(yu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Yme={xAxis:["bottom","top"],yAxis:["left","right"]},Xme={width:"100%",height:"100%"},xB={x:0,y:0};function Jh(e){return e}var Qme=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},Jme=function(t,n,r,s){var o=n.find(function(m){return m&&m.index===r});if(o){if(t==="horizontal")return{x:o.coordinate,y:s.y};if(t==="vertical")return{x:s.x,y:o.coordinate};if(t==="centric"){var i=o.coordinate,c=s.radius;return Ie(Ie(Ie({},s),An(s.cx,s.cy,c,i)),{},{angle:i,radius:c})}var u=o.coordinate,f=s.angle;return Ie(Ie(Ie({},s),An(s.cx,s.cy,u,f)),{},{angle:f,radius:u})}return xB},Gv=function(t,n){var r=n.graphicalItems,s=n.dataStartIndex,o=n.dataEndIndex,i=(r??[]).reduce(function(c,u){var f=u.props.data;return f&&f.length?[].concat(bu(c),bu(f)):c},[]);return i.length>0?i:t&&t.length&&nt(s)&&nt(o)?t.slice(s,o+1):[]};function yB(e){return e==="number"?[0,"auto"]:void 0}var IN=function(t,n,r,s){var o=t.graphicalItems,i=t.tooltipAxis,c=Gv(n,t);return r<0||!o||!o.length||r>=c.length?null:o.reduce(function(u,f){var m,p=(m=f.props.data)!==null&&m!==void 0?m:n;p&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(p=p.slice(t.dataStartIndex,t.dataEndIndex+1));var v;if(i.dataKey&&!i.allowDuplicatedCategory){var x=p===void 0?c:p;v=Cm(x,i.dataKey,s)}else v=p&&p[r]||c[r];return v?[].concat(bu(u),[lz(f,v)]):u},[])},Y$=function(t,n,r,s){var o=s||{x:t.chartX,y:t.chartY},i=Qme(o,r),c=t.orderedTooltipTicks,u=t.tooltipAxis,f=t.tooltipTicks,m=Iie(i,c,f,u);if(m>=0&&f){var p=f[m]&&f[m].value,v=IN(t,n,m,p),x=Jme(r,c,m,o);return{activeTooltipIndex:m,activeLabel:p,activePayload:v,activeCoordinate:x}}return null},Zme=function(t,n){var r=n.axes,s=n.graphicalItems,o=n.axisType,i=n.axisIdKey,c=n.stackGroups,u=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,v=t.stackOffset,x=rz(m,o);return r.reduce(function(j,y){var b,S=y.type.defaultProps!==void 0?Ie(Ie({},y.type.defaultProps),y.props):y.props,N=S.type,C=S.dataKey,k=S.allowDataOverflow,A=S.allowDuplicatedCategory,E=S.scale,P=S.ticks,T=S.includeHidden,$=S[i];if(j[$])return j;var Y=Gv(t.data,{graphicalItems:s.filter(function(z){var V,ee=i in z.props?z.props[i]:(V=z.type.defaultProps)===null||V===void 0?void 0:V[i];return ee===$}),dataStartIndex:u,dataEndIndex:f}),H=Y.length,F,X,L;Cme(S.domain,k,N)&&(F=Y1(S.domain,null,k),x&&(N==="number"||E!=="auto")&&(L=Xd(Y,C,"category")));var I=yB(N);if(!F||F.length===0){var M,q=(M=S.domain)!==null&&M!==void 0?M:I;if(C){if(F=Xd(Y,C,N),N==="category"&&x){var G=AZ(F);A&&G?(X=F,F=dg(0,H)):A||(F=ZM(q,F,y).reduce(function(z,V){return z.indexOf(V)>=0?z:[].concat(bu(z),[V])},[]))}else if(N==="category")A?F=F.filter(function(z){return z!==""&&!Vt(z)}):F=ZM(q,F,y).reduce(function(z,V){return z.indexOf(V)>=0||V===""||Vt(V)?z:[].concat(bu(z),[V])},[]);else if(N==="number"){var O=zie(Y,s.filter(function(z){var V,ee,ae=i in z.props?z.props[i]:(V=z.type.defaultProps)===null||V===void 0?void 0:V[i],ue="hide"in z.props?z.props.hide:(ee=z.type.defaultProps)===null||ee===void 0?void 0:ee.hide;return ae===$&&(T||!ue)}),C,o,m);O&&(F=O)}x&&(N==="number"||E!=="auto")&&(L=Xd(Y,C,"category"))}else x?F=dg(0,H):c&&c[$]&&c[$].hasStack&&N==="number"?F=v==="expand"?[0,1]:iz(c[$].stackGroups,u,f):F=nz(Y,s.filter(function(z){var V=i in z.props?z.props[i]:z.type.defaultProps[i],ee="hide"in z.props?z.props.hide:z.type.defaultProps.hide;return V===$&&(T||!ee)}),N,m,!0);if(N==="number")F=TN(p,F,$,o,P),q&&(F=Y1(q,F,k));else if(N==="category"&&q){var Q=q,B=F.every(function(z){return Q.indexOf(z)>=0});B&&(F=Q)}}return Ie(Ie({},j),{},It({},$,Ie(Ie({},S),{},{axisType:o,domain:F,categoricalDomain:L,duplicateDomain:X,originalDomain:(b=S.domain)!==null&&b!==void 0?b:I,isCategorical:x,layout:m})))},{})},ege=function(t,n){var r=n.graphicalItems,s=n.Axis,o=n.axisType,i=n.axisIdKey,c=n.stackGroups,u=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,v=Gv(t.data,{graphicalItems:r,dataStartIndex:u,dataEndIndex:f}),x=v.length,j=rz(m,o),y=-1;return r.reduce(function(b,S){var N=S.type.defaultProps!==void 0?Ie(Ie({},S.type.defaultProps),S.props):S.props,C=N[i],k=yB("number");if(!b[C]){y++;var A;return j?A=dg(0,x):c&&c[C]&&c[C].hasStack?(A=iz(c[C].stackGroups,u,f),A=TN(p,A,C,o)):(A=Y1(k,nz(v,r.filter(function(E){var P,T,$=i in E.props?E.props[i]:(P=E.type.defaultProps)===null||P===void 0?void 0:P[i],Y="hide"in E.props?E.props.hide:(T=E.type.defaultProps)===null||T===void 0?void 0:T.hide;return $===C&&!Y}),"number",m),s.defaultProps.allowDataOverflow),A=TN(p,A,C,o)),Ie(Ie({},b),{},It({},C,Ie(Ie({axisType:o},s.defaultProps),{},{hide:!0,orientation:_a(Yme,"".concat(o,".").concat(y%2),null),domain:A,originalDomain:k,isCategorical:j,layout:m})))}return b},{})},tge=function(t,n){var r=n.axisType,s=r===void 0?"xAxis":r,o=n.AxisComp,i=n.graphicalItems,c=n.stackGroups,u=n.dataStartIndex,f=n.dataEndIndex,m=t.children,p="".concat(s,"Id"),v=ka(m,o),x={};return v&&v.length?x=Zme(t,{axes:v,graphicalItems:i,axisType:s,axisIdKey:p,stackGroups:c,dataStartIndex:u,dataEndIndex:f}):i&&i.length&&(x=ege(t,{Axis:o,graphicalItems:i,axisType:s,axisIdKey:p,stackGroups:c,dataStartIndex:u,dataEndIndex:f})),x},nge=function(t){var n=Ac(t),r=fl(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:m_(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Qm(n,r)}},X$=function(t){var n=t.children,r=t.defaultShowTooltip,s=ba(n,uu),o=0,i=0;return t.data&&t.data.length!==0&&(i=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(o=s.props.startIndex),s.props.endIndex>=0&&(i=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:i,activeTooltipIndex:-1,isTooltipActive:!!r}},rge=function(t){return!t||!t.length?!1:t.some(function(n){var r=_o(n&&n.type);return r&&r.indexOf("Bar")>=0})},Q$=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},age=function(t,n){var r=t.props,s=t.graphicalItems,o=t.xAxisMap,i=o===void 0?{}:o,c=t.yAxisMap,u=c===void 0?{}:c,f=r.width,m=r.height,p=r.children,v=r.margin||{},x=ba(p,uu),j=ba(p,hl),y=Object.keys(u).reduce(function(A,E){var P=u[E],T=P.orientation;return!P.mirror&&!P.hide?Ie(Ie({},A),{},It({},T,A[T]+P.width)):A},{left:v.left||0,right:v.right||0}),b=Object.keys(i).reduce(function(A,E){var P=i[E],T=P.orientation;return!P.mirror&&!P.hide?Ie(Ie({},A),{},It({},T,_a(A,"".concat(T))+P.height)):A},{top:v.top||0,bottom:v.bottom||0}),S=Ie(Ie({},b),y),N=S.bottom;x&&(S.bottom+=x.props.height||uu.defaultProps.height),j&&n&&(S=Lie(S,s,r,n));var C=f-S.left-S.right,k=m-S.top-S.bottom;return Ie(Ie({brushBottom:N},S),{},{width:Math.max(C,0),height:Math.max(k,0)})},sge=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},K_=function(t){var n=t.chartName,r=t.GraphicalChild,s=t.defaultTooltipEventType,o=s===void 0?"axis":s,i=t.validateTooltipEventTypes,c=i===void 0?["axis"]:i,u=t.axisComponents,f=t.legendContent,m=t.formatAxisMap,p=t.defaultProps,v=function(S,N){var C=N.graphicalItems,k=N.stackGroups,A=N.offset,E=N.updateId,P=N.dataStartIndex,T=N.dataEndIndex,$=S.barSize,Y=S.layout,H=S.barGap,F=S.barCategoryGap,X=S.maxBarSize,L=Q$(Y),I=L.numericAxisName,M=L.cateAxisName,q=rge(C),G=[];return C.forEach(function(O,Q){var B=Gv(S.data,{graphicalItems:[O],dataStartIndex:P,dataEndIndex:T}),z=O.type.defaultProps!==void 0?Ie(Ie({},O.type.defaultProps),O.props):O.props,V=z.dataKey,ee=z.maxBarSize,ae=z["".concat(I,"Id")],ue=z["".concat(M,"Id")],se={},xe=u.reduce(function(Re,Ze){var ht=N["".concat(Ze.axisType,"Map")],Ft=z["".concat(Ze.axisType,"Id")];ht&&ht[Ft]||Ze.axisType==="zAxis"||kl();var zt=ht[Ft];return Ie(Ie({},Re),{},It(It({},Ze.axisType,zt),"".concat(Ze.axisType,"Ticks"),fl(zt)))},se),oe=xe[M],de=xe["".concat(M,"Ticks")],De=k&&k[ae]&&k[ae].hasStack&&Yie(O,k[ae].stackGroups),me=_o(O.type).indexOf("Bar")>=0,ge=Qm(oe,de),we=[],at=q&&$ie({barSize:$,stackGroups:k,totalSize:sge(xe,M)});if(me){var tt,it,At=Vt(ee)?X:ee,Ge=(tt=(it=Qm(oe,de,!0))!==null&&it!==void 0?it:At)!==null&&tt!==void 0?tt:0;we=Die({barGap:H,barCategoryGap:F,bandSize:Ge!==ge?Ge:ge,sizeList:at[ue],maxBarSize:At}),Ge!==ge&&(we=we.map(function(Re){return Ie(Ie({},Re),{},{position:Ie(Ie({},Re.position),{},{offset:Re.position.offset-Ge/2})})}))}var Ee=O&&O.type&&O.type.getComposedData;Ee&&G.push({props:Ie(Ie({},Ee(Ie(Ie({},xe),{},{displayedData:B,props:S,dataKey:V,item:O,bandSize:ge,barPosition:we,offset:A,stackedData:De,layout:Y,dataStartIndex:P,dataEndIndex:T}))),{},It(It(It({key:O.key||"item-".concat(Q)},I,xe[I]),M,xe[M]),"animationId",E)),childIndex:BZ(O,S.children),item:O})}),G},x=function(S,N){var C=S.props,k=S.dataStartIndex,A=S.dataEndIndex,E=S.updateId;if(!pT({props:C}))return null;var P=C.children,T=C.layout,$=C.stackOffset,Y=C.data,H=C.reverseStackOrder,F=Q$(T),X=F.numericAxisName,L=F.cateAxisName,I=ka(P,r),M=Kie(Y,I,"".concat(X,"Id"),"".concat(L,"Id"),$,H),q=u.reduce(function(z,V){var ee="".concat(V.axisType,"Map");return Ie(Ie({},z),{},It({},ee,tge(C,Ie(Ie({},V),{},{graphicalItems:I,stackGroups:V.axisType===X&&M,dataStartIndex:k,dataEndIndex:A}))))},{}),G=age(Ie(Ie({},q),{},{props:C,graphicalItems:I}),N?.legendBBox);Object.keys(q).forEach(function(z){q[z]=m(C,q[z],G,z.replace("Map",""),n)});var O=q["".concat(L,"Map")],Q=nge(O),B=v(C,Ie(Ie({},q),{},{dataStartIndex:k,dataEndIndex:A,updateId:E,graphicalItems:I,stackGroups:M,offset:G}));return Ie(Ie({formattedGraphicalItems:B,graphicalItems:I,offset:G,stackGroups:M},Q),q)},j=(function(b){function S(N){var C,k,A;return Lme(this,S),A=Bme(this,S,[N]),It(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),It(A,"accessibilityManager",new Nme),It(A,"handleLegendBBoxUpdate",function(E){if(E){var P=A.state,T=P.dataStartIndex,$=P.dataEndIndex,Y=P.updateId;A.setState(Ie({legendBBox:E},x({props:A.props,dataStartIndex:T,dataEndIndex:$,updateId:Y},Ie(Ie({},A.state),{},{legendBBox:E}))))}}),It(A,"handleReceiveSyncEvent",function(E,P,T){if(A.props.syncId===E){if(T===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(P)}}),It(A,"handleBrushChange",function(E){var P=E.startIndex,T=E.endIndex;if(P!==A.state.dataStartIndex||T!==A.state.dataEndIndex){var $=A.state.updateId;A.setState(function(){return Ie({dataStartIndex:P,dataEndIndex:T},x({props:A.props,dataStartIndex:P,dataEndIndex:T,updateId:$},A.state))}),A.triggerSyncEvent({dataStartIndex:P,dataEndIndex:T})}}),It(A,"handleMouseEnter",function(E){var P=A.getMouseInfo(E);if(P){var T=Ie(Ie({},P),{},{isTooltipActive:!0});A.setState(T),A.triggerSyncEvent(T);var $=A.props.onMouseEnter;Ht($)&&$(T,E)}}),It(A,"triggeredAfterMouseMove",function(E){var P=A.getMouseInfo(E),T=P?Ie(Ie({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState(T),A.triggerSyncEvent(T);var $=A.props.onMouseMove;Ht($)&&$(T,E)}),It(A,"handleItemMouseEnter",function(E){A.setState(function(){return{isTooltipActive:!0,activeItem:E,activePayload:E.tooltipPayload,activeCoordinate:E.tooltipPosition||{x:E.cx,y:E.cy}}})}),It(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),It(A,"handleMouseMove",function(E){E.persist(),A.throttleTriggeredAfterMouseMove(E)}),It(A,"handleMouseLeave",function(E){A.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};A.setState(P),A.triggerSyncEvent(P);var T=A.props.onMouseLeave;Ht(T)&&T(P,E)}),It(A,"handleOuterEvent",function(E){var P=zZ(E),T=_a(A.props,"".concat(P));if(P&&Ht(T)){var $,Y;/.*touch.*/i.test(P)?Y=A.getMouseInfo(E.changedTouches[0]):Y=A.getMouseInfo(E),T(($=Y)!==null&&$!==void 0?$:{},E)}}),It(A,"handleClick",function(E){var P=A.getMouseInfo(E);if(P){var T=Ie(Ie({},P),{},{isTooltipActive:!0});A.setState(T),A.triggerSyncEvent(T);var $=A.props.onClick;Ht($)&&$(T,E)}}),It(A,"handleMouseDown",function(E){var P=A.props.onMouseDown;if(Ht(P)){var T=A.getMouseInfo(E);P(T,E)}}),It(A,"handleMouseUp",function(E){var P=A.props.onMouseUp;if(Ht(P)){var T=A.getMouseInfo(E);P(T,E)}}),It(A,"handleTouchMove",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(E.changedTouches[0])}),It(A,"handleTouchStart",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.handleMouseDown(E.changedTouches[0])}),It(A,"handleTouchEnd",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.handleMouseUp(E.changedTouches[0])}),It(A,"handleDoubleClick",function(E){var P=A.props.onDoubleClick;if(Ht(P)){var T=A.getMouseInfo(E);P(T,E)}}),It(A,"handleContextMenu",function(E){var P=A.props.onContextMenu;if(Ht(P)){var T=A.getMouseInfo(E);P(T,E)}}),It(A,"triggerSyncEvent",function(E){A.props.syncId!==void 0&&bS.emit(wS,A.props.syncId,E,A.eventEmitterSymbol)}),It(A,"applySyncEvent",function(E){var P=A.props,T=P.layout,$=P.syncMethod,Y=A.state.updateId,H=E.dataStartIndex,F=E.dataEndIndex;if(E.dataStartIndex!==void 0||E.dataEndIndex!==void 0)A.setState(Ie({dataStartIndex:H,dataEndIndex:F},x({props:A.props,dataStartIndex:H,dataEndIndex:F,updateId:Y},A.state)));else if(E.activeTooltipIndex!==void 0){var X=E.chartX,L=E.chartY,I=E.activeTooltipIndex,M=A.state,q=M.offset,G=M.tooltipTicks;if(!q)return;if(typeof $=="function")I=$(G,E);else if($==="value"){I=-1;for(var O=0;O<G.length;O++)if(G[O].value===E.activeLabel){I=O;break}}var Q=Ie(Ie({},q),{},{x:q.left,y:q.top}),B=Math.min(X,Q.x+Q.width),z=Math.min(L,Q.y+Q.height),V=G[I]&&G[I].value,ee=IN(A.state,A.props.data,I),ae=G[I]?{x:T==="horizontal"?G[I].coordinate:B,y:T==="horizontal"?z:G[I].coordinate}:xB;A.setState(Ie(Ie({},E),{},{activeLabel:V,activeCoordinate:ae,activePayload:ee,activeTooltipIndex:I}))}else A.setState(E)}),It(A,"renderCursor",function(E){var P,T=A.state,$=T.isTooltipActive,Y=T.activeCoordinate,H=T.activePayload,F=T.offset,X=T.activeTooltipIndex,L=T.tooltipAxisBandSize,I=A.getTooltipEventType(),M=(P=E.props.active)!==null&&P!==void 0?P:$,q=A.props.layout,G=E.key||"_recharts-cursor";return J.createElement(Rme,{key:G,activeCoordinate:Y,activePayload:H,activeTooltipIndex:X,chartName:n,element:E,isActive:M,layout:q,offset:F,tooltipAxisBandSize:L,tooltipEventType:I})}),It(A,"renderPolarAxis",function(E,P,T){var $=_a(E,"type.axisType"),Y=_a(A.state,"".concat($,"Map")),H=E.type.defaultProps,F=H!==void 0?Ie(Ie({},H),E.props):E.props,X=Y&&Y[F["".concat($,"Id")]];return h.cloneElement(E,Ie(Ie({},X),{},{className:Kt($,X.className),key:E.key||"".concat(P,"-").concat(T),ticks:fl(X,!0)}))}),It(A,"renderPolarGrid",function(E){var P=E.props,T=P.radialLines,$=P.polarAngles,Y=P.polarRadius,H=A.state,F=H.radiusAxisMap,X=H.angleAxisMap,L=Ac(F),I=Ac(X),M=I.cx,q=I.cy,G=I.innerRadius,O=I.outerRadius;return h.cloneElement(E,{polarAngles:Array.isArray($)?$:fl(I,!0).map(function(Q){return Q.coordinate}),polarRadius:Array.isArray(Y)?Y:fl(L,!0).map(function(Q){return Q.coordinate}),cx:M,cy:q,innerRadius:G,outerRadius:O,key:E.key||"polar-grid",radialLines:T})}),It(A,"renderLegend",function(){var E=A.state.formattedGraphicalItems,P=A.props,T=P.children,$=P.width,Y=P.height,H=A.props.margin||{},F=$-(H.left||0)-(H.right||0),X=ez({children:T,formattedGraphicalItems:E,legendWidth:F,legendContent:f});if(!X)return null;var L=X.item,I=K$(X,Tme);return h.cloneElement(L,Ie(Ie({},I),{},{chartWidth:$,chartHeight:Y,margin:H,onBBoxUpdate:A.handleLegendBBoxUpdate}))}),It(A,"renderTooltip",function(){var E,P=A.props,T=P.children,$=P.accessibilityLayer,Y=ba(T,ra);if(!Y)return null;var H=A.state,F=H.isTooltipActive,X=H.activeCoordinate,L=H.activePayload,I=H.activeLabel,M=H.offset,q=(E=Y.props.active)!==null&&E!==void 0?E:F;return h.cloneElement(Y,{viewBox:Ie(Ie({},M),{},{x:M.left,y:M.top}),active:q,label:I,payload:q?L:[],coordinate:X,accessibilityLayer:$})}),It(A,"renderBrush",function(E){var P=A.props,T=P.margin,$=P.data,Y=A.state,H=Y.offset,F=Y.dataStartIndex,X=Y.dataEndIndex,L=Y.updateId;return h.cloneElement(E,{key:E.key||"_recharts-brush",onChange:Kh(A.handleBrushChange,E.props.onChange),data:$,x:nt(E.props.x)?E.props.x:H.left,y:nt(E.props.y)?E.props.y:H.top+H.height+H.brushBottom-(T.bottom||0),width:nt(E.props.width)?E.props.width:H.width,startIndex:F,endIndex:X,updateId:"brush-".concat(L)})}),It(A,"renderReferenceElement",function(E,P,T){if(!E)return null;var $=A,Y=$.clipPathId,H=A.state,F=H.xAxisMap,X=H.yAxisMap,L=H.offset,I=E.type.defaultProps||{},M=E.props,q=M.xAxisId,G=q===void 0?I.xAxisId:q,O=M.yAxisId,Q=O===void 0?I.yAxisId:O;return h.cloneElement(E,{key:E.key||"".concat(P,"-").concat(T),xAxis:F[G],yAxis:X[Q],viewBox:{x:L.left,y:L.top,width:L.width,height:L.height},clipPathId:Y})}),It(A,"renderActivePoints",function(E){var P=E.item,T=E.activePoint,$=E.basePoint,Y=E.childIndex,H=E.isRange,F=[],X=P.props.key,L=P.item.type.defaultProps!==void 0?Ie(Ie({},P.item.type.defaultProps),P.item.props):P.item.props,I=L.activeDot,M=L.dataKey,q=Ie(Ie({index:Y,dataKey:M,cx:T.x,cy:T.y,r:4,fill:B_(P.item),strokeWidth:2,stroke:"#fff",payload:T.payload,value:T.value},Mt(I,!1)),_m(I));return F.push(S.renderActiveDot(I,q,"".concat(X,"-activePoint-").concat(Y))),$?F.push(S.renderActiveDot(I,Ie(Ie({},q),{},{cx:$.x,cy:$.y}),"".concat(X,"-basePoint-").concat(Y))):H&&F.push(null),F}),It(A,"renderGraphicChild",function(E,P,T){var $=A.filterFormatItem(E,P,T);if(!$)return null;var Y=A.getTooltipEventType(),H=A.state,F=H.isTooltipActive,X=H.tooltipAxis,L=H.activeTooltipIndex,I=H.activeLabel,M=A.props.children,q=ba(M,ra),G=$.props,O=G.points,Q=G.isRange,B=G.baseLine,z=$.item.type.defaultProps!==void 0?Ie(Ie({},$.item.type.defaultProps),$.item.props):$.item.props,V=z.activeDot,ee=z.hide,ae=z.activeBar,ue=z.activeShape,se=!!(!ee&&F&&q&&(V||ae||ue)),xe={};Y!=="axis"&&q&&q.props.trigger==="click"?xe={onClick:Kh(A.handleItemMouseEnter,E.props.onClick)}:Y!=="axis"&&(xe={onMouseLeave:Kh(A.handleItemMouseLeave,E.props.onMouseLeave),onMouseEnter:Kh(A.handleItemMouseEnter,E.props.onMouseEnter)});var oe=h.cloneElement(E,Ie(Ie({},$.props),xe));function de(Ze){return typeof X.dataKey=="function"?X.dataKey(Ze.payload):null}if(se)if(L>=0){var De,me;if(X.dataKey&&!X.allowDuplicatedCategory){var ge=typeof X.dataKey=="function"?de:"payload.".concat(X.dataKey.toString());De=Cm(O,ge,I),me=Q&&B&&Cm(B,ge,I)}else De=O?.[L],me=Q&&B&&B[L];if(ue||ae){var we=E.props.activeIndex!==void 0?E.props.activeIndex:L;return[h.cloneElement(E,Ie(Ie(Ie({},$.props),xe),{},{activeIndex:we})),null,null]}if(!Vt(De))return[oe].concat(bu(A.renderActivePoints({item:$,activePoint:De,basePoint:me,childIndex:L,isRange:Q})))}else{var at,tt=(at=A.getItemByXY(A.state.activeCoordinate))!==null&&at!==void 0?at:{graphicalItem:oe},it=tt.graphicalItem,At=it.item,Ge=At===void 0?E:At,Ee=it.childIndex,Re=Ie(Ie(Ie({},$.props),xe),{},{activeIndex:Ee});return[h.cloneElement(Ge,Re),null,null]}return Q?[oe,null,null]:[oe,null]}),It(A,"renderCustomized",function(E,P,T){return h.cloneElement(E,Ie(Ie({key:"recharts-customized-".concat(T)},A.props),A.state))}),It(A,"renderMap",{CartesianGrid:{handler:Jh,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:Jh},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:Jh},YAxis:{handler:Jh},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((C=N.id)!==null&&C!==void 0?C:Iu("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=eF(A.triggeredAfterMouseMove,(k=N.throttleDelay)!==null&&k!==void 0?k:1e3/60),A.state={},A}return Wme(S,b),zme(S,[{key:"componentDidMount",value:function(){var C,k;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,k=C.children,A=C.data,E=C.height,P=C.layout,T=ba(k,ra);if(T){var $=T.props.defaultIndex;if(!(typeof $!="number"||$<0||$>this.state.tooltipTicks.length-1)){var Y=this.state.tooltipTicks[$]&&this.state.tooltipTicks[$].value,H=IN(this.state,A,$,Y),F=this.state.tooltipTicks[$].coordinate,X=(this.state.offset.top+E)/2,L=P==="horizontal",I=L?{x:F,y:X}:{y:F,x:X},M=this.state.formattedGraphicalItems.find(function(G){var O=G.item;return O.type.name==="Scatter"});M&&(I=Ie(Ie({},I),M.props.points[$].tooltipPosition),H=M.props.points[$].tooltipPayload);var q={activeTooltipIndex:$,isTooltipActive:!0,activeLabel:Y,activePayload:H,activeCoordinate:I};this.setState(q),this.renderCursor(T),this.accessibilityManager.setIndex($)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,k){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==k.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var A,E;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(E=this.props.margin.top)!==null&&E!==void 0?E:0}})}return null}},{key:"componentDidUpdate",value:function(C){v1([ba(C.children,ra)],[ba(this.props.children,ra)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=ba(this.props.children,ra);if(C&&typeof C.props.shared=="boolean"){var k=C.props.shared?"axis":"item";return c.indexOf(k)>=0?k:o}return o}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var k=this.container,A=k.getBoundingClientRect(),E=kre(A),P={chartX:Math.round(C.pageX-E.left),chartY:Math.round(C.pageY-E.top)},T=A.width/k.offsetWidth||1,$=this.inRange(P.chartX,P.chartY,T);if(!$)return null;var Y=this.state,H=Y.xAxisMap,F=Y.yAxisMap,X=this.getTooltipEventType(),L=Y$(this.state,this.props.data,this.props.layout,$);if(X!=="axis"&&H&&F){var I=Ac(H).scale,M=Ac(F).scale,q=I&&I.invert?I.invert(P.chartX):null,G=M&&M.invert?M.invert(P.chartY):null;return Ie(Ie({},P),{},{xValue:q,yValue:G},L)}return L?Ie(Ie({},P),L):null}},{key:"inRange",value:function(C,k){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,E=this.props.layout,P=C/A,T=k/A;if(E==="horizontal"||E==="vertical"){var $=this.state.offset,Y=P>=$.left&&P<=$.left+$.width&&T>=$.top&&T<=$.top+$.height;return Y?{x:P,y:T}:null}var H=this.state,F=H.angleAxisMap,X=H.radiusAxisMap;if(F&&X){var L=Ac(F);return nI({x:P,y:T},L)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,k=this.getTooltipEventType(),A=ba(C,ra),E={};A&&k==="axis"&&(A.props.trigger==="click"?E={onClick:this.handleClick}:E={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var P=_m(this.props,this.handleOuterEvent);return Ie(Ie({},P),E)}},{key:"addListener",value:function(){bS.on(wS,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){bS.removeListener(wS,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,k,A){for(var E=this.state.formattedGraphicalItems,P=0,T=E.length;P<T;P++){var $=E[P];if($.item===C||$.props.key===C.key||k===_o($.item.type)&&A===$.childIndex)return $}return null}},{key:"renderClipPath",value:function(){var C=this.clipPathId,k=this.state.offset,A=k.left,E=k.top,P=k.height,T=k.width;return J.createElement("defs",null,J.createElement("clipPath",{id:C},J.createElement("rect",{x:A,y:E,height:P,width:T})))}},{key:"getXScales",value:function(){var C=this.state.xAxisMap;return C?Object.entries(C).reduce(function(k,A){var E=V$(A,2),P=E[0],T=E[1];return Ie(Ie({},k),{},It({},P,T.scale))},{}):null}},{key:"getYScales",value:function(){var C=this.state.yAxisMap;return C?Object.entries(C).reduce(function(k,A){var E=V$(A,2),P=E[0],T=E[1];return Ie(Ie({},k),{},It({},P,T.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(C){var k;return(k=this.state.xAxisMap)===null||k===void 0||(k=k[C])===null||k===void 0?void 0:k.scale}},{key:"getYScaleByAxisId",value:function(C){var k;return(k=this.state.yAxisMap)===null||k===void 0||(k=k[C])===null||k===void 0?void 0:k.scale}},{key:"getItemByXY",value:function(C){var k=this.state,A=k.formattedGraphicalItems,E=k.activeItem;if(A&&A.length)for(var P=0,T=A.length;P<T;P++){var $=A[P],Y=$.props,H=$.item,F=H.type.defaultProps!==void 0?Ie(Ie({},H.type.defaultProps),H.props):H.props,X=_o(H.type);if(X==="Bar"){var L=(Y.data||[]).find(function(G){return Gue(C,G)});if(L)return{graphicalItem:$,payload:L}}else if(X==="RadialBar"){var I=(Y.data||[]).find(function(G){return nI(C,G)});if(I)return{graphicalItem:$,payload:I}}else if(zv($,E)||Bv($,E)||Lf($,E)){var M=vfe({graphicalItem:$,activeTooltipItem:E,itemData:F.data}),q=F.activeIndex===void 0?M:F.activeIndex;return{graphicalItem:Ie(Ie({},$),{},{childIndex:q}),payload:Lf($,E)?F.data[M]:$.props.data[M]}}}return null}},{key:"render",value:function(){var C=this;if(!pT(this))return null;var k=this.props,A=k.children,E=k.className,P=k.width,T=k.height,$=k.style,Y=k.compact,H=k.title,F=k.desc,X=K$(k,Ome),L=Mt(X,!1);if(Y)return J.createElement(E$,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},J.createElement(y1,$c({},L,{width:P,height:T,title:H,desc:F}),this.renderClipPath(),mT(A,this.renderMap)));if(this.props.accessibilityLayer){var I,M;L.tabIndex=(I=this.props.tabIndex)!==null&&I!==void 0?I:0,L.role=(M=this.props.role)!==null&&M!==void 0?M:"application",L.onKeyDown=function(G){C.accessibilityManager.keyboardEvent(G)},L.onFocus=function(){C.accessibilityManager.focus()}}var q=this.parseEventsOfWrapper();return J.createElement(E$,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},J.createElement("div",$c({className:Kt("recharts-wrapper",E),style:Ie({position:"relative",cursor:"default",width:P,height:T},$)},q,{ref:function(O){C.container=O}}),J.createElement(y1,$c({},L,{width:P,height:T,title:H,desc:F,style:Xme}),this.renderClipPath(),mT(A,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(h.Component);It(j,"displayName",n),It(j,"defaultProps",Ie({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},p)),It(j,"getDerivedStateFromProps",function(b,S){var N=b.dataKey,C=b.data,k=b.children,A=b.width,E=b.height,P=b.layout,T=b.stackOffset,$=b.margin,Y=S.dataStartIndex,H=S.dataEndIndex;if(S.updateId===void 0){var F=X$(b);return Ie(Ie(Ie({},F),{},{updateId:0},x(Ie(Ie({props:b},F),{},{updateId:0}),S)),{},{prevDataKey:N,prevData:C,prevWidth:A,prevHeight:E,prevLayout:P,prevStackOffset:T,prevMargin:$,prevChildren:k})}if(N!==S.prevDataKey||C!==S.prevData||A!==S.prevWidth||E!==S.prevHeight||P!==S.prevLayout||T!==S.prevStackOffset||!Bc($,S.prevMargin)){var X=X$(b),L={chartX:S.chartX,chartY:S.chartY,isTooltipActive:S.isTooltipActive},I=Ie(Ie({},Y$(S,C,P)),{},{updateId:S.updateId+1}),M=Ie(Ie(Ie({},X),L),I);return Ie(Ie(Ie({},M),x(Ie({props:b},M),S)),{},{prevDataKey:N,prevData:C,prevWidth:A,prevHeight:E,prevLayout:P,prevStackOffset:T,prevMargin:$,prevChildren:k})}if(!v1(k,S.prevChildren)){var q,G,O,Q,B=ba(k,uu),z=B&&(q=(G=B.props)===null||G===void 0?void 0:G.startIndex)!==null&&q!==void 0?q:Y,V=B&&(O=(Q=B.props)===null||Q===void 0?void 0:Q.endIndex)!==null&&O!==void 0?O:H,ee=z!==Y||V!==H,ae=!Vt(C),ue=ae&&!ee?S.updateId:S.updateId+1;return Ie(Ie({updateId:ue},x(Ie(Ie({props:b},S),{},{updateId:ue,dataStartIndex:z,dataEndIndex:V}),S)),{},{prevChildren:k,dataStartIndex:z,dataEndIndex:V})}return null}),It(j,"renderActiveDot",function(b,S,N){var C;return h.isValidElement(b)?C=h.cloneElement(b,S):Ht(b)?C=b(S):C=J.createElement(Iv,S),J.createElement(un,{className:"recharts-active-dot",key:N},C)});var y=h.forwardRef(function(S,N){return J.createElement(j,$c({},S,{ref:N}))});return y.displayName=j.displayName,y},$N=K_({chartName:"LineChart",GraphicalChild:Al,axisComponents:[{axisType:"xAxis",AxisComp:_i},{axisType:"yAxis",AxisComp:ki}],formatAxisMap:Dz}),oge=K_({chartName:"BarChart",GraphicalChild:Kl,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:_i},{axisType:"yAxis",AxisComp:ki}],formatAxisMap:Dz}),ige=K_({chartName:"PieChart",GraphicalChild:Wo,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Fv},{axisType:"radiusAxis",AxisComp:Dv}],formatAxisMap:sle,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function bB(e){return Array.from(new Map(e.scenarios.map(t=>{const n=String(t.scenarioId??"").trim(),r=String(t.scenarioName??"").trim();return!n&&!r?null:[n||r,r||n]}).filter(t=>!!t)).values())}function G_(e){const t=bB(e),n=e.scenarios.map(v=>v.agentName||v.agentId).filter(Boolean),r=Array.from(new Set(n.length>0?n:e.rerunAgents??[])),s=Array.from(new Set(e.scenarios.map(v=>v.model).filter(v=>!!v))),o=t.slice(0,2).join(", "),i=t.length>2?` +${t.length-2}`:"",c=s.slice(0,2).join(", "),u=s.length>2?` +${s.length-2}`:"",f=e.configName?.trim()||"",m=e.configPath?.trim()||"",p=f&&m?`${f} · ${m}`:f||m;return{scenarioCount:t.length,agentCount:r.length,scopePreview:p||(o?`${o}${i}`:"n/a"),modelSummary:c?`${c}${u}`:""}}function vi(e){const t=typeof e.toolTokensTotal=="number"?e.toolTokensTotal:null;return{id:e.runId,configId:"",configHash:e.configHash,configPath:e.configPath,configName:e.configName,langsmithTraceUrls:e.langsmithTraceUrls,rerunAgents:e.rerunAgents,rerunScenarioIds:e.rerunScenarioIds,rerunServerOverrideAll:e.rerunServerOverrideAll,rerunScenarioServerOverrides:e.rerunScenarioServerOverrides,timestamp:e.timestamp,runNote:e.runNote,mcpServerVersions:e.mcpServerVersions??{},scenarios:(e.scenarioIds??[]).map((n,r)=>({scenarioId:n,scenarioName:e.scenarioNames?.[r]??n,agentId:"",agentName:"",runs:[],passRate:0,avgToolCalls:0,avgDuration:0})),assistantTokenUsage:null,toolTokenUsage:t===null?null:{inputTokens:null,outputTokens:null,totalTokens:t},overallPassRate:e.passRate,totalScenarios:e.totalScenarios,totalRuns:e.totalRuns,avgToolCalls:e.avgToolCalls,avgLatency:Math.round(e.avgLatencyMs??0),totalDurationMs:typeof e.totalDurationMs=="number"?Math.max(0,e.totalDurationMs):void 0,totalToolDurationMs:typeof e.totalToolDurationMs=="number"?Math.max(0,e.totalToolDurationMs):void 0,checkCounts:e.checkCounts}}const J$=10080*60*1e3;function Z$(e){return e.length===0?0:e.reduce((t,n)=>t+n,0)/e.length}function eD(e,t=0){const n=Number(e.toFixed(t));return`${n>0?"+":""}${n.toFixed(t)}`}const lge=()=>{const{configs:e}=up(),{source:t}=$n(),[n,r]=h.useState(!0),[s,o]=h.useState([]),[i,c]=h.useState([]),[u,f]=h.useState([]),[m,p]=h.useState("timestamp"),[v,x]=h.useState("desc"),j=M=>{if(m===M){x(q=>q==="asc"?"desc":"asc");return}p(M),x("desc")};h.useEffect(()=>{let M=!0;r(!0);const q=Date.now(),G=q-720*60*60*1e3,O=q-J$,Q=O-J$,B=new Date(G).toISOString(),z=new Date(O).toISOString(),V=new Date(Q).toISOString(),ee=new Date(O-1).toISOString(),ae=new Date(q).toISOString(),ue=async(se,xe)=>t.listRunSummaries?(await t.listRunSummaries({since:se,until:xe})).map(vi):t.listResults({since:se,until:xe});return Promise.all([t.listResults({since:B,until:ae}),ue(z,ae),ue(V,ee)]).then(([se,xe,oe])=>{M&&(o(se),c(xe),f(oe))}).finally(()=>{M&&r(!1)}),()=>{M=!1}},[t]);const y=e.length,b=s.length,S=i.length===0?0:i.reduce((M,q)=>M+q.overallPassRate,0)/i.length,N=i.length===0?0:Math.round(i.reduce((M,q)=>M+q.avgLatency,0)/i.length),C=Z$(u.map(M=>M.overallPassRate)),k=Z$(u.map(M=>M.avgLatency)),A=(S-C)*100,E=N-k,P=u.length>0,T=P?`${eD(A,1)}% from last week`:"No prior-week baseline",$=P?`${eD(E,0)}ms from last week`:"No prior-week baseline",Y=P?A>0?"up":A<0?"down":"neutral":"neutral",H=P?E<0?"up":E>0?"down":"neutral":"neutral",F=h.useMemo(()=>[...s].sort((q,G)=>{let O=0;return m==="timestamp"&&(O=new Date(q.timestamp).getTime()-new Date(G.timestamp).getTime()),m==="passRate"&&(O=q.overallPassRate-G.overallPassRate),m==="latency"&&(O=q.avgLatency-G.avgLatency),m==="scenarios"&&(O=q.totalScenarios-G.totalScenarios),v==="asc"?O:-O}),[s,m,v]),X=F.slice(0,20),L=M=>{const q=M.toolTokenUsage?.totalTokens;return typeof q=="number"?q.toLocaleString():"n/a"},I=[...F].reverse().map(M=>({date:new Date(M.timestamp).toLocaleDateString("en-US",{month:"short",day:"numeric"}),passRate:Math.round(M.overallPassRate*100),latency:M.avgLatency}));return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(gC,{className:"h-6 w-6"}),"Dashboard"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Overview of your MCP evaluation runs"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(Z,{asChild:!0,children:a.jsxs(Et,{to:"/mcp-evaluations/new",children:[a.jsx(yC,{className:"mr-2 h-4 w-4"}),"New MCP Evaluation"]})}),a.jsx(Z,{variant:"outline",asChild:!0,children:a.jsxs(Et,{to:"/run",children:[a.jsx(ks,{className:"mr-2 h-4 w-4"}),"Run Evaluation"]})}),a.jsx(Z,{variant:"outline",asChild:!0,children:a.jsxs(Et,{to:"/results",children:[a.jsx(bl,{className:"mr-2 h-4 w-4"}),"Browse Results"]})})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsx(nr,{title:"MCP Evaluations",value:y,icon:gm,subtitle:`${y} active`}),a.jsx(nr,{title:"Total Runs",value:b,icon:hC,subtitle:"Last 30 days"}),a.jsx(nr,{title:"Pass Rate",value:n?"—":`${Math.round(S*100)}%`,icon:bl,subtitle:n?"Loading...":T,trend:n?"neutral":Y}),a.jsx(nr,{title:"Avg Latency",value:n?"—":`${N}ms`,icon:bC,subtitle:n?"Loading...":$,trend:n?"neutral":H})]}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Pass Rate Trend"})}),a.jsx(Je,{children:a.jsx(hf,{width:"100%",height:200,children:a.jsxs($N,{data:I,children:[a.jsx(_i,{dataKey:"date",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(ki,{domain:[0,100],tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:M=>`${M}%`}),a.jsx(ra,{formatter:M=>[`${M}%`,"Pass Rate"]}),a.jsx(Al,{type:"monotone",dataKey:"passRate",stroke:"hsl(38, 92%, 50%)",strokeWidth:2,dot:{r:3,fill:"hsl(38, 92%, 50%)"}})]})})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Recent Tool Latency (ms)"})}),a.jsx(Je,{children:a.jsx(hf,{width:"100%",height:200,children:a.jsxs($N,{data:I,children:[a.jsx(_i,{dataKey:"date",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(ki,{tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(ra,{formatter:M=>[`${M}ms`,"Latency"]}),a.jsx(Al,{type:"monotone",dataKey:"latency",stroke:"hsl(200, 80%, 50%)",strokeWidth:2,dot:{r:3,fill:"hsl(200, 80%, 50%)"}})]})})})]})]}),a.jsx("div",{className:"grid gap-6",children:a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Recent Runs"})}),a.jsxs(Je,{className:"p-0",children:[a.jsxs(oa,{children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{children:"Run ID"}),a.jsx(ct,{children:"Evaluated"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>j("timestamp"),children:["Timestamp",m==="timestamp"?v==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}):a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-end gap-1 hover:text-foreground",onClick:()=>j("passRate"),children:["Pass Rate",m==="passRate"?v==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}):a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>j("scenarios"),children:["Scenarios",m==="scenarios"?v==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}):a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),a.jsx(ct,{className:"text-right",children:"Avg Tools"}),a.jsx(ct,{className:"text-right",children:"Tool Tokens"})]})}),a.jsxs(la,{children:[X.length===0&&a.jsx(Wt,{children:a.jsx(qe,{colSpan:7,className:"py-8 text-center text-sm text-muted-foreground",children:"No runs in the past 30 days."})}),X.map(M=>a.jsxs(Wt,{className:"cursor-pointer",children:[a.jsx(qe,{children:a.jsx(Et,{to:`/results/${M.id}`,className:"font-mono text-xs text-primary hover:underline",children:M.id})}),a.jsx(qe,{className:"text-[11px] text-muted-foreground",children:(()=>{const q=G_(M);return a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Evaluated: ",q.scenarioCount," scenario",q.scenarioCount===1?"":"s"," · ",q.agentCount," agent",q.agentCount===1?"":"s",q.modelSummary?` · ${q.modelSummary}`:""]}),a.jsx("div",{className:"font-mono text-xs text-foreground/80",children:q.scopePreview})]})})()}),a.jsx(qe,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(M.timestamp).toLocaleString()]})}),a.jsx(qe,{className:"text-right",children:a.jsxs("div",{className:"flex flex-col items-end gap-1",children:[a.jsx(Ws,{rate:M.overallPassRate}),a.jsx(e4,{run:M})]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:M.totalScenarios}),a.jsx(qe,{className:"text-right font-mono text-sm",children:M.avgToolCalls.toFixed(0)}),a.jsx(qe,{className:"text-right font-mono text-sm",children:L(M)})]},M.id))]})]}),F.length>20&&a.jsx("div",{className:"border-t p-4 text-center",children:a.jsx(Z,{variant:"outline",asChild:!0,children:a.jsx(Et,{to:"/results",children:"Show more"})})})]})]})})]})};function Y_({value:e,onValueChange:t,placeholder:n="Search...",className:r,inputClassName:s,clearAriaLabel:o="Clear search"}){return a.jsxs("div",{className:Me("relative",r),children:[a.jsx(_t,{value:e,onChange:i=>t(i.target.value),placeholder:n,className:Me("h-9 w-[240px] pr-8",s)}),e&&a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 border border-border/60",onClick:()=>t(""),"aria-label":o,children:a.jsx(ca,{className:"h-4 w-4"})})]})}var cge=h.createContext(void 0);function zu(e){const t=h.useContext(cge);return e||t||"ltr"}var SS="rovingFocusGroup.onEntryFocus",uge={bubbles:!1,cancelable:!0},bp="RovingFocusGroup",[DN,wB,dge]=Qf(bp),[fge,Yv]=kr(bp,[dge]),[pge,hge]=fge(bp),jB=h.forwardRef((e,t)=>a.jsx(DN.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(DN.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(mge,{...e,ref:t})})}));jB.displayName=bp;var mge=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:m=!1,...p}=e,v=h.useRef(null),x=Ot(t,v),j=zu(o),[y,b]=Aa({prop:i,defaultProp:c??null,onChange:u,caller:bp}),[S,N]=h.useState(!1),C=Jn(f),k=wB(n),A=h.useRef(!1),[E,P]=h.useState(0);return h.useEffect(()=>{const T=v.current;if(T)return T.addEventListener(SS,C),()=>T.removeEventListener(SS,C)},[C]),a.jsx(pge,{scope:n,orientation:r,dir:j,loop:s,currentTabStopId:y,onItemFocus:h.useCallback(T=>b(T),[b]),onItemShiftTab:h.useCallback(()=>N(!0),[]),onFocusableItemAdd:h.useCallback(()=>P(T=>T+1),[]),onFocusableItemRemove:h.useCallback(()=>P(T=>T-1),[]),children:a.jsx(lt.div,{tabIndex:S||E===0?-1:0,"data-orientation":r,...p,ref:x,style:{outline:"none",...e.style},onMouseDown:Ue(e.onMouseDown,()=>{A.current=!0}),onFocus:Ue(e.onFocus,T=>{const $=!A.current;if(T.target===T.currentTarget&&$&&!S){const Y=new CustomEvent(SS,uge);if(T.currentTarget.dispatchEvent(Y),!Y.defaultPrevented){const H=k().filter(M=>M.focusable),F=H.find(M=>M.active),X=H.find(M=>M.id===y),I=[F,X,...H].filter(Boolean).map(M=>M.ref.current);CB(I,m)}}A.current=!1}),onBlur:Ue(e.onBlur,()=>N(!1))})})}),SB="RovingFocusGroupItem",NB=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:i,...c}=e,u=fr(),f=o||u,m=hge(SB,n),p=m.currentTabStopId===f,v=wB(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:y}=m;return h.useEffect(()=>{if(r)return x(),()=>j()},[r,x,j]),a.jsx(DN.ItemSlot,{scope:n,id:f,focusable:r,active:s,children:a.jsx(lt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:t,onMouseDown:Ue(e.onMouseDown,b=>{r?m.onItemFocus(f):b.preventDefault()}),onFocus:Ue(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:Ue(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){m.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const S=xge(b,m.orientation,m.dir);if(S!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let C=v().filter(k=>k.focusable).map(k=>k.ref.current);if(S==="last")C.reverse();else if(S==="prev"||S==="next"){S==="prev"&&C.reverse();const k=C.indexOf(b.currentTarget);C=m.loop?yge(C,k+1):C.slice(k+1)}setTimeout(()=>CB(C))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:y!=null}):i})})});NB.displayName=SB;var gge={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function vge(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function xge(e,t,n){const r=vge(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return gge[r]}function CB(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function yge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var _B=jB,kB=NB;function bge(e){const t=wge(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),u=c.find(Sge);if(u){const f=u.props.children,m=c.map(p=>p===u?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function wge(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=Cge(s),c=Nge(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jge=Symbol("radix.slottable");function Sge(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jge}function Nge(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Cge(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 LN=["Enter"," "],_ge=["ArrowDown","PageUp","Home"],AB=["ArrowUp","PageDown","End"],kge=[..._ge,...AB],Age={ltr:[...LN,"ArrowRight"],rtl:[...LN,"ArrowLeft"]},Ege={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wp="Menu",[Hf,Pge,Rge]=Qf(wp),[Gl,EB]=kr(wp,[Rge,Ei,Yv]),Xv=Ei(),PB=Yv(),[Tge,Yl]=Gl(wp),[Oge,jp]=Gl(wp),RB=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:i=!0}=e,c=Xv(t),[u,f]=h.useState(null),m=h.useRef(!1),p=Jn(o),v=zu(s);return h.useEffect(()=>{const x=()=>{m.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>m.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),a.jsx(Kg,{...c,children:a.jsx(Tge,{scope:t,open:n,onOpenChange:p,content:u,onContentChange:f,children:a.jsx(Oge,{scope:t,onClose:h.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:v,modal:i,children:r})})})};RB.displayName=wp;var Mge="MenuAnchor",X_=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Xv(n);return a.jsx(tp,{...s,...r,ref:t})});X_.displayName=Mge;var Q_="MenuPortal",[Ige,TB]=Gl(Q_,{forceMount:void 0}),OB=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Yl(Q_,t);return a.jsx(Ige,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(Fl,{asChild:!0,container:s,children:r})})})};OB.displayName=Q_;var Ka="MenuContent",[$ge,J_]=Gl(Ka),MB=h.forwardRef((e,t)=>{const n=TB(Ka,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Yl(Ka,e.__scopeMenu),i=jp(Ka,e.__scopeMenu);return a.jsx(Hf.Provider,{scope:e.__scopeMenu,children:a.jsx(ar,{present:r||o.open,children:a.jsx(Hf.Slot,{scope:e.__scopeMenu,children:i.modal?a.jsx(Dge,{...s,ref:t}):a.jsx(Lge,{...s,ref:t})})})})}),Dge=h.forwardRef((e,t)=>{const n=Yl(Ka,e.__scopeMenu),r=h.useRef(null),s=Ot(t,r);return h.useEffect(()=>{const o=r.current;if(o)return ov(o)},[]),a.jsx(Z_,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ue(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Lge=h.forwardRef((e,t)=>{const n=Yl(Ka,e.__scopeMenu);return a.jsx(Z_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Fge=bge("MenuContent.ScrollLock"),Z_=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:v,onDismiss:x,disableOutsideScroll:j,...y}=e,b=Yl(Ka,n),S=jp(Ka,n),N=Xv(n),C=PB(n),k=Pge(n),[A,E]=h.useState(null),P=h.useRef(null),T=Ot(t,P,b.onContentChange),$=h.useRef(0),Y=h.useRef(""),H=h.useRef(0),F=h.useRef(null),X=h.useRef("right"),L=h.useRef(0),I=j?op:h.Fragment,M=j?{as:Fge,allowPinchZoom:!0}:void 0,q=O=>{const Q=Y.current+O,B=k().filter(se=>!se.disabled),z=document.activeElement,V=B.find(se=>se.ref.current===z)?.textValue,ee=B.map(se=>se.textValue),ae=Qge(ee,Q,V),ue=B.find(se=>se.textValue===ae)?.ref.current;(function se(xe){Y.current=xe,window.clearTimeout($.current),xe!==""&&($.current=window.setTimeout(()=>se(""),1e3))})(Q),ue&&setTimeout(()=>ue.focus())};h.useEffect(()=>()=>window.clearTimeout($.current),[]),av();const G=h.useCallback(O=>X.current===F.current?.side&&Zge(O,F.current?.area),[]);return a.jsx($ge,{scope:n,searchRef:Y,onItemEnter:h.useCallback(O=>{G(O)&&O.preventDefault()},[G]),onItemLeave:h.useCallback(O=>{G(O)||(P.current?.focus(),E(null))},[G]),onTriggerLeave:h.useCallback(O=>{G(O)&&O.preventDefault()},[G]),pointerGraceTimerRef:H,onPointerGraceIntentChange:h.useCallback(O=>{F.current=O},[]),children:a.jsx(I,{...M,children:a.jsx(sp,{asChild:!0,trapped:s,onMountAutoFocus:Ue(o,O=>{O.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:a.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:v,onDismiss:x,children:a.jsx(_B,{asChild:!0,...C,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:E,onEntryFocus:Ue(u,O=>{S.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Gg,{role:"menu","aria-orientation":"vertical","data-state":XB(b.open),"data-radix-menu-content":"",dir:S.dir,...N,...y,ref:T,style:{outline:"none",...y.style},onKeyDown:Ue(y.onKeyDown,O=>{const B=O.target.closest("[data-radix-menu-content]")===O.currentTarget,z=O.ctrlKey||O.altKey||O.metaKey,V=O.key.length===1;B&&(O.key==="Tab"&&O.preventDefault(),!z&&V&&q(O.key));const ee=P.current;if(O.target!==ee||!kge.includes(O.key))return;O.preventDefault();const ue=k().filter(se=>!se.disabled).map(se=>se.ref.current);AB.includes(O.key)&&ue.reverse(),Yge(ue)}),onBlur:Ue(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout($.current),Y.current="")}),onPointerMove:Ue(e.onPointerMove,Vf(O=>{const Q=O.target,B=L.current!==O.clientX;if(O.currentTarget.contains(Q)&&B){const z=O.clientX>L.current?"right":"left";X.current=z,L.current=O.clientX}}))})})})})})})});MB.displayName=Ka;var zge="MenuGroup",ek=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{role:"group",...r,ref:t})});ek.displayName=zge;var Bge="MenuLabel",IB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});IB.displayName=Bge;var Cg="MenuItem",tD="menu.itemSelect",Qv=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=h.useRef(null),i=jp(Cg,e.__scopeMenu),c=J_(Cg,e.__scopeMenu),u=Ot(t,o),f=h.useRef(!1),m=()=>{const p=o.current;if(!n&&p){const v=new CustomEvent(tD,{bubbles:!0,cancelable:!0});p.addEventListener(tD,x=>r?.(x),{once:!0}),uC(p,v),v.defaultPrevented?f.current=!1:i.onClose()}};return a.jsx($B,{...s,ref:u,disabled:n,onClick:Ue(e.onClick,m),onPointerDown:p=>{e.onPointerDown?.(p),f.current=!0},onPointerUp:Ue(e.onPointerUp,p=>{f.current||p.currentTarget?.click()}),onKeyDown:Ue(e.onKeyDown,p=>{const v=c.searchRef.current!=="";n||v&&p.key===" "||LN.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Qv.displayName=Cg;var $B=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=J_(Cg,n),c=PB(n),u=h.useRef(null),f=Ot(t,u),[m,p]=h.useState(!1),[v,x]=h.useState("");return h.useEffect(()=>{const j=u.current;j&&x((j.textContent??"").trim())},[o.children]),a.jsx(Hf.ItemSlot,{scope:n,disabled:r,textValue:s??v,children:a.jsx(kB,{asChild:!0,...c,focusable:!r,children:a.jsx(lt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:f,onPointerMove:Ue(e.onPointerMove,Vf(j=>{r?i.onItemLeave(j):(i.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ue(e.onPointerLeave,Vf(j=>i.onItemLeave(j))),onFocus:Ue(e.onFocus,()=>p(!0)),onBlur:Ue(e.onBlur,()=>p(!1))})})})}),qge="MenuCheckboxItem",DB=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx(qB,{scope:e.__scopeMenu,checked:n,children:a.jsx(Qv,{role:"menuitemcheckbox","aria-checked":_g(n)?"mixed":n,...s,ref:t,"data-state":nk(n),onSelect:Ue(s.onSelect,()=>r?.(_g(n)?!0:!n),{checkForDefaultPrevented:!1})})})});DB.displayName=qge;var LB="MenuRadioGroup",[Uge,Wge]=Gl(LB,{value:void 0,onValueChange:()=>{}}),FB=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Jn(r);return a.jsx(Uge,{scope:e.__scopeMenu,value:n,onValueChange:o,children:a.jsx(ek,{...s,ref:t})})});FB.displayName=LB;var zB="MenuRadioItem",BB=h.forwardRef((e,t)=>{const{value:n,...r}=e,s=Wge(zB,e.__scopeMenu),o=n===s.value;return a.jsx(qB,{scope:e.__scopeMenu,checked:o,children:a.jsx(Qv,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":nk(o),onSelect:Ue(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});BB.displayName=zB;var tk="MenuItemIndicator",[qB,Hge]=Gl(tk,{checked:!1}),UB=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=Hge(tk,n);return a.jsx(ar,{present:r||_g(o.checked)||o.checked===!0,children:a.jsx(lt.span,{...s,ref:t,"data-state":nk(o.checked)})})});UB.displayName=tk;var Vge="MenuSeparator",WB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});WB.displayName=Vge;var Kge="MenuArrow",HB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Xv(n);return a.jsx(Yg,{...s,...r,ref:t})});HB.displayName=Kge;var Gge="MenuSub",[Iwe,VB]=Gl(Gge),Ud="MenuSubTrigger",KB=h.forwardRef((e,t)=>{const n=Yl(Ud,e.__scopeMenu),r=jp(Ud,e.__scopeMenu),s=VB(Ud,e.__scopeMenu),o=J_(Ud,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=o,f={__scopeMenu:e.__scopeMenu},m=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>m,[m]),h.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),u(null)}},[c,u]),a.jsx(X_,{asChild:!0,...f,children:a.jsx($B,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":XB(n.open),...e,ref:Vr(t,s.onTriggerChange),onClick:p=>{e.onClick?.(p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ue(e.onPointerMove,Vf(p=>{o.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Ue(e.onPointerLeave,Vf(p=>{m();const v=n.content?.getBoundingClientRect();if(v){const x=n.content?.dataset.side,j=x==="right",y=j?-5:5,b=v[j?"left":"right"],S=v[j?"right":"left"];o.onPointerGraceIntentChange({area:[{x:p.clientX+y,y:p.clientY},{x:b,y:v.top},{x:S,y:v.top},{x:S,y:v.bottom},{x:b,y:v.bottom}],side:x}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(p),p.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Ue(e.onKeyDown,p=>{const v=o.searchRef.current!=="";e.disabled||v&&p.key===" "||Age[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});KB.displayName=Ud;var GB="MenuSubContent",YB=h.forwardRef((e,t)=>{const n=TB(Ka,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Yl(Ka,e.__scopeMenu),i=jp(Ka,e.__scopeMenu),c=VB(GB,e.__scopeMenu),u=h.useRef(null),f=Ot(t,u);return a.jsx(Hf.Provider,{scope:e.__scopeMenu,children:a.jsx(ar,{present:r||o.open,children:a.jsx(Hf.Slot,{scope:e.__scopeMenu,children:a.jsx(Z_,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:f,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{i.isUsingKeyboardRef.current&&u.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Ue(e.onFocusOutside,m=>{m.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Ue(e.onEscapeKeyDown,m=>{i.onClose(),m.preventDefault()}),onKeyDown:Ue(e.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),v=Ege[i.dir].includes(m.key);p&&v&&(o.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});YB.displayName=GB;function XB(e){return e?"open":"closed"}function _g(e){return e==="indeterminate"}function nk(e){return _g(e)?"indeterminate":e?"checked":"unchecked"}function Yge(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Xge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Qge(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=Xge(e,Math.max(o,0));s.length===1&&(i=i.filter(f=>f!==n));const u=i.find(f=>f.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}function Jge(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const c=t[o],u=t[i],f=c.x,m=c.y,p=u.x,v=u.y;m>r!=v>r&&n<(p-f)*(r-m)/(v-m)+f&&(s=!s)}return s}function Zge(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Jge(n,t)}function Vf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var eve=RB,tve=X_,nve=OB,rve=MB,ave=ek,sve=IB,ove=Qv,ive=DB,lve=FB,cve=BB,uve=UB,dve=WB,fve=HB,pve=KB,hve=YB,Jv="DropdownMenu",[mve]=kr(Jv,[EB]),Gr=EB(),[gve,QB]=mve(Jv),JB=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:i,modal:c=!0}=e,u=Gr(t),f=h.useRef(null),[m,p]=Aa({prop:s,defaultProp:o??!1,onChange:i,caller:Jv});return a.jsx(gve,{scope:t,triggerId:fr(),triggerRef:f,contentId:fr(),open:m,onOpenChange:p,onOpenToggle:h.useCallback(()=>p(v=>!v),[p]),modal:c,children:a.jsx(eve,{...u,open:m,onOpenChange:p,dir:r,modal:c,children:n})})};JB.displayName=Jv;var ZB="DropdownMenuTrigger",e6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=QB(ZB,n),i=Gr(n);return a.jsx(tve,{asChild:!0,...i,children:a.jsx(lt.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Vr(t,o.triggerRef),onPointerDown:Ue(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:Ue(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});e6.displayName=ZB;var vve="DropdownMenuPortal",t6=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Gr(t);return a.jsx(nve,{...r,...n})};t6.displayName=vve;var n6="DropdownMenuContent",r6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=QB(n6,n),o=Gr(n),i=h.useRef(!1);return a.jsx(rve,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:Ue(e.onCloseAutoFocus,c=>{i.current||s.triggerRef.current?.focus(),i.current=!1,c.preventDefault()}),onInteractOutside:Ue(e.onInteractOutside,c=>{const u=c.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0,m=u.button===2||f;(!s.modal||m)&&(i.current=!0)}),style:{...e.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)"}})});r6.displayName=n6;var xve="DropdownMenuGroup",yve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ave,{...s,...r,ref:t})});yve.displayName=xve;var bve="DropdownMenuLabel",a6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(sve,{...s,...r,ref:t})});a6.displayName=bve;var wve="DropdownMenuItem",s6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ove,{...s,...r,ref:t})});s6.displayName=wve;var jve="DropdownMenuCheckboxItem",o6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ive,{...s,...r,ref:t})});o6.displayName=jve;var Sve="DropdownMenuRadioGroup",Nve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(lve,{...s,...r,ref:t})});Nve.displayName=Sve;var Cve="DropdownMenuRadioItem",i6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(cve,{...s,...r,ref:t})});i6.displayName=Cve;var _ve="DropdownMenuItemIndicator",l6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(uve,{...s,...r,ref:t})});l6.displayName=_ve;var kve="DropdownMenuSeparator",c6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(dve,{...s,...r,ref:t})});c6.displayName=kve;var Ave="DropdownMenuArrow",Eve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(fve,{...s,...r,ref:t})});Eve.displayName=Ave;var Pve="DropdownMenuSubTrigger",u6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(pve,{...s,...r,ref:t})});u6.displayName=Pve;var Rve="DropdownMenuSubContent",d6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(hve,{...s,...r,ref:t,style:{...e.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)"}})});d6.displayName=Rve;var Tve=JB,Ove=e6,Mve=t6,f6=r6,p6=a6,h6=s6,m6=o6,g6=i6,v6=l6,x6=c6,y6=u6,b6=d6;const Sp=Tve,Np=Ove,Ive=h.forwardRef(({className:e,inset:t,children:n,...r},s)=>a.jsxs(y6,{ref:s,className:Me("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...r,children:[n,a.jsx(zg,{className:"ml-auto h-4 w-4"})]}));Ive.displayName=y6.displayName;const $ve=h.forwardRef(({className:e,...t},n)=>a.jsx(b6,{ref:n,className:Me("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",e),...t}));$ve.displayName=b6.displayName;const Bu=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(Mve,{children:a.jsx(f6,{ref:r,sideOffset:t,className:Me("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",e),...n})}));Bu.displayName=f6.displayName;const Mr=h.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(h6,{ref:r,className:Me("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n}));Mr.displayName=h6.displayName;const Dve=h.forwardRef(({className:e,children:t,checked:n,...r},s)=>a.jsxs(m6,{ref:s,className:Me("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(v6,{children:a.jsx(Hc,{className:"h-4 w-4"})})}),t]}));Dve.displayName=m6.displayName;const Lve=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(g6,{ref:r,className:Me("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(v6,{children:a.jsx(NW,{className:"h-2 w-2 fill-current"})})}),t]}));Lve.displayName=g6.displayName;const w6=h.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(p6,{ref:r,className:Me("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));w6.displayName=p6.displayName;const j6=h.forwardRef(({className:e,...t},n)=>a.jsx(x6,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));j6.displayName=x6.displayName;function Kf(e,[t,n]){return Math.min(n,Math.max(t,e))}function Fve(e){const t=zve(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),u=c.find(qve);if(u){const f=u.props.children,m=c.map(p=>p===u?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function zve(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=Wve(s),c=Uve(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bve=Symbol("radix.slottable");function qve(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Bve}function Uve(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Wve(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 Zv(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Hve=[" ","Enter","ArrowUp","ArrowDown"],Vve=[" ","Enter"],El="Select",[ex,tx,Kve]=Qf(El),[qu]=kr(El,[Kve,Ei]),nx=Ei(),[Gve,Ii]=qu(El),[Yve,Xve]=qu(El),S6=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:i,defaultValue:c,onValueChange:u,dir:f,name:m,autoComplete:p,disabled:v,required:x,form:j}=e,y=nx(t),[b,S]=h.useState(null),[N,C]=h.useState(null),[k,A]=h.useState(!1),E=zu(f),[P,T]=Aa({prop:r,defaultProp:s??!1,onChange:o,caller:El}),[$,Y]=Aa({prop:i,defaultProp:c,onChange:u,caller:El}),H=h.useRef(null),F=b?j||!!b.closest("form"):!0,[X,L]=h.useState(new Set),I=Array.from(X).map(M=>M.props.value).join(";");return a.jsx(Kg,{...y,children:a.jsxs(Gve,{required:x,scope:t,trigger:b,onTriggerChange:S,valueNode:N,onValueNodeChange:C,valueNodeHasChildren:k,onValueNodeHasChildrenChange:A,contentId:fr(),value:$,onValueChange:Y,open:P,onOpenChange:T,dir:E,triggerPointerDownPosRef:H,disabled:v,children:[a.jsx(ex.Provider,{scope:t,children:a.jsx(Yve,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(M=>{L(q=>new Set(q).add(M))},[]),onNativeOptionRemove:h.useCallback(M=>{L(q=>{const G=new Set(q);return G.delete(M),G})},[]),children:n})}),F?a.jsxs(K6,{"aria-hidden":!0,required:x,tabIndex:-1,name:m,autoComplete:p,value:$,onChange:M=>Y(M.target.value),disabled:v,form:j,children:[$===void 0?a.jsx("option",{value:""}):null,Array.from(X)]},I):null]})})};S6.displayName=El;var N6="SelectTrigger",C6=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=nx(n),i=Ii(N6,n),c=i.disabled||r,u=Ot(t,i.onTriggerChange),f=tx(n),m=h.useRef("touch"),[p,v,x]=Y6(y=>{const b=f().filter(C=>!C.disabled),S=b.find(C=>C.value===i.value),N=X6(b,y,S);N!==void 0&&i.onValueChange(N.value)}),j=y=>{c||(i.onOpenChange(!0),x()),y&&(i.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})};return a.jsx(tp,{asChild:!0,...o,children:a.jsx(lt.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":G6(i.value)?"":void 0,...s,ref:u,onClick:Ue(s.onClick,y=>{y.currentTarget.focus(),m.current!=="mouse"&&j(y)}),onPointerDown:Ue(s.onPointerDown,y=>{m.current=y.pointerType;const b=y.target;b.hasPointerCapture(y.pointerId)&&b.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(j(y),y.preventDefault())}),onKeyDown:Ue(s.onKeyDown,y=>{const b=p.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&v(y.key),!(b&&y.key===" ")&&Hve.includes(y.key)&&(j(),y.preventDefault())})})})});C6.displayName=N6;var _6="SelectValue",k6=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:i="",...c}=e,u=Ii(_6,n),{onValueNodeHasChildrenChange:f}=u,m=o!==void 0,p=Ot(t,u.onValueNodeChange);return pr(()=>{f(m)},[f,m]),a.jsx(lt.span,{...c,ref:p,style:{pointerEvents:"none"},children:G6(u.value)?a.jsx(a.Fragment,{children:i}):o})});k6.displayName=_6;var Qve="SelectIcon",A6=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(lt.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});A6.displayName=Qve;var Jve="SelectPortal",E6=e=>a.jsx(Fl,{asChild:!0,...e});E6.displayName=Jve;var Pl="SelectContent",P6=h.forwardRef((e,t)=>{const n=Ii(Pl,e.__scopeSelect),[r,s]=h.useState();if(pr(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?Nu.createPortal(a.jsx(R6,{scope:e.__scopeSelect,children:a.jsx(ex.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),o):null}return a.jsx(T6,{...e,ref:t})});P6.displayName=Pl;var ys=10,[R6,$i]=qu(Pl),Zve="SelectContentImpl",exe=Fve("SelectContent.RemoveScroll"),T6=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:c,sideOffset:u,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:v,collisionPadding:x,sticky:j,hideWhenDetached:y,avoidCollisions:b,...S}=e,N=Ii(Pl,n),[C,k]=h.useState(null),[A,E]=h.useState(null),P=Ot(t,se=>k(se)),[T,$]=h.useState(null),[Y,H]=h.useState(null),F=tx(n),[X,L]=h.useState(!1),I=h.useRef(!1);h.useEffect(()=>{if(C)return ov(C)},[C]),av();const M=h.useCallback(se=>{const[xe,...oe]=F().map(me=>me.ref.current),[de]=oe.slice(-1),De=document.activeElement;for(const me of se)if(me===De||(me?.scrollIntoView({block:"nearest"}),me===xe&&A&&(A.scrollTop=0),me===de&&A&&(A.scrollTop=A.scrollHeight),me?.focus(),document.activeElement!==De))return},[F,A]),q=h.useCallback(()=>M([T,C]),[M,T,C]);h.useEffect(()=>{X&&q()},[X,q]);const{onOpenChange:G,triggerPointerDownPosRef:O}=N;h.useEffect(()=>{if(C){let se={x:0,y:0};const xe=de=>{se={x:Math.abs(Math.round(de.pageX)-(O.current?.x??0)),y:Math.abs(Math.round(de.pageY)-(O.current?.y??0))}},oe=de=>{se.x<=10&&se.y<=10?de.preventDefault():C.contains(de.target)||G(!1),document.removeEventListener("pointermove",xe),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",oe,{capture:!0})}}},[C,G,O]),h.useEffect(()=>{const se=()=>G(!1);return window.addEventListener("blur",se),window.addEventListener("resize",se),()=>{window.removeEventListener("blur",se),window.removeEventListener("resize",se)}},[G]);const[Q,B]=Y6(se=>{const xe=F().filter(De=>!De.disabled),oe=xe.find(De=>De.ref.current===document.activeElement),de=X6(xe,se,oe);de&&setTimeout(()=>de.ref.current.focus())}),z=h.useCallback((se,xe,oe)=>{const de=!I.current&&!oe;(N.value!==void 0&&N.value===xe||de)&&($(se),de&&(I.current=!0))},[N.value]),V=h.useCallback(()=>C?.focus(),[C]),ee=h.useCallback((se,xe,oe)=>{const de=!I.current&&!oe;(N.value!==void 0&&N.value===xe||de)&&H(se)},[N.value]),ae=r==="popper"?FN:O6,ue=ae===FN?{side:c,sideOffset:u,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:v,collisionPadding:x,sticky:j,hideWhenDetached:y,avoidCollisions:b}:{};return a.jsx(R6,{scope:n,content:C,viewport:A,onViewportChange:E,itemRefCallback:z,selectedItem:T,onItemLeave:V,itemTextRefCallback:ee,focusSelectedItem:q,selectedItemText:Y,position:r,isPositioned:X,searchRef:Q,children:a.jsx(op,{as:exe,allowPinchZoom:!0,children:a.jsx(sp,{asChild:!0,trapped:N.open,onMountAutoFocus:se=>{se.preventDefault()},onUnmountAutoFocus:Ue(s,se=>{N.trigger?.focus({preventScroll:!0}),se.preventDefault()}),children:a.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:se=>se.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:a.jsx(ae,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:se=>se.preventDefault(),...S,...ue,onPlaced:()=>L(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:Ue(S.onKeyDown,se=>{const xe=se.ctrlKey||se.altKey||se.metaKey;if(se.key==="Tab"&&se.preventDefault(),!xe&&se.key.length===1&&B(se.key),["ArrowUp","ArrowDown","Home","End"].includes(se.key)){let de=F().filter(De=>!De.disabled).map(De=>De.ref.current);if(["ArrowUp","End"].includes(se.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(se.key)){const De=se.target,me=de.indexOf(De);de=de.slice(me+1)}setTimeout(()=>M(de)),se.preventDefault()}})})})})})})});T6.displayName=Zve;var txe="SelectItemAlignedPosition",O6=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=Ii(Pl,n),i=$i(Pl,n),[c,u]=h.useState(null),[f,m]=h.useState(null),p=Ot(t,P=>m(P)),v=tx(n),x=h.useRef(!1),j=h.useRef(!0),{viewport:y,selectedItem:b,selectedItemText:S,focusSelectedItem:N}=i,C=h.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&f&&y&&b&&S){const P=o.trigger.getBoundingClientRect(),T=f.getBoundingClientRect(),$=o.valueNode.getBoundingClientRect(),Y=S.getBoundingClientRect();if(o.dir!=="rtl"){const De=Y.left-T.left,me=$.left-De,ge=P.left-me,we=P.width+ge,at=Math.max(we,T.width),tt=window.innerWidth-ys,it=Kf(me,[ys,Math.max(ys,tt-at)]);c.style.minWidth=we+"px",c.style.left=it+"px"}else{const De=T.right-Y.right,me=window.innerWidth-$.right-De,ge=window.innerWidth-P.right-me,we=P.width+ge,at=Math.max(we,T.width),tt=window.innerWidth-ys,it=Kf(me,[ys,Math.max(ys,tt-at)]);c.style.minWidth=we+"px",c.style.right=it+"px"}const H=v(),F=window.innerHeight-ys*2,X=y.scrollHeight,L=window.getComputedStyle(f),I=parseInt(L.borderTopWidth,10),M=parseInt(L.paddingTop,10),q=parseInt(L.borderBottomWidth,10),G=parseInt(L.paddingBottom,10),O=I+M+X+G+q,Q=Math.min(b.offsetHeight*5,O),B=window.getComputedStyle(y),z=parseInt(B.paddingTop,10),V=parseInt(B.paddingBottom,10),ee=P.top+P.height/2-ys,ae=F-ee,ue=b.offsetHeight/2,se=b.offsetTop+ue,xe=I+M+se,oe=O-xe;if(xe<=ee){const De=H.length>0&&b===H[H.length-1].ref.current;c.style.bottom="0px";const me=f.clientHeight-y.offsetTop-y.offsetHeight,ge=Math.max(ae,ue+(De?V:0)+me+q),we=xe+ge;c.style.height=we+"px"}else{const De=H.length>0&&b===H[0].ref.current;c.style.top="0px";const ge=Math.max(ee,I+y.offsetTop+(De?z:0)+ue)+oe;c.style.height=ge+"px",y.scrollTop=xe-ee+y.offsetTop}c.style.margin=`${ys}px 0`,c.style.minHeight=Q+"px",c.style.maxHeight=F+"px",r?.(),requestAnimationFrame(()=>x.current=!0)}},[v,o.trigger,o.valueNode,c,f,y,b,S,o.dir,r]);pr(()=>C(),[C]);const[k,A]=h.useState();pr(()=>{f&&A(window.getComputedStyle(f).zIndex)},[f]);const E=h.useCallback(P=>{P&&j.current===!0&&(C(),N?.(),j.current=!1)},[C,N]);return a.jsx(rxe,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:x,onScrollButtonChange:E,children:a.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:a.jsx(lt.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});O6.displayName=txe;var nxe="SelectPopperPosition",FN=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=ys,...o}=e,i=nx(n);return a.jsx(Gg,{...i,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});FN.displayName=nxe;var[rxe,rk]=qu(Pl,{}),zN="SelectViewport",M6=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=$i(zN,n),i=rk(zN,n),c=Ot(t,o.onViewportChange),u=h.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(ex.Slot,{scope:n,children:a.jsx(lt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Ue(s.onScroll,f=>{const m=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:v}=i;if(v?.current&&p){const x=Math.abs(u.current-m.scrollTop);if(x>0){const j=window.innerHeight-ys*2,y=parseFloat(p.style.minHeight),b=parseFloat(p.style.height),S=Math.max(y,b);if(S<j){const N=S+x,C=Math.min(j,N),k=N-C;p.style.height=C+"px",p.style.bottom==="0px"&&(m.scrollTop=k>0?k:0,p.style.justifyContent="flex-end")}}}u.current=m.scrollTop})})})]})});M6.displayName=zN;var I6="SelectGroup",[axe,sxe]=qu(I6),oxe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=fr();return a.jsx(axe,{scope:n,id:s,children:a.jsx(lt.div,{role:"group","aria-labelledby":s,...r,ref:t})})});oxe.displayName=I6;var $6="SelectLabel",D6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=sxe($6,n);return a.jsx(lt.div,{id:s.id,...r,ref:t})});D6.displayName=$6;var kg="SelectItem",[ixe,L6]=qu(kg),F6=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...i}=e,c=Ii(kg,n),u=$i(kg,n),f=c.value===r,[m,p]=h.useState(o??""),[v,x]=h.useState(!1),j=Ot(t,N=>u.itemRefCallback?.(N,r,s)),y=fr(),b=h.useRef("touch"),S=()=>{s||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(ixe,{scope:n,value:r,disabled:s,textId:y,isSelected:f,onItemTextChange:h.useCallback(N=>{p(C=>C||(N?.textContent??"").trim())},[]),children:a.jsx(ex.ItemSlot,{scope:n,value:r,disabled:s,textValue:m,children:a.jsx(lt.div,{role:"option","aria-labelledby":y,"data-highlighted":v?"":void 0,"aria-selected":f&&v,"data-state":f?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:j,onFocus:Ue(i.onFocus,()=>x(!0)),onBlur:Ue(i.onBlur,()=>x(!1)),onClick:Ue(i.onClick,()=>{b.current!=="mouse"&&S()}),onPointerUp:Ue(i.onPointerUp,()=>{b.current==="mouse"&&S()}),onPointerDown:Ue(i.onPointerDown,N=>{b.current=N.pointerType}),onPointerMove:Ue(i.onPointerMove,N=>{b.current=N.pointerType,s?u.onItemLeave?.():b.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ue(i.onPointerLeave,N=>{N.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Ue(i.onKeyDown,N=>{u.searchRef?.current!==""&&N.key===" "||(Vve.includes(N.key)&&S(),N.key===" "&&N.preventDefault())})})})})});F6.displayName=kg;var Wd="SelectItemText",z6=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,i=Ii(Wd,n),c=$i(Wd,n),u=L6(Wd,n),f=Xve(Wd,n),[m,p]=h.useState(null),v=Ot(t,S=>p(S),u.onItemTextChange,S=>c.itemTextRefCallback?.(S,u.value,u.disabled)),x=m?.textContent,j=h.useMemo(()=>a.jsx("option",{value:u.value,disabled:u.disabled,children:x},u.value),[u.disabled,u.value,x]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=f;return pr(()=>(y(j),()=>b(j)),[y,b,j]),a.jsxs(a.Fragment,{children:[a.jsx(lt.span,{id:u.textId,...o,ref:v}),u.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Nu.createPortal(o.children,i.valueNode):null]})});z6.displayName=Wd;var B6="SelectItemIndicator",q6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return L6(B6,n).isSelected?a.jsx(lt.span,{"aria-hidden":!0,...r,ref:t}):null});q6.displayName=B6;var BN="SelectScrollUpButton",U6=h.forwardRef((e,t)=>{const n=$i(BN,e.__scopeSelect),r=rk(BN,e.__scopeSelect),[s,o]=h.useState(!1),i=Ot(t,r.onScrollButtonChange);return pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=u.scrollTop>0;o(f)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?a.jsx(H6,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});U6.displayName=BN;var qN="SelectScrollDownButton",W6=h.forwardRef((e,t)=>{const n=$i(qN,e.__scopeSelect),r=rk(qN,e.__scopeSelect),[s,o]=h.useState(!1),i=Ot(t,r.onScrollButtonChange);return pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=u.scrollHeight-u.clientHeight,m=Math.ceil(u.scrollTop)<f;o(m)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?a.jsx(H6,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});W6.displayName=qN;var H6=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=$i("SelectScrollButton",n),i=h.useRef(null),c=tx(n),u=h.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>u(),[u]),pr(()=>{c().find(m=>m.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),a.jsx(lt.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Ue(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:Ue(s.onPointerMove,()=>{o.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:Ue(s.onPointerLeave,()=>{u()})})}),lxe="SelectSeparator",V6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(lt.div,{"aria-hidden":!0,...r,ref:t})});V6.displayName=lxe;var UN="SelectArrow",cxe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=nx(n),o=Ii(UN,n),i=$i(UN,n);return o.open&&i.position==="popper"?a.jsx(Yg,{...s,...r,ref:t}):null});cxe.displayName=UN;var uxe="SelectBubbleInput",K6=h.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=h.useRef(null),o=Ot(r,s),i=Zv(t);return h.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(u,"value").set;if(i!==t&&m){const p=new Event("change",{bubbles:!0});m.call(c,t),c.dispatchEvent(p)}},[i,t]),a.jsx(lt.select,{...n,style:{...JD,...n.style},ref:o,defaultValue:t})});K6.displayName=uxe;function G6(e){return e===""||e===void 0}function Y6(e){const t=Jn(e),n=h.useRef(""),r=h.useRef(0),s=h.useCallback(i=>{const c=n.current+i;t(c),(function u(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[t]),o=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function X6(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=dxe(e,Math.max(o,0));s.length===1&&(i=i.filter(f=>f!==n));const u=i.find(f=>f.textValue.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}function dxe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var fxe=S6,Q6=C6,pxe=k6,hxe=A6,mxe=E6,J6=P6,gxe=M6,Z6=D6,e8=F6,vxe=z6,xxe=q6,t8=U6,n8=W6,r8=V6;const Mn=fxe,In=pxe,_n=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Q6,{ref:r,className:Me("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,a.jsx(hxe,{asChild:!0,children:a.jsx(Jt,{className:"h-4 w-4 opacity-50"})})]}));_n.displayName=Q6.displayName;const a8=h.forwardRef(({className:e,...t},n)=>a.jsx(t8,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(_s,{className:"h-4 w-4"})}));a8.displayName=t8.displayName;const s8=h.forwardRef(({className:e,...t},n)=>a.jsx(n8,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Jt,{className:"h-4 w-4"})}));s8.displayName=n8.displayName;const kn=h.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(mxe,{children:a.jsxs(J6,{ref:s,className:Me("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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",n==="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",e),position:n,...r,children:[a.jsx(a8,{}),a.jsx(gxe,{className:Me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(s8,{})]})}));kn.displayName=J6.displayName;const yxe=h.forwardRef(({className:e,...t},n)=>a.jsx(Z6,{ref:n,className:Me("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));yxe.displayName=Z6.displayName;const ut=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(e8,{ref:r,className:Me("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(xxe,{children:a.jsx(Hc,{className:"h-4 w-4"})})}),a.jsx(vxe,{children:t})]}));ut.displayName=e8.displayName;const bxe=h.forwardRef(({className:e,...t},n)=>a.jsx(r8,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));bxe.displayName=r8.displayName;function WN(e){const n=(e.agentEntries&&e.agentEntries.length>0?e.agentEntries:e.agents.map(s=>({kind:"inline",agent:s}))).map(s=>s.kind==="inline"?s.agent.id:s.ref).map(s=>s.trim()).filter(Boolean),r=(e.runDefaults?.selectedAgentNames??[]).filter(s=>n.includes(s));return r.length>0?r:n}function pm(e){return e.relativePath?.trim()||e.sourcePath?.trim()||void 0}const hi=e=>e.configName?.trim()||e.name,wxe="(root)",o8="__ROOT__",nD="mcplab.configurations.collapsedSuites",NS=e=>e.suitePath&&e.suitePath.trim().length>0?e.suitePath.trim():null,nl=e=>e??wxe,CS=e=>e===null?o8:`suite:${e}`,jxe=e=>e===o8?null:e.startsWith("suite:")?e.slice(6):null,Sxe=(e,t)=>t===null?e===null:e===null?!1:e===t||e.startsWith(`${t}/`),Nxe=e=>{for(const t of e){const n=t.scenarioEntries??[];for(const s of n){if(s.kind==="inline"&&s.scenario?.id)return String(s.scenario.id);if(s.kind==="referenced"&&s.ref)return String(s.ref)}const r=t.scenarios??[];for(const s of r)if(s?.id)return String(s.id)}return null},Cxe=e=>Nxe([e]),_xe=e=>{const t=Cxe(e);return t?{href:`/results?scenario=${encodeURIComponent(t)}`,tooltipLabel:`Open results filtered by scenario ${t}`}:{href:"/results",tooltipLabel:"Open results"}},rD=["bg-red-400","bg-red-500","bg-orange-400","bg-orange-500","bg-amber-400","bg-amber-500","bg-yellow-400","bg-yellow-500","bg-lime-400","bg-lime-500","bg-green-400","bg-green-500","bg-emerald-400","bg-emerald-500","bg-teal-400","bg-teal-500","bg-cyan-400","bg-cyan-500","bg-sky-400","bg-sky-500","bg-blue-400","bg-blue-500","bg-indigo-400","bg-indigo-500","bg-violet-400","bg-violet-500","bg-purple-400","bg-purple-500","bg-fuchsia-400","bg-fuchsia-500","bg-pink-400","bg-pink-500","bg-rose-400","bg-rose-500"];function kxe(e){if(e===null)return"bg-slate-400";const t=e.split("").reduce((n,r)=>(n+r.charCodeAt(0))%rD.length,0);return rD[t]??"bg-slate-400"}const Axe=()=>{const{configs:e,deleteConfig:t,cloneConfig:n,loading:r,reload:s}=up(),{source:o}=$n(),i=is(),[c,u]=h.useState("name"),[f,m]=h.useState("asc"),[p,v]=h.useState(""),[x,j]=h.useState("all"),[y,b]=h.useState(()=>{try{const V=window.localStorage.getItem(nD);if(!V)return new Set;const ee=JSON.parse(V);return Array.isArray(ee)?new Set(ee.filter(ae=>typeof ae=="string")):new Set}catch(V){return console.warn("Failed to restore collapsed suites from localStorage",V),new Set}}),[S,N]=h.useState(new Set),[C,k]=h.useState(new Set),[A,E]=h.useState(new Set),[P,T]=h.useState({}),$=p.trim().toLowerCase(),Y=V=>{if(c===V){m(ee=>ee==="asc"?"desc":"asc");return}u(V),m(V==="updatedAt"?"desc":"asc")};h.useEffect(()=>{s();const V=()=>{s()};return window.addEventListener("focus",V),()=>{window.removeEventListener("focus",V)}},[s]),h.useEffect(()=>{let V=!1;return(async()=>{try{if(o.getLatestPassRatesByConfigIds){const ae=await o.getLatestPassRatesByConfigIds({lastDays:365,configs:e.map(ue=>({id:ue.id,sourcePath:ue.sourcePath,relativePath:ue.relativePath,configHash:ue.configHash}))});V||T(ae);return}T({})}catch{V||T({})}})(),()=>{V=!0}},[e,o]);const H=async(V,ee)=>{await t(V),$e({title:"Deleted",description:`"${ee}" has been removed.`})},F=async V=>{const ee=await n(V);$e({title:"Cloned",description:`Created "${hi(ee)}".`}),i(`/mcp-evaluations/${ee.id}`)},X=V=>V.agentEntries?.length??V.agents?.length??0,L=V=>V.scenarioEntries?.length??V.scenarios?.length??0,I=h.useMemo(()=>{const V=new Set;for(const ee of e){const ae=NS(ee);if(V.add(ae),!ae)continue;const ue=ae.split("/").filter(Boolean);for(let se=1;se<ue.length;se+=1)V.add(ue.slice(0,se).join("/"))}return Array.from(V).sort((ee,ae)=>nl(ee).localeCompare(nl(ae)))},[e]),M=h.useMemo(()=>e.filter(V=>{const ee=NS(V),ae=x==="all"?void 0:jxe(x),ue=nl(ee);return ae!==void 0&&!Sxe(ee,ae)?!1:$.length===0?!0:[hi(V),V.id,V.description??"",V.loadError??"",ue,V.relativePath??""].join(" ").toLowerCase().includes($)}),[e,$,x]),q=h.useMemo(()=>[...M].sort((ee,ae)=>{let ue=0;return c==="name"&&(ue=hi(ee).localeCompare(hi(ae))),c==="scenarios"&&(ue=L(ee)-L(ae)),c==="agents"&&(ue=X(ee)-X(ae)),c==="updatedAt"&&(ue=new Date(ee.updatedAt).getTime()-new Date(ae.updatedAt).getTime()),f==="asc"?ue:-ue}),[M,c,f]),G=V=>c!==V?a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"}):f==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}),O=V=>{b(ee=>{const ae=new Set(ee);return ae.has(V)?ae.delete(V):ae.add(V),ae})},Q=async(V,ee,ae)=>{if(C.has(V))return;const ue=e.find(xe=>xe.id===V),se=ue?WN(ue):[];k(xe=>new Set(xe).add(V));try{await o.startRun({configPath:ee,runsPerScenario:1,...se.length>0?{agents:se}:{}}),N(xe=>new Set(xe).add(V)),window.setTimeout(()=>{N(xe=>{const oe=new Set(xe);return oe.delete(V),oe})},2e3),$e({title:"Queued",description:`"${ae}" added to run queue.`})}catch(xe){$e({title:"Could not queue evaluation",description:xe instanceof Error?xe.message:String(xe),variant:"destructive"})}finally{k(xe=>{const oe=new Set(xe);return oe.delete(V),oe})}};h.useEffect(()=>{try{window.localStorage.setItem(nD,JSON.stringify(Array.from(y)))}catch(V){console.warn("Failed to persist collapsed suites to localStorage (quota/private mode?)",V)}},[y]);const B=async(V,ee,ae)=>{if(!A.has(V)){E(ue=>new Set(ue).add(V));try{const ue=ae.filter(me=>typeof me.sourcePath=="string"&&me.sourcePath.trim().length>0);if(ue.length===0){$e({title:"No runnable evaluations",description:`Suite "${ee}" has no evaluation files with a source path.`,variant:"destructive"});return}const se=await Promise.allSettled(ue.map(me=>{const ge=WN(me);return o.startRun({configPath:String(me.sourcePath),runsPerScenario:1,...ge.length>0?{agents:ge}:{}})})),xe=se.filter(me=>me.status==="fulfilled").length,oe=se.length-xe,de=se.find(me=>me.status==="rejected"),De=de?de.reason instanceof Error?de.reason.message:String(de.reason):void 0;$e({title:oe===0?"Suite queued":"Suite queued with errors",description:oe===0?`Queued ${xe} evaluation${xe===1?"":"s"} for suite "${ee}".`:`Queued ${xe}/${ue.length} evaluations for suite "${ee}" (${oe} failed${De?`: ${De}`:""}).`,variant:oe===0?"default":"destructive"})}catch(ue){$e({title:"Could not queue suite",description:ue instanceof Error?ue.message:String(ue),variant:"destructive"})}finally{E(ue=>{const se=new Set(ue);return se.delete(V),se})}}},z=h.useMemo(()=>{const V=new Map;for(const ee of q){const ae=NS(ee),ue=V.get(ae);ue?ue.push(ee):V.set(ae,[ee])}return Array.from(V.entries()).sort((ee,ae)=>nl(ee[0]).localeCompare(nl(ae[0])))},[q]);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(N5,{className:"h-6 w-6"}),"MCP Evaluations"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage your MCP evaluation suites"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Y_,{value:p,onValueChange:v,placeholder:"Search evaluations..."}),a.jsxs(Mn,{value:x,onValueChange:j,children:[a.jsx(_n,{className:"h-9 w-[200px]",children:a.jsx(In,{placeholder:"All suites"})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"all",children:"All suites"}),I.map(V=>a.jsx(ut,{value:CS(V),children:nl(V)},CS(V)))]})]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{s()},children:[a.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Refresh"]}),a.jsxs(Z,{variant:"outline",size:"sm",children:[a.jsx(FW,{className:"mr-2 h-4 w-4"}),"Import YAML"]}),a.jsx(Z,{size:"sm",asChild:!0,children:a.jsxs(Et,{to:"/mcp-evaluations/new",children:[a.jsx(To,{className:"mr-2 h-4 w-4"}),"Create New"]})})]})]}),a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(oa,{children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Y("name"),children:["Name",G("name")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Y("scenarios"),children:["Scenarios",G("scenarios")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Y("agents"),children:["Agents",G("agents")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Y("updatedAt"),children:["Last Updated",G("updatedAt")]})}),a.jsx(ct,{className:"text-right",children:"Last Run"}),a.jsx(ct,{className:"w-[220px] text-right"})]})}),a.jsxs(la,{children:[z.map(([V,ee])=>{const ae=nl(V),ue=CS(V),se=y.has(ue),xe=A.has(ue);return a.jsxs(h.Fragment,{children:[a.jsx(Wt,{className:"bg-muted/40 hover:bg-muted/40",children:a.jsx(qe,{colSpan:6,className:"py-2",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("button",{type:"button",className:"inline-flex h-6 items-center gap-2 text-xs leading-none hover:text-foreground",onClick:()=>O(ue),"aria-expanded":!se,"aria-label":`${se?"Expand":"Collapse"} suite ${ae}`,children:[a.jsx(zg,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform ${se?"":"rotate-90"}`,"aria-hidden":"true"}),a.jsx("span",{className:`h-2 w-2 rounded-full ${kxe(V)}`,"aria-hidden":"true"}),V===null?a.jsx(EW,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":"true"}):a.jsx(kW,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":"true"}),a.jsx("span",{className:"font-medium",children:ae}),a.jsxs("span",{className:"text-muted-foreground",children:["(",ee.length,")"]})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:xe,onClick:()=>{B(ue,ae,ee)},children:[a.jsx(ks,{className:"mr-1 h-3.5 w-3.5"}),xe?"Queueing...":"Run Suite"]})]})})},`suite-${ue}`),!se&&ee.map(oe=>{const de=_xe(oe),De=pm(oe);return a.jsxs(Wt,{children:[a.jsx(qe,{children:a.jsxs("div",{children:[a.jsx(Et,{to:`/mcp-evaluations/${oe.id}`,className:"font-medium text-sm hover:text-primary",children:hi(oe)}),oe.loadError&&a.jsxs(et,{variant:"destructive",className:"ml-2 align-middle text-[10px]",children:[a.jsx(sm,{className:"mr-1 h-3 w-3"}),"Broken"]}),De&&a.jsx("div",{className:"mt-0.5",children:a.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:De})}),oe.loadError&&a.jsx("p",{className:"text-xs text-destructive mt-0.5 break-all",children:oe.loadError})]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:L(oe)}),a.jsx(qe,{className:"text-right font-mono text-sm",children:X(oe)}),a.jsx(qe,{className:"text-right text-xs text-muted-foreground",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(oe.updatedAt).toLocaleDateString()]})}),a.jsx(qe,{className:"text-right",children:typeof P[oe.id]=="number"?a.jsx("div",{className:"inline-flex justify-end",children:a.jsx(Ws,{rate:P[oe.id]})}):""}),a.jsx(qe,{className:"w-[220px] whitespace-nowrap",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Bg,{className:"h-4 w-4"})})}),a.jsxs(Bu,{align:"end",children:[a.jsxs(Mr,{onClick:()=>i(`/mcp-evaluations/${oe.id}`),children:[a.jsx(Zf,{className:"mr-2 h-3.5 w-3.5"}),"Edit"]}),a.jsxs(Mr,{onClick:()=>{F(oe.id)},children:[a.jsx(Hr,{className:"mr-2 h-3.5 w-3.5"}),"Clone"]}),a.jsxs(Mr,{className:"text-destructive",onClick:()=>{H(oe.id,hi(oe))},children:[a.jsx(Xa,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]}),a.jsx(Js,{children:a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsx(Z,{size:"icon",variant:"outline",className:"h-8 w-8",asChild:!0,"aria-label":de.tooltipLabel,children:a.jsxs(Et,{to:de.href,children:[a.jsx(bl,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"sr-only",children:de.tooltipLabel})]})})}),a.jsx(Rs,{children:de.tooltipLabel})]})}),a.jsx(Js,{children:a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsx(Z,{size:"sm",variant:"outline",className:`h-8 px-2 text-xs ${S.has(oe.id)?"border-green-600 bg-green-600 text-white hover:bg-green-700 hover:text-white":""}`,disabled:C.has(oe.id)||!oe.sourcePath,onClick:()=>oe.sourcePath&&void Q(oe.id,oe.sourcePath,hi(oe)),"aria-label":`Queue ${hi(oe)}`,children:S.has(oe.id)?"Queued":C.has(oe.id)?"Queueing...":a.jsxs(a.Fragment,{children:[a.jsx(TW,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"sr-only",children:"Queue evaluation"})]})})}),a.jsx(Rs,{children:"Queue evaluation run"})]})}),a.jsx(Z,{size:"sm",variant:"outline",asChild:!0,children:a.jsxs(Et,{to:`/run?configId=${encodeURIComponent(oe.id)}`,children:[a.jsx(ks,{className:"h-3.5 w-3.5"}),"Run"]})})]})})]},oe.id)})]},`suite-group-${ue}`)}),!r&&e.length===0&&a.jsx(Wt,{children:a.jsx(qe,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"No MCP evaluations yet. Create your first one to get started."})}),!r&&e.length>0&&q.length===0&&a.jsx(Wt,{children:a.jsx(qe,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"No MCP evaluations match this filter."})}),r&&a.jsx(Wt,{children:a.jsx(qe,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"Loading MCP evaluations..."})})]})]})})})]})};var Exe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pxe=Exe.reduce((e,t)=>{const n=rv(`Primitive.${t}`),r=h.forwardRef((s,o)=>{const{asChild:i,...c}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Rxe="Label",i8=h.forwardRef((e,t)=>a.jsx(Pxe.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));i8.displayName=Rxe;var l8=i8;const Txe=zl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=h.forwardRef(({className:e,...t},n)=>a.jsx(l8,{ref:n,className:Me(Txe(),e),...t}));We.displayName=l8.displayName;const Ts=h.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:Me("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background 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",e),ref:n,...t}));Ts.displayName="Textarea";var rx="Tabs",[Oxe]=kr(rx,[Yv]),c8=Yv(),[Mxe,ak]=Oxe(rx),u8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:c,activationMode:u="automatic",...f}=e,m=zu(c),[p,v]=Aa({prop:r,onChange:s,defaultProp:o??"",caller:rx});return a.jsx(Mxe,{scope:n,baseId:fr(),value:p,onValueChange:v,orientation:i,dir:m,activationMode:u,children:a.jsx(lt.div,{dir:m,"data-orientation":i,...f,ref:t})})});u8.displayName=rx;var d8="TabsList",f8=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=ak(d8,n),i=c8(n);return a.jsx(_B,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(lt.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});f8.displayName=d8;var p8="TabsTrigger",h8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=ak(p8,n),c=c8(n),u=v8(i.baseId,r),f=x8(i.baseId,r),m=r===i.value;return a.jsx(kB,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(lt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":f,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:u,...o,ref:t,onMouseDown:Ue(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:Ue(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:Ue(e.onFocus,()=>{const p=i.activationMode!=="manual";!m&&!s&&p&&i.onValueChange(r)})})})});h8.displayName=p8;var m8="TabsContent",g8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,c=ak(m8,n),u=v8(c.baseId,r),f=x8(c.baseId,r),m=r===c.value,p=h.useRef(m);return h.useEffect(()=>{const v=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(v)},[]),a.jsx(ar,{present:s||m,children:({present:v})=>a.jsx(lt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!v,id:f,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:v&&o})})});g8.displayName=m8;function v8(e,t){return`${e}-trigger-${t}`}function x8(e,t){return`${e}-content-${t}`}var Ixe=u8,y8=f8,b8=h8,w8=g8;const ax=Ixe,Cp=h.forwardRef(({className:e,...t},n)=>a.jsx(y8,{ref:n,className:Me("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Cp.displayName=y8.displayName;const Xs=h.forwardRef(({className:e,...t},n)=>a.jsx(b8,{ref:n,className:Me("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));Xs.displayName=b8.displayName;const Gf=h.forwardRef(({className:e,...t},n)=>a.jsx(w8,{ref:n,className:Me("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Gf.displayName=w8.displayName;const $xe={openai:"OpenAI",anthropic:"Anthropic",azure:"Azure OpenAI",azure_openai:"Azure OpenAI",google:"Google"};function Yf(e){return $xe[e]??e}const aD={openai:"bg-emerald-100 text-emerald-800",anthropic:"bg-orange-100 text-orange-800",azure:"bg-blue-100 text-blue-800",azure_openai:"bg-blue-100 text-blue-800",google:"bg-yellow-100 text-yellow-800",custom:"bg-gray-100 text-gray-800"};function j8({provider:e}){return a.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${aD[e]??aD.custom}`,children:Yf(e)})}var sx="Checkbox",[Dxe]=kr(sx),[Lxe,sk]=Dxe(sx);function Fxe(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:o,form:i,name:c,onCheckedChange:u,required:f,value:m="on",internal_do_not_use_render:p}=e,[v,x]=Aa({prop:n,defaultProp:s??!1,onChange:u,caller:sx}),[j,y]=h.useState(null),[b,S]=h.useState(null),N=h.useRef(!1),C=j?!!i||!!j.closest("form"):!0,k={checked:v,disabled:o,setChecked:x,control:j,setControl:y,name:c,form:i,value:m,hasConsumerStoppedPropagationRef:N,required:f,defaultChecked:bi(s)?!1:s,isFormControl:C,bubbleInput:b,setBubbleInput:S};return a.jsx(Lxe,{scope:t,...k,children:zxe(p)?p(k):r})}var S8="CheckboxTrigger",N8=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:o,value:i,disabled:c,checked:u,required:f,setControl:m,setChecked:p,hasConsumerStoppedPropagationRef:v,isFormControl:x,bubbleInput:j}=sk(S8,e),y=Ot(s,m),b=h.useRef(u);return h.useEffect(()=>{const S=o?.form;if(S){const N=()=>p(b.current);return S.addEventListener("reset",N),()=>S.removeEventListener("reset",N)}},[o,p]),a.jsx(lt.button,{type:"button",role:"checkbox","aria-checked":bi(u)?"mixed":u,"aria-required":f,"data-state":E8(u),"data-disabled":c?"":void 0,disabled:c,value:i,...r,ref:y,onKeyDown:Ue(t,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Ue(n,S=>{p(N=>bi(N)?!0:!N),j&&x&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})});N8.displayName=S8;var ok=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:o,required:i,disabled:c,value:u,onCheckedChange:f,form:m,...p}=e;return a.jsx(Fxe,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:c,required:i,onCheckedChange:f,name:r,form:m,value:u,internal_do_not_use_render:({isFormControl:v})=>a.jsxs(a.Fragment,{children:[a.jsx(N8,{...p,ref:t,__scopeCheckbox:n}),v&&a.jsx(A8,{__scopeCheckbox:n})]})})});ok.displayName=sx;var C8="CheckboxIndicator",_8=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=sk(C8,n);return a.jsx(ar,{present:r||bi(o.checked)||o.checked===!0,children:a.jsx(lt.span,{"data-state":E8(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});_8.displayName=C8;var k8="CheckboxBubbleInput",A8=h.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:c,disabled:u,name:f,value:m,form:p,bubbleInput:v,setBubbleInput:x}=sk(k8,e),j=Ot(n,x),y=Zv(o),b=Vg(r);h.useEffect(()=>{const N=v;if(!N)return;const C=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(C,"checked").set,E=!s.current;if(y!==o&&A){const P=new Event("click",{bubbles:E});N.indeterminate=bi(o),A.call(N,bi(o)?!1:o),N.dispatchEvent(P)}},[v,y,o,s]);const S=h.useRef(bi(o)?!1:o);return a.jsx(lt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??S.current,required:c,disabled:u,name:f,value:m,form:p,...t,tabIndex:-1,ref:j,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});A8.displayName=k8;function zxe(e){return typeof e=="function"}function bi(e){return e==="indeterminate"}function E8(e){return bi(e)?"indeterminate":e?"checked":"unchecked"}const br=h.forwardRef(({className:e,...t},n)=>a.jsx(ok,{ref:n,className:Me("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-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",e),...t,children:a.jsx(_8,{className:Me("flex items-center justify-center text-current"),children:a.jsx(Hc,{className:"h-4 w-4"})})}));br.displayName=ok.displayName;var ox="Collapsible",[Bxe]=kr(ox),[qxe,ik]=Bxe(ox),P8=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...c}=e,[u,f]=Aa({prop:r,defaultProp:s??!1,onChange:i,caller:ox});return a.jsx(qxe,{scope:n,disabled:o,contentId:fr(),open:u,onOpenToggle:h.useCallback(()=>f(m=>!m),[f]),children:a.jsx(lt.div,{"data-state":ck(u),"data-disabled":o?"":void 0,...c,ref:t})})});P8.displayName=ox;var R8="CollapsibleTrigger",T8=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=ik(R8,n);return a.jsx(lt.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":ck(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:Ue(e.onClick,s.onOpenToggle)})});T8.displayName=R8;var lk="CollapsibleContent",O8=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=ik(lk,e.__scopeCollapsible);return a.jsx(ar,{present:n||s.open,children:({present:o})=>a.jsx(Uxe,{...r,ref:t,present:o})})});O8.displayName=lk;var Uxe=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,i=ik(lk,n),[c,u]=h.useState(r),f=h.useRef(null),m=Ot(t,f),p=h.useRef(0),v=p.current,x=h.useRef(0),j=x.current,y=i.open||c,b=h.useRef(y),S=h.useRef(void 0);return h.useEffect(()=>{const N=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(N)},[]),pr(()=>{const N=f.current;if(N){S.current=S.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const C=N.getBoundingClientRect();p.current=C.height,x.current=C.width,b.current||(N.style.transitionDuration=S.current.transitionDuration,N.style.animationName=S.current.animationName),u(r)}},[i.open,r]),a.jsx(lt.div,{"data-state":ck(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...o,ref:m,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":j?`${j}px`:void 0,...e.style},children:y&&s})});function ck(e){return e?"open":"closed"}var Wxe=P8;const Ss=Wxe,Ba=T8,Ns=O8;function Hxe(e){return e.length>0?`Tool sequence · ${e.join(" -> ")}`:"Tool sequence"}function Ga({text:e,variant:t="assistant",className:n}){const r=Vxe(e);return a.jsx("div",{className:Me("space-y-2",t==="system"&&"text-xs",n),children:r.map((s,o)=>a.jsx(h.Fragment,{children:Kxe(s,o,t)},`md-${o}`))})}function Vxe(e){const t=e.replace(/\r\n/g,`
123
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gB(e,t){if(e){if(typeof e=="string")return MN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return MN(e,t)}}function Vme(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Kme(e){if(Array.isArray(e))return MN(e)}function MN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function G$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ie(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?G$(Object(n),!0).forEach(function(r){It(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function It(e,t,n){return t=vB(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vB(e){var t=Gme(e,"string");return yu(t)=="symbol"?t:t+""}function Gme(e,t){if(yu(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Yme={xAxis:["bottom","top"],yAxis:["left","right"]},Xme={width:"100%",height:"100%"},xB={x:0,y:0};function Jh(e){return e}var Qme=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},Jme=function(t,n,r,s){var o=n.find(function(m){return m&&m.index===r});if(o){if(t==="horizontal")return{x:o.coordinate,y:s.y};if(t==="vertical")return{x:s.x,y:o.coordinate};if(t==="centric"){var i=o.coordinate,c=s.radius;return Ie(Ie(Ie({},s),An(s.cx,s.cy,c,i)),{},{angle:i,radius:c})}var u=o.coordinate,f=s.angle;return Ie(Ie(Ie({},s),An(s.cx,s.cy,u,f)),{},{angle:f,radius:u})}return xB},Gv=function(t,n){var r=n.graphicalItems,s=n.dataStartIndex,o=n.dataEndIndex,i=(r??[]).reduce(function(c,u){var f=u.props.data;return f&&f.length?[].concat(bu(c),bu(f)):c},[]);return i.length>0?i:t&&t.length&&nt(s)&&nt(o)?t.slice(s,o+1):[]};function yB(e){return e==="number"?[0,"auto"]:void 0}var IN=function(t,n,r,s){var o=t.graphicalItems,i=t.tooltipAxis,c=Gv(n,t);return r<0||!o||!o.length||r>=c.length?null:o.reduce(function(u,f){var m,p=(m=f.props.data)!==null&&m!==void 0?m:n;p&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(p=p.slice(t.dataStartIndex,t.dataEndIndex+1));var v;if(i.dataKey&&!i.allowDuplicatedCategory){var x=p===void 0?c:p;v=Cm(x,i.dataKey,s)}else v=p&&p[r]||c[r];return v?[].concat(bu(u),[lz(f,v)]):u},[])},Y$=function(t,n,r,s){var o=s||{x:t.chartX,y:t.chartY},i=Qme(o,r),c=t.orderedTooltipTicks,u=t.tooltipAxis,f=t.tooltipTicks,m=Iie(i,c,f,u);if(m>=0&&f){var p=f[m]&&f[m].value,v=IN(t,n,m,p),x=Jme(r,c,m,o);return{activeTooltipIndex:m,activeLabel:p,activePayload:v,activeCoordinate:x}}return null},Zme=function(t,n){var r=n.axes,s=n.graphicalItems,o=n.axisType,i=n.axisIdKey,c=n.stackGroups,u=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,v=t.stackOffset,x=rz(m,o);return r.reduce(function(j,y){var b,S=y.type.defaultProps!==void 0?Ie(Ie({},y.type.defaultProps),y.props):y.props,N=S.type,C=S.dataKey,k=S.allowDataOverflow,A=S.allowDuplicatedCategory,E=S.scale,P=S.ticks,T=S.includeHidden,$=S[i];if(j[$])return j;var Y=Gv(t.data,{graphicalItems:s.filter(function(z){var V,ee=i in z.props?z.props[i]:(V=z.type.defaultProps)===null||V===void 0?void 0:V[i];return ee===$}),dataStartIndex:u,dataEndIndex:f}),H=Y.length,F,X,L;Cme(S.domain,k,N)&&(F=Y1(S.domain,null,k),x&&(N==="number"||E!=="auto")&&(L=Xd(Y,C,"category")));var I=yB(N);if(!F||F.length===0){var M,q=(M=S.domain)!==null&&M!==void 0?M:I;if(C){if(F=Xd(Y,C,N),N==="category"&&x){var G=AZ(F);A&&G?(X=F,F=dg(0,H)):A||(F=ZM(q,F,y).reduce(function(z,V){return z.indexOf(V)>=0?z:[].concat(bu(z),[V])},[]))}else if(N==="category")A?F=F.filter(function(z){return z!==""&&!Vt(z)}):F=ZM(q,F,y).reduce(function(z,V){return z.indexOf(V)>=0||V===""||Vt(V)?z:[].concat(bu(z),[V])},[]);else if(N==="number"){var O=zie(Y,s.filter(function(z){var V,ee,ae=i in z.props?z.props[i]:(V=z.type.defaultProps)===null||V===void 0?void 0:V[i],ue="hide"in z.props?z.props.hide:(ee=z.type.defaultProps)===null||ee===void 0?void 0:ee.hide;return ae===$&&(T||!ue)}),C,o,m);O&&(F=O)}x&&(N==="number"||E!=="auto")&&(L=Xd(Y,C,"category"))}else x?F=dg(0,H):c&&c[$]&&c[$].hasStack&&N==="number"?F=v==="expand"?[0,1]:iz(c[$].stackGroups,u,f):F=nz(Y,s.filter(function(z){var V=i in z.props?z.props[i]:z.type.defaultProps[i],ee="hide"in z.props?z.props.hide:z.type.defaultProps.hide;return V===$&&(T||!ee)}),N,m,!0);if(N==="number")F=TN(p,F,$,o,P),q&&(F=Y1(q,F,k));else if(N==="category"&&q){var Q=q,B=F.every(function(z){return Q.indexOf(z)>=0});B&&(F=Q)}}return Ie(Ie({},j),{},It({},$,Ie(Ie({},S),{},{axisType:o,domain:F,categoricalDomain:L,duplicateDomain:X,originalDomain:(b=S.domain)!==null&&b!==void 0?b:I,isCategorical:x,layout:m})))},{})},ege=function(t,n){var r=n.graphicalItems,s=n.Axis,o=n.axisType,i=n.axisIdKey,c=n.stackGroups,u=n.dataStartIndex,f=n.dataEndIndex,m=t.layout,p=t.children,v=Gv(t.data,{graphicalItems:r,dataStartIndex:u,dataEndIndex:f}),x=v.length,j=rz(m,o),y=-1;return r.reduce(function(b,S){var N=S.type.defaultProps!==void 0?Ie(Ie({},S.type.defaultProps),S.props):S.props,C=N[i],k=yB("number");if(!b[C]){y++;var A;return j?A=dg(0,x):c&&c[C]&&c[C].hasStack?(A=iz(c[C].stackGroups,u,f),A=TN(p,A,C,o)):(A=Y1(k,nz(v,r.filter(function(E){var P,T,$=i in E.props?E.props[i]:(P=E.type.defaultProps)===null||P===void 0?void 0:P[i],Y="hide"in E.props?E.props.hide:(T=E.type.defaultProps)===null||T===void 0?void 0:T.hide;return $===C&&!Y}),"number",m),s.defaultProps.allowDataOverflow),A=TN(p,A,C,o)),Ie(Ie({},b),{},It({},C,Ie(Ie({axisType:o},s.defaultProps),{},{hide:!0,orientation:_a(Yme,"".concat(o,".").concat(y%2),null),domain:A,originalDomain:k,isCategorical:j,layout:m})))}return b},{})},tge=function(t,n){var r=n.axisType,s=r===void 0?"xAxis":r,o=n.AxisComp,i=n.graphicalItems,c=n.stackGroups,u=n.dataStartIndex,f=n.dataEndIndex,m=t.children,p="".concat(s,"Id"),v=ka(m,o),x={};return v&&v.length?x=Zme(t,{axes:v,graphicalItems:i,axisType:s,axisIdKey:p,stackGroups:c,dataStartIndex:u,dataEndIndex:f}):i&&i.length&&(x=ege(t,{Axis:o,graphicalItems:i,axisType:s,axisIdKey:p,stackGroups:c,dataStartIndex:u,dataEndIndex:f})),x},nge=function(t){var n=Ac(t),r=fl(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:m_(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Qm(n,r)}},X$=function(t){var n=t.children,r=t.defaultShowTooltip,s=ba(n,uu),o=0,i=0;return t.data&&t.data.length!==0&&(i=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(o=s.props.startIndex),s.props.endIndex>=0&&(i=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:i,activeTooltipIndex:-1,isTooltipActive:!!r}},rge=function(t){return!t||!t.length?!1:t.some(function(n){var r=_o(n&&n.type);return r&&r.indexOf("Bar")>=0})},Q$=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},age=function(t,n){var r=t.props,s=t.graphicalItems,o=t.xAxisMap,i=o===void 0?{}:o,c=t.yAxisMap,u=c===void 0?{}:c,f=r.width,m=r.height,p=r.children,v=r.margin||{},x=ba(p,uu),j=ba(p,hl),y=Object.keys(u).reduce(function(A,E){var P=u[E],T=P.orientation;return!P.mirror&&!P.hide?Ie(Ie({},A),{},It({},T,A[T]+P.width)):A},{left:v.left||0,right:v.right||0}),b=Object.keys(i).reduce(function(A,E){var P=i[E],T=P.orientation;return!P.mirror&&!P.hide?Ie(Ie({},A),{},It({},T,_a(A,"".concat(T))+P.height)):A},{top:v.top||0,bottom:v.bottom||0}),S=Ie(Ie({},b),y),N=S.bottom;x&&(S.bottom+=x.props.height||uu.defaultProps.height),j&&n&&(S=Lie(S,s,r,n));var C=f-S.left-S.right,k=m-S.top-S.bottom;return Ie(Ie({brushBottom:N},S),{},{width:Math.max(C,0),height:Math.max(k,0)})},sge=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},K_=function(t){var n=t.chartName,r=t.GraphicalChild,s=t.defaultTooltipEventType,o=s===void 0?"axis":s,i=t.validateTooltipEventTypes,c=i===void 0?["axis"]:i,u=t.axisComponents,f=t.legendContent,m=t.formatAxisMap,p=t.defaultProps,v=function(S,N){var C=N.graphicalItems,k=N.stackGroups,A=N.offset,E=N.updateId,P=N.dataStartIndex,T=N.dataEndIndex,$=S.barSize,Y=S.layout,H=S.barGap,F=S.barCategoryGap,X=S.maxBarSize,L=Q$(Y),I=L.numericAxisName,M=L.cateAxisName,q=rge(C),G=[];return C.forEach(function(O,Q){var B=Gv(S.data,{graphicalItems:[O],dataStartIndex:P,dataEndIndex:T}),z=O.type.defaultProps!==void 0?Ie(Ie({},O.type.defaultProps),O.props):O.props,V=z.dataKey,ee=z.maxBarSize,ae=z["".concat(I,"Id")],ue=z["".concat(M,"Id")],se={},xe=u.reduce(function(Re,Ze){var ht=N["".concat(Ze.axisType,"Map")],Ft=z["".concat(Ze.axisType,"Id")];ht&&ht[Ft]||Ze.axisType==="zAxis"||kl();var zt=ht[Ft];return Ie(Ie({},Re),{},It(It({},Ze.axisType,zt),"".concat(Ze.axisType,"Ticks"),fl(zt)))},se),oe=xe[M],de=xe["".concat(M,"Ticks")],De=k&&k[ae]&&k[ae].hasStack&&Yie(O,k[ae].stackGroups),me=_o(O.type).indexOf("Bar")>=0,ge=Qm(oe,de),we=[],at=q&&$ie({barSize:$,stackGroups:k,totalSize:sge(xe,M)});if(me){var tt,it,At=Vt(ee)?X:ee,Ge=(tt=(it=Qm(oe,de,!0))!==null&&it!==void 0?it:At)!==null&&tt!==void 0?tt:0;we=Die({barGap:H,barCategoryGap:F,bandSize:Ge!==ge?Ge:ge,sizeList:at[ue],maxBarSize:At}),Ge!==ge&&(we=we.map(function(Re){return Ie(Ie({},Re),{},{position:Ie(Ie({},Re.position),{},{offset:Re.position.offset-Ge/2})})}))}var Ee=O&&O.type&&O.type.getComposedData;Ee&&G.push({props:Ie(Ie({},Ee(Ie(Ie({},xe),{},{displayedData:B,props:S,dataKey:V,item:O,bandSize:ge,barPosition:we,offset:A,stackedData:De,layout:Y,dataStartIndex:P,dataEndIndex:T}))),{},It(It(It({key:O.key||"item-".concat(Q)},I,xe[I]),M,xe[M]),"animationId",E)),childIndex:BZ(O,S.children),item:O})}),G},x=function(S,N){var C=S.props,k=S.dataStartIndex,A=S.dataEndIndex,E=S.updateId;if(!pT({props:C}))return null;var P=C.children,T=C.layout,$=C.stackOffset,Y=C.data,H=C.reverseStackOrder,F=Q$(T),X=F.numericAxisName,L=F.cateAxisName,I=ka(P,r),M=Kie(Y,I,"".concat(X,"Id"),"".concat(L,"Id"),$,H),q=u.reduce(function(z,V){var ee="".concat(V.axisType,"Map");return Ie(Ie({},z),{},It({},ee,tge(C,Ie(Ie({},V),{},{graphicalItems:I,stackGroups:V.axisType===X&&M,dataStartIndex:k,dataEndIndex:A}))))},{}),G=age(Ie(Ie({},q),{},{props:C,graphicalItems:I}),N?.legendBBox);Object.keys(q).forEach(function(z){q[z]=m(C,q[z],G,z.replace("Map",""),n)});var O=q["".concat(L,"Map")],Q=nge(O),B=v(C,Ie(Ie({},q),{},{dataStartIndex:k,dataEndIndex:A,updateId:E,graphicalItems:I,stackGroups:M,offset:G}));return Ie(Ie({formattedGraphicalItems:B,graphicalItems:I,offset:G,stackGroups:M},Q),q)},j=(function(b){function S(N){var C,k,A;return Lme(this,S),A=Bme(this,S,[N]),It(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),It(A,"accessibilityManager",new Nme),It(A,"handleLegendBBoxUpdate",function(E){if(E){var P=A.state,T=P.dataStartIndex,$=P.dataEndIndex,Y=P.updateId;A.setState(Ie({legendBBox:E},x({props:A.props,dataStartIndex:T,dataEndIndex:$,updateId:Y},Ie(Ie({},A.state),{},{legendBBox:E}))))}}),It(A,"handleReceiveSyncEvent",function(E,P,T){if(A.props.syncId===E){if(T===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(P)}}),It(A,"handleBrushChange",function(E){var P=E.startIndex,T=E.endIndex;if(P!==A.state.dataStartIndex||T!==A.state.dataEndIndex){var $=A.state.updateId;A.setState(function(){return Ie({dataStartIndex:P,dataEndIndex:T},x({props:A.props,dataStartIndex:P,dataEndIndex:T,updateId:$},A.state))}),A.triggerSyncEvent({dataStartIndex:P,dataEndIndex:T})}}),It(A,"handleMouseEnter",function(E){var P=A.getMouseInfo(E);if(P){var T=Ie(Ie({},P),{},{isTooltipActive:!0});A.setState(T),A.triggerSyncEvent(T);var $=A.props.onMouseEnter;Ht($)&&$(T,E)}}),It(A,"triggeredAfterMouseMove",function(E){var P=A.getMouseInfo(E),T=P?Ie(Ie({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState(T),A.triggerSyncEvent(T);var $=A.props.onMouseMove;Ht($)&&$(T,E)}),It(A,"handleItemMouseEnter",function(E){A.setState(function(){return{isTooltipActive:!0,activeItem:E,activePayload:E.tooltipPayload,activeCoordinate:E.tooltipPosition||{x:E.cx,y:E.cy}}})}),It(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),It(A,"handleMouseMove",function(E){E.persist(),A.throttleTriggeredAfterMouseMove(E)}),It(A,"handleMouseLeave",function(E){A.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};A.setState(P),A.triggerSyncEvent(P);var T=A.props.onMouseLeave;Ht(T)&&T(P,E)}),It(A,"handleOuterEvent",function(E){var P=zZ(E),T=_a(A.props,"".concat(P));if(P&&Ht(T)){var $,Y;/.*touch.*/i.test(P)?Y=A.getMouseInfo(E.changedTouches[0]):Y=A.getMouseInfo(E),T(($=Y)!==null&&$!==void 0?$:{},E)}}),It(A,"handleClick",function(E){var P=A.getMouseInfo(E);if(P){var T=Ie(Ie({},P),{},{isTooltipActive:!0});A.setState(T),A.triggerSyncEvent(T);var $=A.props.onClick;Ht($)&&$(T,E)}}),It(A,"handleMouseDown",function(E){var P=A.props.onMouseDown;if(Ht(P)){var T=A.getMouseInfo(E);P(T,E)}}),It(A,"handleMouseUp",function(E){var P=A.props.onMouseUp;if(Ht(P)){var T=A.getMouseInfo(E);P(T,E)}}),It(A,"handleTouchMove",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(E.changedTouches[0])}),It(A,"handleTouchStart",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.handleMouseDown(E.changedTouches[0])}),It(A,"handleTouchEnd",function(E){E.changedTouches!=null&&E.changedTouches.length>0&&A.handleMouseUp(E.changedTouches[0])}),It(A,"handleDoubleClick",function(E){var P=A.props.onDoubleClick;if(Ht(P)){var T=A.getMouseInfo(E);P(T,E)}}),It(A,"handleContextMenu",function(E){var P=A.props.onContextMenu;if(Ht(P)){var T=A.getMouseInfo(E);P(T,E)}}),It(A,"triggerSyncEvent",function(E){A.props.syncId!==void 0&&bS.emit(wS,A.props.syncId,E,A.eventEmitterSymbol)}),It(A,"applySyncEvent",function(E){var P=A.props,T=P.layout,$=P.syncMethod,Y=A.state.updateId,H=E.dataStartIndex,F=E.dataEndIndex;if(E.dataStartIndex!==void 0||E.dataEndIndex!==void 0)A.setState(Ie({dataStartIndex:H,dataEndIndex:F},x({props:A.props,dataStartIndex:H,dataEndIndex:F,updateId:Y},A.state)));else if(E.activeTooltipIndex!==void 0){var X=E.chartX,L=E.chartY,I=E.activeTooltipIndex,M=A.state,q=M.offset,G=M.tooltipTicks;if(!q)return;if(typeof $=="function")I=$(G,E);else if($==="value"){I=-1;for(var O=0;O<G.length;O++)if(G[O].value===E.activeLabel){I=O;break}}var Q=Ie(Ie({},q),{},{x:q.left,y:q.top}),B=Math.min(X,Q.x+Q.width),z=Math.min(L,Q.y+Q.height),V=G[I]&&G[I].value,ee=IN(A.state,A.props.data,I),ae=G[I]?{x:T==="horizontal"?G[I].coordinate:B,y:T==="horizontal"?z:G[I].coordinate}:xB;A.setState(Ie(Ie({},E),{},{activeLabel:V,activeCoordinate:ae,activePayload:ee,activeTooltipIndex:I}))}else A.setState(E)}),It(A,"renderCursor",function(E){var P,T=A.state,$=T.isTooltipActive,Y=T.activeCoordinate,H=T.activePayload,F=T.offset,X=T.activeTooltipIndex,L=T.tooltipAxisBandSize,I=A.getTooltipEventType(),M=(P=E.props.active)!==null&&P!==void 0?P:$,q=A.props.layout,G=E.key||"_recharts-cursor";return J.createElement(Rme,{key:G,activeCoordinate:Y,activePayload:H,activeTooltipIndex:X,chartName:n,element:E,isActive:M,layout:q,offset:F,tooltipAxisBandSize:L,tooltipEventType:I})}),It(A,"renderPolarAxis",function(E,P,T){var $=_a(E,"type.axisType"),Y=_a(A.state,"".concat($,"Map")),H=E.type.defaultProps,F=H!==void 0?Ie(Ie({},H),E.props):E.props,X=Y&&Y[F["".concat($,"Id")]];return h.cloneElement(E,Ie(Ie({},X),{},{className:Kt($,X.className),key:E.key||"".concat(P,"-").concat(T),ticks:fl(X,!0)}))}),It(A,"renderPolarGrid",function(E){var P=E.props,T=P.radialLines,$=P.polarAngles,Y=P.polarRadius,H=A.state,F=H.radiusAxisMap,X=H.angleAxisMap,L=Ac(F),I=Ac(X),M=I.cx,q=I.cy,G=I.innerRadius,O=I.outerRadius;return h.cloneElement(E,{polarAngles:Array.isArray($)?$:fl(I,!0).map(function(Q){return Q.coordinate}),polarRadius:Array.isArray(Y)?Y:fl(L,!0).map(function(Q){return Q.coordinate}),cx:M,cy:q,innerRadius:G,outerRadius:O,key:E.key||"polar-grid",radialLines:T})}),It(A,"renderLegend",function(){var E=A.state.formattedGraphicalItems,P=A.props,T=P.children,$=P.width,Y=P.height,H=A.props.margin||{},F=$-(H.left||0)-(H.right||0),X=ez({children:T,formattedGraphicalItems:E,legendWidth:F,legendContent:f});if(!X)return null;var L=X.item,I=K$(X,Tme);return h.cloneElement(L,Ie(Ie({},I),{},{chartWidth:$,chartHeight:Y,margin:H,onBBoxUpdate:A.handleLegendBBoxUpdate}))}),It(A,"renderTooltip",function(){var E,P=A.props,T=P.children,$=P.accessibilityLayer,Y=ba(T,ra);if(!Y)return null;var H=A.state,F=H.isTooltipActive,X=H.activeCoordinate,L=H.activePayload,I=H.activeLabel,M=H.offset,q=(E=Y.props.active)!==null&&E!==void 0?E:F;return h.cloneElement(Y,{viewBox:Ie(Ie({},M),{},{x:M.left,y:M.top}),active:q,label:I,payload:q?L:[],coordinate:X,accessibilityLayer:$})}),It(A,"renderBrush",function(E){var P=A.props,T=P.margin,$=P.data,Y=A.state,H=Y.offset,F=Y.dataStartIndex,X=Y.dataEndIndex,L=Y.updateId;return h.cloneElement(E,{key:E.key||"_recharts-brush",onChange:Kh(A.handleBrushChange,E.props.onChange),data:$,x:nt(E.props.x)?E.props.x:H.left,y:nt(E.props.y)?E.props.y:H.top+H.height+H.brushBottom-(T.bottom||0),width:nt(E.props.width)?E.props.width:H.width,startIndex:F,endIndex:X,updateId:"brush-".concat(L)})}),It(A,"renderReferenceElement",function(E,P,T){if(!E)return null;var $=A,Y=$.clipPathId,H=A.state,F=H.xAxisMap,X=H.yAxisMap,L=H.offset,I=E.type.defaultProps||{},M=E.props,q=M.xAxisId,G=q===void 0?I.xAxisId:q,O=M.yAxisId,Q=O===void 0?I.yAxisId:O;return h.cloneElement(E,{key:E.key||"".concat(P,"-").concat(T),xAxis:F[G],yAxis:X[Q],viewBox:{x:L.left,y:L.top,width:L.width,height:L.height},clipPathId:Y})}),It(A,"renderActivePoints",function(E){var P=E.item,T=E.activePoint,$=E.basePoint,Y=E.childIndex,H=E.isRange,F=[],X=P.props.key,L=P.item.type.defaultProps!==void 0?Ie(Ie({},P.item.type.defaultProps),P.item.props):P.item.props,I=L.activeDot,M=L.dataKey,q=Ie(Ie({index:Y,dataKey:M,cx:T.x,cy:T.y,r:4,fill:B_(P.item),strokeWidth:2,stroke:"#fff",payload:T.payload,value:T.value},Mt(I,!1)),_m(I));return F.push(S.renderActiveDot(I,q,"".concat(X,"-activePoint-").concat(Y))),$?F.push(S.renderActiveDot(I,Ie(Ie({},q),{},{cx:$.x,cy:$.y}),"".concat(X,"-basePoint-").concat(Y))):H&&F.push(null),F}),It(A,"renderGraphicChild",function(E,P,T){var $=A.filterFormatItem(E,P,T);if(!$)return null;var Y=A.getTooltipEventType(),H=A.state,F=H.isTooltipActive,X=H.tooltipAxis,L=H.activeTooltipIndex,I=H.activeLabel,M=A.props.children,q=ba(M,ra),G=$.props,O=G.points,Q=G.isRange,B=G.baseLine,z=$.item.type.defaultProps!==void 0?Ie(Ie({},$.item.type.defaultProps),$.item.props):$.item.props,V=z.activeDot,ee=z.hide,ae=z.activeBar,ue=z.activeShape,se=!!(!ee&&F&&q&&(V||ae||ue)),xe={};Y!=="axis"&&q&&q.props.trigger==="click"?xe={onClick:Kh(A.handleItemMouseEnter,E.props.onClick)}:Y!=="axis"&&(xe={onMouseLeave:Kh(A.handleItemMouseLeave,E.props.onMouseLeave),onMouseEnter:Kh(A.handleItemMouseEnter,E.props.onMouseEnter)});var oe=h.cloneElement(E,Ie(Ie({},$.props),xe));function de(Ze){return typeof X.dataKey=="function"?X.dataKey(Ze.payload):null}if(se)if(L>=0){var De,me;if(X.dataKey&&!X.allowDuplicatedCategory){var ge=typeof X.dataKey=="function"?de:"payload.".concat(X.dataKey.toString());De=Cm(O,ge,I),me=Q&&B&&Cm(B,ge,I)}else De=O?.[L],me=Q&&B&&B[L];if(ue||ae){var we=E.props.activeIndex!==void 0?E.props.activeIndex:L;return[h.cloneElement(E,Ie(Ie(Ie({},$.props),xe),{},{activeIndex:we})),null,null]}if(!Vt(De))return[oe].concat(bu(A.renderActivePoints({item:$,activePoint:De,basePoint:me,childIndex:L,isRange:Q})))}else{var at,tt=(at=A.getItemByXY(A.state.activeCoordinate))!==null&&at!==void 0?at:{graphicalItem:oe},it=tt.graphicalItem,At=it.item,Ge=At===void 0?E:At,Ee=it.childIndex,Re=Ie(Ie(Ie({},$.props),xe),{},{activeIndex:Ee});return[h.cloneElement(Ge,Re),null,null]}return Q?[oe,null,null]:[oe,null]}),It(A,"renderCustomized",function(E,P,T){return h.cloneElement(E,Ie(Ie({key:"recharts-customized-".concat(T)},A.props),A.state))}),It(A,"renderMap",{CartesianGrid:{handler:Jh,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:Jh},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:Jh},YAxis:{handler:Jh},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((C=N.id)!==null&&C!==void 0?C:Iu("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=eF(A.triggeredAfterMouseMove,(k=N.throttleDelay)!==null&&k!==void 0?k:1e3/60),A.state={},A}return Wme(S,b),zme(S,[{key:"componentDidMount",value:function(){var C,k;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,k=C.children,A=C.data,E=C.height,P=C.layout,T=ba(k,ra);if(T){var $=T.props.defaultIndex;if(!(typeof $!="number"||$<0||$>this.state.tooltipTicks.length-1)){var Y=this.state.tooltipTicks[$]&&this.state.tooltipTicks[$].value,H=IN(this.state,A,$,Y),F=this.state.tooltipTicks[$].coordinate,X=(this.state.offset.top+E)/2,L=P==="horizontal",I=L?{x:F,y:X}:{y:F,x:X},M=this.state.formattedGraphicalItems.find(function(G){var O=G.item;return O.type.name==="Scatter"});M&&(I=Ie(Ie({},I),M.props.points[$].tooltipPosition),H=M.props.points[$].tooltipPayload);var q={activeTooltipIndex:$,isTooltipActive:!0,activeLabel:Y,activePayload:H,activeCoordinate:I};this.setState(q),this.renderCursor(T),this.accessibilityManager.setIndex($)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,k){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==k.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var A,E;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(E=this.props.margin.top)!==null&&E!==void 0?E:0}})}return null}},{key:"componentDidUpdate",value:function(C){v1([ba(C.children,ra)],[ba(this.props.children,ra)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=ba(this.props.children,ra);if(C&&typeof C.props.shared=="boolean"){var k=C.props.shared?"axis":"item";return c.indexOf(k)>=0?k:o}return o}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var k=this.container,A=k.getBoundingClientRect(),E=kre(A),P={chartX:Math.round(C.pageX-E.left),chartY:Math.round(C.pageY-E.top)},T=A.width/k.offsetWidth||1,$=this.inRange(P.chartX,P.chartY,T);if(!$)return null;var Y=this.state,H=Y.xAxisMap,F=Y.yAxisMap,X=this.getTooltipEventType(),L=Y$(this.state,this.props.data,this.props.layout,$);if(X!=="axis"&&H&&F){var I=Ac(H).scale,M=Ac(F).scale,q=I&&I.invert?I.invert(P.chartX):null,G=M&&M.invert?M.invert(P.chartY):null;return Ie(Ie({},P),{},{xValue:q,yValue:G},L)}return L?Ie(Ie({},P),L):null}},{key:"inRange",value:function(C,k){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,E=this.props.layout,P=C/A,T=k/A;if(E==="horizontal"||E==="vertical"){var $=this.state.offset,Y=P>=$.left&&P<=$.left+$.width&&T>=$.top&&T<=$.top+$.height;return Y?{x:P,y:T}:null}var H=this.state,F=H.angleAxisMap,X=H.radiusAxisMap;if(F&&X){var L=Ac(F);return nI({x:P,y:T},L)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,k=this.getTooltipEventType(),A=ba(C,ra),E={};A&&k==="axis"&&(A.props.trigger==="click"?E={onClick:this.handleClick}:E={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var P=_m(this.props,this.handleOuterEvent);return Ie(Ie({},P),E)}},{key:"addListener",value:function(){bS.on(wS,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){bS.removeListener(wS,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,k,A){for(var E=this.state.formattedGraphicalItems,P=0,T=E.length;P<T;P++){var $=E[P];if($.item===C||$.props.key===C.key||k===_o($.item.type)&&A===$.childIndex)return $}return null}},{key:"renderClipPath",value:function(){var C=this.clipPathId,k=this.state.offset,A=k.left,E=k.top,P=k.height,T=k.width;return J.createElement("defs",null,J.createElement("clipPath",{id:C},J.createElement("rect",{x:A,y:E,height:P,width:T})))}},{key:"getXScales",value:function(){var C=this.state.xAxisMap;return C?Object.entries(C).reduce(function(k,A){var E=V$(A,2),P=E[0],T=E[1];return Ie(Ie({},k),{},It({},P,T.scale))},{}):null}},{key:"getYScales",value:function(){var C=this.state.yAxisMap;return C?Object.entries(C).reduce(function(k,A){var E=V$(A,2),P=E[0],T=E[1];return Ie(Ie({},k),{},It({},P,T.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(C){var k;return(k=this.state.xAxisMap)===null||k===void 0||(k=k[C])===null||k===void 0?void 0:k.scale}},{key:"getYScaleByAxisId",value:function(C){var k;return(k=this.state.yAxisMap)===null||k===void 0||(k=k[C])===null||k===void 0?void 0:k.scale}},{key:"getItemByXY",value:function(C){var k=this.state,A=k.formattedGraphicalItems,E=k.activeItem;if(A&&A.length)for(var P=0,T=A.length;P<T;P++){var $=A[P],Y=$.props,H=$.item,F=H.type.defaultProps!==void 0?Ie(Ie({},H.type.defaultProps),H.props):H.props,X=_o(H.type);if(X==="Bar"){var L=(Y.data||[]).find(function(G){return Gue(C,G)});if(L)return{graphicalItem:$,payload:L}}else if(X==="RadialBar"){var I=(Y.data||[]).find(function(G){return nI(C,G)});if(I)return{graphicalItem:$,payload:I}}else if(zv($,E)||Bv($,E)||Lf($,E)){var M=vfe({graphicalItem:$,activeTooltipItem:E,itemData:F.data}),q=F.activeIndex===void 0?M:F.activeIndex;return{graphicalItem:Ie(Ie({},$),{},{childIndex:q}),payload:Lf($,E)?F.data[M]:$.props.data[M]}}}return null}},{key:"render",value:function(){var C=this;if(!pT(this))return null;var k=this.props,A=k.children,E=k.className,P=k.width,T=k.height,$=k.style,Y=k.compact,H=k.title,F=k.desc,X=K$(k,Ome),L=Mt(X,!1);if(Y)return J.createElement(E$,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},J.createElement(y1,$c({},L,{width:P,height:T,title:H,desc:F}),this.renderClipPath(),mT(A,this.renderMap)));if(this.props.accessibilityLayer){var I,M;L.tabIndex=(I=this.props.tabIndex)!==null&&I!==void 0?I:0,L.role=(M=this.props.role)!==null&&M!==void 0?M:"application",L.onKeyDown=function(G){C.accessibilityManager.keyboardEvent(G)},L.onFocus=function(){C.accessibilityManager.focus()}}var q=this.parseEventsOfWrapper();return J.createElement(E$,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},J.createElement("div",$c({className:Kt("recharts-wrapper",E),style:Ie({position:"relative",cursor:"default",width:P,height:T},$)},q,{ref:function(O){C.container=O}}),J.createElement(y1,$c({},L,{width:P,height:T,title:H,desc:F,style:Xme}),this.renderClipPath(),mT(A,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(h.Component);It(j,"displayName",n),It(j,"defaultProps",Ie({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},p)),It(j,"getDerivedStateFromProps",function(b,S){var N=b.dataKey,C=b.data,k=b.children,A=b.width,E=b.height,P=b.layout,T=b.stackOffset,$=b.margin,Y=S.dataStartIndex,H=S.dataEndIndex;if(S.updateId===void 0){var F=X$(b);return Ie(Ie(Ie({},F),{},{updateId:0},x(Ie(Ie({props:b},F),{},{updateId:0}),S)),{},{prevDataKey:N,prevData:C,prevWidth:A,prevHeight:E,prevLayout:P,prevStackOffset:T,prevMargin:$,prevChildren:k})}if(N!==S.prevDataKey||C!==S.prevData||A!==S.prevWidth||E!==S.prevHeight||P!==S.prevLayout||T!==S.prevStackOffset||!Bc($,S.prevMargin)){var X=X$(b),L={chartX:S.chartX,chartY:S.chartY,isTooltipActive:S.isTooltipActive},I=Ie(Ie({},Y$(S,C,P)),{},{updateId:S.updateId+1}),M=Ie(Ie(Ie({},X),L),I);return Ie(Ie(Ie({},M),x(Ie({props:b},M),S)),{},{prevDataKey:N,prevData:C,prevWidth:A,prevHeight:E,prevLayout:P,prevStackOffset:T,prevMargin:$,prevChildren:k})}if(!v1(k,S.prevChildren)){var q,G,O,Q,B=ba(k,uu),z=B&&(q=(G=B.props)===null||G===void 0?void 0:G.startIndex)!==null&&q!==void 0?q:Y,V=B&&(O=(Q=B.props)===null||Q===void 0?void 0:Q.endIndex)!==null&&O!==void 0?O:H,ee=z!==Y||V!==H,ae=!Vt(C),ue=ae&&!ee?S.updateId:S.updateId+1;return Ie(Ie({updateId:ue},x(Ie(Ie({props:b},S),{},{updateId:ue,dataStartIndex:z,dataEndIndex:V}),S)),{},{prevChildren:k,dataStartIndex:z,dataEndIndex:V})}return null}),It(j,"renderActiveDot",function(b,S,N){var C;return h.isValidElement(b)?C=h.cloneElement(b,S):Ht(b)?C=b(S):C=J.createElement(Iv,S),J.createElement(un,{className:"recharts-active-dot",key:N},C)});var y=h.forwardRef(function(S,N){return J.createElement(j,$c({},S,{ref:N}))});return y.displayName=j.displayName,y},$N=K_({chartName:"LineChart",GraphicalChild:Al,axisComponents:[{axisType:"xAxis",AxisComp:_i},{axisType:"yAxis",AxisComp:ki}],formatAxisMap:Dz}),oge=K_({chartName:"BarChart",GraphicalChild:Kl,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:_i},{axisType:"yAxis",AxisComp:ki}],formatAxisMap:Dz}),ige=K_({chartName:"PieChart",GraphicalChild:Wo,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Fv},{axisType:"radiusAxis",AxisComp:Dv}],formatAxisMap:sle,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function bB(e){return Array.from(new Map(e.scenarios.map(t=>{const n=String(t.scenarioId??"").trim(),r=String(t.scenarioName??"").trim();return!n&&!r?null:[n||r,r||n]}).filter(t=>!!t)).values())}function G_(e){const t=bB(e),n=e.scenarios.map(v=>v.agentName||v.agentId).filter(Boolean),r=Array.from(new Set(n.length>0?n:e.rerunAgents??[])),s=Array.from(new Set(e.scenarios.map(v=>v.model).filter(v=>!!v))),o=t.slice(0,2).join(", "),i=t.length>2?` +${t.length-2}`:"",c=s.slice(0,2).join(", "),u=s.length>2?` +${s.length-2}`:"",f=e.configName?.trim()||"",m=e.configPath?.trim()||"",p=f||m;return{scenarioCount:t.length,agentCount:r.length,scopePreview:p||(o?`${o}${i}`:"n/a"),modelSummary:c?`${c}${u}`:""}}function vi(e){const t=typeof e.toolTokensTotal=="number"?e.toolTokensTotal:null;return{id:e.runId,configId:"",configHash:e.configHash,configPath:e.configPath,configName:e.configName,langsmithTraceUrls:e.langsmithTraceUrls,rerunAgents:e.rerunAgents,rerunScenarioIds:e.rerunScenarioIds,rerunServerOverrideAll:e.rerunServerOverrideAll,rerunScenarioServerOverrides:e.rerunScenarioServerOverrides,timestamp:e.timestamp,runNote:e.runNote,mcpServerVersions:e.mcpServerVersions??{},scenarios:(e.scenarioIds??[]).map((n,r)=>({scenarioId:n,scenarioName:e.scenarioNames?.[r]??n,agentId:"",agentName:"",runs:[],passRate:0,avgToolCalls:0,avgDuration:0})),assistantTokenUsage:null,toolTokenUsage:t===null?null:{inputTokens:null,outputTokens:null,totalTokens:t},overallPassRate:e.passRate,totalScenarios:e.totalScenarios,totalRuns:e.totalRuns,avgToolCalls:e.avgToolCalls,avgLatency:Math.round(e.avgLatencyMs??0),totalDurationMs:typeof e.totalDurationMs=="number"?Math.max(0,e.totalDurationMs):void 0,totalToolDurationMs:typeof e.totalToolDurationMs=="number"?Math.max(0,e.totalToolDurationMs):void 0,checkCounts:e.checkCounts}}const J$=10080*60*1e3;function Z$(e){return e.length===0?0:e.reduce((t,n)=>t+n,0)/e.length}function eD(e,t=0){const n=Number(e.toFixed(t));return`${n>0?"+":""}${n.toFixed(t)}`}const lge=()=>{const{configs:e}=up(),{source:t}=$n(),[n,r]=h.useState(!0),[s,o]=h.useState([]),[i,c]=h.useState([]),[u,f]=h.useState([]),[m,p]=h.useState("timestamp"),[v,x]=h.useState("desc"),j=M=>{if(m===M){x(q=>q==="asc"?"desc":"asc");return}p(M),x("desc")};h.useEffect(()=>{let M=!0;r(!0);const q=Date.now(),G=q-720*60*60*1e3,O=q-J$,Q=O-J$,B=new Date(G).toISOString(),z=new Date(O).toISOString(),V=new Date(Q).toISOString(),ee=new Date(O-1).toISOString(),ae=new Date(q).toISOString(),ue=async(se,xe)=>t.listRunSummaries?(await t.listRunSummaries({since:se,until:xe})).map(vi):t.listResults({since:se,until:xe});return Promise.all([t.listResults({since:B,until:ae}),ue(z,ae),ue(V,ee)]).then(([se,xe,oe])=>{M&&(o(se),c(xe),f(oe))}).finally(()=>{M&&r(!1)}),()=>{M=!1}},[t]);const y=e.length,b=s.length,S=i.length===0?0:i.reduce((M,q)=>M+q.overallPassRate,0)/i.length,N=i.length===0?0:Math.round(i.reduce((M,q)=>M+q.avgLatency,0)/i.length),C=Z$(u.map(M=>M.overallPassRate)),k=Z$(u.map(M=>M.avgLatency)),A=(S-C)*100,E=N-k,P=u.length>0,T=P?`${eD(A,1)}% from last week`:"No prior-week baseline",$=P?`${eD(E,0)}ms from last week`:"No prior-week baseline",Y=P?A>0?"up":A<0?"down":"neutral":"neutral",H=P?E<0?"up":E>0?"down":"neutral":"neutral",F=h.useMemo(()=>[...s].sort((q,G)=>{let O=0;return m==="timestamp"&&(O=new Date(q.timestamp).getTime()-new Date(G.timestamp).getTime()),m==="passRate"&&(O=q.overallPassRate-G.overallPassRate),m==="latency"&&(O=q.avgLatency-G.avgLatency),m==="scenarios"&&(O=q.totalScenarios-G.totalScenarios),v==="asc"?O:-O}),[s,m,v]),X=F.slice(0,20),L=M=>{const q=M.toolTokenUsage?.totalTokens;return typeof q=="number"?q.toLocaleString():"n/a"},I=[...F].reverse().map(M=>({date:new Date(M.timestamp).toLocaleDateString("en-US",{month:"short",day:"numeric"}),passRate:Math.round(M.overallPassRate*100),latency:M.avgLatency}));return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(gC,{className:"h-6 w-6"}),"Dashboard"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Overview of your MCP evaluation runs"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(Z,{asChild:!0,children:a.jsxs(Et,{to:"/mcp-evaluations/new",children:[a.jsx(yC,{className:"mr-2 h-4 w-4"}),"New MCP Evaluation"]})}),a.jsx(Z,{variant:"outline",asChild:!0,children:a.jsxs(Et,{to:"/run",children:[a.jsx(ks,{className:"mr-2 h-4 w-4"}),"Run Evaluation"]})}),a.jsx(Z,{variant:"outline",asChild:!0,children:a.jsxs(Et,{to:"/results",children:[a.jsx(bl,{className:"mr-2 h-4 w-4"}),"Browse Results"]})})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsx(nr,{title:"MCP Evaluations",value:y,icon:gm,subtitle:`${y} active`}),a.jsx(nr,{title:"Total Runs",value:b,icon:hC,subtitle:"Last 30 days"}),a.jsx(nr,{title:"Pass Rate",value:n?"—":`${Math.round(S*100)}%`,icon:bl,subtitle:n?"Loading...":T,trend:n?"neutral":Y}),a.jsx(nr,{title:"Avg Latency",value:n?"—":`${N}ms`,icon:bC,subtitle:n?"Loading...":$,trend:n?"neutral":H})]}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Pass Rate Trend"})}),a.jsx(Je,{children:a.jsx(hf,{width:"100%",height:200,children:a.jsxs($N,{data:I,children:[a.jsx(_i,{dataKey:"date",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(ki,{domain:[0,100],tick:{fontSize:11},tickLine:!1,axisLine:!1,tickFormatter:M=>`${M}%`}),a.jsx(ra,{formatter:M=>[`${M}%`,"Pass Rate"]}),a.jsx(Al,{type:"monotone",dataKey:"passRate",stroke:"hsl(38, 92%, 50%)",strokeWidth:2,dot:{r:3,fill:"hsl(38, 92%, 50%)"}})]})})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Recent Tool Latency (ms)"})}),a.jsx(Je,{children:a.jsx(hf,{width:"100%",height:200,children:a.jsxs($N,{data:I,children:[a.jsx(_i,{dataKey:"date",tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(ki,{tick:{fontSize:11},tickLine:!1,axisLine:!1}),a.jsx(ra,{formatter:M=>[`${M}ms`,"Latency"]}),a.jsx(Al,{type:"monotone",dataKey:"latency",stroke:"hsl(200, 80%, 50%)",strokeWidth:2,dot:{r:3,fill:"hsl(200, 80%, 50%)"}})]})})})]})]}),a.jsx("div",{className:"grid gap-6",children:a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Recent Runs"})}),a.jsxs(Je,{className:"p-0",children:[a.jsxs(oa,{children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{children:"Run ID"}),a.jsx(ct,{children:"Evaluated"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>j("timestamp"),children:["Timestamp",m==="timestamp"?v==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}):a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-end gap-1 hover:text-foreground",onClick:()=>j("passRate"),children:["Pass Rate",m==="passRate"?v==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}):a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>j("scenarios"),children:["Scenarios",m==="scenarios"?v==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}):a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"})]})}),a.jsx(ct,{className:"text-right",children:"Avg Tools"}),a.jsx(ct,{className:"text-right",children:"Tool Tokens"})]})}),a.jsxs(la,{children:[X.length===0&&a.jsx(Wt,{children:a.jsx(qe,{colSpan:7,className:"py-8 text-center text-sm text-muted-foreground",children:"No runs in the past 30 days."})}),X.map(M=>a.jsxs(Wt,{className:"cursor-pointer",children:[a.jsx(qe,{children:a.jsx(Et,{to:`/results/${M.id}`,className:"font-mono text-xs text-primary hover:underline",children:M.id})}),a.jsx(qe,{className:"text-[11px] text-muted-foreground",children:(()=>{const q=G_(M);return a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Evaluated: ",q.scenarioCount," scenario",q.scenarioCount===1?"":"s"," · ",q.agentCount," agent",q.agentCount===1?"":"s",q.modelSummary?` · ${q.modelSummary}`:""]}),a.jsx("div",{className:"font-mono text-xs text-foreground/80",children:q.scopePreview})]})})()}),a.jsx(qe,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(M.timestamp).toLocaleString()]})}),a.jsx(qe,{className:"text-right",children:a.jsxs("div",{className:"flex flex-col items-end gap-1",children:[a.jsx(Ws,{rate:M.overallPassRate}),a.jsx(e4,{run:M})]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:M.totalScenarios}),a.jsx(qe,{className:"text-right font-mono text-sm",children:M.avgToolCalls.toFixed(0)}),a.jsx(qe,{className:"text-right font-mono text-sm",children:L(M)})]},M.id))]})]}),F.length>20&&a.jsx("div",{className:"border-t p-4 text-center",children:a.jsx(Z,{variant:"outline",asChild:!0,children:a.jsx(Et,{to:"/results",children:"Show more"})})})]})]})})]})};function Y_({value:e,onValueChange:t,placeholder:n="Search...",className:r,inputClassName:s,clearAriaLabel:o="Clear search"}){return a.jsxs("div",{className:Me("relative",r),children:[a.jsx(_t,{value:e,onChange:i=>t(i.target.value),placeholder:n,className:Me("h-9 w-[240px] pr-8",s)}),e&&a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 border border-border/60",onClick:()=>t(""),"aria-label":o,children:a.jsx(ca,{className:"h-4 w-4"})})]})}var cge=h.createContext(void 0);function zu(e){const t=h.useContext(cge);return e||t||"ltr"}var SS="rovingFocusGroup.onEntryFocus",uge={bubbles:!1,cancelable:!0},bp="RovingFocusGroup",[DN,wB,dge]=Qf(bp),[fge,Yv]=kr(bp,[dge]),[pge,hge]=fge(bp),jB=h.forwardRef((e,t)=>a.jsx(DN.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(DN.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(mge,{...e,ref:t})})}));jB.displayName=bp;var mge=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:m=!1,...p}=e,v=h.useRef(null),x=Ot(t,v),j=zu(o),[y,b]=Aa({prop:i,defaultProp:c??null,onChange:u,caller:bp}),[S,N]=h.useState(!1),C=Jn(f),k=wB(n),A=h.useRef(!1),[E,P]=h.useState(0);return h.useEffect(()=>{const T=v.current;if(T)return T.addEventListener(SS,C),()=>T.removeEventListener(SS,C)},[C]),a.jsx(pge,{scope:n,orientation:r,dir:j,loop:s,currentTabStopId:y,onItemFocus:h.useCallback(T=>b(T),[b]),onItemShiftTab:h.useCallback(()=>N(!0),[]),onFocusableItemAdd:h.useCallback(()=>P(T=>T+1),[]),onFocusableItemRemove:h.useCallback(()=>P(T=>T-1),[]),children:a.jsx(lt.div,{tabIndex:S||E===0?-1:0,"data-orientation":r,...p,ref:x,style:{outline:"none",...e.style},onMouseDown:Ue(e.onMouseDown,()=>{A.current=!0}),onFocus:Ue(e.onFocus,T=>{const $=!A.current;if(T.target===T.currentTarget&&$&&!S){const Y=new CustomEvent(SS,uge);if(T.currentTarget.dispatchEvent(Y),!Y.defaultPrevented){const H=k().filter(M=>M.focusable),F=H.find(M=>M.active),X=H.find(M=>M.id===y),I=[F,X,...H].filter(Boolean).map(M=>M.ref.current);CB(I,m)}}A.current=!1}),onBlur:Ue(e.onBlur,()=>N(!1))})})}),SB="RovingFocusGroupItem",NB=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:i,...c}=e,u=fr(),f=o||u,m=hge(SB,n),p=m.currentTabStopId===f,v=wB(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:y}=m;return h.useEffect(()=>{if(r)return x(),()=>j()},[r,x,j]),a.jsx(DN.ItemSlot,{scope:n,id:f,focusable:r,active:s,children:a.jsx(lt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:t,onMouseDown:Ue(e.onMouseDown,b=>{r?m.onItemFocus(f):b.preventDefault()}),onFocus:Ue(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:Ue(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){m.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const S=xge(b,m.orientation,m.dir);if(S!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let C=v().filter(k=>k.focusable).map(k=>k.ref.current);if(S==="last")C.reverse();else if(S==="prev"||S==="next"){S==="prev"&&C.reverse();const k=C.indexOf(b.currentTarget);C=m.loop?yge(C,k+1):C.slice(k+1)}setTimeout(()=>CB(C))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:y!=null}):i})})});NB.displayName=SB;var gge={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function vge(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function xge(e,t,n){const r=vge(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return gge[r]}function CB(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function yge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var _B=jB,kB=NB;function bge(e){const t=wge(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),u=c.find(Sge);if(u){const f=u.props.children,m=c.map(p=>p===u?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function wge(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=Cge(s),c=Nge(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jge=Symbol("radix.slottable");function Sge(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jge}function Nge(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Cge(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 LN=["Enter"," "],_ge=["ArrowDown","PageUp","Home"],AB=["ArrowUp","PageDown","End"],kge=[..._ge,...AB],Age={ltr:[...LN,"ArrowRight"],rtl:[...LN,"ArrowLeft"]},Ege={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wp="Menu",[Hf,Pge,Rge]=Qf(wp),[Gl,EB]=kr(wp,[Rge,Ei,Yv]),Xv=Ei(),PB=Yv(),[Tge,Yl]=Gl(wp),[Oge,jp]=Gl(wp),RB=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:i=!0}=e,c=Xv(t),[u,f]=h.useState(null),m=h.useRef(!1),p=Jn(o),v=zu(s);return h.useEffect(()=>{const x=()=>{m.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>m.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),a.jsx(Kg,{...c,children:a.jsx(Tge,{scope:t,open:n,onOpenChange:p,content:u,onContentChange:f,children:a.jsx(Oge,{scope:t,onClose:h.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:v,modal:i,children:r})})})};RB.displayName=wp;var Mge="MenuAnchor",X_=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Xv(n);return a.jsx(tp,{...s,...r,ref:t})});X_.displayName=Mge;var Q_="MenuPortal",[Ige,TB]=Gl(Q_,{forceMount:void 0}),OB=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Yl(Q_,t);return a.jsx(Ige,{scope:t,forceMount:n,children:a.jsx(ar,{present:n||o.open,children:a.jsx(Fl,{asChild:!0,container:s,children:r})})})};OB.displayName=Q_;var Ka="MenuContent",[$ge,J_]=Gl(Ka),MB=h.forwardRef((e,t)=>{const n=TB(Ka,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Yl(Ka,e.__scopeMenu),i=jp(Ka,e.__scopeMenu);return a.jsx(Hf.Provider,{scope:e.__scopeMenu,children:a.jsx(ar,{present:r||o.open,children:a.jsx(Hf.Slot,{scope:e.__scopeMenu,children:i.modal?a.jsx(Dge,{...s,ref:t}):a.jsx(Lge,{...s,ref:t})})})})}),Dge=h.forwardRef((e,t)=>{const n=Yl(Ka,e.__scopeMenu),r=h.useRef(null),s=Ot(t,r);return h.useEffect(()=>{const o=r.current;if(o)return ov(o)},[]),a.jsx(Z_,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ue(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Lge=h.forwardRef((e,t)=>{const n=Yl(Ka,e.__scopeMenu);return a.jsx(Z_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Fge=bge("MenuContent.ScrollLock"),Z_=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:v,onDismiss:x,disableOutsideScroll:j,...y}=e,b=Yl(Ka,n),S=jp(Ka,n),N=Xv(n),C=PB(n),k=Pge(n),[A,E]=h.useState(null),P=h.useRef(null),T=Ot(t,P,b.onContentChange),$=h.useRef(0),Y=h.useRef(""),H=h.useRef(0),F=h.useRef(null),X=h.useRef("right"),L=h.useRef(0),I=j?op:h.Fragment,M=j?{as:Fge,allowPinchZoom:!0}:void 0,q=O=>{const Q=Y.current+O,B=k().filter(se=>!se.disabled),z=document.activeElement,V=B.find(se=>se.ref.current===z)?.textValue,ee=B.map(se=>se.textValue),ae=Qge(ee,Q,V),ue=B.find(se=>se.textValue===ae)?.ref.current;(function se(xe){Y.current=xe,window.clearTimeout($.current),xe!==""&&($.current=window.setTimeout(()=>se(""),1e3))})(Q),ue&&setTimeout(()=>ue.focus())};h.useEffect(()=>()=>window.clearTimeout($.current),[]),av();const G=h.useCallback(O=>X.current===F.current?.side&&Zge(O,F.current?.area),[]);return a.jsx($ge,{scope:n,searchRef:Y,onItemEnter:h.useCallback(O=>{G(O)&&O.preventDefault()},[G]),onItemLeave:h.useCallback(O=>{G(O)||(P.current?.focus(),E(null))},[G]),onTriggerLeave:h.useCallback(O=>{G(O)&&O.preventDefault()},[G]),pointerGraceTimerRef:H,onPointerGraceIntentChange:h.useCallback(O=>{F.current=O},[]),children:a.jsx(I,{...M,children:a.jsx(sp,{asChild:!0,trapped:s,onMountAutoFocus:Ue(o,O=>{O.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:a.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:v,onDismiss:x,children:a.jsx(_B,{asChild:!0,...C,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:E,onEntryFocus:Ue(u,O=>{S.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Gg,{role:"menu","aria-orientation":"vertical","data-state":XB(b.open),"data-radix-menu-content":"",dir:S.dir,...N,...y,ref:T,style:{outline:"none",...y.style},onKeyDown:Ue(y.onKeyDown,O=>{const B=O.target.closest("[data-radix-menu-content]")===O.currentTarget,z=O.ctrlKey||O.altKey||O.metaKey,V=O.key.length===1;B&&(O.key==="Tab"&&O.preventDefault(),!z&&V&&q(O.key));const ee=P.current;if(O.target!==ee||!kge.includes(O.key))return;O.preventDefault();const ue=k().filter(se=>!se.disabled).map(se=>se.ref.current);AB.includes(O.key)&&ue.reverse(),Yge(ue)}),onBlur:Ue(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout($.current),Y.current="")}),onPointerMove:Ue(e.onPointerMove,Vf(O=>{const Q=O.target,B=L.current!==O.clientX;if(O.currentTarget.contains(Q)&&B){const z=O.clientX>L.current?"right":"left";X.current=z,L.current=O.clientX}}))})})})})})})});MB.displayName=Ka;var zge="MenuGroup",ek=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{role:"group",...r,ref:t})});ek.displayName=zge;var Bge="MenuLabel",IB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{...r,ref:t})});IB.displayName=Bge;var Cg="MenuItem",tD="menu.itemSelect",Qv=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=h.useRef(null),i=jp(Cg,e.__scopeMenu),c=J_(Cg,e.__scopeMenu),u=Ot(t,o),f=h.useRef(!1),m=()=>{const p=o.current;if(!n&&p){const v=new CustomEvent(tD,{bubbles:!0,cancelable:!0});p.addEventListener(tD,x=>r?.(x),{once:!0}),uC(p,v),v.defaultPrevented?f.current=!1:i.onClose()}};return a.jsx($B,{...s,ref:u,disabled:n,onClick:Ue(e.onClick,m),onPointerDown:p=>{e.onPointerDown?.(p),f.current=!0},onPointerUp:Ue(e.onPointerUp,p=>{f.current||p.currentTarget?.click()}),onKeyDown:Ue(e.onKeyDown,p=>{const v=c.searchRef.current!=="";n||v&&p.key===" "||LN.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Qv.displayName=Cg;var $B=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=J_(Cg,n),c=PB(n),u=h.useRef(null),f=Ot(t,u),[m,p]=h.useState(!1),[v,x]=h.useState("");return h.useEffect(()=>{const j=u.current;j&&x((j.textContent??"").trim())},[o.children]),a.jsx(Hf.ItemSlot,{scope:n,disabled:r,textValue:s??v,children:a.jsx(kB,{asChild:!0,...c,focusable:!r,children:a.jsx(lt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:f,onPointerMove:Ue(e.onPointerMove,Vf(j=>{r?i.onItemLeave(j):(i.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ue(e.onPointerLeave,Vf(j=>i.onItemLeave(j))),onFocus:Ue(e.onFocus,()=>p(!0)),onBlur:Ue(e.onBlur,()=>p(!1))})})})}),qge="MenuCheckboxItem",DB=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx(qB,{scope:e.__scopeMenu,checked:n,children:a.jsx(Qv,{role:"menuitemcheckbox","aria-checked":_g(n)?"mixed":n,...s,ref:t,"data-state":nk(n),onSelect:Ue(s.onSelect,()=>r?.(_g(n)?!0:!n),{checkForDefaultPrevented:!1})})})});DB.displayName=qge;var LB="MenuRadioGroup",[Uge,Wge]=Gl(LB,{value:void 0,onValueChange:()=>{}}),FB=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Jn(r);return a.jsx(Uge,{scope:e.__scopeMenu,value:n,onValueChange:o,children:a.jsx(ek,{...s,ref:t})})});FB.displayName=LB;var zB="MenuRadioItem",BB=h.forwardRef((e,t)=>{const{value:n,...r}=e,s=Wge(zB,e.__scopeMenu),o=n===s.value;return a.jsx(qB,{scope:e.__scopeMenu,checked:o,children:a.jsx(Qv,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":nk(o),onSelect:Ue(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});BB.displayName=zB;var tk="MenuItemIndicator",[qB,Hge]=Gl(tk,{checked:!1}),UB=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=Hge(tk,n);return a.jsx(ar,{present:r||_g(o.checked)||o.checked===!0,children:a.jsx(lt.span,{...s,ref:t,"data-state":nk(o.checked)})})});UB.displayName=tk;var Vge="MenuSeparator",WB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(lt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});WB.displayName=Vge;var Kge="MenuArrow",HB=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Xv(n);return a.jsx(Yg,{...s,...r,ref:t})});HB.displayName=Kge;var Gge="MenuSub",[Iwe,VB]=Gl(Gge),Ud="MenuSubTrigger",KB=h.forwardRef((e,t)=>{const n=Yl(Ud,e.__scopeMenu),r=jp(Ud,e.__scopeMenu),s=VB(Ud,e.__scopeMenu),o=J_(Ud,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=o,f={__scopeMenu:e.__scopeMenu},m=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>m,[m]),h.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),u(null)}},[c,u]),a.jsx(X_,{asChild:!0,...f,children:a.jsx($B,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":XB(n.open),...e,ref:Vr(t,s.onTriggerChange),onClick:p=>{e.onClick?.(p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ue(e.onPointerMove,Vf(p=>{o.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Ue(e.onPointerLeave,Vf(p=>{m();const v=n.content?.getBoundingClientRect();if(v){const x=n.content?.dataset.side,j=x==="right",y=j?-5:5,b=v[j?"left":"right"],S=v[j?"right":"left"];o.onPointerGraceIntentChange({area:[{x:p.clientX+y,y:p.clientY},{x:b,y:v.top},{x:S,y:v.top},{x:S,y:v.bottom},{x:b,y:v.bottom}],side:x}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(p),p.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Ue(e.onKeyDown,p=>{const v=o.searchRef.current!=="";e.disabled||v&&p.key===" "||Age[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});KB.displayName=Ud;var GB="MenuSubContent",YB=h.forwardRef((e,t)=>{const n=TB(Ka,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Yl(Ka,e.__scopeMenu),i=jp(Ka,e.__scopeMenu),c=VB(GB,e.__scopeMenu),u=h.useRef(null),f=Ot(t,u);return a.jsx(Hf.Provider,{scope:e.__scopeMenu,children:a.jsx(ar,{present:r||o.open,children:a.jsx(Hf.Slot,{scope:e.__scopeMenu,children:a.jsx(Z_,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:f,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{i.isUsingKeyboardRef.current&&u.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Ue(e.onFocusOutside,m=>{m.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Ue(e.onEscapeKeyDown,m=>{i.onClose(),m.preventDefault()}),onKeyDown:Ue(e.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),v=Ege[i.dir].includes(m.key);p&&v&&(o.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});YB.displayName=GB;function XB(e){return e?"open":"closed"}function _g(e){return e==="indeterminate"}function nk(e){return _g(e)?"indeterminate":e?"checked":"unchecked"}function Yge(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Xge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Qge(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=Xge(e,Math.max(o,0));s.length===1&&(i=i.filter(f=>f!==n));const u=i.find(f=>f.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}function Jge(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const c=t[o],u=t[i],f=c.x,m=c.y,p=u.x,v=u.y;m>r!=v>r&&n<(p-f)*(r-m)/(v-m)+f&&(s=!s)}return s}function Zge(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Jge(n,t)}function Vf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var eve=RB,tve=X_,nve=OB,rve=MB,ave=ek,sve=IB,ove=Qv,ive=DB,lve=FB,cve=BB,uve=UB,dve=WB,fve=HB,pve=KB,hve=YB,Jv="DropdownMenu",[mve]=kr(Jv,[EB]),Gr=EB(),[gve,QB]=mve(Jv),JB=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:i,modal:c=!0}=e,u=Gr(t),f=h.useRef(null),[m,p]=Aa({prop:s,defaultProp:o??!1,onChange:i,caller:Jv});return a.jsx(gve,{scope:t,triggerId:fr(),triggerRef:f,contentId:fr(),open:m,onOpenChange:p,onOpenToggle:h.useCallback(()=>p(v=>!v),[p]),modal:c,children:a.jsx(eve,{...u,open:m,onOpenChange:p,dir:r,modal:c,children:n})})};JB.displayName=Jv;var ZB="DropdownMenuTrigger",e6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=QB(ZB,n),i=Gr(n);return a.jsx(tve,{asChild:!0,...i,children:a.jsx(lt.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Vr(t,o.triggerRef),onPointerDown:Ue(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:Ue(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});e6.displayName=ZB;var vve="DropdownMenuPortal",t6=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Gr(t);return a.jsx(nve,{...r,...n})};t6.displayName=vve;var n6="DropdownMenuContent",r6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=QB(n6,n),o=Gr(n),i=h.useRef(!1);return a.jsx(rve,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:Ue(e.onCloseAutoFocus,c=>{i.current||s.triggerRef.current?.focus(),i.current=!1,c.preventDefault()}),onInteractOutside:Ue(e.onInteractOutside,c=>{const u=c.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0,m=u.button===2||f;(!s.modal||m)&&(i.current=!0)}),style:{...e.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)"}})});r6.displayName=n6;var xve="DropdownMenuGroup",yve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ave,{...s,...r,ref:t})});yve.displayName=xve;var bve="DropdownMenuLabel",a6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(sve,{...s,...r,ref:t})});a6.displayName=bve;var wve="DropdownMenuItem",s6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ove,{...s,...r,ref:t})});s6.displayName=wve;var jve="DropdownMenuCheckboxItem",o6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(ive,{...s,...r,ref:t})});o6.displayName=jve;var Sve="DropdownMenuRadioGroup",Nve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(lve,{...s,...r,ref:t})});Nve.displayName=Sve;var Cve="DropdownMenuRadioItem",i6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(cve,{...s,...r,ref:t})});i6.displayName=Cve;var _ve="DropdownMenuItemIndicator",l6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(uve,{...s,...r,ref:t})});l6.displayName=_ve;var kve="DropdownMenuSeparator",c6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(dve,{...s,...r,ref:t})});c6.displayName=kve;var Ave="DropdownMenuArrow",Eve=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(fve,{...s,...r,ref:t})});Eve.displayName=Ave;var Pve="DropdownMenuSubTrigger",u6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(pve,{...s,...r,ref:t})});u6.displayName=Pve;var Rve="DropdownMenuSubContent",d6=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Gr(n);return a.jsx(hve,{...s,...r,ref:t,style:{...e.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)"}})});d6.displayName=Rve;var Tve=JB,Ove=e6,Mve=t6,f6=r6,p6=a6,h6=s6,m6=o6,g6=i6,v6=l6,x6=c6,y6=u6,b6=d6;const Sp=Tve,Np=Ove,Ive=h.forwardRef(({className:e,inset:t,children:n,...r},s)=>a.jsxs(y6,{ref:s,className:Me("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...r,children:[n,a.jsx(zg,{className:"ml-auto h-4 w-4"})]}));Ive.displayName=y6.displayName;const $ve=h.forwardRef(({className:e,...t},n)=>a.jsx(b6,{ref:n,className:Me("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",e),...t}));$ve.displayName=b6.displayName;const Bu=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(Mve,{children:a.jsx(f6,{ref:r,sideOffset:t,className:Me("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",e),...n})}));Bu.displayName=f6.displayName;const Mr=h.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(h6,{ref:r,className:Me("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n}));Mr.displayName=h6.displayName;const Dve=h.forwardRef(({className:e,children:t,checked:n,...r},s)=>a.jsxs(m6,{ref:s,className:Me("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(v6,{children:a.jsx(Hc,{className:"h-4 w-4"})})}),t]}));Dve.displayName=m6.displayName;const Lve=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(g6,{ref:r,className:Me("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(v6,{children:a.jsx(NW,{className:"h-2 w-2 fill-current"})})}),t]}));Lve.displayName=g6.displayName;const w6=h.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(p6,{ref:r,className:Me("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));w6.displayName=p6.displayName;const j6=h.forwardRef(({className:e,...t},n)=>a.jsx(x6,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));j6.displayName=x6.displayName;function Kf(e,[t,n]){return Math.min(n,Math.max(t,e))}function Fve(e){const t=zve(e),n=h.forwardRef((r,s)=>{const{children:o,...i}=r,c=h.Children.toArray(o),u=c.find(qve);if(u){const f=u.props.children,m=c.map(p=>p===u?h.Children.count(f)>1?h.Children.only(null):h.isValidElement(f)?f.props.children:null:p);return a.jsx(t,{...i,ref:s,children:h.isValidElement(f)?h.cloneElement(f,void 0,m):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function zve(e){const t=h.forwardRef((n,r)=>{const{children:s,...o}=n;if(h.isValidElement(s)){const i=Wve(s),c=Uve(o,s.props);return s.type!==h.Fragment&&(c.ref=r?Vr(r,i):i),h.cloneElement(s,c)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bve=Symbol("radix.slottable");function qve(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Bve}function Uve(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Wve(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 Zv(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Hve=[" ","Enter","ArrowUp","ArrowDown"],Vve=[" ","Enter"],El="Select",[ex,tx,Kve]=Qf(El),[qu]=kr(El,[Kve,Ei]),nx=Ei(),[Gve,Ii]=qu(El),[Yve,Xve]=qu(El),S6=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:i,defaultValue:c,onValueChange:u,dir:f,name:m,autoComplete:p,disabled:v,required:x,form:j}=e,y=nx(t),[b,S]=h.useState(null),[N,C]=h.useState(null),[k,A]=h.useState(!1),E=zu(f),[P,T]=Aa({prop:r,defaultProp:s??!1,onChange:o,caller:El}),[$,Y]=Aa({prop:i,defaultProp:c,onChange:u,caller:El}),H=h.useRef(null),F=b?j||!!b.closest("form"):!0,[X,L]=h.useState(new Set),I=Array.from(X).map(M=>M.props.value).join(";");return a.jsx(Kg,{...y,children:a.jsxs(Gve,{required:x,scope:t,trigger:b,onTriggerChange:S,valueNode:N,onValueNodeChange:C,valueNodeHasChildren:k,onValueNodeHasChildrenChange:A,contentId:fr(),value:$,onValueChange:Y,open:P,onOpenChange:T,dir:E,triggerPointerDownPosRef:H,disabled:v,children:[a.jsx(ex.Provider,{scope:t,children:a.jsx(Yve,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(M=>{L(q=>new Set(q).add(M))},[]),onNativeOptionRemove:h.useCallback(M=>{L(q=>{const G=new Set(q);return G.delete(M),G})},[]),children:n})}),F?a.jsxs(K6,{"aria-hidden":!0,required:x,tabIndex:-1,name:m,autoComplete:p,value:$,onChange:M=>Y(M.target.value),disabled:v,form:j,children:[$===void 0?a.jsx("option",{value:""}):null,Array.from(X)]},I):null]})})};S6.displayName=El;var N6="SelectTrigger",C6=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=nx(n),i=Ii(N6,n),c=i.disabled||r,u=Ot(t,i.onTriggerChange),f=tx(n),m=h.useRef("touch"),[p,v,x]=Y6(y=>{const b=f().filter(C=>!C.disabled),S=b.find(C=>C.value===i.value),N=X6(b,y,S);N!==void 0&&i.onValueChange(N.value)}),j=y=>{c||(i.onOpenChange(!0),x()),y&&(i.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})};return a.jsx(tp,{asChild:!0,...o,children:a.jsx(lt.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":G6(i.value)?"":void 0,...s,ref:u,onClick:Ue(s.onClick,y=>{y.currentTarget.focus(),m.current!=="mouse"&&j(y)}),onPointerDown:Ue(s.onPointerDown,y=>{m.current=y.pointerType;const b=y.target;b.hasPointerCapture(y.pointerId)&&b.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(j(y),y.preventDefault())}),onKeyDown:Ue(s.onKeyDown,y=>{const b=p.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&v(y.key),!(b&&y.key===" ")&&Hve.includes(y.key)&&(j(),y.preventDefault())})})})});C6.displayName=N6;var _6="SelectValue",k6=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:i="",...c}=e,u=Ii(_6,n),{onValueNodeHasChildrenChange:f}=u,m=o!==void 0,p=Ot(t,u.onValueNodeChange);return pr(()=>{f(m)},[f,m]),a.jsx(lt.span,{...c,ref:p,style:{pointerEvents:"none"},children:G6(u.value)?a.jsx(a.Fragment,{children:i}):o})});k6.displayName=_6;var Qve="SelectIcon",A6=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(lt.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});A6.displayName=Qve;var Jve="SelectPortal",E6=e=>a.jsx(Fl,{asChild:!0,...e});E6.displayName=Jve;var Pl="SelectContent",P6=h.forwardRef((e,t)=>{const n=Ii(Pl,e.__scopeSelect),[r,s]=h.useState();if(pr(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?Nu.createPortal(a.jsx(R6,{scope:e.__scopeSelect,children:a.jsx(ex.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),o):null}return a.jsx(T6,{...e,ref:t})});P6.displayName=Pl;var ys=10,[R6,$i]=qu(Pl),Zve="SelectContentImpl",exe=Fve("SelectContent.RemoveScroll"),T6=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:c,sideOffset:u,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:v,collisionPadding:x,sticky:j,hideWhenDetached:y,avoidCollisions:b,...S}=e,N=Ii(Pl,n),[C,k]=h.useState(null),[A,E]=h.useState(null),P=Ot(t,se=>k(se)),[T,$]=h.useState(null),[Y,H]=h.useState(null),F=tx(n),[X,L]=h.useState(!1),I=h.useRef(!1);h.useEffect(()=>{if(C)return ov(C)},[C]),av();const M=h.useCallback(se=>{const[xe,...oe]=F().map(me=>me.ref.current),[de]=oe.slice(-1),De=document.activeElement;for(const me of se)if(me===De||(me?.scrollIntoView({block:"nearest"}),me===xe&&A&&(A.scrollTop=0),me===de&&A&&(A.scrollTop=A.scrollHeight),me?.focus(),document.activeElement!==De))return},[F,A]),q=h.useCallback(()=>M([T,C]),[M,T,C]);h.useEffect(()=>{X&&q()},[X,q]);const{onOpenChange:G,triggerPointerDownPosRef:O}=N;h.useEffect(()=>{if(C){let se={x:0,y:0};const xe=de=>{se={x:Math.abs(Math.round(de.pageX)-(O.current?.x??0)),y:Math.abs(Math.round(de.pageY)-(O.current?.y??0))}},oe=de=>{se.x<=10&&se.y<=10?de.preventDefault():C.contains(de.target)||G(!1),document.removeEventListener("pointermove",xe),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",oe,{capture:!0})}}},[C,G,O]),h.useEffect(()=>{const se=()=>G(!1);return window.addEventListener("blur",se),window.addEventListener("resize",se),()=>{window.removeEventListener("blur",se),window.removeEventListener("resize",se)}},[G]);const[Q,B]=Y6(se=>{const xe=F().filter(De=>!De.disabled),oe=xe.find(De=>De.ref.current===document.activeElement),de=X6(xe,se,oe);de&&setTimeout(()=>de.ref.current.focus())}),z=h.useCallback((se,xe,oe)=>{const de=!I.current&&!oe;(N.value!==void 0&&N.value===xe||de)&&($(se),de&&(I.current=!0))},[N.value]),V=h.useCallback(()=>C?.focus(),[C]),ee=h.useCallback((se,xe,oe)=>{const de=!I.current&&!oe;(N.value!==void 0&&N.value===xe||de)&&H(se)},[N.value]),ae=r==="popper"?FN:O6,ue=ae===FN?{side:c,sideOffset:u,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:v,collisionPadding:x,sticky:j,hideWhenDetached:y,avoidCollisions:b}:{};return a.jsx(R6,{scope:n,content:C,viewport:A,onViewportChange:E,itemRefCallback:z,selectedItem:T,onItemLeave:V,itemTextRefCallback:ee,focusSelectedItem:q,selectedItemText:Y,position:r,isPositioned:X,searchRef:Q,children:a.jsx(op,{as:exe,allowPinchZoom:!0,children:a.jsx(sp,{asChild:!0,trapped:N.open,onMountAutoFocus:se=>{se.preventDefault()},onUnmountAutoFocus:Ue(s,se=>{N.trigger?.focus({preventScroll:!0}),se.preventDefault()}),children:a.jsx(Ll,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:se=>se.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:a.jsx(ae,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:se=>se.preventDefault(),...S,...ue,onPlaced:()=>L(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:Ue(S.onKeyDown,se=>{const xe=se.ctrlKey||se.altKey||se.metaKey;if(se.key==="Tab"&&se.preventDefault(),!xe&&se.key.length===1&&B(se.key),["ArrowUp","ArrowDown","Home","End"].includes(se.key)){let de=F().filter(De=>!De.disabled).map(De=>De.ref.current);if(["ArrowUp","End"].includes(se.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(se.key)){const De=se.target,me=de.indexOf(De);de=de.slice(me+1)}setTimeout(()=>M(de)),se.preventDefault()}})})})})})})});T6.displayName=Zve;var txe="SelectItemAlignedPosition",O6=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=Ii(Pl,n),i=$i(Pl,n),[c,u]=h.useState(null),[f,m]=h.useState(null),p=Ot(t,P=>m(P)),v=tx(n),x=h.useRef(!1),j=h.useRef(!0),{viewport:y,selectedItem:b,selectedItemText:S,focusSelectedItem:N}=i,C=h.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&f&&y&&b&&S){const P=o.trigger.getBoundingClientRect(),T=f.getBoundingClientRect(),$=o.valueNode.getBoundingClientRect(),Y=S.getBoundingClientRect();if(o.dir!=="rtl"){const De=Y.left-T.left,me=$.left-De,ge=P.left-me,we=P.width+ge,at=Math.max(we,T.width),tt=window.innerWidth-ys,it=Kf(me,[ys,Math.max(ys,tt-at)]);c.style.minWidth=we+"px",c.style.left=it+"px"}else{const De=T.right-Y.right,me=window.innerWidth-$.right-De,ge=window.innerWidth-P.right-me,we=P.width+ge,at=Math.max(we,T.width),tt=window.innerWidth-ys,it=Kf(me,[ys,Math.max(ys,tt-at)]);c.style.minWidth=we+"px",c.style.right=it+"px"}const H=v(),F=window.innerHeight-ys*2,X=y.scrollHeight,L=window.getComputedStyle(f),I=parseInt(L.borderTopWidth,10),M=parseInt(L.paddingTop,10),q=parseInt(L.borderBottomWidth,10),G=parseInt(L.paddingBottom,10),O=I+M+X+G+q,Q=Math.min(b.offsetHeight*5,O),B=window.getComputedStyle(y),z=parseInt(B.paddingTop,10),V=parseInt(B.paddingBottom,10),ee=P.top+P.height/2-ys,ae=F-ee,ue=b.offsetHeight/2,se=b.offsetTop+ue,xe=I+M+se,oe=O-xe;if(xe<=ee){const De=H.length>0&&b===H[H.length-1].ref.current;c.style.bottom="0px";const me=f.clientHeight-y.offsetTop-y.offsetHeight,ge=Math.max(ae,ue+(De?V:0)+me+q),we=xe+ge;c.style.height=we+"px"}else{const De=H.length>0&&b===H[0].ref.current;c.style.top="0px";const ge=Math.max(ee,I+y.offsetTop+(De?z:0)+ue)+oe;c.style.height=ge+"px",y.scrollTop=xe-ee+y.offsetTop}c.style.margin=`${ys}px 0`,c.style.minHeight=Q+"px",c.style.maxHeight=F+"px",r?.(),requestAnimationFrame(()=>x.current=!0)}},[v,o.trigger,o.valueNode,c,f,y,b,S,o.dir,r]);pr(()=>C(),[C]);const[k,A]=h.useState();pr(()=>{f&&A(window.getComputedStyle(f).zIndex)},[f]);const E=h.useCallback(P=>{P&&j.current===!0&&(C(),N?.(),j.current=!1)},[C,N]);return a.jsx(rxe,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:x,onScrollButtonChange:E,children:a.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:a.jsx(lt.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});O6.displayName=txe;var nxe="SelectPopperPosition",FN=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=ys,...o}=e,i=nx(n);return a.jsx(Gg,{...i,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});FN.displayName=nxe;var[rxe,rk]=qu(Pl,{}),zN="SelectViewport",M6=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=$i(zN,n),i=rk(zN,n),c=Ot(t,o.onViewportChange),u=h.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(ex.Slot,{scope:n,children:a.jsx(lt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Ue(s.onScroll,f=>{const m=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:v}=i;if(v?.current&&p){const x=Math.abs(u.current-m.scrollTop);if(x>0){const j=window.innerHeight-ys*2,y=parseFloat(p.style.minHeight),b=parseFloat(p.style.height),S=Math.max(y,b);if(S<j){const N=S+x,C=Math.min(j,N),k=N-C;p.style.height=C+"px",p.style.bottom==="0px"&&(m.scrollTop=k>0?k:0,p.style.justifyContent="flex-end")}}}u.current=m.scrollTop})})})]})});M6.displayName=zN;var I6="SelectGroup",[axe,sxe]=qu(I6),oxe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=fr();return a.jsx(axe,{scope:n,id:s,children:a.jsx(lt.div,{role:"group","aria-labelledby":s,...r,ref:t})})});oxe.displayName=I6;var $6="SelectLabel",D6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=sxe($6,n);return a.jsx(lt.div,{id:s.id,...r,ref:t})});D6.displayName=$6;var kg="SelectItem",[ixe,L6]=qu(kg),F6=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...i}=e,c=Ii(kg,n),u=$i(kg,n),f=c.value===r,[m,p]=h.useState(o??""),[v,x]=h.useState(!1),j=Ot(t,N=>u.itemRefCallback?.(N,r,s)),y=fr(),b=h.useRef("touch"),S=()=>{s||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(ixe,{scope:n,value:r,disabled:s,textId:y,isSelected:f,onItemTextChange:h.useCallback(N=>{p(C=>C||(N?.textContent??"").trim())},[]),children:a.jsx(ex.ItemSlot,{scope:n,value:r,disabled:s,textValue:m,children:a.jsx(lt.div,{role:"option","aria-labelledby":y,"data-highlighted":v?"":void 0,"aria-selected":f&&v,"data-state":f?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:j,onFocus:Ue(i.onFocus,()=>x(!0)),onBlur:Ue(i.onBlur,()=>x(!1)),onClick:Ue(i.onClick,()=>{b.current!=="mouse"&&S()}),onPointerUp:Ue(i.onPointerUp,()=>{b.current==="mouse"&&S()}),onPointerDown:Ue(i.onPointerDown,N=>{b.current=N.pointerType}),onPointerMove:Ue(i.onPointerMove,N=>{b.current=N.pointerType,s?u.onItemLeave?.():b.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ue(i.onPointerLeave,N=>{N.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Ue(i.onKeyDown,N=>{u.searchRef?.current!==""&&N.key===" "||(Vve.includes(N.key)&&S(),N.key===" "&&N.preventDefault())})})})})});F6.displayName=kg;var Wd="SelectItemText",z6=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,i=Ii(Wd,n),c=$i(Wd,n),u=L6(Wd,n),f=Xve(Wd,n),[m,p]=h.useState(null),v=Ot(t,S=>p(S),u.onItemTextChange,S=>c.itemTextRefCallback?.(S,u.value,u.disabled)),x=m?.textContent,j=h.useMemo(()=>a.jsx("option",{value:u.value,disabled:u.disabled,children:x},u.value),[u.disabled,u.value,x]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=f;return pr(()=>(y(j),()=>b(j)),[y,b,j]),a.jsxs(a.Fragment,{children:[a.jsx(lt.span,{id:u.textId,...o,ref:v}),u.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Nu.createPortal(o.children,i.valueNode):null]})});z6.displayName=Wd;var B6="SelectItemIndicator",q6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return L6(B6,n).isSelected?a.jsx(lt.span,{"aria-hidden":!0,...r,ref:t}):null});q6.displayName=B6;var BN="SelectScrollUpButton",U6=h.forwardRef((e,t)=>{const n=$i(BN,e.__scopeSelect),r=rk(BN,e.__scopeSelect),[s,o]=h.useState(!1),i=Ot(t,r.onScrollButtonChange);return pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=u.scrollTop>0;o(f)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?a.jsx(H6,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});U6.displayName=BN;var qN="SelectScrollDownButton",W6=h.forwardRef((e,t)=>{const n=$i(qN,e.__scopeSelect),r=rk(qN,e.__scopeSelect),[s,o]=h.useState(!1),i=Ot(t,r.onScrollButtonChange);return pr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=u.scrollHeight-u.clientHeight,m=Math.ceil(u.scrollTop)<f;o(m)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?a.jsx(H6,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});W6.displayName=qN;var H6=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=$i("SelectScrollButton",n),i=h.useRef(null),c=tx(n),u=h.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>u(),[u]),pr(()=>{c().find(m=>m.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),a.jsx(lt.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Ue(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:Ue(s.onPointerMove,()=>{o.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:Ue(s.onPointerLeave,()=>{u()})})}),lxe="SelectSeparator",V6=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(lt.div,{"aria-hidden":!0,...r,ref:t})});V6.displayName=lxe;var UN="SelectArrow",cxe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=nx(n),o=Ii(UN,n),i=$i(UN,n);return o.open&&i.position==="popper"?a.jsx(Yg,{...s,...r,ref:t}):null});cxe.displayName=UN;var uxe="SelectBubbleInput",K6=h.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=h.useRef(null),o=Ot(r,s),i=Zv(t);return h.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(u,"value").set;if(i!==t&&m){const p=new Event("change",{bubbles:!0});m.call(c,t),c.dispatchEvent(p)}},[i,t]),a.jsx(lt.select,{...n,style:{...JD,...n.style},ref:o,defaultValue:t})});K6.displayName=uxe;function G6(e){return e===""||e===void 0}function Y6(e){const t=Jn(e),n=h.useRef(""),r=h.useRef(0),s=h.useCallback(i=>{const c=n.current+i;t(c),(function u(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[t]),o=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function X6(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=dxe(e,Math.max(o,0));s.length===1&&(i=i.filter(f=>f!==n));const u=i.find(f=>f.textValue.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}function dxe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var fxe=S6,Q6=C6,pxe=k6,hxe=A6,mxe=E6,J6=P6,gxe=M6,Z6=D6,e8=F6,vxe=z6,xxe=q6,t8=U6,n8=W6,r8=V6;const Mn=fxe,In=pxe,_n=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Q6,{ref:r,className:Me("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,a.jsx(hxe,{asChild:!0,children:a.jsx(Jt,{className:"h-4 w-4 opacity-50"})})]}));_n.displayName=Q6.displayName;const a8=h.forwardRef(({className:e,...t},n)=>a.jsx(t8,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(_s,{className:"h-4 w-4"})}));a8.displayName=t8.displayName;const s8=h.forwardRef(({className:e,...t},n)=>a.jsx(n8,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Jt,{className:"h-4 w-4"})}));s8.displayName=n8.displayName;const kn=h.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(mxe,{children:a.jsxs(J6,{ref:s,className:Me("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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",n==="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",e),position:n,...r,children:[a.jsx(a8,{}),a.jsx(gxe,{className:Me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(s8,{})]})}));kn.displayName=J6.displayName;const yxe=h.forwardRef(({className:e,...t},n)=>a.jsx(Z6,{ref:n,className:Me("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));yxe.displayName=Z6.displayName;const ut=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(e8,{ref:r,className:Me("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(xxe,{children:a.jsx(Hc,{className:"h-4 w-4"})})}),a.jsx(vxe,{children:t})]}));ut.displayName=e8.displayName;const bxe=h.forwardRef(({className:e,...t},n)=>a.jsx(r8,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));bxe.displayName=r8.displayName;function WN(e){const n=(e.agentEntries&&e.agentEntries.length>0?e.agentEntries:e.agents.map(s=>({kind:"inline",agent:s}))).map(s=>s.kind==="inline"?s.agent.id:s.ref).map(s=>s.trim()).filter(Boolean),r=(e.runDefaults?.selectedAgentNames??[]).filter(s=>n.includes(s));return r.length>0?r:n}function pm(e){return e.relativePath?.trim()||e.sourcePath?.trim()||void 0}const hi=e=>e.configName?.trim()||e.name,wxe="(root)",o8="__ROOT__",nD="mcplab.configurations.collapsedSuites",NS=e=>e.suitePath&&e.suitePath.trim().length>0?e.suitePath.trim():null,nl=e=>e??wxe,CS=e=>e===null?o8:`suite:${e}`,jxe=e=>e===o8?null:e.startsWith("suite:")?e.slice(6):null,Sxe=(e,t)=>t===null?e===null:e===null?!1:e===t||e.startsWith(`${t}/`),Nxe=e=>{for(const t of e){const n=t.scenarioEntries??[];for(const s of n){if(s.kind==="inline"&&s.scenario?.id)return String(s.scenario.id);if(s.kind==="referenced"&&s.ref)return String(s.ref)}const r=t.scenarios??[];for(const s of r)if(s?.id)return String(s.id)}return null},Cxe=e=>Nxe([e]),_xe=e=>{const t=Cxe(e);return t?{href:`/results?scenario=${encodeURIComponent(t)}`,tooltipLabel:`Open results filtered by scenario ${t}`}:{href:"/results",tooltipLabel:"Open results"}},rD=["bg-red-400","bg-red-500","bg-orange-400","bg-orange-500","bg-amber-400","bg-amber-500","bg-yellow-400","bg-yellow-500","bg-lime-400","bg-lime-500","bg-green-400","bg-green-500","bg-emerald-400","bg-emerald-500","bg-teal-400","bg-teal-500","bg-cyan-400","bg-cyan-500","bg-sky-400","bg-sky-500","bg-blue-400","bg-blue-500","bg-indigo-400","bg-indigo-500","bg-violet-400","bg-violet-500","bg-purple-400","bg-purple-500","bg-fuchsia-400","bg-fuchsia-500","bg-pink-400","bg-pink-500","bg-rose-400","bg-rose-500"];function kxe(e){if(e===null)return"bg-slate-400";const t=e.split("").reduce((n,r)=>(n+r.charCodeAt(0))%rD.length,0);return rD[t]??"bg-slate-400"}const Axe=()=>{const{configs:e,deleteConfig:t,cloneConfig:n,loading:r,reload:s}=up(),{source:o}=$n(),i=is(),[c,u]=h.useState("name"),[f,m]=h.useState("asc"),[p,v]=h.useState(""),[x,j]=h.useState("all"),[y,b]=h.useState(()=>{try{const V=window.localStorage.getItem(nD);if(!V)return new Set;const ee=JSON.parse(V);return Array.isArray(ee)?new Set(ee.filter(ae=>typeof ae=="string")):new Set}catch(V){return console.warn("Failed to restore collapsed suites from localStorage",V),new Set}}),[S,N]=h.useState(new Set),[C,k]=h.useState(new Set),[A,E]=h.useState(new Set),[P,T]=h.useState({}),$=p.trim().toLowerCase(),Y=V=>{if(c===V){m(ee=>ee==="asc"?"desc":"asc");return}u(V),m(V==="updatedAt"?"desc":"asc")};h.useEffect(()=>{s();const V=()=>{s()};return window.addEventListener("focus",V),()=>{window.removeEventListener("focus",V)}},[s]),h.useEffect(()=>{let V=!1;return(async()=>{try{if(o.getLatestPassRatesByConfigIds){const ae=await o.getLatestPassRatesByConfigIds({lastDays:365,configs:e.map(ue=>({id:ue.id,sourcePath:ue.sourcePath,relativePath:ue.relativePath,configHash:ue.configHash}))});V||T(ae);return}T({})}catch{V||T({})}})(),()=>{V=!0}},[e,o]);const H=async(V,ee)=>{await t(V),$e({title:"Deleted",description:`"${ee}" has been removed.`})},F=async V=>{const ee=await n(V);$e({title:"Cloned",description:`Created "${hi(ee)}".`}),i(`/mcp-evaluations/${ee.id}`)},X=V=>V.agentEntries?.length??V.agents?.length??0,L=V=>V.scenarioEntries?.length??V.scenarios?.length??0,I=h.useMemo(()=>{const V=new Set;for(const ee of e){const ae=NS(ee);if(V.add(ae),!ae)continue;const ue=ae.split("/").filter(Boolean);for(let se=1;se<ue.length;se+=1)V.add(ue.slice(0,se).join("/"))}return Array.from(V).sort((ee,ae)=>nl(ee).localeCompare(nl(ae)))},[e]),M=h.useMemo(()=>e.filter(V=>{const ee=NS(V),ae=x==="all"?void 0:jxe(x),ue=nl(ee);return ae!==void 0&&!Sxe(ee,ae)?!1:$.length===0?!0:[hi(V),V.id,V.description??"",V.loadError??"",ue,V.relativePath??""].join(" ").toLowerCase().includes($)}),[e,$,x]),q=h.useMemo(()=>[...M].sort((ee,ae)=>{let ue=0;return c==="name"&&(ue=hi(ee).localeCompare(hi(ae))),c==="scenarios"&&(ue=L(ee)-L(ae)),c==="agents"&&(ue=X(ee)-X(ae)),c==="updatedAt"&&(ue=new Date(ee.updatedAt).getTime()-new Date(ae.updatedAt).getTime()),f==="asc"?ue:-ue}),[M,c,f]),G=V=>c!==V?a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"}):f==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}),O=V=>{b(ee=>{const ae=new Set(ee);return ae.has(V)?ae.delete(V):ae.add(V),ae})},Q=async(V,ee,ae)=>{if(C.has(V))return;const ue=e.find(xe=>xe.id===V),se=ue?WN(ue):[];k(xe=>new Set(xe).add(V));try{await o.startRun({configPath:ee,runsPerScenario:1,...se.length>0?{agents:se}:{}}),N(xe=>new Set(xe).add(V)),window.setTimeout(()=>{N(xe=>{const oe=new Set(xe);return oe.delete(V),oe})},2e3),$e({title:"Queued",description:`"${ae}" added to run queue.`})}catch(xe){$e({title:"Could not queue evaluation",description:xe instanceof Error?xe.message:String(xe),variant:"destructive"})}finally{k(xe=>{const oe=new Set(xe);return oe.delete(V),oe})}};h.useEffect(()=>{try{window.localStorage.setItem(nD,JSON.stringify(Array.from(y)))}catch(V){console.warn("Failed to persist collapsed suites to localStorage (quota/private mode?)",V)}},[y]);const B=async(V,ee,ae)=>{if(!A.has(V)){E(ue=>new Set(ue).add(V));try{const ue=ae.filter(me=>typeof me.sourcePath=="string"&&me.sourcePath.trim().length>0);if(ue.length===0){$e({title:"No runnable evaluations",description:`Suite "${ee}" has no evaluation files with a source path.`,variant:"destructive"});return}const se=await Promise.allSettled(ue.map(me=>{const ge=WN(me);return o.startRun({configPath:String(me.sourcePath),runsPerScenario:1,...ge.length>0?{agents:ge}:{}})})),xe=se.filter(me=>me.status==="fulfilled").length,oe=se.length-xe,de=se.find(me=>me.status==="rejected"),De=de?de.reason instanceof Error?de.reason.message:String(de.reason):void 0;$e({title:oe===0?"Suite queued":"Suite queued with errors",description:oe===0?`Queued ${xe} evaluation${xe===1?"":"s"} for suite "${ee}".`:`Queued ${xe}/${ue.length} evaluations for suite "${ee}" (${oe} failed${De?`: ${De}`:""}).`,variant:oe===0?"default":"destructive"})}catch(ue){$e({title:"Could not queue suite",description:ue instanceof Error?ue.message:String(ue),variant:"destructive"})}finally{E(ue=>{const se=new Set(ue);return se.delete(V),se})}}},z=h.useMemo(()=>{const V=new Map;for(const ee of q){const ae=NS(ee),ue=V.get(ae);ue?ue.push(ee):V.set(ae,[ee])}return Array.from(V.entries()).sort((ee,ae)=>nl(ee[0]).localeCompare(nl(ae[0])))},[q]);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(N5,{className:"h-6 w-6"}),"MCP Evaluations"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage your MCP evaluation suites"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Y_,{value:p,onValueChange:v,placeholder:"Search evaluations..."}),a.jsxs(Mn,{value:x,onValueChange:j,children:[a.jsx(_n,{className:"h-9 w-[200px]",children:a.jsx(In,{placeholder:"All suites"})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"all",children:"All suites"}),I.map(V=>a.jsx(ut,{value:CS(V),children:nl(V)},CS(V)))]})]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{s()},children:[a.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Refresh"]}),a.jsxs(Z,{variant:"outline",size:"sm",children:[a.jsx(FW,{className:"mr-2 h-4 w-4"}),"Import YAML"]}),a.jsx(Z,{size:"sm",asChild:!0,children:a.jsxs(Et,{to:"/mcp-evaluations/new",children:[a.jsx(To,{className:"mr-2 h-4 w-4"}),"Create New"]})})]})]}),a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(oa,{children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Y("name"),children:["Name",G("name")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Y("scenarios"),children:["Scenarios",G("scenarios")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Y("agents"),children:["Agents",G("agents")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>Y("updatedAt"),children:["Last Updated",G("updatedAt")]})}),a.jsx(ct,{className:"text-right",children:"Last Run"}),a.jsx(ct,{className:"w-[220px] text-right"})]})}),a.jsxs(la,{children:[z.map(([V,ee])=>{const ae=nl(V),ue=CS(V),se=y.has(ue),xe=A.has(ue);return a.jsxs(h.Fragment,{children:[a.jsx(Wt,{className:"bg-muted/40 hover:bg-muted/40",children:a.jsx(qe,{colSpan:6,className:"py-2",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("button",{type:"button",className:"inline-flex h-6 items-center gap-2 text-xs leading-none hover:text-foreground",onClick:()=>O(ue),"aria-expanded":!se,"aria-label":`${se?"Expand":"Collapse"} suite ${ae}`,children:[a.jsx(zg,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform ${se?"":"rotate-90"}`,"aria-hidden":"true"}),a.jsx("span",{className:`h-2 w-2 rounded-full ${kxe(V)}`,"aria-hidden":"true"}),V===null?a.jsx(EW,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":"true"}):a.jsx(kW,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":"true"}),a.jsx("span",{className:"font-medium",children:ae}),a.jsxs("span",{className:"text-muted-foreground",children:["(",ee.length,")"]})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:xe,onClick:()=>{B(ue,ae,ee)},children:[a.jsx(ks,{className:"mr-1 h-3.5 w-3.5"}),xe?"Queueing...":"Run Suite"]})]})})},`suite-${ue}`),!se&&ee.map(oe=>{const de=_xe(oe),De=pm(oe);return a.jsxs(Wt,{children:[a.jsx(qe,{children:a.jsxs("div",{children:[a.jsx(Et,{to:`/mcp-evaluations/${oe.id}`,className:"font-medium text-sm hover:text-primary",children:hi(oe)}),oe.loadError&&a.jsxs(et,{variant:"destructive",className:"ml-2 align-middle text-[10px]",children:[a.jsx(sm,{className:"mr-1 h-3 w-3"}),"Broken"]}),De&&a.jsx("div",{className:"mt-0.5",children:a.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:De})}),oe.loadError&&a.jsx("p",{className:"text-xs text-destructive mt-0.5 break-all",children:oe.loadError})]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:L(oe)}),a.jsx(qe,{className:"text-right font-mono text-sm",children:X(oe)}),a.jsx(qe,{className:"text-right text-xs text-muted-foreground",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(oe.updatedAt).toLocaleDateString()]})}),a.jsx(qe,{className:"text-right",children:typeof P[oe.id]=="number"?a.jsx("div",{className:"inline-flex justify-end",children:a.jsx(Ws,{rate:P[oe.id]})}):""}),a.jsx(qe,{className:"w-[220px] whitespace-nowrap",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Bg,{className:"h-4 w-4"})})}),a.jsxs(Bu,{align:"end",children:[a.jsxs(Mr,{onClick:()=>i(`/mcp-evaluations/${oe.id}`),children:[a.jsx(Zf,{className:"mr-2 h-3.5 w-3.5"}),"Edit"]}),a.jsxs(Mr,{onClick:()=>{F(oe.id)},children:[a.jsx(Hr,{className:"mr-2 h-3.5 w-3.5"}),"Clone"]}),a.jsxs(Mr,{className:"text-destructive",onClick:()=>{H(oe.id,hi(oe))},children:[a.jsx(Xa,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]}),a.jsx(Js,{children:a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsx(Z,{size:"icon",variant:"outline",className:"h-8 w-8",asChild:!0,"aria-label":de.tooltipLabel,children:a.jsxs(Et,{to:de.href,children:[a.jsx(bl,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"sr-only",children:de.tooltipLabel})]})})}),a.jsx(Rs,{children:de.tooltipLabel})]})}),a.jsx(Js,{children:a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsx(Z,{size:"sm",variant:"outline",className:`h-8 px-2 text-xs ${S.has(oe.id)?"border-green-600 bg-green-600 text-white hover:bg-green-700 hover:text-white":""}`,disabled:C.has(oe.id)||!oe.sourcePath,onClick:()=>oe.sourcePath&&void Q(oe.id,oe.sourcePath,hi(oe)),"aria-label":`Queue ${hi(oe)}`,children:S.has(oe.id)?"Queued":C.has(oe.id)?"Queueing...":a.jsxs(a.Fragment,{children:[a.jsx(TW,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"sr-only",children:"Queue evaluation"})]})})}),a.jsx(Rs,{children:"Queue evaluation run"})]})}),a.jsx(Z,{size:"sm",variant:"outline",asChild:!0,children:a.jsxs(Et,{to:`/run?configId=${encodeURIComponent(oe.id)}`,children:[a.jsx(ks,{className:"h-3.5 w-3.5"}),"Run"]})})]})})]},oe.id)})]},`suite-group-${ue}`)}),!r&&e.length===0&&a.jsx(Wt,{children:a.jsx(qe,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"No MCP evaluations yet. Create your first one to get started."})}),!r&&e.length>0&&q.length===0&&a.jsx(Wt,{children:a.jsx(qe,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"No MCP evaluations match this filter."})}),r&&a.jsx(Wt,{children:a.jsx(qe,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:"Loading MCP evaluations..."})})]})]})})})]})};var Exe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pxe=Exe.reduce((e,t)=>{const n=rv(`Primitive.${t}`),r=h.forwardRef((s,o)=>{const{asChild:i,...c}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Rxe="Label",i8=h.forwardRef((e,t)=>a.jsx(Pxe.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));i8.displayName=Rxe;var l8=i8;const Txe=zl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=h.forwardRef(({className:e,...t},n)=>a.jsx(l8,{ref:n,className:Me(Txe(),e),...t}));We.displayName=l8.displayName;const Ts=h.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:Me("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background 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",e),ref:n,...t}));Ts.displayName="Textarea";var rx="Tabs",[Oxe]=kr(rx,[Yv]),c8=Yv(),[Mxe,ak]=Oxe(rx),u8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:c,activationMode:u="automatic",...f}=e,m=zu(c),[p,v]=Aa({prop:r,onChange:s,defaultProp:o??"",caller:rx});return a.jsx(Mxe,{scope:n,baseId:fr(),value:p,onValueChange:v,orientation:i,dir:m,activationMode:u,children:a.jsx(lt.div,{dir:m,"data-orientation":i,...f,ref:t})})});u8.displayName=rx;var d8="TabsList",f8=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=ak(d8,n),i=c8(n);return a.jsx(_B,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(lt.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});f8.displayName=d8;var p8="TabsTrigger",h8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=ak(p8,n),c=c8(n),u=v8(i.baseId,r),f=x8(i.baseId,r),m=r===i.value;return a.jsx(kB,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(lt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":f,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:u,...o,ref:t,onMouseDown:Ue(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:Ue(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:Ue(e.onFocus,()=>{const p=i.activationMode!=="manual";!m&&!s&&p&&i.onValueChange(r)})})})});h8.displayName=p8;var m8="TabsContent",g8=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,c=ak(m8,n),u=v8(c.baseId,r),f=x8(c.baseId,r),m=r===c.value,p=h.useRef(m);return h.useEffect(()=>{const v=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(v)},[]),a.jsx(ar,{present:s||m,children:({present:v})=>a.jsx(lt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!v,id:f,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:v&&o})})});g8.displayName=m8;function v8(e,t){return`${e}-trigger-${t}`}function x8(e,t){return`${e}-content-${t}`}var Ixe=u8,y8=f8,b8=h8,w8=g8;const ax=Ixe,Cp=h.forwardRef(({className:e,...t},n)=>a.jsx(y8,{ref:n,className:Me("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Cp.displayName=y8.displayName;const Xs=h.forwardRef(({className:e,...t},n)=>a.jsx(b8,{ref:n,className:Me("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));Xs.displayName=b8.displayName;const Gf=h.forwardRef(({className:e,...t},n)=>a.jsx(w8,{ref:n,className:Me("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Gf.displayName=w8.displayName;const $xe={openai:"OpenAI",anthropic:"Anthropic",azure:"Azure OpenAI",azure_openai:"Azure OpenAI",google:"Google"};function Yf(e){return $xe[e]??e}const aD={openai:"bg-emerald-100 text-emerald-800",anthropic:"bg-orange-100 text-orange-800",azure:"bg-blue-100 text-blue-800",azure_openai:"bg-blue-100 text-blue-800",google:"bg-yellow-100 text-yellow-800",custom:"bg-gray-100 text-gray-800"};function j8({provider:e}){return a.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${aD[e]??aD.custom}`,children:Yf(e)})}var sx="Checkbox",[Dxe]=kr(sx),[Lxe,sk]=Dxe(sx);function Fxe(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:o,form:i,name:c,onCheckedChange:u,required:f,value:m="on",internal_do_not_use_render:p}=e,[v,x]=Aa({prop:n,defaultProp:s??!1,onChange:u,caller:sx}),[j,y]=h.useState(null),[b,S]=h.useState(null),N=h.useRef(!1),C=j?!!i||!!j.closest("form"):!0,k={checked:v,disabled:o,setChecked:x,control:j,setControl:y,name:c,form:i,value:m,hasConsumerStoppedPropagationRef:N,required:f,defaultChecked:bi(s)?!1:s,isFormControl:C,bubbleInput:b,setBubbleInput:S};return a.jsx(Lxe,{scope:t,...k,children:zxe(p)?p(k):r})}var S8="CheckboxTrigger",N8=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:o,value:i,disabled:c,checked:u,required:f,setControl:m,setChecked:p,hasConsumerStoppedPropagationRef:v,isFormControl:x,bubbleInput:j}=sk(S8,e),y=Ot(s,m),b=h.useRef(u);return h.useEffect(()=>{const S=o?.form;if(S){const N=()=>p(b.current);return S.addEventListener("reset",N),()=>S.removeEventListener("reset",N)}},[o,p]),a.jsx(lt.button,{type:"button",role:"checkbox","aria-checked":bi(u)?"mixed":u,"aria-required":f,"data-state":E8(u),"data-disabled":c?"":void 0,disabled:c,value:i,...r,ref:y,onKeyDown:Ue(t,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Ue(n,S=>{p(N=>bi(N)?!0:!N),j&&x&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})});N8.displayName=S8;var ok=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:o,required:i,disabled:c,value:u,onCheckedChange:f,form:m,...p}=e;return a.jsx(Fxe,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:c,required:i,onCheckedChange:f,name:r,form:m,value:u,internal_do_not_use_render:({isFormControl:v})=>a.jsxs(a.Fragment,{children:[a.jsx(N8,{...p,ref:t,__scopeCheckbox:n}),v&&a.jsx(A8,{__scopeCheckbox:n})]})})});ok.displayName=sx;var C8="CheckboxIndicator",_8=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=sk(C8,n);return a.jsx(ar,{present:r||bi(o.checked)||o.checked===!0,children:a.jsx(lt.span,{"data-state":E8(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});_8.displayName=C8;var k8="CheckboxBubbleInput",A8=h.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:c,disabled:u,name:f,value:m,form:p,bubbleInput:v,setBubbleInput:x}=sk(k8,e),j=Ot(n,x),y=Zv(o),b=Vg(r);h.useEffect(()=>{const N=v;if(!N)return;const C=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(C,"checked").set,E=!s.current;if(y!==o&&A){const P=new Event("click",{bubbles:E});N.indeterminate=bi(o),A.call(N,bi(o)?!1:o),N.dispatchEvent(P)}},[v,y,o,s]);const S=h.useRef(bi(o)?!1:o);return a.jsx(lt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??S.current,required:c,disabled:u,name:f,value:m,form:p,...t,tabIndex:-1,ref:j,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});A8.displayName=k8;function zxe(e){return typeof e=="function"}function bi(e){return e==="indeterminate"}function E8(e){return bi(e)?"indeterminate":e?"checked":"unchecked"}const br=h.forwardRef(({className:e,...t},n)=>a.jsx(ok,{ref:n,className:Me("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-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",e),...t,children:a.jsx(_8,{className:Me("flex items-center justify-center text-current"),children:a.jsx(Hc,{className:"h-4 w-4"})})}));br.displayName=ok.displayName;var ox="Collapsible",[Bxe]=kr(ox),[qxe,ik]=Bxe(ox),P8=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...c}=e,[u,f]=Aa({prop:r,defaultProp:s??!1,onChange:i,caller:ox});return a.jsx(qxe,{scope:n,disabled:o,contentId:fr(),open:u,onOpenToggle:h.useCallback(()=>f(m=>!m),[f]),children:a.jsx(lt.div,{"data-state":ck(u),"data-disabled":o?"":void 0,...c,ref:t})})});P8.displayName=ox;var R8="CollapsibleTrigger",T8=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=ik(R8,n);return a.jsx(lt.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":ck(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:Ue(e.onClick,s.onOpenToggle)})});T8.displayName=R8;var lk="CollapsibleContent",O8=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=ik(lk,e.__scopeCollapsible);return a.jsx(ar,{present:n||s.open,children:({present:o})=>a.jsx(Uxe,{...r,ref:t,present:o})})});O8.displayName=lk;var Uxe=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,i=ik(lk,n),[c,u]=h.useState(r),f=h.useRef(null),m=Ot(t,f),p=h.useRef(0),v=p.current,x=h.useRef(0),j=x.current,y=i.open||c,b=h.useRef(y),S=h.useRef(void 0);return h.useEffect(()=>{const N=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(N)},[]),pr(()=>{const N=f.current;if(N){S.current=S.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const C=N.getBoundingClientRect();p.current=C.height,x.current=C.width,b.current||(N.style.transitionDuration=S.current.transitionDuration,N.style.animationName=S.current.animationName),u(r)}},[i.open,r]),a.jsx(lt.div,{"data-state":ck(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...o,ref:m,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":j?`${j}px`:void 0,...e.style},children:y&&s})});function ck(e){return e?"open":"closed"}var Wxe=P8;const Ss=Wxe,Ba=T8,Ns=O8;function Hxe(e){return e.length>0?`Tool sequence · ${e.join(" -> ")}`:"Tool sequence"}function Ga({text:e,variant:t="assistant",className:n}){const r=Vxe(e);return a.jsx("div",{className:Me("space-y-2",t==="system"&&"text-xs",n),children:r.map((s,o)=>a.jsx(h.Fragment,{children:Kxe(s,o,t)},`md-${o}`))})}function Vxe(e){const t=e.replace(/\r\n/g,`
124
124
  `).split(`
125
125
  `),n=[];let r=0;const s=i=>i.trim()==="",o=i=>i.trimStart().startsWith("```");for(;r<t.length;){const i=t[r],c=i.trim();if(s(i)){r+=1;continue}if(o(i)){const v=c.replace(/^```/,"").trim()||void 0;r+=1;const x=[];for(;r<t.length&&!o(t[r]);)x.push(t[r]),r+=1;r<t.length&&o(t[r])&&(r+=1),n.push({type:"code",lang:v,code:x.join(`
126
126
  `)});continue}if(/^---+$/.test(c)||/^\*\*\*+$/.test(c)){n.push({type:"hr"}),r+=1;continue}if(c.startsWith(">")){const v=[];for(;r<t.length&&t[r].trim().startsWith(">");)v.push(t[r].trim().replace(/^>\s?/,"")),r+=1;n.push({type:"blockquote",text:v.join(`
127
127
  `)});continue}const u=c.match(/^(#{1,4})\s+(.+)$/);if(u){n.push({type:"heading",level:u[1].length,text:u[2].trim()}),r+=1;continue}if(sD(t,r)){const v=oD(t[r]);r+=2;const x=[];for(;r<t.length&&t[r].includes("|")&&!s(t[r]);)x.push(oD(t[r])),r+=1;n.push({type:"table",headers:v,rows:x});continue}const f=c.match(/^\d+\.\s+/),m=c.match(/^[-*+]\s+/);if(f||m){const v=!!f,x=[];for(;r<t.length;){const j=t[r].trim();if(v?/^\d+\.\s+/.test(j):/^[-*+]\s+/.test(j)){x.push(j.replace(v?/^\d+\.\s+/:/^[-*+]\s+/,"")),r+=1;continue}s(t[r])&&(r+=1);break}n.push({type:"list",ordered:v,items:x});continue}const p=[i];for(r+=1;r<t.length;){const v=t[r],x=v.trim();if(s(v)||o(v)||/^---+$/.test(x)||/^#{1,4}\s+/.test(x)||x.startsWith(">")||sD(t,r)||/^\d+\.\s+/.test(x)||/^[-*+]\s+/.test(x))break;p.push(v),r+=1}n.push({type:"paragraph",text:p.join(`
128
128
  `)})}return n}function sD(e,t){if(t+1>=e.length)return!1;const n=e[t].trim(),r=e[t+1].trim();return n.includes("|")?/^\|?(\s*:?-{3,}:?\s*\|)+\s*:?-{3,}:?\s*\|?$/.test(r):!1}function oD(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>t.trim())}function Kxe(e,t,n){if(e.type==="hr")return a.jsx("hr",{className:"border-border/60"});if(e.type==="heading"){const r=e.level===1?"text-base font-semibold":e.level===2?"text-sm font-semibold":"text-sm font-medium";return a.jsx("h4",{className:r,children:Cc(e.text,`${t}-h`)})}if(e.type==="paragraph")return a.jsx("p",{className:Me("whitespace-pre-wrap leading-relaxed",n==="system"&&"leading-normal"),children:Cc(e.text,`${t}-p`)});if(e.type==="blockquote")return a.jsx("blockquote",{className:"border-l-2 border-muted-foreground/30 pl-3 text-muted-foreground italic",children:Cc(e.text,`${t}-bq`)});if(e.type==="code")return a.jsxs("div",{className:"rounded-md border bg-muted/70",children:[e.lang&&a.jsx("div",{className:"border-b px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:e.lang}),a.jsx("pre",{className:"max-h-72 overflow-auto p-2 text-xs",children:a.jsx("code",{children:e.code})})]});if(e.type==="list"){const r=e.ordered?"ol":"ul";return a.jsx(r,{className:Me("space-y-1 pl-5",e.ordered?"list-decimal":"list-disc"),children:e.items.map((s,o)=>a.jsx("li",{className:"leading-relaxed",children:Cc(s,`${t}-li-${o}`)},`${t}-li-${o}`))})}return e.type==="table"?a.jsx("div",{className:"overflow-x-auto rounded-md border",children:a.jsxs("table",{className:"w-full min-w-[480px] border-collapse text-xs",children:[a.jsx("thead",{className:"bg-muted/40",children:a.jsx("tr",{children:e.headers.map((r,s)=>a.jsx("th",{className:"border-b px-2 py-1.5 text-left font-semibold align-top",children:Cc(r,`${t}-thc-${s}`)},`${t}-th-${s}`))})}),a.jsx("tbody",{children:e.rows.map((r,s)=>a.jsx("tr",{className:"border-t",children:r.map((o,i)=>a.jsx("td",{className:"px-2 py-1.5 align-top",children:Cc(o,`${t}-tdc-${s}-${i}`)},`${t}-td-${s}-${i}`))},`${t}-row-${s}`))})]})}):null}function Cc(e,t){return e.split(/(`[^`]+`|\*\*[^*]+\*\*|\*[^*\n]+\*|_[^_\n]+_|~~[^~\n]+~~|\[[^\]]+\]\([^)]+\))/g).filter(Boolean).map((r,s)=>{if(r.startsWith("`")&&r.endsWith("`"))return a.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.92em]",children:r.slice(1,-1)},`${t}-${s}`);if(r.startsWith("**")&&r.endsWith("**"))return a.jsx("strong",{children:r.slice(2,-2)},`${t}-${s}`);if(r.startsWith("*")&&r.endsWith("*"))return a.jsx("em",{children:r.slice(1,-1)},`${t}-${s}`);if(r.startsWith("_")&&r.endsWith("_"))return a.jsx("em",{children:r.slice(1,-1)},`${t}-${s}`);if(r.startsWith("~~")&&r.endsWith("~~"))return a.jsx("s",{children:r.slice(2,-2)},`${t}-${s}`);const o=r.match(/^\[([^\]]+)\]\(([^)]+)\)$/);return o?a.jsx("a",{href:o[2],target:"_blank",rel:"noreferrer",className:"underline underline-offset-2",children:o[1]},`${t}-${s}`):a.jsx(h.Fragment,{children:r},`${t}-${s}`)})}function M8({message:e,className:t,assistantLabel:n,renderActions:r}){const s=e.role;if(s==="tool"){const c=String(e.text??"").trim();return/^(Approved|Denied) tool call\b/i.test(c)?null:a.jsxs("div",{className:Me("rounded-md border border-sky-500/30 bg-sky-500/10 px-3 py-2 text-sm",t),children:[a.jsxs("div",{className:"mb-1 flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wide text-sky-700",children:[a.jsx(Ua,{className:"h-3.5 w-3.5"}),"Tool",a.jsx("span",{className:"font-normal normal-case text-sky-700/80",children:new Date(e.createdAt).toLocaleTimeString()})]}),a.jsx("p",{className:"whitespace-pre-wrap text-sky-900",children:e.text})]})}if(s==="system")return a.jsxs("div",{className:Me("flex items-start gap-2 text-xs",t),children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(vC,{className:"h-3 w-3"})}),a.jsx("div",{className:"max-w-[92%] rounded-md border border-amber-400/30 bg-amber-50/70 p-3 text-sm",children:a.jsx(Ga,{text:e.text,variant:"assistant"})})]});const o=s==="user",i=o?Kc:Wr;return a.jsxs("div",{className:Me(`flex items-start gap-2 text-xs ${o?"justify-end":"justify-start"}`,t),children:[!o&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(i,{className:"h-3 w-3"})}),a.jsxs("div",{className:"relative max-w-[92%]",children:[a.jsxs("div",{className:`max-w-full break-words rounded-md border px-3 py-2 text-sm ${o?"border-primary/20 bg-primary/10":"border-border/80 bg-background shadow-sm"}`,children:[!o&&n&&a.jsx("p",{className:"mb-2 text-[11px] font-semibold text-muted-foreground",children:n}),o?a.jsx("p",{className:"whitespace-pre-wrap",children:e.text}):a.jsx(Ga,{text:e.text,variant:"assistant",className:"text-sm"})]}),r]}),o&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(Kc,{className:"h-3 w-3"})})]})}function HN({call:e,loading:t=!1,onApprove:n,onDeny:r,defaultOpen:s,className:o,description:i}){const c=e.status==="pending",u=e.tool||e.publicToolName||"unknown_tool";return a.jsxs("details",{open:s??c,className:Me("group overflow-hidden rounded-md border border-border/60 bg-background",o),children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ua,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:`Tool call ${u}`}),a.jsx("span",{className:`shrink-0 whitespace-nowrap rounded px-1.5 py-0.5 text-[10px] font-semibold ${c?"bg-amber-100 text-amber-900":e.status==="error"?"bg-red-100 text-red-900":e.status==="denied"?"bg-gray-100 text-gray-700":"bg-muted text-muted-foreground"}`,children:c?"Needs approval":e.status==="error"?"Error":e.status==="denied"?"Denied":"Approved"})]})}),a.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsxs("div",{className:"space-y-2 border-t border-border/50 px-3 py-2",children:[i&&a.jsx(Ga,{text:i,variant:"assistant",className:"text-sm"}),a.jsx("pre",{className:"max-h-40 w-full max-w-full overflow-x-auto overflow-y-auto whitespace-pre rounded border bg-muted/50 p-2 text-xs",children:a.jsx("code",{children:JSON.stringify(e.arguments??{},null,2)})}),e.error&&a.jsx("p",{className:"text-xs text-destructive",children:e.error}),c&&a.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:t,onClick:()=>r?.(e.id),children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:t,onClick:()=>n?.(e.id),children:"Approve"})]})]})]})}function I8(){return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-md border bg-background px-3 py-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),"Thinking..."]})]})}function Gxe({snippets:e,snippetsLabel:t,onSnippetSelect:n,disabled:r=!1,contentClassName:s="w-[360px]"}){return a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 shrink-0 gap-1 px-1.5 text-[11px] font-normal text-muted-foreground/80 hover:text-muted-foreground",disabled:r,children:[a.jsx(To,{className:"h-3 w-3"}),"Snippets",a.jsx(Jt,{className:"h-3 w-3"})]})}),a.jsxs(Bu,{align:"start",className:s,children:[a.jsx(w6,{children:t}),a.jsx(j6,{}),e.map(o=>a.jsx(Mr,{className:"items-start whitespace-normal px-2 py-2",onSelect:()=>n(o.prompt),children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"text-xs font-medium leading-tight",children:o.label}),a.jsx("div",{className:"text-[11px] leading-snug text-muted-foreground",children:o.description})]})},o.label))]})]})}function $8({input:e,onInputChange:t,onSend:n,onCancel:r,inputPlaceholder:s,snippets:o,snippetsLabel:i,onSnippetSelect:c,loading:u=!1,disabled:f=!1,inputRef:m,snippetContentClassName:p}){const v=f||u;return a.jsxs("div",{className:"rounded-xl border bg-background p-2 shadow-sm",children:[a.jsx(Ts,{ref:m,value:e,onChange:x=>t(x.target.value),placeholder:s,disabled:f,rows:1,className:"min-h-10 max-h-40 resize-none border-0 bg-transparent px-2 py-1 text-sm shadow-none focus-visible:ring-0 focus-visible:ring-offset-0",onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),v||n())}}),a.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 px-1 pt-1",children:[a.jsx(Gxe,{snippets:o,snippetsLabel:i,onSnippetSelect:c,disabled:v,contentClassName:p}),u&&r?a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-full",onClick:r,"aria-label":"Cancel assistant message",title:"Cancel assistant message",children:[a.jsx("span",{className:"pointer-events-none absolute inset-[2px] rounded-full border border-primary/20 border-t-primary/70 motion-reduce:animate-none animate-[spin_2.2s_linear_infinite]"}),a.jsx("span",{className:"pointer-events-none absolute inset-[4px] rounded-full border border-primary/10 motion-reduce:animate-none animate-pulse"}),a.jsx(Vd,{className:"relative z-10 h-4 w-4"})]}):u?a.jsx(Z,{type:"button",size:"icon",className:"h-8 w-8 shrink-0 rounded-full",disabled:!0,"aria-label":"Assistant is loading",title:"Assistant is loading",children:a.jsx(_r,{className:"h-4 w-4 animate-spin"})}):a.jsx(Z,{type:"button",size:"icon",className:"h-8 w-8 shrink-0 rounded-full pr-0.5",onClick:n,disabled:v||!e.trim(),"aria-label":"Send assistant message",title:"Send assistant message",children:a.jsx($W,{className:"h-4 w-4"})})]})]})}const Yxe=lv,Xxe=cv,D8=h.forwardRef(({className:e,...t},n)=>a.jsx(Ru,{ref:n,className:Me("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",e),...t}));D8.displayName=Ru.displayName;const L8=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Xxe,{children:[a.jsx(D8,{}),a.jsxs(Tu,{ref:r,className:Me("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",e),...n,children:[t,a.jsxs(uv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(ca,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));L8.displayName=Tu.displayName;const F8=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});F8.displayName="DialogHeader";const z8=h.forwardRef(({className:e,...t},n)=>a.jsx(ip,{ref:n,className:Me("text-lg font-semibold leading-none tracking-tight",e),...t}));z8.displayName=ip.displayName;const B8=h.forwardRef(({className:e,...t},n)=>a.jsx(lp,{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));B8.displayName=lp.displayName;function Qxe(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var uk="ScrollArea",[q8]=kr(uk),[Jxe,cs]=q8(uk),U8=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=e,[c,u]=h.useState(null),[f,m]=h.useState(null),[p,v]=h.useState(null),[x,j]=h.useState(null),[y,b]=h.useState(null),[S,N]=h.useState(0),[C,k]=h.useState(0),[A,E]=h.useState(!1),[P,T]=h.useState(!1),$=Ot(t,H=>u(H)),Y=zu(s);return a.jsx(Jxe,{scope:n,type:r,dir:Y,scrollHideDelay:o,scrollArea:c,viewport:f,onViewportChange:m,content:p,onContentChange:v,scrollbarX:x,onScrollbarXChange:j,scrollbarXEnabled:A,onScrollbarXEnabledChange:E,scrollbarY:y,onScrollbarYChange:b,scrollbarYEnabled:P,onScrollbarYEnabledChange:T,onCornerWidthChange:N,onCornerHeightChange:k,children:a.jsx(lt.div,{dir:Y,...i,ref:$,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});U8.displayName=uk;var W8="ScrollAreaViewport",H8=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:s,...o}=e,i=cs(W8,n),c=h.useRef(null),u=Ot(t,c,i.onViewportChange);return a.jsxs(a.Fragment,{children:[a.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:s}),a.jsx(lt.div,{"data-radix-scroll-area-viewport":"",...o,ref:u,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});H8.displayName=W8;var oo="ScrollAreaScrollbar",dk=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=cs(oo,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,c=e.orientation==="horizontal";return h.useEffect(()=>(c?o(!0):i(!0),()=>{c?o(!1):i(!1)}),[c,o,i]),s.type==="hover"?a.jsx(Zxe,{...r,ref:t,forceMount:n}):s.type==="scroll"?a.jsx(eye,{...r,ref:t,forceMount:n}):s.type==="auto"?a.jsx(V8,{...r,ref:t,forceMount:n}):s.type==="always"?a.jsx(fk,{...r,ref:t}):null});dk.displayName=oo;var Zxe=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=cs(oo,e.__scopeScrollArea),[o,i]=h.useState(!1);return h.useEffect(()=>{const c=s.scrollArea;let u=0;if(c){const f=()=>{window.clearTimeout(u),i(!0)},m=()=>{u=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",f),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(u),c.removeEventListener("pointerenter",f),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(ar,{present:n||o,children:a.jsx(V8,{"data-state":o?"visible":"hidden",...r,ref:t})})}),eye=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=cs(oo,e.__scopeScrollArea),o=e.orientation==="horizontal",i=lx(()=>u("SCROLL_END"),100),[c,u]=Qxe("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 h.useEffect(()=>{if(c==="idle"){const f=window.setTimeout(()=>u("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(f)}},[c,s.scrollHideDelay,u]),h.useEffect(()=>{const f=s.viewport,m=o?"scrollLeft":"scrollTop";if(f){let p=f[m];const v=()=>{const x=f[m];p!==x&&(u("SCROLL"),i()),p=x};return f.addEventListener("scroll",v),()=>f.removeEventListener("scroll",v)}},[s.viewport,o,u,i]),a.jsx(ar,{present:n||c!=="hidden",children:a.jsx(fk,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Ue(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:Ue(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),V8=h.forwardRef((e,t)=>{const n=cs(oo,e.__scopeScrollArea),{forceMount:r,...s}=e,[o,i]=h.useState(!1),c=e.orientation==="horizontal",u=lx(()=>{if(n.viewport){const f=n.viewport.offsetWidth<n.viewport.scrollWidth,m=n.viewport.offsetHeight<n.viewport.scrollHeight;i(c?f:m)}},10);return wu(n.viewport,u),wu(n.content,u),a.jsx(ar,{present:r||o,children:a.jsx(fk,{"data-state":o?"visible":"hidden",...s,ref:t})})}),fk=h.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,s=cs(oo,e.__scopeScrollArea),o=h.useRef(null),i=h.useRef(0),[c,u]=h.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=Q8(c.viewport,c.content),m={...r,sizes:c,onSizesChange:u,hasThumb:f>0&&f<1,onThumbChange:v=>o.current=v,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:v=>i.current=v};function p(v,x){return oye(v,i.current,c,x)}return n==="horizontal"?a.jsx(tye,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const v=s.viewport.scrollLeft,x=iD(v,c,s.dir);o.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:v=>{s.viewport&&(s.viewport.scrollLeft=v)},onDragScroll:v=>{s.viewport&&(s.viewport.scrollLeft=p(v,s.dir))}}):n==="vertical"?a.jsx(nye,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const v=s.viewport.scrollTop,x=iD(v,c);o.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:v=>{s.viewport&&(s.viewport.scrollTop=v)},onDragScroll:v=>{s.viewport&&(s.viewport.scrollTop=p(v))}}):null}),tye=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,o=cs(oo,e.__scopeScrollArea),[i,c]=h.useState(),u=h.useRef(null),f=Ot(t,u,o.onScrollbarXChange);return h.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),a.jsx(G8,{"data-orientation":"horizontal",...s,ref:f,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ix(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(o.viewport){const v=o.viewport.scrollLeft+m.deltaX;e.onWheelScroll(v),Z8(v,p)&&m.preventDefault()}},onResize:()=>{u.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Eg(i.paddingLeft),paddingEnd:Eg(i.paddingRight)}})}})}),nye=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,o=cs(oo,e.__scopeScrollArea),[i,c]=h.useState(),u=h.useRef(null),f=Ot(t,u,o.onScrollbarYChange);return h.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),a.jsx(G8,{"data-orientation":"vertical",...s,ref:f,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ix(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(o.viewport){const v=o.viewport.scrollTop+m.deltaY;e.onWheelScroll(v),Z8(v,p)&&m.preventDefault()}},onResize:()=>{u.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Eg(i.paddingTop),paddingEnd:Eg(i.paddingBottom)}})}})}),[rye,K8]=q8(oo),G8=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:u,onDragScroll:f,onWheelScroll:m,onResize:p,...v}=e,x=cs(oo,n),[j,y]=h.useState(null),b=Ot(t,$=>y($)),S=h.useRef(null),N=h.useRef(""),C=x.viewport,k=r.content-r.viewport,A=Jn(m),E=Jn(u),P=lx(p,10);function T($){if(S.current){const Y=$.clientX-S.current.left,H=$.clientY-S.current.top;f({x:Y,y:H})}}return h.useEffect(()=>{const $=Y=>{const H=Y.target;j?.contains(H)&&A(Y,k)};return document.addEventListener("wheel",$,{passive:!1}),()=>document.removeEventListener("wheel",$,{passive:!1})},[C,j,k,A]),h.useEffect(E,[r,E]),wu(j,P),wu(x.content,P),a.jsx(rye,{scope:n,scrollbar:j,hasThumb:s,onThumbChange:Jn(o),onThumbPointerUp:Jn(i),onThumbPositionChange:E,onThumbPointerDown:Jn(c),children:a.jsx(lt.div,{...v,ref:b,style:{position:"absolute",...v.style},onPointerDown:Ue(e.onPointerDown,$=>{$.button===0&&($.target.setPointerCapture($.pointerId),S.current=j.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),T($))}),onPointerMove:Ue(e.onPointerMove,T),onPointerUp:Ue(e.onPointerUp,$=>{const Y=$.target;Y.hasPointerCapture($.pointerId)&&Y.releasePointerCapture($.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),S.current=null})})})}),Ag="ScrollAreaThumb",Y8=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=K8(Ag,e.__scopeScrollArea);return a.jsx(ar,{present:n||s.hasThumb,children:a.jsx(aye,{ref:t,...r})})}),aye=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,o=cs(Ag,n),i=K8(Ag,n),{onThumbPositionChange:c}=i,u=Ot(t,p=>i.onThumbChange(p)),f=h.useRef(void 0),m=lx(()=>{f.current&&(f.current(),f.current=void 0)},100);return h.useEffect(()=>{const p=o.viewport;if(p){const v=()=>{if(m(),!f.current){const x=iye(p,c);f.current=x,c()}};return c(),p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[o.viewport,m,c]),a.jsx(lt.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ue(e.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),j=p.clientX-x.left,y=p.clientY-x.top;i.onThumbPointerDown({x:j,y})}),onPointerUp:Ue(e.onPointerUp,i.onThumbPointerUp)})});Y8.displayName=Ag;var pk="ScrollAreaCorner",X8=h.forwardRef((e,t)=>{const n=cs(pk,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(sye,{...e,ref:t}):null});X8.displayName=pk;var sye=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=cs(pk,n),[o,i]=h.useState(0),[c,u]=h.useState(0),f=!!(o&&c);return wu(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),u(m)}),wu(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),i(m)}),f?a.jsx(lt.div,{...r,ref:t,style:{width:o,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Eg(e){return e?parseInt(e,10):0}function Q8(e,t){const n=e/t;return isNaN(n)?0:n}function ix(e){const t=Q8(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function oye(e,t,n,r="ltr"){const s=ix(n),o=s/2,i=t||o,c=s-i,u=n.scrollbar.paddingStart+i,f=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return J8([u,f],p)(e)}function iD(e,t,n="ltr"){const r=ix(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,c=o-r,u=n==="ltr"?[0,i]:[i*-1,0],f=Kf(e,u);return J8([0,i],[0,c])(f)}function J8(e,t){return n=>{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*(n-e[0])}}function Z8(e,t){return e>0&&e<t}var iye=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=n.left!==o.left,c=n.top!==o.top;(i||c)&&t(),n=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function lx(e,t){const n=Jn(e),r=h.useRef(0);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),h.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function wu(e,t){const n=Jn(t);pr(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}var eq=U8,lye=H8,cye=X8;const hk=h.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(eq,{ref:r,className:Me("relative overflow-hidden",e),...n,children:[a.jsx(lye,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(tq,{}),a.jsx(cye,{})]}));hk.displayName=eq.displayName;const tq=h.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(dk,{ref:r,orientation:t,className:Me("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(Y8,{className:"relative flex-1 rounded-full bg-border"})}));tq.displayName=dk.displayName;function VN(e){return e instanceof Error&&e.name==="AbortError"||typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}function uye(e,t,n){if(e.type==="agent_check"){const s=String(e.label??"").trim();return s?t.find(o=>o.type==="agent_check"&&o.label===s):void 0}if(e.type==="tool_input_contains"||e.type==="tool_input_regex"||e.type==="tool_input_jsonpath"){const s=t.filter(i=>i.type===e.type&&i.metadata?.tool===e.tool),o=i=>e.type==="tool_input_contains"?bo(e.value)!==void 0&&bo(i.metadata?.value)===bo(e.value):e.type==="tool_input_regex"?bo(e.value)!==void 0&&bo(i.metadata?.pattern)===bo(e.value):i.metadata?.path===e.path&&e.equals===void 0==(i.metadata?.equals===void 0)&&(e.equals===void 0||i.metadata?.equals===e.equals);return s.find(o)??t.find(i=>i.type===e.type&&i.label===n(e))}const r=n(e);return t.find(s=>s.type===e.type&&s.label===r)}function nq({evalRules:e,failureReasons:t,runError:n,checkResults:r}){return n||t.find(o=>o.startsWith("Scenario error:"))?e.map(o=>({rule:o,status:"not_evaluated",failureReason:void 0})):r?.length?e.map(o=>{const i=uye(o,r,cx);return{rule:o,status:i?.status??"not_evaluated",failureReason:i?.reason}}):e.map(o=>{const i=fye(o,t);return{rule:o,status:i?"failed":"passed",failureReason:i}})}function cx(e){if(e.type==="required_tool")return`Required tool · ${e.value}`;if(e.type==="forbidden_tool")return`Forbidden tool · ${e.value}`;if(e.type==="tool_sequence")return WL(e.sequence??[]);if(e.type==="tool_input_contains")return gb({type:"contains",tool:String(e.tool??""),value:String(e.value??"")});if(e.type==="tool_input_regex")return gb({type:"regex",tool:String(e.tool??""),pattern:String(e.value??"")});if(e.type==="tool_input_jsonpath"){const t={type:"jsonpath",tool:String(e.tool??""),path:String(e.path??""),...e.equals!==void 0?{equals:e.equals}:{}};return gb(t)}return e.type==="response_contains"?`Text contains · ${e.value}`:e.type==="response_not_contains"?`Text does not contain · ${e.value}`:e.type==="response_starts_with"?`Text starts with · ${e.value}`:e.type==="response_ends_with"?`Text ends with · ${e.value}`:e.type==="response_equals"?`Text equals · ${e.value}`:e.type==="response_regex"?`Text matches regex · ${e.value}`:e.type==="response_jsonpath"?e.equals!==void 0?`JSONPath equals · ${e.path} == ${String(e.equals)}`:`JSONPath exists · ${e.path}`:e.type==="response_jsonpath_exists"?`JSONPath exists · ${e.path}`:e.type==="response_jsonpath_not_exists"?`JSONPath not exists · ${e.path}`:e.type==="agent_check"?`Agent check · ${e.label}`:`${e.type} · ${e.value}`}function dye(e){return WL(e).replace(/^Tool sequence · /,"")}function fye(e,t){if(e.type==="tool_input_contains"||e.type==="tool_input_regex"||e.type==="tool_input_jsonpath"){const o=e.type==="tool_input_contains"?{type:"contains",tool:String(e.tool??""),value:String(e.value??"")}:e.type==="tool_input_regex"?{type:"regex",tool:String(e.tool??""),pattern:String(e.value??"")}:{type:"jsonpath",tool:String(e.tool??""),path:String(e.path??""),...e.equals!==void 0?{equals:e.equals}:{}},i=[kd(o,"tool_not_used"),kd(o,"input_mismatch"),kd(o,"invalid_regex"),kd(o,"invalid_jsonpath"),kd(o,"serialization")];return t.find(c=>i.includes(c))}if(e.type==="response_jsonpath_exists"){const o=String(e.path??"").trim();return o?t.find(i=>i.startsWith(`JSONPath assertion failed: ${o}`)||i.startsWith(`JSONPath assertion failed: invalid JSON for path ${o}`)):void 0}const n=bo(e.value);if((e.type==="response_contains"||e.type==="response_not_contains"||e.type==="response_starts_with"||e.type==="response_ends_with"||e.type==="response_equals"||e.type==="response_regex")&&n===void 0)return;const r=e.type==="required_tool"?`Required tool not used: ${e.value}`:e.type==="forbidden_tool"?`Forbidden tool used: ${e.value}`:e.type==="tool_sequence"?`Tool sequence order was not satisfied: ${(e.sequence??[]).join(" -> ")}`:e.type==="response_contains"?`Contains assertion failed: ${n}`:e.type==="response_not_contains"?`Not-contains assertion failed: ${n}`:e.type==="response_starts_with"?`Starts-with assertion failed: ${n}`:e.type==="response_ends_with"?`Ends-with assertion failed: ${n}`:e.type==="response_equals"?`Equals assertion failed: ${n}`:e.type==="response_regex"?`Regex assertion failed: ${n}`:e.type==="response_jsonpath"?e.equals!==void 0?`JSONPath equals assertion failed: ${e.path}`:`JSONPath assertion failed: ${e.path}`:e.type==="response_jsonpath_not_exists"?`JSONPath not-exists assertion failed: ${e.path}`:e.type==="agent_check"?String(e.label??""):"";if(!r)return;const s=t.find(o=>o===r);if(s)return s;if(e.type==="response_regex"){const o=n??"";return o?t.find(i=>i.startsWith("Regex assertion failed:")&&i.includes(o)):void 0}return e.type==="response_jsonpath"||e.type==="response_jsonpath_not_exists"?t.find(o=>o.includes(e.path??"")):e.type==="tool_sequence"?t.find(o=>o.startsWith(`Tool sequence order was not satisfied: ${dye(e.sequence??[])}`)||o.startsWith("Required tool in sequence not used:")):t.find(o=>o.startsWith(r))}async function pye(e){const{sessionId:t,source:n,serverName:r,onLaunchUrl:s,timeoutMs:o=5*6e4}=e,i=Date.now()+o;let c=!1;for(;Date.now()<i;){const{session:u}=await n.getOAuthRuntimeSession(t),f=u.authorizeLaunchUrl||u.authorizationUrl||"";if(f&&s&&s(f),u.status==="completed"&&u.hasAccessToken){c=!0;break}if(u.status==="error"||u.status==="stopped")throw new Error(`OAuth login failed for '${r}' (${u.status}). ${u.lastError||""}`.trim());await new Promise(m=>setTimeout(m,1500))}if(!c)throw new Error(`OAuth login timed out for '${r}'. Authorization was not completed within 5 minutes.`)}const hye=250;async function Po(e){const{serverNames:t,source:n,onServerAuthStart:r,onServerStatus:s,timeoutMs:o=5*6e4}=e,i=Array.from(new Set(t.filter(Boolean)));if(i.length===0)return;const c=Date.now()+o,u=new Set,f=new Map;for(;Date.now()<c;){const m=await n.ensureOAuthServers({serverNames:i});for(const v of m.servers){const x=`${v.status}:${v.debugState??""}:${v.runtimeSessionId??""}`;f.get(v.serverName)!==x&&(f.set(v.serverName,x),s?.({serverName:v.serverName,status:v.status,debugState:v.debugState,tokenExpiresAt:v.tokenExpiresAt,tokenExpiresInSeconds:v.tokenExpiresInSeconds,message:v.message}))}const p=m.servers.filter(v=>v.status==="auth_required");if(p.length===0&&m.allReady)return;for(const v of p){const x=v.runtimeSessionId;if(!x)throw new Error(v.message||`OAuth login required for '${v.serverName}'.`);u.has(x)||(u.add(x),r?.(v.serverName));const j=(()=>{let y=!1;return b=>{if(y||!b)return;y=!0;const S=b.startsWith("http")?b:`${window.location.origin}${b}`;window.open(S,"_blank","noopener,noreferrer")}})();j(v.authorizeLaunchUrl||v.authorizationUrl||""),await pye({sessionId:x,source:n,serverName:v.serverName,onLaunchUrl:j,timeoutMs:Math.max(1e4,c-Date.now())})}await new Promise(v=>{window.setTimeout(v,hye)})}throw new Error("OAuth login timed out before all required servers were authorized.")}const mye=[{label:"Suggest Checks",description:"Propose stronger evaluation checks for this scenario.",prompt:"Review the current checks in this scenario and suggest stronger alternatives. For each suggestion, explain what failure mode it catches that the existing checks miss. Prioritize checks that are deterministic, not sensitive to minor phrasing changes, and that would reliably catch regressions."},{label:"Suggest Value Capture Rules",description:"Recommend extract/value capture rules for key outputs.",prompt:"Analyze the expected tool calls and outputs in this scenario and suggest value capture rules that extract the most meaningful structured data. For each rule, explain which field to capture, why it matters for evaluation, and what a good vs. bad captured value looks like."},{label:"Generate Structured Updates",description:"Return apply-ready Checks and Value Capture suggestions.",prompt:["Propose concrete scenario updates and include structured suggestions that can be applied directly.","Return ONLY valid JSON envelope and no markdown.","Required shape:",'{"type":"assistant_message","text":"short rationale","suggestions":{"evalRules":{"replacement":[...]}, "extractRules":{"replacement":[...]}}}',"If tool usage is clear, include at least one required_tool check.","For argument validation, use tool_input_contains with tool and value, tool_input_regex with tool and value, or tool_input_jsonpath with tool and path plus optional equals.","Prefer deterministic checks and concise capture patterns."].join(`
129
- `)},{label:"Improve Prompt Determinism",description:"Reduce ambiguity and improve reproducibility.",prompt:"Identify parts of this scenario's prompt or context that are ambiguous, open-ended, or likely to produce different results across runs. Suggest specific rewrites that make the expected behavior more deterministic — without changing the intent of what is being tested."},{label:"Generate Scenario Draft",description:"Create a draft scenario from the current context.",prompt:"Based on the current tool configuration and context, generate a complete scenario draft. Include a clear prompt, realistic expected tool calls with arguments, meaningful checks that validate the core behavior, and at least one value capture rule. Explain your choices so I can adjust them."}];function rq(e){if(Array.isArray(e.sequence))return e.sequence.map(n=>n.trim()).filter(Boolean);const t=typeof e.value=="string"?e.value.trim():"";return!t||t.toLowerCase()==="tool sequence"?[]:t.split(/\s*(?:->|,|\n)\s*/).map(n=>n.trim()).filter(Boolean)}function gye(e){const t=[];let n=0;for(const r of e){if(r.type==="tool_sequence"){const s=rq(r);s.length>0?t.push({type:"tool_sequence",sequence:s}):n+=1;continue}t.push(r)}return{rules:t,skippedToolSequences:n}}function vye(e){if(e.type==="tool_sequence"){const t=rq(e);return t.length>0?`Tool sequence · ${t.join(" -> ")}`:"Tool sequence · No tool steps"}return cx(e)}function xye({open:e,onOpenChange:t,configId:n,configPath:r,scenario:s,agents:o,servers:i,defaultAssistantAgentName:c,initialUserMessage:u,onApplyPatch:f}){const{source:m}=$n(),[p,v]=h.useState(null),[x,j]=h.useState(null),[y,b]=h.useState(""),[S,N]=h.useState(!1),[C,k]=h.useState(!1),[A,E]=h.useState(new Set),P=h.useRef(null),T=h.useRef(null),$=h.useRef(null),Y=h.useRef(null),H=h.useRef(0),[F,X]=h.useState(!1),L=h.useRef(!1),I=c||o[0]?.id||"",M=h.useCallback(()=>{const ge=Y.current;ge&&ge.controller.abort()},[]);h.useEffect(()=>{if(!e||!I||p)return;let ge=!1;return N(!0),(async()=>{const at=Array.from(new Set(s.serverIds.filter(it=>i.find(Ge=>Ge.id===it)?.authType==="oauth2")));await Po({serverNames:at,source:m});const tt=await m.createScenarioAssistantSession({configId:n,configPath:r,scenarioId:s.id,selectedAssistantAgentName:I,context:{scenario:{id:s.id,name:s.name,prompt:s.prompt,serverNames:s.serverIds,evalRules:s.evalRules,extractRules:s.extractRules},availableServers:i.map(it=>({name:it.name||it.id,url:it.url})),availableAgents:o.map(it=>({name:it.name||it.id,provider:it.provider,model:it.model}))}});ge||(v(tt.sessionId),G(tt.session),N(!1))})().catch(at=>{ge||$e({title:"Could not start Scenario Assistant",description:at instanceof Error?at.message:String(at),variant:"destructive"})}).finally(()=>{ge||N(!1)}),()=>{ge=!0}},[e,m,p,n,r,s,o,i,I]);const q=()=>{M(),v(null),j(null),b(""),E(new Set),$.current=null},G=h.useCallback(ge=>{j(we=>we&&we.messages.length>ge.messages.length?we:ge)},[]),O=h.useCallback(()=>{const ge=Y.current;ge&&(M(),b(ge.prompt),N(!1),k(!1))},[M]),Q=ge=>{q(),m.closeScenarioAssistantSession(ge).catch(()=>{})};h.useEffect(()=>{e||p&&(L.current||F||Q(p))},[e,p,m,F]),h.useEffect(()=>()=>{M(),p&&m.closeScenarioAssistantSession(p).catch(()=>{})},[M,p,m]),h.useEffect(()=>{if(!e)return;F&&X(!1),L.current&&(L.current=!1);const ge=window.setTimeout(()=>{P.current?.scrollIntoView({behavior:"smooth",block:"end"})},0);return()=>window.clearTimeout(ge)},[e,S,x?.messages.length,x?.pendingToolCalls.length,x?.warnings.length]),h.useEffect(()=>{const ge=T.current;if(!ge)return;ge.style.height="0px";const we=Math.min(ge.scrollHeight,160);ge.style.height=`${Math.max(40,we)}px`},[y,e]);const B=o.length>0&&s.serverIds.length>0&&!!I,z=async ge=>{if(!p)return;const we=ge.trim();if(!we)return;const at=++H.current,tt=new AbortController,it=`msg-local-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,At={id:it,role:"user",text:we,createdAt:new Date().toISOString()};Y.current={id:at,controller:tt,prompt:we},k(!0),j(Ge=>Ge&&{...Ge,messages:[...Ge.messages,At]}),b(""),N(!0);try{const Ge=await m.sendScenarioAssistantMessage(p,we,tt.signal);if(tt.signal.aborted||Y.current?.id!==at)return;G(Ge.session)}catch(Ge){if(VN(Ge)||tt.signal.aborted||Y.current?.id!==at)return;j(Ee=>Ee&&{...Ee,messages:Ee.messages.filter(Re=>Re.id!==it)}),b(Ee=>Ee.trim()?Ee:we),$e({title:"Scenario Assistant error",description:Ge instanceof Error?Ge.message:String(Ge),variant:"destructive"})}finally{Y.current?.id===at&&(Y.current=null,N(!1),k(!1))}},V=ge=>{b(ge),requestAnimationFrame(()=>T.current?.focus())};h.useEffect(()=>{if(!e||!p||!x||!B||Y.current)return;const ge=String(u??"").trim();ge&&$.current!==ge&&($.current=ge,z(ge))},[e,p,x,B,u]),h.useEffect(()=>{if(!(!e||!p||!x))return m.subscribeScenarioAssistantSessionEvents(p,ge=>{G(ge.payload.session)})},[e,p,m,G]);const ee=async ge=>{if(p){N(!0);try{const we=await m.approveScenarioAssistantToolCall(p,ge);G(we.session)}catch(we){$e({title:"Tool call failed",description:we instanceof Error?we.message:String(we),variant:"destructive"})}finally{N(!1)}}},ae=async ge=>{if(p){N(!0);try{const we=await m.denyScenarioAssistantToolCall(p,ge);G(we.session)}catch(we){$e({title:"Could not deny tool call",description:we instanceof Error?we.message:String(we),variant:"destructive"})}finally{N(!1)}}},ue=async()=>{if(p){N(!0);try{const ge=await m.approveAllScenarioAssistantToolCalls(p);G(ge.session)}catch(ge){$e({title:"Could not approve all tool calls",description:ge instanceof Error?ge.message:String(ge),variant:"destructive"})}finally{N(!1)}}},se=(ge,we,at,tt,it="replace")=>{if(!we)return;if(at==="prompt"&&we.prompt&&f({prompt:we.prompt.replacement}),at==="evalRules"&&we.evalRules){const Ge=gye(tt??we.evalRules.replacement);f({evalRules:it==="append"?[...s.evalRules,...Ge.rules]:Ge.rules}),Ge.skippedToolSequences>0&&$e({title:"Skipped invalid tool sequence",description:"The assistant suggested a sequence check without any tool steps.",variant:"destructive"})}if(at==="extractRules"&&we.extractRules&&f({extractRules:we.extractRules.replacement}),ge){const Ge=`${ge}:${at}`;E(Ee=>new Set([...Ee,Ge]))}$e({title:"Applied suggestion",description:`Updated ${{prompt:"Prompt",evalRules:"Checks",extractRules:"Value Capture Rules"}[at]}`})},xe=(ge,we,at,tt)=>{if(we?.extractRules){if(f({extractRules:tt==="append"?[...s.extractRules,...at]:at}),ge){const it=`${ge}:extractRules`;E(At=>new Set([...At,it]))}$e({title:"Applied suggestion",description:"Updated Value Capture Rules"})}},oe=()=>{const ge=document.activeElement;ge instanceof HTMLElement&&ge.blur()},de=ge=>{ge||(oe(),X(!1),L.current=!1),t(ge)},De=()=>{oe(),L.current=!0,X(!0),t(!1)},me=()=>{oe(),L.current=!1,X(!1),p&&Q(p)};return a.jsxs(a.Fragment,{children:[!e&&p&&a.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 rounded-md border bg-background px-3 py-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium",children:"Scenario Assistant (session active)"}),a.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:["Resume conversation for ",a.jsx("span",{className:"font-mono",children:s.id}),x?` · ${x.messages.length} messages`:""]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>t(!0),children:[a.jsx(sa,{className:"mr-1.5 h-3.5 w-3.5"}),"Resume"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-8 px-2 text-muted-foreground",onClick:me,"aria-label":"Discard assistant session",title:"Discard assistant session",children:a.jsx(ca,{className:"h-4 w-4"})})]})]}),a.jsx(Yxe,{open:e,onOpenChange:de,children:a.jsxs(L8,{className:"max-w-6xl h-[85vh] flex flex-col",children:[p&&a.jsxs("button",{type:"button",className:"absolute right-12 top-4 z-10 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",onClick:De,"aria-label":"Minimize assistant",title:"Minimize assistant",children:[a.jsx(OW,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Minimize"})]}),a.jsx(F8,{className:"pr-20",children:a.jsx("div",{className:"flex items-start justify-between gap-3",children:a.jsxs("div",{className:"min-w-0",children:[a.jsxs(z8,{className:"flex items-center gap-2",children:[a.jsx(sa,{className:"h-4 w-4"}),"Scenario Assistant"]}),a.jsx(B8,{children:"LLM-guided scenario authoring with MCP tool introspection and per-tool-call approval."})]})})}),B?a.jsxs("div",{className:"min-h-0 flex flex-1 flex-col gap-3",children:[a.jsx("div",{className:"grid gap-3 sm:grid-cols-1",children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"MCP Context"}),a.jsxs("div",{className:"h-8 rounded-md border px-2 text-xs flex items-center gap-2",children:[a.jsx(Ua,{className:"h-3.5 w-3.5"}),x?`Loaded ${x.toolsLoaded} tools`:"Preparing..."]})]})}),a.jsx(hk,{className:"min-h-0 flex-1 rounded-md border p-3",children:a.jsxs("div",{className:"space-y-3",children:[x?.warnings?.map((ge,we)=>a.jsx("div",{className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:ge},`${ge}-${we}`)),x?.messages.map(ge=>a.jsxs(h.Fragment,{children:[(()=>{const we=ge.pendingToolCallIds??(ge.pendingToolCallId?[ge.pendingToolCallId]:[]),at=we.map(Ee=>(x?.pendingToolCalls??[]).find(Re=>Re.id===Ee)).filter(Ee=>!!Ee),tt=we.map(Ee=>x.pendingToolCalls.find(Re=>Re.id===Ee)??x.pendingToolCalls.find(Re=>Re.id===Ee)).filter(Boolean);if(!(ge.role==="assistant"&&we.length>0))return a.jsx("div",{className:"space-y-2",children:a.jsx(jye,{message:ge})});const At=at.length,Ge=tt.length-At;return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("div",{className:"w-full max-w-[92%] space-y-2",children:[tt.length>1&&At>0&&a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-amber-200 bg-amber-50/50 px-3 py-1.5",children:[a.jsxs("span",{className:"text-xs text-amber-900",children:[Ge," of ",tt.length," tool calls resolved"]}),a.jsxs(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:At===0,onClick:()=>{ue()},children:["Approve All (",At,")"]})]}),tt.map((Ee,Re)=>a.jsx(HN,{call:Ee,loading:S,description:Re===0?ge.text:void 0,onApprove:Ze=>{ee(Ze)},onDeny:Ze=>{ae(Ze)}},Ee.id))]})]})})(),ge.suggestions&&a.jsxs("div",{className:"ml-0 space-y-3 rounded-md border border-dashed bg-muted/10 p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[a.jsx(sa,{className:"h-3.5 w-3.5"}),"Structured Suggestions"]}),ge.suggestions.prompt&&a.jsx(yye,{title:"Prompt",rationale:ge.suggestions.prompt.rationale,preview:ge.suggestions.prompt.replacement,applied:A.has(`${ge.id}:prompt`),onApply:()=>se(ge.id,ge.suggestions,"prompt")}),ge.suggestions.evalRules&&a.jsx(bye,{rationale:ge.suggestions.evalRules.rationale,rules:ge.suggestions.evalRules.replacement,applied:A.has(`${ge.id}:evalRules`),onApply:we=>se(ge.id,ge.suggestions,"evalRules",we,"append"),onReplace:we=>se(ge.id,ge.suggestions,"evalRules",we,"replace")}),ge.suggestions.extractRules&&a.jsx(wye,{rationale:ge.suggestions.extractRules.rationale,rules:ge.suggestions.extractRules.replacement,applied:A.has(`${ge.id}:extractRules`),onApply:we=>xe(ge.id,ge.suggestions,we,"append"),onReplace:we=>xe(ge.id,ge.suggestions,we,"replace")}),(()=>{const we=ge.suggestions?.notes,at=Array.isArray(we)?we:typeof we=="string"?[we]:[];return at.length===0?null:a.jsxs("div",{className:"space-y-2 rounded-md border p-3",children:[a.jsx("h5",{className:"text-sm font-medium",children:"Notes"}),a.jsx("ul",{className:"space-y-1 text-xs text-muted-foreground list-disc pl-4",children:at.map((tt,it)=>a.jsx("li",{children:tt},`${ge.id}-note-${it}`))})]})})()]})]},ge.id)),(x?.pendingToolCalls??[]).filter(ge=>!(x?.messages??[]).some(we=>we.pendingToolCallId===ge.id||we.pendingToolCallIds?.includes(ge.id))).map(ge=>a.jsx(HN,{call:ge,loading:S,onApprove:we=>{ee(we)},onDeny:we=>{ae(we)}},ge.id)),!x&&S&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),"Starting assistant session..."]}),x&&S&&a.jsx(I8,{}),a.jsx("div",{ref:P})]})}),a.jsx($8,{input:y,onInputChange:b,onSend:()=>{z(y)},onCancel:p&&C?O:void 0,inputPlaceholder:"Get assistance with creating or refining this scenario ...",snippets:mye,snippetsLabel:"Scenario Assistant Snippets",onSnippetSelect:V,loading:S,disabled:!p,inputRef:T,snippetContentClassName:"w-[320px]"})]}):a.jsx("div",{className:"rounded-md border p-3 text-sm text-muted-foreground",children:"Scenario Assistant requires a configured assistant agent and at least one selected server on the scenario."})]})})]})}function yye({title:e,rationale:t,preview:n,applied:r=!1,onApply:s}){return a.jsxs("div",{className:`space-y-2 rounded-md border p-3 ${r?"border-emerald-300 bg-emerald-50/40":""}`,children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h5",{className:"text-sm font-medium",children:e})}),t&&a.jsx("p",{className:"text-xs text-muted-foreground",children:t}),a.jsx("pre",{className:"max-h-56 overflow-auto rounded bg-muted p-2 text-xs whitespace-pre-wrap",children:n}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Z,{type:"button",size:"sm",className:"h-8",variant:r?"secondary":"default",onClick:s,disabled:r,children:r?a.jsxs(a.Fragment,{children:[a.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5"}),"Applied"]}):"Apply"})})]})}function bye({rationale:e,rules:t,applied:n=!1,onApply:r,onReplace:s}){const[o,i]=h.useState(()=>new Set(t.map((p,v)=>v))),c=o.size,u=t.filter((p,v)=>o.has(v)),f=c===t.length,m=(p,v)=>{i(x=>{const j=new Set(x);return v?j.add(p):j.delete(p),j})};return a.jsxs("div",{className:`space-y-2 rounded-md border p-3 ${n?"border-emerald-300 bg-emerald-50/40":""}`,children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h5",{className:"text-sm font-medium",children:"Checks"})}),e&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e}),a.jsxs("div",{className:"space-y-2 rounded bg-muted/60 p-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[a.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[c," of ",t.length," selected"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-[11px]",disabled:n||t.length===0,onClick:()=>i(f?new Set:new Set(t.map((p,v)=>v))),children:f?"Unselect all":"Select all"})]}),t.map((p,v)=>{const x=vye(p),j=`scenario-assistant-check-${v}-${p.type}`;return a.jsxs("div",{className:"flex items-start gap-2 rounded bg-background p-2",children:[a.jsx(br,{id:j,checked:o.has(v),disabled:n,onCheckedChange:y=>m(v,y===!0),"aria-label":`Select ${x}`}),a.jsxs("label",{htmlFor:j,className:"min-w-0 flex-1 cursor-pointer space-y-1",children:[a.jsx("span",{className:"block text-xs font-medium",children:x}),a.jsx("code",{className:"block break-words rounded bg-muted px-1.5 py-1 text-[11px] text-muted-foreground",children:JSON.stringify(p)})]})]},`${p.type}-${v}`)})]}),a.jsx("div",{className:"flex justify-end gap-2",children:n?a.jsxs(Z,{type:"button",size:"sm",variant:"secondary",disabled:!0,children:[a.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5"}),"Applied"]}):a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",size:"sm",className:"h-8",variant:"outline",onClick:()=>s(u),disabled:c===0,children:"Replace all"}),a.jsx(Z,{type:"button",size:"sm",className:"h-8",onClick:()=>r(u),disabled:c===0,children:"Add selected"})]})})]})}function wye({rationale:e,rules:t,applied:n=!1,onApply:r,onReplace:s}){const[o,i]=h.useState(()=>new Set(t.map((p,v)=>v))),c=o.size,u=t.filter((p,v)=>o.has(v)),f=c===t.length,m=(p,v)=>{i(x=>{const j=new Set(x);return v?j.add(p):j.delete(p),j})};return a.jsxs("div",{className:`space-y-2 rounded-md border p-3 ${n?"border-emerald-300 bg-emerald-50/40":""}`,children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h5",{className:"text-sm font-medium",children:"Value Capture Rules"})}),e&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e}),a.jsxs("div",{className:"space-y-2 rounded bg-muted/60 p-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[a.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[c," of ",t.length," selected"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-[11px]",disabled:n||t.length===0,onClick:()=>i(f?new Set:new Set(t.map((p,v)=>v))),children:f?"Unselect all":"Select all"})]}),t.map((p,v)=>{const x=`${p.name} · ${p.pattern}`,j=`scenario-assistant-extract-${v}-${p.name}`;return a.jsxs("div",{className:"flex items-start gap-2 rounded bg-background p-2",children:[a.jsx(br,{id:j,checked:o.has(v),disabled:n,onCheckedChange:y=>m(v,y===!0),"aria-label":`Select ${x}`}),a.jsxs("label",{htmlFor:j,className:"min-w-0 flex-1 cursor-pointer space-y-1",children:[a.jsx("span",{className:"block text-xs font-medium",children:x}),a.jsx("code",{className:"block break-words rounded bg-muted px-1.5 py-1 text-[11px] text-muted-foreground",children:JSON.stringify(p)})]})]},`${p.name}-${v}`)})]}),a.jsx("div",{className:"flex justify-end gap-2",children:n?a.jsxs(Z,{type:"button",size:"sm",variant:"secondary",disabled:!0,children:[a.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5"}),"Applied"]}):a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",size:"sm",className:"h-8",variant:"outline",onClick:()=>s(u),disabled:c===0,children:"Replace all"}),a.jsx(Z,{type:"button",size:"sm",className:"h-8",onClick:()=>r(u),disabled:c===0,children:"Add selected"})]})})]})}function jye({message:e}){const t=async s=>{try{await navigator.clipboard.writeText(s),$e({title:"Copied"})}catch(o){$e({title:"Could not copy",description:o instanceof Error?o.message:String(o),variant:"destructive"})}},n=e.role==="user"||e.role==="assistant",r=e.role==="user";return a.jsx(M8,{message:e,assistantLabel:e.role==="assistant"?"Assistant":void 0,renderActions:n?a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:`absolute bottom-1 h-6 w-6 text-muted-foreground ${r?"-left-8":"-right-8"}`,onClick:()=>{t(e.text)},"aria-label":"Copy message",title:"Copy message",children:a.jsx(Hr,{className:"h-3.5 w-3.5"})}):void 0})}function ta(e){return typeof e=="number"?e.toLocaleString():"n/a"}function KN(e,t){const n=t?.nonPositiveLabel??"0s";if(!Number.isFinite(e)||e<=0)return n;const r=Math.floor(e),s=Math.floor(r/3600),o=Math.floor(r%3600/60),i=r%60;return s>0?`${s}h ${o}m ${i}s`:o>0?`${o}m ${i}s`:`${i}s`}function Sye({run:e,fallbackUserPrompt:t}){const[n,r]=h.useState(!0),[s,o]=h.useState(!1);return a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ss,{open:n,onOpenChange:r,children:a.jsxs("div",{className:"rounded-md border border-muted-foreground/20 bg-card p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsx("button",{type:"button",className:"mb-2 flex w-full items-center justify-between gap-2 text-left",children:a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${n?"rotate-180":""}`}),a.jsx(Wr,{className:"h-3.5 w-3.5"}),"Final answer"]})})}),a.jsx(Ns,{children:a.jsx(GN,{text:e.finalAnswer||"No final answer captured.",maxLength:1200,className:"text-xs text-foreground"})})]})}),a.jsx(Ss,{open:s,onOpenChange:o,children:a.jsxs("div",{className:"rounded-md border border-muted-foreground/20 bg-card p-2",children:[a.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${s?"rotate-180":""}`}),a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Conversation trace"})]})}),a.jsxs(et,{variant:"outline",className:"h-5 text-[10px]",children:[e.toolCalls.length," tool calls"]})]}),a.jsx(Ns,{children:a.jsx("div",{className:"space-y-2 rounded-md border bg-muted/20 p-2",children:e.conversation.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No conversation trace captured."}):e.conversation.map(i=>a.jsx(Nye,{item:i,fallbackUserPrompt:t},i.id))})})]})})]})}function Nye({item:e,fallbackUserPrompt:t}){if(e.kind==="tool_call"){const u=lD(e,"input");return a.jsx(uD,{variant:"call",title:`Tool call · ${e.toolName||"unknown"}${u}`,text:e.text})}if(e.kind==="tool_result"){const u=lD(e,"output"),f=e.ok?a.jsx(Va,{className:"h-3.5 w-3.5 text-emerald-700 dark:text-emerald-300"}):a.jsx(ll,{className:"h-3.5 w-3.5 text-rose-700 dark:text-rose-300"});return a.jsx(uD,{variant:e.ok?"result_ok":"result_error",title:`Tool result · ${e.toolName||"unknown"} · ${e.ok?"ok":"error"}${typeof e.durationMs=="number"?` · ${e.durationMs}ms`:""}${u}`,text:e.text,icon:f})}const n=e.kind==="user_prompt",r=cD(e.text,e.kind),s=t?cD(t,"user_prompt"):"",o=n&&!r&&s?s:r,i=n?"User prompt":e.kind==="assistant_final"?"Agent final":"Agent",c=n?Kc:Wr;return a.jsxs("div",{className:`flex items-start gap-2 text-xs ${n?"justify-end":"justify-start"}`,children:[!n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",children:a.jsx(c,{className:"h-3 w-3"})}),a.jsxs("div",{className:`max-w-[90%] rounded-md p-2 ${n?"bg-primary/10":"bg-muted/50"}`,children:[a.jsx("p",{className:`mb-1 text-[11px] font-semibold text-muted-foreground ${n?"text-right":""}`,children:i}),n?a.jsx(GN,{text:o,maxLength:280,className:"text-xs"}):a.jsx(GN,{text:o,maxLength:500,className:"text-xs"})]}),n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(c,{className:"h-3 w-3"})})]})}function lD(e,t){const n=t==="input"?e.estimatedTokens?.inputTokens:e.estimatedTokens?.outputTokens;return typeof n!="number"?"":` · estimated ${ta(n)} tokens`}function cD(e,t){const r=String(e??"").replace(/^\s+/,"");return t==="user_prompt"?r.replace(/^user:\s*/i,""):t==="assistant_final"||t==="assistant_thought"?r.replace(/^assistant:\s*/i,""):r}function uD({variant:e,title:t,text:n,icon:r}){const[s,o]=h.useState(!1),i={call:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",result_ok:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",result_error:"border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-300"};return a.jsx(Ss,{open:s,onOpenChange:o,children:a.jsxs("div",{className:`rounded-md border p-2 text-xs ${i[e]}`,children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[11px]",children:[r??a.jsx(Ua,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:t})]}),a.jsx("span",{className:"text-[11px] font-semibold",children:s?"Hide content":"Show content"})]})}),a.jsx(Ns,{children:a.jsx("p",{className:"mt-2 font-mono whitespace-pre-wrap text-foreground",children:n})})]})})}function GN({text:e,maxLength:t,className:n}){const[r,s]=h.useState(!1),o=e.length>t,i=r||!o?e:`${e.slice(0,t)}...`;return a.jsxs("div",{children:[a.jsx(Ga,{text:i,className:n}),o&&a.jsx("button",{type:"button",className:"mt-1 text-[11px] font-medium text-primary hover:underline",onClick:()=>s(c=>!c),children:r?"Show less":"Show all"})]})}const aq=["image/jpeg","image/png","image/gif","image/webp"],sq=["application/pdf","text/plain","text/markdown","text/csv"];function Cye(e){return aq.includes(e)||sq.includes(e)}function dD({value:e,onValueChange:t,className:n,hideToolSequence:r=!1}){return a.jsxs(Mn,{value:e,onValueChange:s=>t(s),children:[a.jsx(_n,{className:n,children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"required_tool",children:"Required Tool"}),a.jsx(ut,{value:"forbidden_tool",children:"Forbidden Tool"}),!r&&a.jsx(ut,{value:"tool_sequence",children:"Tool Sequence"}),a.jsx(ut,{value:"agent_check",children:"Judge Agent"}),a.jsx(ut,{value:"response_contains",children:"Text contains"}),a.jsx(ut,{value:"response_not_contains",children:"Text does not contain"}),a.jsx(ut,{value:"response_starts_with",children:"Text starts with"}),a.jsx(ut,{value:"response_ends_with",children:"Text ends with"}),a.jsx(ut,{value:"response_equals",children:"Text equals"}),a.jsx(ut,{value:"response_regex",children:"Text matches regex"}),a.jsx(ut,{value:"tool_input_contains",children:"Tool input contains"}),a.jsx(ut,{value:"tool_input_regex",children:"Tool input regex"}),a.jsx(ut,{value:"tool_input_jsonpath",children:"Tool input JSONPath"}),a.jsx(ut,{value:"response_jsonpath",children:"JSONPath (optional equals)"}),a.jsx(ut,{value:"response_jsonpath_exists",children:"JSONPath exists"}),a.jsx(ut,{value:"response_jsonpath_not_exists",children:"JSONPath not exists"})]})]})}const _ye=()=>({id:`scn-${Date.now()}`,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]});function oq(e){return Hxe(e).replace(/^Tool sequence · /,"")}function hm(e){return e.startsWith("tool_input_")}function fD(e){const t=e.trim();if(t)return t==="true"?!0:t==="false"?!1:Number.isNaN(Number(t))?t:Number(t)}function YN({scenarios:e,scenarioOrigins:t,scenarioOverrides:n,agents:r,servers:s,configId:o,configPath:i,defaultAssistantAgentName:c,assistantInitialPromptByScenarioId:u,assistantAutoOpenNonceByScenarioId:f,testCaseReturnToPath:m,onChange:p,readOnly:v,allowAdd:x=!v,allowStructureEdits:j=!v}){const y=(C,k)=>{const A=e.map((E,P)=>P===C?{...E,...k}:E);p(A)},b=C=>p(e.filter((k,A)=>A!==C)),S=()=>p([...e,_ye()]),N=(C,k)=>{const A=C+k;if(A<0||A>=e.length)return;const E=[...e],[P]=E.splice(C,1);E.splice(A,0,P),p(E)};return a.jsxs("div",{className:v?"space-y-2":"space-y-4",children:[!v&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Scenarios"}),x&&j&&a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:S,children:[a.jsx(To,{className:"mr-1.5 h-3.5 w-3.5"}),"Add Scenario"]})]}),e.map((C,k)=>a.jsx(kye,{scenario:C,scenarioOrigin:t?.[k],hasMcpServerOverride:n?.[k],index:k,total:e.length,agents:r,servers:s,configId:o,configPath:i,defaultAssistantAgentName:c,assistantInitialPrompt:u?.[C.id],assistantAutoOpenNonce:f?.[C.id],testCaseReturnToPath:m,onUpdate:A=>y(k,A),onMoveUp:()=>N(k,-1),onMoveDown:()=>N(k,1),onRemove:()=>b(k),readOnly:v,allowStructureEdits:j},C.id)),e.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No scenarios configured. Add one to get started."})]})}function kye({scenario:e,scenarioOrigin:t,hasMcpServerOverride:n,index:r,total:s,agents:o,servers:i,configId:c,configPath:u,defaultAssistantAgentName:f,assistantInitialPrompt:m,assistantAutoOpenNonce:p,testCaseReturnToPath:v,onUpdate:x,onMoveUp:j,onMoveDown:y,onRemove:b,readOnly:S,allowStructureEdits:N}){const{source:C}=$n(),[k,A]=h.useState("required_tool"),[E,P]=h.useState(""),[T,$]=h.useState(""),[Y,H]=h.useState(""),[F,X]=h.useState(""),[L,I]=h.useState(""),[M,q]=h.useState(""),[G,O]=h.useState(""),[Q,B]=h.useState([]),[z,V]=h.useState(!1),[ee,ae]=h.useState(null),[ue,se]=h.useState(null),[xe,oe]=h.useState(!1),[de,De]=h.useState(null),[me,ge]=h.useState(""),[we,at]=h.useState(null),[tt,it]=h.useState(!1),[At,Ge]=h.useState(null),[Ee,Re]=h.useState(""),[Ze,ht]=h.useState(""),[Ft,zt]=h.useState(!1),[jt,rn]=h.useState(f||o[0]?.id||""),[an,qt]=h.useState(!1),[Zt,sn]=h.useState(null),[ln,ke]=h.useState(""),ze=h.useRef(null);function Xe(ie){if(!ie)return;const rt=Array.from(ie),Yt=new Array(rt.length).fill(null);let Pt=0,Lt=0;const tn=()=>{const ne=Yt.filter(Ne=>Ne!==null);ne.length>0?(x({attachments:[...e.attachments??[],...ne]}),Lt>0&&$e({title:`${Lt} file${Lt>1?"s":""} skipped`,description:"Unsupported file type. Images must be JPEG/PNG/GIF/WebP; documents must be PDF, TXT, MD, or CSV.",variant:"destructive"})):rt.length>0&&$e({title:"Could not attach files",description:Lt>0?"Unsupported file type. Images must be JPEG/PNG/GIF/WebP; documents must be PDF, TXT, MD, or CSV.":"Files could not be read.",variant:"destructive"})};rt.forEach((ne,Ne)=>{const pt=new FileReader;pt.onload=()=>{const Nt=pt.result,jn=Nt.indexOf(","),bn=jn>=0?Nt.slice(jn+1):"";if(bn){const nn=Nt.slice(0,jn).replace("data:","").replace(";base64",""),sr=nn.startsWith("image/");Cye(nn)?Yt[Ne]={type:sr?"image":"document",media_type:nn,data:bn,name:ne.name}:Lt++}++Pt===rt.length&&tn()},pt.onerror=()=>{++Pt===rt.length&&tn()},pt.readAsDataURL(ne)})}function kt(ie){x({attachments:(e.attachments??[]).filter((rt,Yt)=>Yt!==ie)})}const[vt,fe]=h.useState(null),[Oe,Ve]=h.useState(!S),U=ie=>{const rt=ie.target;rt&&(rt.closest("button, a, input, select, textarea, [role='button']")||Ve(Yt=>!Yt))},le=ie=>ie?e.evalRules.findIndex(rt=>rt===ie):-1,W=()=>{if(hm(k)){const Pt=T.trim();if(!Pt)return;let Lt;if(k==="tool_input_jsonpath"){const Ne=Y.trim();if(!Ne)return;const pt=fD(F);Lt={type:k,tool:Pt,path:Ne,...pt!==void 0?{equals:pt}:{}}}else{const Ne=E.trim();if(!Ne)return;Lt={type:k,tool:Pt,value:Ne}}const tn=[...e.evalRules],ne=le(de);ne>=0?tn[ne]=Lt:tn.push(Lt),x({evalRules:tn}),$(""),H(""),P(""),X(""),De(null),A("required_tool");return}if(k==="response_jsonpath"||k==="response_jsonpath_exists"||k==="response_jsonpath_not_exists"){const Pt=Y.trim();if(!Pt)return;if(k==="response_jsonpath"){const Lt=fD(F);x({evalRules:[...e.evalRules,{type:k,path:Pt,...Lt!==void 0?{equals:Lt}:{}}]})}else x({evalRules:[...e.evalRules,{type:k,path:Pt}]});H(""),X("");return}if(k==="agent_check"){const Pt=L.trim(),Lt=M.trim();if(!Pt||!Lt)return;const tn=[...e.evalRules],ne={type:"agent_check",label:Pt,prompt:Lt},Ne=le(ue);Ne>=0?tn[Ne]=ne:tn.push(ne),x({evalRules:tn}),I(""),q(""),se(null),oe(!1),A("required_tool");return}if(k==="tool_sequence"){const Pt=Q.map(Lt=>Lt.trim()).filter(Lt=>typeof Lt=="string"&&Lt.length>0);if(Pt.length===0)return;Ke(Pt);return}if(!E.trim())return;const ie=[...e.evalRules],rt={type:k,value:E.trim()},Yt=le(de);Yt>=0?ie[Yt]=rt:ie.push(rt),x({evalRules:ie}),P(""),ge(""),De(null),A("required_tool")},ye=()=>{const ie=G.trim();ie&&(B(rt=>[...rt,ie]),O(""))},ve=(ie,rt)=>{const Yt=ie+rt;B(Pt=>{if(Yt<0||Yt>=Pt.length)return Pt;const Lt=[...Pt],[tn]=Lt.splice(ie,1);return Lt.splice(Yt,0,tn),Lt})},Ce=ie=>{B(rt=>rt.filter((Yt,Pt)=>Pt!==ie))},_e=e.evalRules.findIndex(ie=>ie.type==="tool_sequence"),K=_e>=0?e.evalRules[_e]:void 0,pe=K?.type==="tool_sequence"?K.sequence??[]:[],Ae=_e>=0,Ke=ie=>{const rt=[...e.evalRules],Yt=ie.length>0?{type:"tool_sequence",sequence:ie}:null,Pt=le(ee),Lt=Pt>=0?Pt:_e;Lt>=0?Yt?rt[Lt]=Yt:rt.splice(Lt,1):Yt&&rt.push(Yt),x({evalRules:rt}),V(!1),B([]),O(""),ae(null),k==="tool_sequence"&&A("required_tool")};h.useEffect(()=>{z&&B(pe)},[z,_e,pe.join("|")]),h.useEffect(()=>{V(k==="tool_sequence")},[k]),h.useEffect(()=>{oe(k==="agent_check")},[k]),h.useEffect(()=>{ee&&le(ee)<0&&ae(null),ue&&le(ue)<0&&se(null),de&&le(de)<0&&De(null)},[e.evalRules,ee,ue,de]),h.useEffect(()=>{ee&&k!=="tool_sequence"&&ae(null),ue&&k!=="agent_check"&&se(null),de&&de.type!==k&&De(null)},[k,ee,ue,de]);const te=ie=>{const rt=e.evalRules.filter((Pt,Lt)=>Lt!==ie),Yt=rt.some(Pt=>Pt.type==="agent_check");x({evalRules:rt,agentContext:Yt?e.agentContext:void 0})},Le=["response_contains","response_not_contains","response_starts_with","response_ends_with","response_equals","response_regex","tool_input_contains","tool_input_regex","tool_input_jsonpath"],ot=()=>{!Ee.trim()||!Ze.trim()||(x({extractRules:[...e.extractRules,{name:Ee.trim(),pattern:Ze.trim()}]}),Re(""),ht(""))},Ut=ie=>{x({extractRules:e.extractRules.filter((rt,Yt)=>Yt!==ie)})},Te=ie=>{const rt=e.serverIds.includes(ie)?e.serverIds.filter(Yt=>Yt!==ie):[...e.serverIds,ie];x({serverIds:rt})},Qt={required_tool:"Required",forbidden_tool:"Forbidden",tool_sequence:"Sequence",tool_input_contains:"Input Contains",tool_input_regex:"Input Regex",tool_input_jsonpath:"Input JSONPath",response_contains:"Contains",response_not_contains:"Not Contains",response_starts_with:"Starts With",response_ends_with:"Ends With",response_equals:"Equals",response_regex:"Regex",response_jsonpath:"JSONPath",response_jsonpath_exists:"JSONPath Exists",response_jsonpath_not_exists:"JSONPath Not Exists",agent_check:"Agent"},St={required_tool:"border-sky-300/60 bg-sky-500/10 text-sky-700",forbidden_tool:"border-rose-300/60 bg-rose-500/10 text-rose-700",tool_sequence:"border-teal-300/60 bg-teal-500/10 text-teal-700",tool_input_contains:"border-blue-300/60 bg-blue-500/10 text-blue-700",tool_input_regex:"border-blue-300/60 bg-blue-500/10 text-blue-700",tool_input_jsonpath:"border-blue-300/60 bg-blue-500/10 text-blue-700",response_contains:"border-violet-300/60 bg-violet-500/10 text-violet-700",response_not_contains:"border-amber-300/60 bg-amber-500/10 text-amber-700",response_starts_with:"border-cyan-300/60 bg-cyan-500/10 text-cyan-700",response_ends_with:"border-indigo-300/60 bg-indigo-500/10 text-indigo-700",response_equals:"border-lime-300/60 bg-lime-500/10 text-lime-700",response_regex:"border-fuchsia-300/60 bg-fuchsia-500/10 text-fuchsia-700",response_jsonpath:"border-emerald-300/60 bg-emerald-500/10 text-emerald-700",response_jsonpath_exists:"border-green-300/60 bg-green-500/10 text-green-700",response_jsonpath_not_exists:"border-orange-300/60 bg-orange-500/10 text-orange-700",agent_check:"border-teal-300/60 bg-teal-500/10 text-teal-700"},Gt=k==="required_tool"||k==="forbidden_tool",Xn=hm(k),zn=k==="response_jsonpath"||k==="response_jsonpath_exists"||k==="response_jsonpath_not_exists",Ra=k==="tool_sequence"&&z,Xl=k==="agent_check"&&xe,Bn=e.serverIds.filter(ie=>i.some(rt=>rt.id===ie)),Li=o.map(ie=>ie.id).filter(Boolean),pa=Bn.length>0,[jr,io]=h.useState(""),[Fi,Wu]=h.useState(0);h.useEffect(()=>{const ie=(m??"").trim();ie&&jr!==ie&&(zt(!0),io(ie))},[m,jr]),h.useEffect(()=>{p&&p!==Fi&&(zt(!0),Wu(p))},[p,Fi]),h.useEffect(()=>{at(null),Ge(null),ge("")},[e.serverIds.join("|")]),h.useEffect(()=>{ge(""),H(""),X(""),O("")},[k]),h.useEffect(()=>{jt&&Li.includes(jt)||rn(f||o[0]?.id||"")},[jt,f,o,Li]);const En=async()=>{if(jt){qt(!0),sn(null);try{const ie=e.serverIds.filter(Yt=>i.find(Lt=>Lt.id===Yt)?.authType==="oauth2");await Po({serverNames:ie,source:C});const rt=await C.runScenarioPreview({selectedAgentName:jt,scenario:{id:e.id,name:e.name,prompt:e.prompt,serverNames:e.serverIds,attachments:e.attachments??[],evalRules:e.evalRules,extractRules:e.extractRules}});fe(rt)}catch(ie){sn(ie instanceof Error?ie.message:String(ie))}finally{qt(!1)}}},Hu=()=>{if(!vt)return;const ie=pD(e.evalRules,vt.run.failureReasons,vt.run.checkResults),rt=ie.length?ie.map(tn=>`${tn.status.toUpperCase()} - ${Aye(tn.rule)}${tn.failureReason?` (${tn.failureReason})`:""}`).join(`
129
+ `)},{label:"Improve Prompt Determinism",description:"Reduce ambiguity and improve reproducibility.",prompt:"Identify parts of this scenario's prompt or context that are ambiguous, open-ended, or likely to produce different results across runs. Suggest specific rewrites that make the expected behavior more deterministic — without changing the intent of what is being tested."},{label:"Generate Scenario Draft",description:"Create a draft scenario from the current context.",prompt:"Based on the current tool configuration and context, generate a complete scenario draft. Include a clear prompt, realistic expected tool calls with arguments, meaningful checks that validate the core behavior, and at least one value capture rule. Explain your choices so I can adjust them."}];function rq(e){if(Array.isArray(e.sequence))return e.sequence.map(n=>n.trim()).filter(Boolean);const t=typeof e.value=="string"?e.value.trim():"";return!t||t.toLowerCase()==="tool sequence"?[]:t.split(/\s*(?:->|,|\n)\s*/).map(n=>n.trim()).filter(Boolean)}function gye(e){const t=[];let n=0;for(const r of e){if(r.type==="tool_sequence"){const s=rq(r);s.length>0?t.push({type:"tool_sequence",sequence:s}):n+=1;continue}t.push(r)}return{rules:t,skippedToolSequences:n}}function vye(e){if(e.type==="tool_sequence"){const t=rq(e);return t.length>0?`Tool sequence · ${t.join(" -> ")}`:"Tool sequence · No tool steps"}return cx(e)}function xye({open:e,onOpenChange:t,configId:n,configPath:r,scenario:s,agents:o,servers:i,defaultAssistantAgentName:c,initialUserMessage:u,onApplyPatch:f}){const{source:m}=$n(),[p,v]=h.useState(null),[x,j]=h.useState(null),[y,b]=h.useState(""),[S,N]=h.useState(!1),[C,k]=h.useState(!1),[A,E]=h.useState(new Set),P=h.useRef(null),T=h.useRef(null),$=h.useRef(null),Y=h.useRef(null),H=h.useRef(0),[F,X]=h.useState(!1),L=h.useRef(!1),I=c||o[0]?.id||"",M=h.useCallback(()=>{const ge=Y.current;ge&&ge.controller.abort()},[]);h.useEffect(()=>{if(!e||!I||p)return;let ge=!1;return N(!0),(async()=>{const at=Array.from(new Set(s.serverIds.filter(it=>i.find(Ge=>Ge.id===it)?.authType==="oauth2")));await Po({serverNames:at,source:m});const tt=await m.createScenarioAssistantSession({configId:n,configPath:r,scenarioId:s.id,selectedAssistantAgentName:I,context:{scenario:{id:s.id,name:s.name,prompt:s.prompt,serverNames:s.serverIds,evalRules:s.evalRules,extractRules:s.extractRules},availableServers:i.map(it=>({name:it.name||it.id,url:it.url})),availableAgents:o.map(it=>({name:it.name||it.id,provider:it.provider,model:it.model}))}});ge||(v(tt.sessionId),G(tt.session),N(!1))})().catch(at=>{ge||$e({title:"Could not start Scenario Assistant",description:at instanceof Error?at.message:String(at),variant:"destructive"})}).finally(()=>{ge||N(!1)}),()=>{ge=!0}},[e,m,p,n,r,s,o,i,I]);const q=()=>{M(),v(null),j(null),b(""),E(new Set),$.current=null},G=h.useCallback(ge=>{j(we=>we&&we.messages.length>ge.messages.length?we:ge)},[]),O=h.useCallback(()=>{const ge=Y.current;ge&&(M(),b(ge.prompt),N(!1),k(!1))},[M]),Q=ge=>{q(),m.closeScenarioAssistantSession(ge).catch(()=>{})};h.useEffect(()=>{e||p&&(L.current||F||Q(p))},[e,p,m,F]),h.useEffect(()=>()=>{M(),p&&m.closeScenarioAssistantSession(p).catch(()=>{})},[M,p,m]),h.useEffect(()=>{if(!e)return;F&&X(!1),L.current&&(L.current=!1);const ge=window.setTimeout(()=>{P.current?.scrollIntoView({behavior:"smooth",block:"end"})},0);return()=>window.clearTimeout(ge)},[e,S,x?.messages.length,x?.pendingToolCalls.length,x?.warnings.length]),h.useEffect(()=>{const ge=T.current;if(!ge)return;ge.style.height="0px";const we=Math.min(ge.scrollHeight,160);ge.style.height=`${Math.max(40,we)}px`},[y,e]);const B=o.length>0&&s.serverIds.length>0&&!!I,z=async ge=>{if(!p)return;const we=ge.trim();if(!we)return;const at=++H.current,tt=new AbortController,it=`msg-local-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,At={id:it,role:"user",text:we,createdAt:new Date().toISOString()};Y.current={id:at,controller:tt,prompt:we},k(!0),j(Ge=>Ge&&{...Ge,messages:[...Ge.messages,At]}),b(""),N(!0);try{const Ge=await m.sendScenarioAssistantMessage(p,we,tt.signal);if(tt.signal.aborted||Y.current?.id!==at)return;G(Ge.session)}catch(Ge){if(VN(Ge)||tt.signal.aborted||Y.current?.id!==at)return;j(Ee=>Ee&&{...Ee,messages:Ee.messages.filter(Re=>Re.id!==it)}),b(Ee=>Ee.trim()?Ee:we),$e({title:"Scenario Assistant error",description:Ge instanceof Error?Ge.message:String(Ge),variant:"destructive"})}finally{Y.current?.id===at&&(Y.current=null,N(!1),k(!1))}},V=ge=>{b(ge),requestAnimationFrame(()=>T.current?.focus())};h.useEffect(()=>{if(!e||!p||!x||!B||Y.current)return;const ge=String(u??"").trim();ge&&$.current!==ge&&($.current=ge,z(ge))},[e,p,x,B,u]),h.useEffect(()=>{if(!(!e||!p||!x))return m.subscribeScenarioAssistantSessionEvents(p,ge=>{G(ge.payload.session)})},[e,p,m,G]);const ee=async ge=>{if(p){N(!0);try{const we=await m.approveScenarioAssistantToolCall(p,ge);G(we.session)}catch(we){$e({title:"Tool call failed",description:we instanceof Error?we.message:String(we),variant:"destructive"})}finally{N(!1)}}},ae=async ge=>{if(p){N(!0);try{const we=await m.denyScenarioAssistantToolCall(p,ge);G(we.session)}catch(we){$e({title:"Could not deny tool call",description:we instanceof Error?we.message:String(we),variant:"destructive"})}finally{N(!1)}}},ue=async()=>{if(p){N(!0);try{const ge=await m.approveAllScenarioAssistantToolCalls(p);G(ge.session)}catch(ge){$e({title:"Could not approve all tool calls",description:ge instanceof Error?ge.message:String(ge),variant:"destructive"})}finally{N(!1)}}},se=(ge,we,at,tt,it="replace")=>{if(!we)return;if(at==="prompt"&&we.prompt&&f({prompt:we.prompt.replacement}),at==="evalRules"&&we.evalRules){const Ge=gye(tt??we.evalRules.replacement);f({evalRules:it==="append"?[...s.evalRules,...Ge.rules]:Ge.rules}),Ge.skippedToolSequences>0&&$e({title:"Skipped invalid tool sequence",description:"The assistant suggested a sequence check without any tool steps.",variant:"destructive"})}if(at==="extractRules"&&we.extractRules&&f({extractRules:we.extractRules.replacement}),ge){const Ge=`${ge}:${at}`;E(Ee=>new Set([...Ee,Ge]))}$e({title:"Applied suggestion",description:`Updated ${{prompt:"Prompt",evalRules:"Checks",extractRules:"Value Capture Rules"}[at]}`})},xe=(ge,we,at,tt)=>{if(we?.extractRules){if(f({extractRules:tt==="append"?[...s.extractRules,...at]:at}),ge){const it=`${ge}:extractRules`;E(At=>new Set([...At,it]))}$e({title:"Applied suggestion",description:"Updated Value Capture Rules"})}},oe=()=>{const ge=document.activeElement;ge instanceof HTMLElement&&ge.blur()},de=ge=>{ge||(oe(),X(!1),L.current=!1),t(ge)},De=()=>{oe(),L.current=!0,X(!0),t(!1)},me=()=>{oe(),L.current=!1,X(!1),p&&Q(p)};return a.jsxs(a.Fragment,{children:[!e&&p&&a.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 rounded-md border bg-background px-3 py-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium",children:"Scenario Assistant (session active)"}),a.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:["Resume conversation for ",a.jsx("span",{className:"font-mono",children:s.id}),x?` · ${x.messages.length} messages`:""]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>t(!0),children:[a.jsx(sa,{className:"mr-1.5 h-3.5 w-3.5"}),"Resume"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-8 px-2 text-muted-foreground",onClick:me,"aria-label":"Discard assistant session",title:"Discard assistant session",children:a.jsx(ca,{className:"h-4 w-4"})})]})]}),a.jsx(Yxe,{open:e,onOpenChange:de,children:a.jsxs(L8,{className:"max-w-6xl h-[85vh] flex flex-col",children:[p&&a.jsxs("button",{type:"button",className:"absolute right-12 top-4 z-10 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",onClick:De,"aria-label":"Minimize assistant",title:"Minimize assistant",children:[a.jsx(OW,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Minimize"})]}),a.jsx(F8,{className:"pr-20",children:a.jsx("div",{className:"flex items-start justify-between gap-3",children:a.jsxs("div",{className:"min-w-0",children:[a.jsxs(z8,{className:"flex items-center gap-2",children:[a.jsx(sa,{className:"h-4 w-4"}),"Scenario Assistant"]}),a.jsx(B8,{children:"LLM-guided scenario authoring with MCP tool introspection and per-tool-call approval."})]})})}),B?a.jsxs("div",{className:"min-h-0 flex flex-1 flex-col gap-3",children:[a.jsx("div",{className:"grid gap-3 sm:grid-cols-1",children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"MCP Context"}),a.jsxs("div",{className:"h-8 rounded-md border px-2 text-xs flex items-center gap-2",children:[a.jsx(Ua,{className:"h-3.5 w-3.5"}),x?`Loaded ${x.toolsLoaded} tools`:"Preparing..."]})]})}),a.jsx(hk,{className:"min-h-0 flex-1 rounded-md border p-3",children:a.jsxs("div",{className:"space-y-3",children:[x?.warnings?.map((ge,we)=>a.jsx("div",{className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900",children:ge},`${ge}-${we}`)),x?.messages.map(ge=>a.jsxs(h.Fragment,{children:[(()=>{const we=ge.pendingToolCallIds??(ge.pendingToolCallId?[ge.pendingToolCallId]:[]),at=we.map(Ee=>(x?.pendingToolCalls??[]).find(Re=>Re.id===Ee)).filter(Ee=>!!Ee),tt=we.map(Ee=>x.pendingToolCalls.find(Re=>Re.id===Ee)??x.pendingToolCalls.find(Re=>Re.id===Ee)).filter(Boolean);if(!(ge.role==="assistant"&&we.length>0))return a.jsx("div",{className:"space-y-2",children:a.jsx(jye,{message:ge})});const At=at.length,Ge=tt.length-At;return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("div",{className:"w-full max-w-[92%] space-y-2",children:[tt.length>1&&At>0&&a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-amber-200 bg-amber-50/50 px-3 py-1.5",children:[a.jsxs("span",{className:"text-xs text-amber-900",children:[Ge," of ",tt.length," tool calls resolved"]}),a.jsxs(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:At===0,onClick:()=>{ue()},children:["Approve All (",At,")"]})]}),tt.map((Ee,Re)=>a.jsx(HN,{call:Ee,loading:S,description:Re===0?ge.text:void 0,onApprove:Ze=>{ee(Ze)},onDeny:Ze=>{ae(Ze)}},Ee.id))]})]})})(),ge.suggestions&&a.jsxs("div",{className:"ml-0 space-y-3 rounded-md border border-dashed bg-muted/10 p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[a.jsx(sa,{className:"h-3.5 w-3.5"}),"Structured Suggestions"]}),ge.suggestions.prompt&&a.jsx(yye,{title:"Prompt",rationale:ge.suggestions.prompt.rationale,preview:ge.suggestions.prompt.replacement,applied:A.has(`${ge.id}:prompt`),onApply:()=>se(ge.id,ge.suggestions,"prompt")}),ge.suggestions.evalRules&&a.jsx(bye,{rationale:ge.suggestions.evalRules.rationale,rules:ge.suggestions.evalRules.replacement,applied:A.has(`${ge.id}:evalRules`),onApply:we=>se(ge.id,ge.suggestions,"evalRules",we,"append"),onReplace:we=>se(ge.id,ge.suggestions,"evalRules",we,"replace")}),ge.suggestions.extractRules&&a.jsx(wye,{rationale:ge.suggestions.extractRules.rationale,rules:ge.suggestions.extractRules.replacement,applied:A.has(`${ge.id}:extractRules`),onApply:we=>xe(ge.id,ge.suggestions,we,"append"),onReplace:we=>xe(ge.id,ge.suggestions,we,"replace")}),(()=>{const we=ge.suggestions?.notes,at=Array.isArray(we)?we:typeof we=="string"?[we]:[];return at.length===0?null:a.jsxs("div",{className:"space-y-2 rounded-md border p-3",children:[a.jsx("h5",{className:"text-sm font-medium",children:"Notes"}),a.jsx("ul",{className:"space-y-1 text-xs text-muted-foreground list-disc pl-4",children:at.map((tt,it)=>a.jsx("li",{children:tt},`${ge.id}-note-${it}`))})]})})()]})]},ge.id)),(x?.pendingToolCalls??[]).filter(ge=>!(x?.messages??[]).some(we=>we.pendingToolCallId===ge.id||we.pendingToolCallIds?.includes(ge.id))).map(ge=>a.jsx(HN,{call:ge,loading:S,onApprove:we=>{ee(we)},onDeny:we=>{ae(we)}},ge.id)),!x&&S&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),"Starting assistant session..."]}),x&&S&&a.jsx(I8,{}),a.jsx("div",{ref:P})]})}),a.jsx($8,{input:y,onInputChange:b,onSend:()=>{z(y)},onCancel:p&&C?O:void 0,inputPlaceholder:"Get assistance with creating or refining this scenario ...",snippets:mye,snippetsLabel:"Scenario Assistant Snippets",onSnippetSelect:V,loading:S,disabled:!p,inputRef:T,snippetContentClassName:"w-[320px]"})]}):a.jsx("div",{className:"rounded-md border p-3 text-sm text-muted-foreground",children:"Scenario Assistant requires a configured assistant agent and at least one selected server on the scenario."})]})})]})}function yye({title:e,rationale:t,preview:n,applied:r=!1,onApply:s}){return a.jsxs("div",{className:`space-y-2 rounded-md border p-3 ${r?"border-emerald-300 bg-emerald-50/40":""}`,children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h5",{className:"text-sm font-medium",children:e})}),t&&a.jsx("p",{className:"text-xs text-muted-foreground",children:t}),a.jsx("pre",{className:"max-h-56 overflow-auto rounded bg-muted p-2 text-xs whitespace-pre-wrap",children:n}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Z,{type:"button",size:"sm",className:"h-8",variant:r?"secondary":"default",onClick:s,disabled:r,children:r?a.jsxs(a.Fragment,{children:[a.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5"}),"Applied"]}):"Apply"})})]})}function bye({rationale:e,rules:t,applied:n=!1,onApply:r,onReplace:s}){const[o,i]=h.useState(()=>new Set(t.map((p,v)=>v))),c=o.size,u=t.filter((p,v)=>o.has(v)),f=c===t.length,m=(p,v)=>{i(x=>{const j=new Set(x);return v?j.add(p):j.delete(p),j})};return a.jsxs("div",{className:`space-y-2 rounded-md border p-3 ${n?"border-emerald-300 bg-emerald-50/40":""}`,children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h5",{className:"text-sm font-medium",children:"Checks"})}),e&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e}),a.jsxs("div",{className:"space-y-2 rounded bg-muted/60 p-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[a.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[c," of ",t.length," selected"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-[11px]",disabled:n||t.length===0,onClick:()=>i(f?new Set:new Set(t.map((p,v)=>v))),children:f?"Unselect all":"Select all"})]}),t.map((p,v)=>{const x=vye(p),j=`scenario-assistant-check-${v}-${p.type}`;return a.jsxs("div",{className:"flex items-start gap-2 rounded bg-background p-2",children:[a.jsx(br,{id:j,checked:o.has(v),disabled:n,onCheckedChange:y=>m(v,y===!0),"aria-label":`Select ${x}`}),a.jsxs("label",{htmlFor:j,className:"min-w-0 flex-1 cursor-pointer space-y-1",children:[a.jsx("span",{className:"block text-xs font-medium",children:x}),a.jsx("code",{className:"block break-words rounded bg-muted px-1.5 py-1 text-[11px] text-muted-foreground",children:JSON.stringify(p)})]})]},`${p.type}-${v}`)})]}),a.jsx("div",{className:"flex justify-end gap-2",children:n?a.jsxs(Z,{type:"button",size:"sm",variant:"secondary",disabled:!0,children:[a.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5"}),"Applied"]}):a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",size:"sm",className:"h-8",variant:"outline",onClick:()=>s(u),disabled:c===0,children:"Replace all"}),a.jsx(Z,{type:"button",size:"sm",className:"h-8",onClick:()=>r(u),disabled:c===0,children:"Add selected"})]})})]})}function wye({rationale:e,rules:t,applied:n=!1,onApply:r,onReplace:s}){const[o,i]=h.useState(()=>new Set(t.map((p,v)=>v))),c=o.size,u=t.filter((p,v)=>o.has(v)),f=c===t.length,m=(p,v)=>{i(x=>{const j=new Set(x);return v?j.add(p):j.delete(p),j})};return a.jsxs("div",{className:`space-y-2 rounded-md border p-3 ${n?"border-emerald-300 bg-emerald-50/40":""}`,children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h5",{className:"text-sm font-medium",children:"Value Capture Rules"})}),e&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e}),a.jsxs("div",{className:"space-y-2 rounded bg-muted/60 p-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[a.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[c," of ",t.length," selected"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-[11px]",disabled:n||t.length===0,onClick:()=>i(f?new Set:new Set(t.map((p,v)=>v))),children:f?"Unselect all":"Select all"})]}),t.map((p,v)=>{const x=`${p.name} · ${p.pattern}`,j=`scenario-assistant-extract-${v}-${p.name}`;return a.jsxs("div",{className:"flex items-start gap-2 rounded bg-background p-2",children:[a.jsx(br,{id:j,checked:o.has(v),disabled:n,onCheckedChange:y=>m(v,y===!0),"aria-label":`Select ${x}`}),a.jsxs("label",{htmlFor:j,className:"min-w-0 flex-1 cursor-pointer space-y-1",children:[a.jsx("span",{className:"block text-xs font-medium",children:x}),a.jsx("code",{className:"block break-words rounded bg-muted px-1.5 py-1 text-[11px] text-muted-foreground",children:JSON.stringify(p)})]})]},`${p.name}-${v}`)})]}),a.jsx("div",{className:"flex justify-end gap-2",children:n?a.jsxs(Z,{type:"button",size:"sm",variant:"secondary",disabled:!0,children:[a.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5"}),"Applied"]}):a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",size:"sm",className:"h-8",variant:"outline",onClick:()=>s(u),disabled:c===0,children:"Replace all"}),a.jsx(Z,{type:"button",size:"sm",className:"h-8",onClick:()=>r(u),disabled:c===0,children:"Add selected"})]})})]})}function jye({message:e}){const t=async s=>{try{await navigator.clipboard.writeText(s),$e({title:"Copied"})}catch(o){$e({title:"Could not copy",description:o instanceof Error?o.message:String(o),variant:"destructive"})}},n=e.role==="user"||e.role==="assistant",r=e.role==="user";return a.jsx(M8,{message:e,assistantLabel:e.role==="assistant"?"Assistant":void 0,renderActions:n?a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:`absolute bottom-1 h-6 w-6 text-muted-foreground ${r?"-left-8":"-right-8"}`,onClick:()=>{t(e.text)},"aria-label":"Copy message",title:"Copy message",children:a.jsx(Hr,{className:"h-3.5 w-3.5"})}):void 0})}function ta(e){return typeof e=="number"?e.toLocaleString():"n/a"}function KN(e,t){const n=t?.nonPositiveLabel??"0s";if(!Number.isFinite(e)||e<=0)return n;const r=Math.floor(e),s=Math.floor(r/3600),o=Math.floor(r%3600/60),i=r%60;return s>0?`${s}h ${o}m ${i}s`:o>0?`${o}m ${i}s`:`${i}s`}function Sye({run:e,fallbackUserPrompt:t}){const[n,r]=h.useState(!0),[s,o]=h.useState(!1);return a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ss,{open:n,onOpenChange:r,children:a.jsxs("div",{className:"rounded-md border border-muted-foreground/20 bg-card p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsx("button",{type:"button",className:"mb-2 flex w-full items-center justify-between gap-2 text-left",children:a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${n?"rotate-180":""}`}),a.jsx(Wr,{className:"h-3.5 w-3.5"}),"Final answer"]})})}),a.jsx(Ns,{children:a.jsx(GN,{text:e.finalAnswer||"No final answer captured.",maxLength:1200,className:"text-xs text-foreground"})})]})}),a.jsx(Ss,{open:s,onOpenChange:o,children:a.jsxs("div",{className:"rounded-md border border-muted-foreground/20 bg-card p-2",children:[a.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${s?"rotate-180":""}`}),a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Conversation trace"})]})}),a.jsxs(et,{variant:"outline",className:"h-5 text-[10px]",children:[e.toolCalls.length," tool calls"]})]}),a.jsx(Ns,{children:a.jsx("div",{className:"space-y-2 rounded-md border bg-muted/20 p-2",children:e.conversation.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No conversation trace captured."}):e.conversation.map(i=>a.jsx(Nye,{item:i,fallbackUserPrompt:t},i.id))})})]})})]})}function Nye({item:e,fallbackUserPrompt:t}){if(e.kind==="tool_call"){const u=lD(e,"input");return a.jsx(uD,{variant:"call",title:`Tool call · ${e.toolName||"unknown"}${u}`,text:e.text})}if(e.kind==="tool_result"){const u=lD(e,"output"),f=e.ok?a.jsx(Va,{className:"h-3.5 w-3.5 text-emerald-700 dark:text-emerald-300"}):a.jsx(ll,{className:"h-3.5 w-3.5 text-rose-700 dark:text-rose-300"});return a.jsx(uD,{variant:e.ok?"result_ok":"result_error",title:`Tool result · ${e.toolName||"unknown"} · ${e.ok?"ok":"error"}${typeof e.durationMs=="number"?` · ${e.durationMs}ms`:""}${u}`,text:e.text,icon:f})}const n=e.kind==="user_prompt",r=cD(e.text,e.kind),s=t?cD(t,"user_prompt"):"",o=n&&!r&&s?s:r,i=n?"User prompt":e.kind==="assistant_final"?"Agent final":"Agent",c=n?Kc:Wr;return a.jsxs("div",{className:`flex items-start gap-2 text-xs ${n?"justify-end":"justify-start"}`,children:[!n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",children:a.jsx(c,{className:"h-3 w-3"})}),a.jsxs("div",{className:`max-w-[90%] rounded-md p-2 ${n?"bg-primary/10":"bg-muted/50"}`,children:[a.jsx("p",{className:`mb-1 text-[11px] font-semibold text-muted-foreground ${n?"text-right":""}`,children:i}),n?a.jsx(GN,{text:o,maxLength:280,className:"text-xs"}):a.jsx(GN,{text:o,maxLength:500,className:"text-xs"})]}),n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(c,{className:"h-3 w-3"})})]})}function lD(e,t){const n=t==="input"?e.estimatedTokens?.inputTokens:e.estimatedTokens?.outputTokens;return typeof n!="number"?"":` · estimated ${ta(n)} tokens`}function cD(e,t){const r=String(e??"").replace(/^\s+/,"");return t==="user_prompt"?r.replace(/^user:\s*/i,""):t==="assistant_final"||t==="assistant_thought"?r.replace(/^assistant:\s*/i,""):r}function uD({variant:e,title:t,text:n,icon:r}){const[s,o]=h.useState(!1),i={call:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",result_ok:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",result_error:"border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-300"};return a.jsx(Ss,{open:s,onOpenChange:o,children:a.jsxs("div",{className:`rounded-md border p-2 text-xs ${i[e]}`,children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[11px]",children:[r??a.jsx(Ua,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:t})]}),a.jsx("span",{className:"text-[11px] font-semibold",children:s?"Hide content":"Show content"})]})}),a.jsx(Ns,{children:a.jsx("p",{className:"mt-2 font-mono whitespace-pre-wrap text-foreground",children:n})})]})})}function GN({text:e,maxLength:t,className:n}){const[r,s]=h.useState(!1),o=e.length>t,i=r||!o?e:`${e.slice(0,t)}...`;return a.jsxs("div",{children:[a.jsx(Ga,{text:i,className:n}),o&&a.jsx("button",{type:"button",className:"mt-1 text-[11px] font-medium text-primary hover:underline",onClick:()=>s(c=>!c),children:r?"Show less":"Show all"})]})}const aq=["image/jpeg","image/png","image/gif","image/webp"],sq=["application/pdf","text/plain","text/markdown","text/csv"];function Cye(e){return aq.includes(e)||sq.includes(e)}function dD({value:e,onValueChange:t,className:n,hideToolSequence:r=!1}){return a.jsxs(Mn,{value:e,onValueChange:s=>t(s),children:[a.jsx(_n,{className:n,children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"required_tool",children:"Required Tool"}),a.jsx(ut,{value:"forbidden_tool",children:"Forbidden Tool"}),!r&&a.jsx(ut,{value:"tool_sequence",children:"Tool Sequence"}),a.jsx(ut,{value:"agent_check",children:"Judge Agent"}),a.jsx(ut,{value:"response_contains",children:"Text contains"}),a.jsx(ut,{value:"response_not_contains",children:"Text does not contain"}),a.jsx(ut,{value:"response_starts_with",children:"Text starts with"}),a.jsx(ut,{value:"response_ends_with",children:"Text ends with"}),a.jsx(ut,{value:"response_equals",children:"Text equals"}),a.jsx(ut,{value:"response_regex",children:"Text matches regex"}),a.jsx(ut,{value:"tool_input_contains",children:"Tool input contains"}),a.jsx(ut,{value:"tool_input_regex",children:"Tool input regex"}),a.jsx(ut,{value:"tool_input_jsonpath",children:"Tool input JSONPath"}),a.jsx(ut,{value:"response_jsonpath",children:"JSONPath (optional equals)"}),a.jsx(ut,{value:"response_jsonpath_exists",children:"JSONPath exists"}),a.jsx(ut,{value:"response_jsonpath_not_exists",children:"JSONPath not exists"})]})]})}const _ye=()=>({id:`scn-${Date.now()}`,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]});function oq(e){return Hxe(e).replace(/^Tool sequence · /,"")}function hm(e){return e.startsWith("tool_input_")}function fD(e){const t=e.trim();if(t)return t==="true"?!0:t==="false"?!1:Number.isNaN(Number(t))?t:Number(t)}function YN({scenarios:e,scenarioOrigins:t,scenarioOverrides:n,agents:r,servers:s,configId:o,configPath:i,defaultAssistantAgentName:c,assistantInitialPromptByScenarioId:u,assistantAutoOpenNonceByScenarioId:f,testCaseReturnToPath:m,onChange:p,readOnly:v,allowAdd:x=!v,allowStructureEdits:j=!v}){const y=(C,k)=>{const A=e.map((E,P)=>P===C?{...E,...k}:E);p(A)},b=C=>p(e.filter((k,A)=>A!==C)),S=()=>p([...e,_ye()]),N=(C,k)=>{const A=C+k;if(A<0||A>=e.length)return;const E=[...e],[P]=E.splice(C,1);E.splice(A,0,P),p(E)};return a.jsxs("div",{className:v?"space-y-2":"space-y-4",children:[!v&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Scenarios"}),x&&j&&a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:S,children:[a.jsx(To,{className:"mr-1.5 h-3.5 w-3.5"}),"Add Scenario"]})]}),e.map((C,k)=>a.jsx(kye,{scenario:C,scenarioOrigin:t?.[k],hasMcpServerOverride:n?.[k],index:k,total:e.length,agents:r,servers:s,configId:o,configPath:i,defaultAssistantAgentName:c,assistantInitialPrompt:u?.[C.id],assistantAutoOpenNonce:f?.[C.id],testCaseReturnToPath:m,onUpdate:A=>y(k,A),onMoveUp:()=>N(k,-1),onMoveDown:()=>N(k,1),onRemove:()=>b(k),readOnly:v,allowStructureEdits:j},C.id)),e.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No scenarios configured. Add one to get started."})]})}function kye({scenario:e,scenarioOrigin:t,hasMcpServerOverride:n,index:r,total:s,agents:o,servers:i,configId:c,configPath:u,defaultAssistantAgentName:f,assistantInitialPrompt:m,assistantAutoOpenNonce:p,testCaseReturnToPath:v,onUpdate:x,onMoveUp:j,onMoveDown:y,onRemove:b,readOnly:S,allowStructureEdits:N}){const{source:C}=$n(),[k,A]=h.useState("required_tool"),[E,P]=h.useState(""),[T,$]=h.useState(""),[Y,H]=h.useState(""),[F,X]=h.useState(""),[L,I]=h.useState(""),[M,q]=h.useState(""),[G,O]=h.useState(""),[Q,B]=h.useState([]),[z,V]=h.useState(!1),[ee,ae]=h.useState(null),[ue,se]=h.useState(null),[xe,oe]=h.useState(!1),[de,De]=h.useState(null),[me,ge]=h.useState(""),[we,at]=h.useState(null),[tt,it]=h.useState(!1),[At,Ge]=h.useState(null),[Ee,Re]=h.useState(""),[Ze,ht]=h.useState(""),[Ft,zt]=h.useState(!1),[jt,rn]=h.useState(f||o[0]?.id||""),[an,qt]=h.useState(!1),[Zt,sn]=h.useState(null),[ln,_e]=h.useState(""),ze=h.useRef(null);function Xe(ie){if(!ie)return;const rt=Array.from(ie),Yt=new Array(rt.length).fill(null);let Pt=0,Lt=0;const tn=()=>{const ne=Yt.filter(Ne=>Ne!==null);ne.length>0?(x({attachments:[...e.attachments??[],...ne]}),Lt>0&&$e({title:`${Lt} file${Lt>1?"s":""} skipped`,description:"Unsupported file type. Images must be JPEG/PNG/GIF/WebP; documents must be PDF, TXT, MD, or CSV.",variant:"destructive"})):rt.length>0&&$e({title:"Could not attach files",description:Lt>0?"Unsupported file type. Images must be JPEG/PNG/GIF/WebP; documents must be PDF, TXT, MD, or CSV.":"Files could not be read.",variant:"destructive"})};rt.forEach((ne,Ne)=>{const pt=new FileReader;pt.onload=()=>{const Nt=pt.result,jn=Nt.indexOf(","),bn=jn>=0?Nt.slice(jn+1):"";if(bn){const nn=Nt.slice(0,jn).replace("data:","").replace(";base64",""),sr=nn.startsWith("image/");Cye(nn)?Yt[Ne]={type:sr?"image":"document",media_type:nn,data:bn,name:ne.name}:Lt++}++Pt===rt.length&&tn()},pt.onerror=()=>{++Pt===rt.length&&tn()},pt.readAsDataURL(ne)})}function kt(ie){x({attachments:(e.attachments??[]).filter((rt,Yt)=>Yt!==ie)})}const[vt,fe]=h.useState(null),[Oe,Ve]=h.useState(!S),U=ie=>{const rt=ie.target;rt&&(rt.closest("button, a, input, select, textarea, [role='button']")||Ve(Yt=>!Yt))},le=ie=>ie?e.evalRules.findIndex(rt=>rt===ie):-1,W=()=>{if(hm(k)){const Pt=T.trim();if(!Pt)return;let Lt;if(k==="tool_input_jsonpath"){const Ne=Y.trim();if(!Ne)return;const pt=fD(F);Lt={type:k,tool:Pt,path:Ne,...pt!==void 0?{equals:pt}:{}}}else{const Ne=E.trim();if(!Ne)return;Lt={type:k,tool:Pt,value:Ne}}const tn=[...e.evalRules],ne=le(de);ne>=0?tn[ne]=Lt:tn.push(Lt),x({evalRules:tn}),$(""),H(""),P(""),X(""),De(null),A("required_tool");return}if(k==="response_jsonpath"||k==="response_jsonpath_exists"||k==="response_jsonpath_not_exists"){const Pt=Y.trim();if(!Pt)return;if(k==="response_jsonpath"){const Lt=fD(F);x({evalRules:[...e.evalRules,{type:k,path:Pt,...Lt!==void 0?{equals:Lt}:{}}]})}else x({evalRules:[...e.evalRules,{type:k,path:Pt}]});H(""),X("");return}if(k==="agent_check"){const Pt=L.trim(),Lt=M.trim();if(!Pt||!Lt)return;const tn=[...e.evalRules],ne={type:"agent_check",label:Pt,prompt:Lt},Ne=le(ue);Ne>=0?tn[Ne]=ne:tn.push(ne),x({evalRules:tn}),I(""),q(""),se(null),oe(!1),A("required_tool");return}if(k==="tool_sequence"){const Pt=Q.map(Lt=>Lt.trim()).filter(Lt=>typeof Lt=="string"&&Lt.length>0);if(Pt.length===0)return;Ke(Pt);return}if(!E.trim())return;const ie=[...e.evalRules],rt={type:k,value:E.trim()},Yt=le(de);Yt>=0?ie[Yt]=rt:ie.push(rt),x({evalRules:ie}),P(""),ge(""),De(null),A("required_tool")},ye=()=>{const ie=G.trim();ie&&(B(rt=>[...rt,ie]),O(""))},ve=(ie,rt)=>{const Yt=ie+rt;B(Pt=>{if(Yt<0||Yt>=Pt.length)return Pt;const Lt=[...Pt],[tn]=Lt.splice(ie,1);return Lt.splice(Yt,0,tn),Lt})},ke=ie=>{B(rt=>rt.filter((Yt,Pt)=>Pt!==ie))},Ce=e.evalRules.findIndex(ie=>ie.type==="tool_sequence"),K=Ce>=0?e.evalRules[Ce]:void 0,pe=K?.type==="tool_sequence"?K.sequence??[]:[],Ae=Ce>=0,Ke=ie=>{const rt=[...e.evalRules],Yt=ie.length>0?{type:"tool_sequence",sequence:ie}:null,Pt=le(ee),Lt=Pt>=0?Pt:Ce;Lt>=0?Yt?rt[Lt]=Yt:rt.splice(Lt,1):Yt&&rt.push(Yt),x({evalRules:rt}),V(!1),B([]),O(""),ae(null),k==="tool_sequence"&&A("required_tool")};h.useEffect(()=>{z&&B(pe)},[z,Ce,pe.join("|")]),h.useEffect(()=>{V(k==="tool_sequence")},[k]),h.useEffect(()=>{oe(k==="agent_check")},[k]),h.useEffect(()=>{ee&&le(ee)<0&&ae(null),ue&&le(ue)<0&&se(null),de&&le(de)<0&&De(null)},[e.evalRules,ee,ue,de]),h.useEffect(()=>{ee&&k!=="tool_sequence"&&ae(null),ue&&k!=="agent_check"&&se(null),de&&de.type!==k&&De(null)},[k,ee,ue,de]);const te=ie=>{const rt=e.evalRules.filter((Pt,Lt)=>Lt!==ie),Yt=rt.some(Pt=>Pt.type==="agent_check");x({evalRules:rt,agentContext:Yt?e.agentContext:void 0})},Le=["response_contains","response_not_contains","response_starts_with","response_ends_with","response_equals","response_regex","tool_input_contains","tool_input_regex","tool_input_jsonpath"],ot=()=>{!Ee.trim()||!Ze.trim()||(x({extractRules:[...e.extractRules,{name:Ee.trim(),pattern:Ze.trim()}]}),Re(""),ht(""))},Ut=ie=>{x({extractRules:e.extractRules.filter((rt,Yt)=>Yt!==ie)})},Te=ie=>{const rt=e.serverIds.includes(ie)?e.serverIds.filter(Yt=>Yt!==ie):[...e.serverIds,ie];x({serverIds:rt})},Qt={required_tool:"Required",forbidden_tool:"Forbidden",tool_sequence:"Sequence",tool_input_contains:"Input Contains",tool_input_regex:"Input Regex",tool_input_jsonpath:"Input JSONPath",response_contains:"Contains",response_not_contains:"Not Contains",response_starts_with:"Starts With",response_ends_with:"Ends With",response_equals:"Equals",response_regex:"Regex",response_jsonpath:"JSONPath",response_jsonpath_exists:"JSONPath Exists",response_jsonpath_not_exists:"JSONPath Not Exists",agent_check:"Agent"},St={required_tool:"border-sky-300/60 bg-sky-500/10 text-sky-700",forbidden_tool:"border-rose-300/60 bg-rose-500/10 text-rose-700",tool_sequence:"border-teal-300/60 bg-teal-500/10 text-teal-700",tool_input_contains:"border-blue-300/60 bg-blue-500/10 text-blue-700",tool_input_regex:"border-blue-300/60 bg-blue-500/10 text-blue-700",tool_input_jsonpath:"border-blue-300/60 bg-blue-500/10 text-blue-700",response_contains:"border-violet-300/60 bg-violet-500/10 text-violet-700",response_not_contains:"border-amber-300/60 bg-amber-500/10 text-amber-700",response_starts_with:"border-cyan-300/60 bg-cyan-500/10 text-cyan-700",response_ends_with:"border-indigo-300/60 bg-indigo-500/10 text-indigo-700",response_equals:"border-lime-300/60 bg-lime-500/10 text-lime-700",response_regex:"border-fuchsia-300/60 bg-fuchsia-500/10 text-fuchsia-700",response_jsonpath:"border-emerald-300/60 bg-emerald-500/10 text-emerald-700",response_jsonpath_exists:"border-green-300/60 bg-green-500/10 text-green-700",response_jsonpath_not_exists:"border-orange-300/60 bg-orange-500/10 text-orange-700",agent_check:"border-teal-300/60 bg-teal-500/10 text-teal-700"},Gt=k==="required_tool"||k==="forbidden_tool",Xn=hm(k),zn=k==="response_jsonpath"||k==="response_jsonpath_exists"||k==="response_jsonpath_not_exists",Ra=k==="tool_sequence"&&z,Xl=k==="agent_check"&&xe,Bn=e.serverIds.filter(ie=>i.some(rt=>rt.id===ie)),Li=o.map(ie=>ie.id).filter(Boolean),pa=Bn.length>0,[jr,io]=h.useState(""),[Fi,Wu]=h.useState(0);h.useEffect(()=>{const ie=(m??"").trim();ie&&jr!==ie&&(zt(!0),io(ie))},[m,jr]),h.useEffect(()=>{p&&p!==Fi&&(zt(!0),Wu(p))},[p,Fi]),h.useEffect(()=>{at(null),Ge(null),ge("")},[e.serverIds.join("|")]),h.useEffect(()=>{ge(""),H(""),X(""),O("")},[k]),h.useEffect(()=>{jt&&Li.includes(jt)||rn(f||o[0]?.id||"")},[jt,f,o,Li]);const En=async()=>{if(jt){qt(!0),sn(null);try{const ie=e.serverIds.filter(Yt=>i.find(Lt=>Lt.id===Yt)?.authType==="oauth2");await Po({serverNames:ie,source:C});const rt=await C.runScenarioPreview({selectedAgentName:jt,scenario:{id:e.id,name:e.name,prompt:e.prompt,serverNames:e.serverIds,attachments:e.attachments??[],evalRules:e.evalRules,extractRules:e.extractRules}});fe(rt)}catch(ie){sn(ie instanceof Error?ie.message:String(ie))}finally{qt(!1)}}},Hu=()=>{if(!vt)return;const ie=pD(e.evalRules,vt.run.failureReasons,vt.run.checkResults),rt=ie.length?ie.map(tn=>`${tn.status.toUpperCase()} - ${Aye(tn.rule)}${tn.failureReason?` (${tn.failureReason})`:""}`).join(`
130
130
  `):"No checks configured.",Yt=Object.keys(vt.run.extractedValues).length>0?Object.entries(vt.run.extractedValues).map(([tn,ne])=>`${tn}: ${String(ne)}`).join(`
131
131
  `):"No extracted values.",Pt=vt.run.toolCalls.length>0?vt.run.toolCalls.map((tn,ne)=>`${ne+1}. ${tn.name} (${tn.duration}ms)`).join(`
132
132
  `):"No tool calls.",Lt=[`I ran a prompt preview for scenario '${e.id}' and want you to suggest concrete updates.`,`Run ID: ${vt.runId}`,`Agent: ${vt.agentName}`,`Outcome: ${vt.run.passed?"passed":"failed"}`,`Duration: ${vt.run.duration}ms`,"","Current check outcomes:",rt,"","Tool sequence:",Pt,"","Extracted values:",Yt,"","Final answer:",vt.run.finalAnswer||"(empty)","","If the run has a meaningful ordered tool path, suggest a tool_sequence check using the raw tool names in the tool sequence order, even if other tools appear between them.","Use agent_check only for semantic or fuzzy validation;","Please propose concrete updates to the Prompt, Checks, and/or Value Capture Rules based on this preview."].join(`
133
- `);ke(Lt),zt(!0)},Vo=async()=>{if(!(!pa||S)){it(!0),Ge(null);try{const ie=Bn.filter(Yt=>i.find(Lt=>Lt.id===Yt)?.authType==="oauth2");await Po({serverNames:ie,source:C});const rt=new Set;for(const Yt of Bn){const Pt=await C.discoverToolsForAnalysis({serverNames:[Yt]});for(const Lt of Pt.servers)for(const tn of Lt.tools)rt.add(tn.name)}at(Array.from(rt).sort((Yt,Pt)=>Yt.localeCompare(Pt)))}catch(ie){Ge(ie instanceof Error?ie.message:"Failed to load tools")}finally{it(!1)}}};return a.jsx(Ss,{open:Oe,onOpenChange:Ve,children:a.jsxs(Qe,{className:S?"rounded-md border shadow-none":"border-dashed",children:[a.jsxs($t,{className:`${S?"px-3 py-3":"pb-3"} flex-row items-center justify-between space-y-0 cursor-pointer`,onClick:U,children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[!S&&a.jsx(Ba,{asChild:!0,children:a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${Oe?"rotate-0":"-rotate-90"}`})})}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[r+1,"."]}),a.jsx(Dt,{className:"truncate text-sm font-medium",children:e.name||`Scenario ${r+1}`}),S&&t==="referenced"&&a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 px-2 text-xs",asChild:!0,children:a.jsx(Et,{to:`/libraries/test-cases/${encodeURIComponent(e.id)}${v?`?returnTo=${encodeURIComponent(v)}`:""}`,children:"Edit test"})})]}),S?a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx(et,{variant:t==="inline"?"secondary":"outline",children:t==="referenced"?"Referenced":"Inline"}),n&&a.jsx(et,{variant:"secondary",children:"Override"}),a.jsx(Ba,{asChild:!0,children:a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-8 w-8","aria-label":Oe?"Collapse scenario details":"Expand scenario details",children:a.jsx(Jt,{className:`h-4 w-4 transition-transform ${Oe?"rotate-180":""}`})})})]}):N&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>zt(!0),title:o.length===0?"Add at least one agent in the config":e.serverIds.length===0?"Select at least one server for this scenario":"Open Scenario Assistant",children:[a.jsx(sa,{className:"h-3.5 w-3.5 text-amber-500"}),"Ask Assistant"]}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:j,disabled:r===0,"aria-label":"Move scenario up",children:a.jsx(_s,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:y,disabled:r===s-1,"aria-label":"Move scenario down",children:a.jsx(Jt,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:b,children:a.jsx(Xa,{className:"h-3.5 w-3.5 text-destructive"})})]})]}),a.jsx(Ns,{children:a.jsxs(Je,{className:"space-y-3",children:[a.jsx(xye,{open:Ft,onOpenChange:ie=>{zt(ie),ie||ke("")},configId:c,configPath:u,scenario:e,agents:o,servers:i,defaultAssistantAgentName:f,initialUserMessage:ln||m,onApplyPatch:ie=>x({...ie.prompt!==void 0?{prompt:ie.prompt}:{},...ie.evalRules!==void 0?{evalRules:ie.evalRules}:{},...ie.extractRules!==void 0?{extractRules:ie.extractRules}:{}})}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Name"}),a.jsx(_t,{value:e.name,onChange:ie=>x({name:ie.target.value}),disabled:S,placeholder:"e.g. List directory"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Servers"}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.map(ie=>a.jsx(et,{variant:e.serverIds.includes(ie.id)?"default":"outline",className:`cursor-pointer text-xs ${e.serverIds.includes(ie.id)?"":"opacity-50"}`,onClick:()=>!S&&Te(ie.id),children:ie.name||ie.id},ie.id)),i.length===0&&a.jsx("span",{className:"text-xs text-muted-foreground",children:"Add servers above first"})]})]}),a.jsxs(Qe,{className:"border bg-card",children:[a.jsxs($t,{className:"pb-2",children:[a.jsx(Dt,{className:"text-sm",children:"Prompt"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"The instruction sent to the agent for this scenario. Be explicit about the task, expected output, and constraints."})]}),a.jsxs(Je,{className:"space-y-3 pt-0",children:[a.jsx(Ts,{value:e.prompt,onChange:ie=>x({prompt:ie.target.value}),disabled:S,placeholder:"The prompt to send to the agent...",rows:4,className:"text-xs"}),a.jsxs("div",{children:[a.jsx("input",{ref:ze,type:"file",accept:[...aq,...sq,".md"].join(","),multiple:!0,className:"hidden",onChange:ie=>Xe(ie.target.files)}),(e.attachments?.length??0)>0?a.jsxs("div",{className:"flex flex-wrap items-start gap-2",children:[e.attachments?.map((ie,rt)=>a.jsxs("div",{className:"group relative",title:`${ie.name??`attachment ${rt+1}`}`,children:[a.jsx("div",{className:"flex h-16 w-16 items-center justify-center overflow-hidden rounded border bg-muted",children:ie.type==="image"?a.jsx("img",{src:`data:${ie.media_type};base64,${ie.data}`,alt:ie.name??`attachment ${rt+1}`,className:"h-full w-full object-cover"}):a.jsx(GS,{className:"h-6 w-6 text-muted-foreground"})}),ie.name&&a.jsx("p",{className:"mt-0.5 max-w-[64px] truncate text-center text-xs text-muted-foreground",children:ie.name}),!S&&a.jsx("button",{type:"button",onClick:()=>kt(rt),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full bg-destructive text-destructive-foreground group-hover:flex","aria-label":"Remove attachment",children:a.jsx(ca,{className:"h-2.5 w-2.5"})})]},rt)),!S&&a.jsx("button",{type:"button",onClick:()=>ze.current?.click(),className:"flex h-16 w-16 items-center justify-center self-start rounded border border-dashed text-muted-foreground hover:border-foreground hover:text-foreground","aria-label":"Attach file",title:"Attach file (image or document)",children:a.jsx(iP,{className:"h-4 w-4"})})]}):!S&&a.jsxs("button",{type:"button",onClick:()=>ze.current?.click(),className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[a.jsx(iP,{className:"h-3.5 w-3.5"}),"Attach file"]})]})]})]}),!S&&a.jsxs(Qe,{className:"border bg-muted/20",children:[a.jsxs($t,{className:"pb-2",children:[a.jsx(Dt,{className:"text-sm",children:"Run Prompt Preview"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Execute the current draft prompt once and inspect final answer, conversation trace, tool calls, and check outcomes."})]}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Agent"}),a.jsxs(Mn,{value:jt,onValueChange:rn,children:[a.jsx(_n,{className:"h-8 text-xs",children:a.jsx(In,{placeholder:"Select agent"})}),a.jsx(kn,{children:o.map(ie=>a.jsx(ut,{value:ie.id,children:ie.name||ie.id},ie.id))})]})]}),a.jsx("div",{className:"flex items-end",children:a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1.5 px-2 text-xs",onClick:()=>{En()},disabled:an||!jt||!e.prompt.trim()||e.serverIds.length===0,children:an?a.jsxs(a.Fragment,{children:[a.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}),"Running..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ks,{className:"h-3.5 w-3.5"}),"Run Prompt"]})})})]}),!e.prompt.trim()&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Add a prompt to run preview."}),e.serverIds.length===0&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Select at least one server to run preview."}),Zt&&a.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:Zt}),vt&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[a.jsx(et,{variant:vt.run.passed?"default":"destructive",children:vt.run.passed?"Passed":"Failed"}),a.jsxs(et,{variant:"outline",children:[vt.run.duration,"ms"]}),a.jsxs(et,{variant:"outline",children:[vt.run.toolCalls.length," tool calls"]}),a.jsx(et,{variant:"outline",className:"font-mono",children:vt.agentName}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"ml-auto h-6 gap-1.5 px-2 text-[11px]",onClick:Hu,children:[a.jsx(sa,{className:"h-3.5 w-3.5 text-amber-500"}),"Send to Assistant"]})]}),e.evalRules.length===0?a.jsxs("div",{className:"rounded-md border bg-muted/20 p-2",children:[a.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Check results"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"No checks configured for this scenario."})]}):(()=>{const ie=pD(e.evalRules,vt.run.failureReasons,vt.run.checkResults),rt=ie.filter(Pt=>Pt.status==="passed"),Yt=ie.filter(Pt=>Pt.status==="failed");return a.jsxs("div",{className:"rounded-md border bg-muted/20 p-2",children:[a.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Checks"}),a.jsxs(et,{variant:"outline",className:"h-5 border-success/30 bg-success/10 text-success text-[10px]",children:[rt.length," passed"]}),a.jsxs(et,{variant:"outline",className:`h-5 text-[10px] ${Yt.length>0?"border-destructive/30 bg-destructive/10 text-destructive":""}`,children:[Yt.length," failed"]})]}),a.jsx("div",{className:"space-y-1",children:ie.map((Pt,Lt)=>a.jsxs("div",{className:`flex items-start justify-between gap-2 rounded-md border px-2 py-1.5 text-xs ${Pt.status==="failed"?"border-destructive/20 bg-destructive/5":"border-success/20 bg-success/5"}`,children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[Pt.status==="failed"?a.jsx(ll,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):a.jsx(Va,{className:"h-3.5 w-3.5 shrink-0 text-success"}),a.jsx("span",{className:"font-medium",children:Eye(Pt.rule)})]}),Pt.failureReason&&a.jsx("p",{className:"mt-1 pl-5 text-[11px] text-muted-foreground",children:Pye(Pt.failureReason)})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${Pt.status==="failed"?"border-destructive/30 text-destructive":"border-success/30 text-success"}`,children:Pt.status})]},`${e.id}-preview-check-${Lt}`))})]})})(),vt.run.failureReasons.length>0&&a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2",children:[a.jsx("p",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-destructive",children:"Check failures"}),a.jsx("ul",{className:"list-disc space-y-1 pl-4 text-xs text-destructive",children:vt.run.failureReasons.map((ie,rt)=>a.jsx("li",{children:ie},`${vt.runId}-failure-${rt}`))})]}),Object.keys(vt.run.extractedValues).length>0&&a.jsxs("div",{className:"rounded-md border bg-background p-2",children:[a.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Extracted values"}),a.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:Object.entries(vt.run.extractedValues).map(([ie,rt])=>a.jsxs("div",{className:"rounded border bg-muted/20 px-2 py-1 text-xs",children:[a.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:ie}),a.jsx("div",{className:"break-all",children:String(rt)})]},ie))})]}),a.jsx(Sye,{run:vt.run,fallbackUserPrompt:e.prompt})]})]})]}),a.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[a.jsxs(Qe,{className:"border bg-muted/20",children:[a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Dt,{className:"text-sm",children:"Checks"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Checks determine pass/fail for the scenario. Add tool checks or text pattern checks for the final answer."})]}),!S&&a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs shrink-0",onClick:()=>zt(!0),title:"Ask for help improving checks",children:[a.jsx(sa,{className:"h-3.5 w-3.5 text-amber-500"}),"Ask Assistant"]})})]})}),a.jsx(Je,{className:"space-y-2",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{className:"text-xs",children:"Checks (pass / fail)"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"These determine whether the scenario passes. Add tool checks (required/forbidden) or text pattern checks for the final answer."}),a.jsx("div",{className:"space-y-1.5",children:e.evalRules.length===0?a.jsx("p",{className:"rounded-md border border-dashed bg-background/60 px-2 py-2 text-xs text-muted-foreground",children:"No checks yet. Add tool checks or text pattern checks below."}):e.evalRules.map((ie,rt)=>a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-md border bg-background px-2 py-2 text-xs",children:[a.jsx("div",{className:"min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`rounded-full border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${St[ie.type]}`,children:Qt[ie.type]}),ie.type==="agent_check"?a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium leading-tight",children:ie.label||"Unnamed check"}),ie.prompt&&a.jsx("div",{className:"mt-0.5 break-words text-[11px] leading-snug text-muted-foreground",children:ie.prompt})]}):ie.type==="tool_sequence"?a.jsx("span",{className:"font-mono break-all",children:oq(ie.sequence??[])}):hm(ie.type)?a.jsx("span",{className:"font-mono break-all",children:ie.type==="tool_input_contains"?`${ie.tool} contains ${String(ie.value)}`:ie.type==="tool_input_regex"?`${ie.tool} matches ${String(ie.value)}`:`${ie.tool} · ${ie.path} · ${ie.equals!==void 0?`== ${String(ie.equals)}`:"exists"}`}):a.jsx("span",{className:"font-mono break-all",children:ie.path?ie.equals!==void 0?`${ie.path} == ${String(ie.equals)}`:ie.path:ie.value})]})}),!S&&a.jsxs("div",{className:"flex items-center gap-1",children:[(ie.type==="tool_sequence"||ie.type==="agent_check"||Le.includes(ie.type))&&a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-[11px]",onClick:()=>{if(ie.type==="tool_sequence"){A("tool_sequence"),B(ie.sequence??[]),ae(ie),V(!0);return}if(ie.type==="agent_check"){A("agent_check"),se(ie),I(ie.label??""),q(ie.prompt??""),oe(!0);return}A(ie.type),De(ie),P(String(ie.value??"")),$(ie.tool??""),H(ie.path??""),X(ie.equals!==void 0?String(ie.equals):"")},"aria-label":`Edit check ${rt+1}`,children:a.jsx(LW,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>te(rt),"aria-label":`Remove check ${rt+1}`,children:a.jsx(ca,{className:"h-3.5 w-3.5"})})]})]},rt))}),!S&&a.jsxs("div",{className:"space-y-2",children:[Xl?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx(dD,{value:k,onValueChange:A,className:"h-8 w-[14.5rem] shrink-0 text-xs"}),a.jsx(_t,{value:L,onChange:ie=>I(ie.target.value),placeholder:"Prompt name",className:"h-8 text-xs"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:W,children:ue!==null?"Update check":"Add check"})]}),a.jsx(Ts,{value:M,onChange:ie=>q(ie.target.value),placeholder:"Judge prompt. Example: Confirm the answer includes a valid earliest and latest timestamp range, and that neither is 'Not available'.",className:"min-h-[64px] text-xs"})]}):a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx(dD,{value:k,onValueChange:A,className:"h-8 w-[14.5rem] shrink-0 text-xs",hideToolSequence:Ae&&k!=="tool_sequence"}),zn?a.jsxs(a.Fragment,{children:[a.jsx(_t,{value:Y,onChange:ie=>H(ie.target.value),placeholder:"JSONPath (e.g. $.status)",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),W())}),k==="response_jsonpath"&&a.jsx(_t,{value:F,onChange:ie=>X(ie.target.value),placeholder:"Equals (optional)",className:"h-8 w-[12rem] text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),W())})]}):Xn?a.jsxs(a.Fragment,{children:[we&&we.length>0?a.jsxs(Mn,{value:T,onValueChange:$,children:[a.jsx(_n,{className:"h-8 text-xs font-mono",children:a.jsx(In,{placeholder:"Select tool"})}),a.jsx(kn,{children:we.map(ie=>a.jsx(ut,{value:ie,children:ie},ie))})]}):a.jsx(_t,{value:T,onChange:ie=>$(ie.target.value),placeholder:"Tool name",className:"h-8 text-xs font-mono"}),k==="tool_input_jsonpath"&&a.jsx(_t,{value:Y,onChange:ie=>H(ie.target.value),placeholder:"JSONPath (e.g. $.query)",className:"h-8 text-xs font-mono"}),k==="tool_input_jsonpath"?a.jsx(_t,{value:F,onChange:ie=>X(ie.target.value),placeholder:"Equals (optional)",className:"h-8 w-[10rem] text-xs font-mono"}):a.jsx(_t,{value:E,onChange:ie=>P(ie.target.value),placeholder:k==="tool_input_regex"?"Regex pattern":"Text present in input",className:"h-8 w-[10rem] text-xs font-mono"})]}):Ra?a.jsxs("div",{className:"min-w-0 flex-1 flex items-end gap-2",children:[a.jsx(_t,{value:G,onChange:ie=>O(ie.target.value),placeholder:"Tool name",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),ye())}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:ye,children:"Add step"})]}):a.jsx(_t,{value:E,onChange:ie=>P(ie.target.value),placeholder:"Value",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),W())}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:W,children:de!==null?"Update check":"Add"})]}),Ra&&a.jsxs("div",{className:"space-y-2 rounded-md border bg-background px-2 py-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Sequence steps"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Require these tools in order. Other tools may appear between them."})]}),!S&&Q.length>0&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-[11px]",onClick:()=>B([]),children:"Clear"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-[11px]",onClick:()=>Ke(Q),children:Ae?"Update sequence":"Add sequence"})]})]}),Q.length===0?a.jsx("p",{className:"rounded-md border border-dashed bg-muted/20 px-2 py-2 text-xs text-muted-foreground",children:"No ordered tool sequence yet."}):a.jsx("div",{className:"space-y-1.5",children:Q.map((ie,rt)=>a.jsxs("div",{className:"flex items-center gap-2 rounded-md border bg-muted/10 px-2 py-1.5",children:[a.jsxs("span",{className:"text-xs font-medium",children:[rt+1,"."]}),a.jsx("span",{className:"min-w-0 flex-1 font-mono text-xs break-all",children:ie}),!S&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ve(rt,-1),disabled:rt===0,"aria-label":`Move tool ${rt+1} up`,children:a.jsx(_s,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ve(rt,1),disabled:rt===Q.length-1,"aria-label":`Move tool ${rt+1} down`,children:a.jsx(Jt,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>Ce(rt),"aria-label":`Remove tool ${rt+1}`,children:a.jsx(ca,{className:"h-3.5 w-3.5"})})]})]},`${e.id}-tool-sequence-draft-${rt}`))})]}),Gt&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx(We,{className:"mb-1 block text-[11px] text-muted-foreground",children:"Pick from selected server tools (optional)"}),a.jsxs(Mn,{value:me,onValueChange:ie=>{ge(ie),P(ie)},disabled:tt||!we||we.length===0,children:[a.jsx(_n,{className:"h-8 text-xs",children:a.jsx(In,{placeholder:tt?"Loading tools...":we&&we.length>0?"Select tool to insert in value field":"Load tools first"})}),a.jsx(kn,{children:(we??[]).map(ie=>a.jsx(ut,{value:ie,children:ie},ie))})]})]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:Vo,disabled:!pa||tt,children:tt?"Loading...":we?"Refresh tools":"Load tools"})]}),!pa&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Select at least one server in this scenario to load tool names."}),At&&a.jsxs("p",{className:"text-[11px] text-destructive",children:["Could not load tools: ",At]})]})]})]})})]}),a.jsxs(Qe,{className:"border bg-muted/10",children:[a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Dt,{className:"text-sm",children:"Value Capture Rules"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Formerly “Extract Rules”. These do not fail the run. They capture structured values from the final answer for reporting and comparisons."})]}),!S&&a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs shrink-0",onClick:()=>zt(!0),title:"Ask for help improving value capture rules",children:[a.jsx(sa,{className:"h-3.5 w-3.5 text-amber-500"}),"Ask Assistant"]})]})}),a.jsx(Je,{className:"space-y-2",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{className:"text-xs",children:"Value Capture Rules"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use regex patterns to capture values like max concentration, product names, date ranges, or IDs from the final answer text."}),a.jsx("div",{className:"space-y-1.5",children:e.extractRules.length===0?a.jsx("p",{className:"w-full rounded-md border border-dashed bg-background/60 px-2 py-2 text-xs text-muted-foreground",children:"No value capture rules yet. Add one below to capture structured output from the final answer."}):e.extractRules.map((ie,rt)=>a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border bg-background px-2 py-2 text-xs",children:[a.jsx("div",{className:"min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"rounded-full border border-violet-300/60 bg-violet-500/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-violet-700",children:ie.name}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground",children:"regex:"}),a.jsx("code",{className:"font-mono break-all text-foreground",children:ie.pattern})]})}),!S&&a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>Ut(rt),"aria-label":`Remove value capture rule ${rt+1}`,children:a.jsx(ca,{className:"h-3.5 w-3.5"})})]},rt))}),!S&&a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx(_t,{value:Ee,onChange:ie=>Re(ie.target.value),placeholder:"Field name",className:"h-8 text-xs w-36"}),a.jsx(_t,{value:Ze,onChange:ie=>ht(ie.target.value),placeholder:"Regex pattern",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),ot())}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:ot,children:"Add"})]})]})})]})]}),e.evalRules.some(ie=>ie.type==="agent_check")&&a.jsxs(Qe,{className:"border bg-muted/10",children:[a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx(Dt,{className:"text-sm",children:"Judge context"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Extra context is shared across all judge checks in this scenario and sent once in the batched judge request."})]})}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(br,{id:`judge-ctx-prompt-${e.id}`,checked:e.agentContext?.include_prompt??!1,disabled:S,className:"mt-0.5",onCheckedChange:ie=>{x({agentContext:{...e.agentContext,include_prompt:ie===!0}})}}),a.jsxs("div",{children:[a.jsx(We,{htmlFor:`judge-ctx-prompt-${e.id}`,className:"cursor-pointer text-xs font-medium",children:"Include prompt"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sends the scenario prompt so the judge can verify the answer addresses the original question."})]})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(br,{id:`judge-ctx-tools-${e.id}`,checked:e.agentContext?.include_tool_sequence??!1,disabled:S,className:"mt-0.5",onCheckedChange:ie=>{x({agentContext:{...e.agentContext,include_tool_sequence:ie===!0}})}}),a.jsxs("div",{children:[a.jsx(We,{htmlFor:`judge-ctx-tools-${e.id}`,className:"cursor-pointer text-xs font-medium",children:"Include tool sequence"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sends the list of called tool names so the judge can reason about which tools were used."})]})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(br,{id:`judge-ctx-inputs-${e.id}`,checked:e.agentContext?.include_tool_inputs??!1,disabled:S,className:"mt-0.5",onCheckedChange:ie=>{x({agentContext:{...e.agentContext,include_tool_inputs:ie===!0}})}}),a.jsxs("div",{children:[a.jsx(We,{htmlFor:`judge-ctx-inputs-${e.id}`,className:"cursor-pointer text-xs font-medium",children:"Include tool inputs"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sends the called MCP tools and their arguments so the judge can verify how the tools were used."})]})]})]})]})]})})]})})}function pD(e,t,n){return nq({evalRules:e,failureReasons:t,checkResults:n})}function Aye(e){return e.type==="agent_check"?`${e.type}: ${e.label??""} — ${e.prompt??""}`:e.type==="tool_sequence"?`${e.type}: ${oq(e.sequence??[])}`:hm(e.type)?`${e.type}: ${e.tool??""}: ${hD(e)}`:e.path?`${e.type}: ${hD(e)}`:`${e.type}: ${e.value??""}`}function hD(e){return e.path?e.equals!==void 0?`${e.path} == ${String(e.equals)}`:e.path:String(e.value??"")}const Eye=cx;function Pye(e){const t=String(e??"").trim(),n=t.match(/^Regex assertion failed:\s*(.+)$/i);return n?`Text match failed: ${n[1]}`:t}function iq(e){const t=e.name?.trim()||e.id||"Server",n=e.authValue?.trim()||"",r=e.oauthTokenUrl?.trim()||"";return e.authType==="bearer"&&n.length===0?`${t}: bearer token is required.`:e.authType==="api-key"&&r.length===0&&n.length===0?`${t}: API key value is required.`:null}const Pg=0;function Xf(e){return e??Pg}const Rye=()=>({id:`cfg-${Date.now()}`,name:"",configName:"",description:"",servers:[],serverEntries:[],agents:[],agentEntries:[],scenarios:[],scenarioEntries:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),mD=()=>{const{id:e,tab:t}=Bl(),n=Kr(),r=is(),[s,o]=zo(),{getConfig:i,addConfig:c,updateConfig:u,loading:f}=up(),{source:m}=$n(),{servers:p,agents:v,scenarios:x}=Is(),j=e==="new",y=!j&&!!e,b=y?i(e):void 0,[S,N]=h.useState(j||t==="edit"),[C,k]=h.useState(()=>b?structuredClone(b):Rye()),[A,E]=h.useState(""),[P,T]=h.useState(""),[$,Y]=h.useState({}),[H,F]=h.useState({}),[X,L]=h.useState({}),I=h.useMemo(()=>{const K=t||s.get("tab");return K==="agents"||K==="scenarios"?K:"scenarios"},[t,s]),M=`${n.pathname}${n.search}`;h.useEffect(()=>{b&&!S&&k(structuredClone(b))},[b,S]),h.useEffect(()=>{t==="edit"&&!j&&N(!0)},[t,j]);const q=K=>k(pe=>({...pe,...K})),G=h.useMemo(()=>C.serverEntries&&C.serverEntries.length>0?C.serverEntries:(C.servers??[]).map(K=>({kind:"inline",server:K})),[C.serverEntries,C.servers]),O=h.useMemo(()=>C.scenarioEntries&&C.scenarioEntries.length>0?C.scenarioEntries:C.scenarios.map(K=>({kind:"inline",scenario:K})),[C.scenarioEntries,C.scenarios]),Q=K=>{q({scenarioEntries:K,scenarios:K.filter(pe=>pe.kind==="inline").map(pe=>pe.scenario)})},B=h.useMemo(()=>C.agentEntries&&C.agentEntries.length>0?C.agentEntries:C.agents.map(K=>({kind:"inline",agent:K})),[C.agentEntries,C.agents]),z=K=>{q({agentEntries:K,agents:K.filter(pe=>pe.kind==="inline").map(pe=>pe.agent)})},V=!S,ee=C.runDefaults?.selectedAgentNames??[],ae=async()=>{if(!C.name.trim()){$e({title:"Validation Error",description:"Config ID is required.",variant:"destructive"});return}const K=G.map(Te=>Te.kind==="referenced"?{kind:"referenced",ref:p.find(St=>St.id===Te.ref)?.id||Te.ref}:Te),pe=B.map(Te=>Te.kind==="referenced"?{kind:"referenced",ref:v.find(St=>St.id===Te.ref)?.id||Te.ref}:Te),Ae=O.map(Te=>{if(Te.kind==="referenced"){const Qt=x.find(Gt=>Gt.id===Te.ref),St=(Te.mcpServers??[]).map(Gt=>Gt.kind==="referenced"?{kind:"referenced",ref:p.find(zn=>zn.id===Gt.ref)?.id||Gt.ref}:Gt);return{kind:"referenced",ref:Qt?.id||Te.ref,...Te.mcpServers!==void 0?{mcpServers:St}:{}}}return Te}),Ke=K.filter(Te=>Te.kind==="inline").map(Te=>({server:Te.server,error:iq(Te.server)})).find(Te=>!!Te.error);if(Ke?.error){$e({title:"Validation Error",description:Ke.error,variant:"destructive"});return}if(Ae.filter(Te=>Te.kind==="inline").some(Te=>!Te.scenario.name?.trim())){$e({title:"Validation Error",description:"Inline scenarios must have a name before saving.",variant:"destructive"});return}const Le=new Set(pe.map(Te=>Te.kind==="inline"?Te.agent.id:Te.ref)),ot=(C.runDefaults?.selectedAgentNames??[]).filter(Te=>Le.has(Te)),Ut={...C,serverEntries:K,servers:K.filter(Te=>Te.kind==="inline").map(Te=>Te.server),agentEntries:pe,agents:pe.filter(Te=>Te.kind==="inline").map(Te=>Te.agent),scenarioEntries:Ae,scenarios:Ae.filter(Te=>Te.kind==="inline").map(Te=>Te.scenario),runDefaults:ot.length>0?{...C.runDefaults??{},selectedAgentNames:ot}:void 0,updatedAt:new Date().toISOString()};if(j){const Te=await c(Ut);k(Te);const Qt=Hn(Te.configName,Hn(Te.name,Te.id));$e({title:"MCP Evaluation Created",description:`"${Qt}" has been saved.`}),r(`/mcp-evaluations/${Te.id}`)}else{const Te=await u(C.id,Ut);k(Te);const Qt=Hn(Te.configName,Hn(Te.name,Te.id));$e({title:"MCP Evaluation Updated",description:`"${Qt}" has been updated.`}),N(!1),r(`/mcp-evaluations/${Te.id}`,{replace:!0})}},ue=Hn(C.configName,Hn(C.name,C.id)),se=j?"New MCP Evaluation":S?`Editing: ${ue}`:ue,xe=j?"/mcp-evaluations/new":`/mcp-evaluations/${encodeURIComponent(C.id||e||"")}`,oe=!!b?.loadError,de=h.useMemo(()=>v.map(K=>({id:K.id,ref:K.id,label:Hn(K.name,K.id),model:K.model})).sort((K,pe)=>K.label.localeCompare(pe.label)),[v]),De=(K,pe)=>{const Ae=pe?Array.from(new Set([...ee,K])):ee.filter(Ke=>Ke!==K);q({runDefaults:{...C.runDefaults??{},selectedAgentNames:Ae}})},me=K=>{const pe=new Set([...B.filter(Le=>Le.kind==="inline").map(Le=>Hn(Le.agent.name,Le.agent.id)),...v.map(Le=>Hn(Le.name,Le.id))]),Ae=`${K}-custom`;let Ke=Ae,te=2;for(;pe.has(Ke);)Ke=`${Ae}-${te}`,te+=1;return Ke},ge=()=>{const pe={id:`agt-${Date.now()}`,name:"",provider:"openai",model:"gpt-4o",temperature:Pg,maxTokens:4096};z([{kind:"inline",agent:pe},...B]),Y(Ae=>({...Ae,[pe.id]:!0}))},we=()=>{const K=v.find(Ke=>Ke.id===P);if(!K)return;const pe=K.id;new Set(B.filter(Ke=>Ke.kind==="referenced").map(Ke=>Ke.ref)).has(pe)||z([...B,{kind:"referenced",ref:pe}]),T("")},at=()=>{const K=new Set(B.filter(Ae=>Ae.kind==="referenced").map(Ae=>Ae.ref)),pe=v.filter(Ae=>!K.has(Ae.id)).map(Ae=>({kind:"referenced",ref:Ae.id}));pe.length>0&&z([...B,...pe])},tt=()=>{const K=v.find(te=>te.id===P);if(!K)return;const pe=Hn(K.name,K.id),Ae=me(pe),Ke={...structuredClone(K),id:`agt-${Date.now()}`,name:Ae};z([...B,{kind:"inline",agent:Ke}]),Y(te=>({...te,[Ke.id]:!0})),T(""),$e({title:"Imported agent as inline",description:Ae})},it=K=>{const pe=B[K];if(!pe)return;const Ae=pe.kind==="inline"?pe.agent.id:pe.ref,Ke=ee.filter(te=>te!==Ae);q({runDefaults:{...C.runDefaults??{},selectedAgentNames:Ke}}),pe.kind==="inline"&&Y(te=>{const Le={...te};return delete Le[pe.agent.id],Le}),z(B.filter((te,Le)=>Le!==K))},At=(K,pe)=>{const Ae=K+pe;if(Ae<0||Ae>=B.length)return;const Ke=[...B],[te]=Ke.splice(K,1);Ke.splice(Ae,0,te),z(Ke)},Ge=K=>{const pe=B[K];if(!pe||pe.kind!=="referenced")return;const Ae=rn(pe.ref);if(!Ae){$e({title:"Referenced agent not found",variant:"destructive"});return}const Ke=Hn(Ae.name,Ae.id),te=me(Ke),Le={...structuredClone(Ae),id:`agt-${Date.now()}`,name:te},ot=[...B];if(ot[K]={kind:"inline",agent:Le},z(ot),ee.includes(pe.ref)){const Ut=ee.map(Te=>Te===pe.ref?Le.id:Te);q({runDefaults:{...C.runDefaults??{},selectedAgentNames:Array.from(new Set(Ut))}})}Y(Ut=>({...Ut,[Le.id]:!0})),$e({title:"Referenced agent converted to inline",description:te})},Ee=()=>{const K=x.find(Ae=>Ae.id===A);if(!K)return;const pe={...structuredClone(K),id:`scn-${Date.now()}`,serverIds:[...K.serverIds]};Q([...O,{kind:"inline",scenario:pe}]),L(Ae=>({...Ae,[pe.id]:!0})),E("")},Re=()=>{const pe={id:`scn-${Date.now()}`,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]};Q([{kind:"inline",scenario:pe},...O]),L(Ae=>({...Ae,[pe.id]:!0}))},Ze=()=>{const K=x.find(Ke=>Ke.id===A);if(!K)return;const pe=K.id;new Set(O.filter(Ke=>Ke.kind==="referenced").map(Ke=>Ke.ref)).has(pe)||Q([...O,{kind:"referenced",ref:pe}]),E("")},ht=K=>{const pe=O[K];pe?.kind==="inline"&&L(Ae=>{const Ke={...Ae};return delete Ke[pe.scenario.id],Ke}),Q(O.filter((Ae,Ke)=>Ke!==K))},Ft=(K,pe)=>{const Ae=K+pe;if(Ae<0||Ae>=O.length)return;const Ke=[...O],[te]=Ke.splice(K,1);Ke.splice(Ae,0,te),Q(Ke)},zt=K=>{const pe=O[K];if(!pe||pe.kind!=="referenced")return;const Ae=an(pe.ref);if(!Ae){$e({title:"Referenced scenario not found",variant:"destructive"});return}const Ke=new Set(O.filter(St=>St.kind==="inline").map(St=>St.scenario.name?.trim().toLowerCase()).filter(Boolean)),te=`${Hn(Ae.name,Ae.id)}-custom`;let Le=te,ot=2;for(;Ke.has(Le.toLowerCase());)Le=`${te}-${ot}`,ot+=1;const Ut=Date.now(),Te={...structuredClone(Ae),id:`scn-${Ut}`,name:Le,serverIds:pe.mcpServers&&pe.mcpServers.length>0?pe.mcpServers.map(St=>St.kind==="referenced"?St.ref:St.server.id):[...Ae.serverIds]},Qt=[...O];Qt[K]={kind:"inline",scenario:Te},Q(Qt),L(St=>({...St,[Te.id]:!0})),$e({title:"Referenced scenario converted to inline",description:Le})},jt=K=>p.find(pe=>pe.id===K),rn=K=>v.find(pe=>pe.id===K),an=K=>x.find(pe=>pe.id===K),qt=G.filter(K=>K.kind==="referenced").map(K=>K.ref),Zt=qt.map(jt).filter(K=>!!K),sn=B.filter(K=>K.kind==="referenced").map(K=>K.ref),ln=sn.map(rn).filter(K=>!!K);B.filter(K=>K.kind==="inline");const ke=B.flatMap(K=>{if(K.kind==="referenced"){const pe=rn(K.ref);return pe?[{agent:pe,origin:"referenced",ref:K.ref}]:[]}return[{agent:K.agent,origin:"inline",ref:void 0}]}),ze=O.filter(K=>K.kind==="referenced").map(K=>K.ref),Xe=O.flatMap(K=>{if(K.kind==="referenced"){const pe=an(K.ref);if(!pe)return[];if(K.mcpServers===void 0)return[{scenario:pe,origin:"referenced",hasMcpServerOverride:!1}];const Ae=K.mcpServers.flatMap(Ke=>Ke.kind==="referenced"?[Ke.ref]:[Ke.server.id]);return[{scenario:{...pe,serverIds:Ae},origin:"referenced",hasMcpServerOverride:!0}]}return[{scenario:K.scenario,origin:"inline",hasMcpServerOverride:!1}]}),kt=Array.from(new Map([...v,...C.agents,...ln].map(K=>[K.id,K])).values()),vt=Array.from(new Map([...p,...C.servers??[],...Zt].map(K=>[K.id,K])).values()),fe=O.filter(K=>K.kind==="referenced").flatMap(K=>(K.mcpServers??[]).filter(pe=>pe.kind==="referenced").map(pe=>pe.ref)),Oe=Array.from(new Set([...qt,...fe].filter(K=>!jt(K)))),Ve=sn.filter(K=>!rn(K)),U=ze.filter(K=>!an(K));new Set(Oe);const le=new Set(U),W=B.length,ye=O.length,ve=[...p],Ce=(K,pe)=>{const Ae=O[K];if(!Ae||Ae.kind!=="referenced")return;const Ke=[...O];Ke[K]={kind:"referenced",ref:Ae.ref,mcpServers:pe.map(te=>({kind:"referenced",ref:te}))},Q(Ke)},_e=K=>{const pe=O[K];if(!pe||pe.kind!=="referenced")return;const Ae=[...O];Ae[K]={kind:"referenced",ref:pe.ref},Q(Ae)};return h.useEffect(()=>{if(!P)return;v.some(pe=>pe.id===P)||T("")},[v,P]),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Z,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",children:a.jsx(Et,{to:"/mcp-evaluations",children:a.jsx(Si,{className:"h-4 w-4"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-2xl font-bold truncate",children:se}),a.jsxs("p",{className:"text-sm text-muted-foreground flex flex-wrap items-center gap-x-2 gap-y-1",children:[j?"Create a new MCP evaluation":f?"Loading configuration...":b?b.loadError?"MCP evaluation could not be fully loaded":a.jsxs(a.Fragment,{children:["Last updated ",a.jsx("span",{children:new Date(C.updatedAt).toLocaleDateString()})]}):"MCP evaluation not found",!j&&pm(C)&&a.jsxs("span",{"aria-label":"Evaluation file",className:"inline-flex min-w-0 items-center gap-1 text-xs font-mono",children:[a.jsx("span",{"aria-hidden":"true",children:"·"}),a.jsx(_W,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),a.jsx("span",{className:"truncate",children:pm(C)})]})]})]}),a.jsxs("div",{className:"flex gap-2 shrink-0",children:[y&&!S&&a.jsx(Z,{size:"sm",onClick:()=>{N(!0),r(`${xe}/edit`)},children:"Edit"}),y&&!S&&b&&!oe&&a.jsx(Z,{size:"sm",variant:"outline",asChild:!0,children:a.jsxs(Et,{to:`/run?configId=${encodeURIComponent(b.id)}`,children:[a.jsx(ks,{className:"h-3.5 w-3.5"}),"Run Evaluation"]})}),y&&!S&&oe&&a.jsxs(et,{variant:"destructive",className:"py-1 px-3 text-xs",children:[a.jsx(sm,{className:"mr-1 h-3 w-3"}),"Broken config"]}),S&&a.jsxs(a.Fragment,{children:[!j&&a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>{k(structuredClone(b)),N(!1),r(xe)},children:"Cancel"}),a.jsxs(Z,{size:"sm",onClick:()=>{ae()},children:[a.jsx(IW,{className:"mr-1.5 h-3.5 w-3.5"}),"Save"]})]})]})]}),oe&&!S&&a.jsx(Qe,{className:"border-destructive/40",children:a.jsxs(Je,{className:"pt-6 space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(sm,{className:"mt-0.5 h-5 w-5 text-destructive"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold",children:"This configuration is broken"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"The file is still present, but it could not be loaded because one or more references or fields are invalid."})]})]}),a.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[a.jsx("p",{className:"text-xs font-medium mb-1",children:"File"}),a.jsx("p",{className:"text-xs font-mono break-all",children:b&&pm(b)})]}),a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-3",children:[a.jsx("p",{className:"text-xs font-medium mb-1 text-destructive",children:"Load Error"}),a.jsx("p",{className:"text-xs break-all text-destructive",children:b?.loadError})]}),(Oe.length>0||Ve.length>0||U.length>0)&&a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-background p-3 space-y-1.5",children:[a.jsx("p",{className:"text-xs font-medium",children:"Broken references"}),Oe.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Servers:"," ",a.jsx("span",{className:"text-destructive",children:Oe.join(", ")})]}),Ve.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Agents: ",a.jsx("span",{className:"text-destructive",children:Ve.join(", ")})]}),U.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Scenarios:"," ",a.jsx("span",{className:"text-destructive",children:U.join(", ")})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Valid items still render below. Only the missing references are marked as broken."})]})}),!oe&&(C.loadWarnings?.length??0)>0&&a.jsx(Qe,{className:"border-amber-500/30",children:a.jsxs(Je,{className:"pt-4 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-700 dark:text-amber-300",children:[a.jsx(sm,{className:"h-4 w-4"}),"Migration warnings"]}),C.loadWarnings?.map((K,pe)=>a.jsx("p",{className:"text-xs text-muted-foreground",children:K},`${K}-${pe}`))]})}),a.jsxs("div",{className:"flex gap-4",children:[a.jsx(et,{variant:I==="scenarios"?"default":"outline",className:"py-1 px-3 text-xs",children:a.jsxs(Et,{to:`${xe}/scenarios`,className:"inline-flex items-center gap-1.5 whitespace-nowrap",children:[a.jsx(GS,{className:"h-3 w-3"}),ye," scenario",ye!==1?"s":""]})}),a.jsx(et,{variant:I==="agents"?"default":"outline",className:"py-1 px-3 text-xs",children:a.jsxs(Et,{to:`${xe}/agents`,className:"inline-flex items-center gap-1.5 whitespace-nowrap",children:[a.jsx(Wr,{className:"h-3 w-3"}),W," agent",W!==1?"s":""]})})]}),a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6 space-y-3",children:a.jsxs("div",{className:`grid gap-4 ${V||!j?"sm:grid-cols-2":"sm:grid-cols-3"}`,children:[!V&&j&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Config ID"}),a.jsx(_t,{value:C.name,onChange:K=>q({name:K.target.value}),disabled:V,placeholder:"e.g. check-weather"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Name"}),a.jsx(_t,{value:C.configName||"",onChange:K=>q({configName:K.target.value}),disabled:V,placeholder:"e.g. Weather checks baseline"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Description"}),a.jsx(_t,{value:C.description||"",onChange:K=>q({description:K.target.value}),disabled:V,placeholder:"Brief description..."})]})]})})}),a.jsxs(ax,{value:I,onValueChange:K=>{if(K!=="servers"&&K!=="agents"&&K!=="scenarios")return;const pe=new URLSearchParams(s);if(pe.delete("tab"),o(pe,{replace:!0}),e&&e!=="new"){r(`/mcp-evaluations/${encodeURIComponent(e)}/${K}`,{replace:!0});return}r(`/mcp-evaluations/${e??"new"}/${K}`,{replace:!0})},className:"space-y-4",children:[a.jsxs(Cp,{children:[a.jsxs(Xs,{value:"scenarios",className:"gap-1.5",children:[a.jsx(GS,{className:"h-3.5 w-3.5"}),"Scenarios"]}),a.jsxs(Xs,{value:"agents",className:"gap-1.5",children:[a.jsx(Wr,{className:"h-3.5 w-3.5"}),"Agents"]})]}),a.jsxs(Gf,{value:"agents",children:[!V&&a.jsx(Qe,{className:"mb-4",children:a.jsxs(Je,{className:"pt-4 space-y-3",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",children:[a.jsxs(Mn,{value:P,onValueChange:T,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{placeholder:"Select agent from library"})}),a.jsx(kn,{children:de.map(K=>a.jsx(ut,{value:K.id,children:K.label},K.id))})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!P,onClick:we,children:"Add Ref"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!P,onClick:tt,children:"Import Inline"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:v.length===0||v.every(K=>B.some(pe=>pe.kind==="referenced"&&pe.ref===K.id)),onClick:at,children:"Add All Refs"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",onClick:ge,children:"Add agent"})]})]}),a.jsxs("div",{className:"space-y-2",children:[B.map((K,pe)=>{const Ae=K.kind==="referenced"?rn(K.ref):null,Ke=K.kind==="inline"?Hn(K.agent.name,K.agent.id):Hn(Ae?.name,K.ref),te=K.kind==="inline"?K.agent.model:Ae?.model||"unknown",Le=K.kind==="inline"?K.agent.id:K.ref,ot=K.kind==="referenced"&&!Ae,Ut=K.kind==="inline"?K.agent.id:K.ref,Te=ee.includes(Ut),Qt=K.kind==="inline"&&!!$[K.agent.id];return a.jsxs("div",{className:"rounded-md border text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>At(pe,-1),disabled:pe===0,"aria-label":"Move agent up",children:a.jsx(_s,{className:"h-3 w-3"})}),a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>At(pe,1),disabled:pe===B.length-1,"aria-label":"Move agent down",children:a.jsx(Jt,{className:"h-3 w-3"})})]}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[pe+1,"."]}),a.jsx("span",{className:"truncate font-medium",children:Ke}),a.jsx(et,{variant:K.kind==="inline"?"secondary":"outline",children:K.kind==="inline"?"Inline":"Referenced"}),a.jsx(et,{variant:"outline",className:"font-mono text-[10px]",children:te}),Te&&a.jsx(et,{variant:"outline",className:"text-xs border-emerald-300 text-emerald-700 bg-emerald-50",children:"Default"}),ot&&a.jsx(et,{variant:"destructive",children:"Missing"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("label",{className:"mx-2 flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx("input",{type:"checkbox",checked:Te,onChange:St=>De(Ut,St.target.checked)}),a.jsx("span",{children:"Default"})]}),K.kind==="inline"&&a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Y(St=>({...St,[K.agent.id]:!St[K.agent.id]})),children:Qt?"Collapse":"Expand"}),K.kind==="referenced"&&a.jsx(a.Fragment,{children:a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Ge(pe),disabled:ot,children:"Convert to inline"})}),a.jsx(Z,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>it(pe),"aria-label":"Remove agent entry",children:a.jsx(Xa,{className:"h-3.5 w-3.5"})})]})]}),K.kind==="inline"&&Qt&&a.jsxs("div",{className:"border-t px-3 py-3 space-y-3",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Name"}),a.jsx(_t,{value:K.agent.name,onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,name:St.target.value}},z(Gt)},placeholder:"e.g. GPT-5 Mini custom"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Provider"}),a.jsxs(Mn,{value:K.agent.provider,onValueChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,provider:St}},z(Gt)},children:[a.jsx(_n,{children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"openai",children:"OpenAI"}),a.jsx(ut,{value:"anthropic",children:"Anthropic"}),a.jsx(ut,{value:"azure",children:"Azure OpenAI"}),a.jsx(ut,{value:"google",children:"Google"}),a.jsx(ut,{value:"custom",children:"Custom"})]})]})]})]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Model"}),a.jsx(_t,{value:K.agent.model,onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,model:St.target.value}},z(Gt)},className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Max Tokens"}),a.jsx(_t,{type:"number",min:1,max:128e3,value:K.agent.maxTokens,onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,maxTokens:parseInt(St.target.value)||0}},z(Gt)},className:"font-mono text-xs"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Temperature"}),a.jsx(_t,{type:"number",min:0,max:2,step:.01,value:Xf(K.agent.temperature),onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,temperature:Number(St.target.value)||Pg}},z(Gt)},className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"System Prompt"}),a.jsx(Ts,{value:K.agent.systemPrompt||"",onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,systemPrompt:St.target.value}},z(Gt)},rows:3,className:"text-xs"})]})]})]},`agent-entry-${pe}-${Le}`)}),B.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents configured yet. Add inline agents or references."})]}),Ve.length>0&&a.jsxs("p",{className:"text-xs text-destructive",children:["Missing agent refs: ",Ve.join(", ")]})]})}),V?a.jsx(Qe,{children:a.jsx(Je,{className:"pt-4",children:a.jsxs("div",{className:"space-y-2",children:[ke.map((K,pe)=>{const Ae=Hn(K.agent.name,K.agent.id),Ke=ee.includes(K.origin==="inline"?K.agent.id:K.ref||K.agent.id),te=K.ref??K.agent.id,Le=!!H[te];return a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[pe+1,"."]}),a.jsx("div",{className:"truncate font-medium text-sm",children:Ae})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[Ke&&a.jsx(et,{variant:"outline",className:"text-xs border-emerald-300 text-emerald-700 bg-emerald-50",children:"Default"}),a.jsx(et,{variant:K.origin==="inline"?"secondary":"outline",children:K.origin==="inline"?"Inline":"Referenced"}),a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-8 w-8",onClick:()=>F(ot=>({...ot,[te]:!ot[te]})),"aria-label":Le?"Collapse agent details":"Expand agent details",children:a.jsx(Jt,{className:`h-4 w-4 transition-transform ${Le?"rotate-180":""}`})})]})]}),Le&&a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 border-t pt-2",children:[a.jsx(j8,{provider:K.agent.provider}),a.jsx(et,{variant:"outline",className:"text-xs font-mono",children:K.agent.model}),a.jsxs(et,{variant:"outline",className:"text-xs font-mono",children:["max_tokens: ",K.agent.maxTokens]}),a.jsxs(et,{variant:"outline",className:"text-xs font-mono",children:["temperature: ",Xf(K.agent.temperature)]})]})]},`agent-view-${pe}-${K.ref??K.agent.id}`)}),ke.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No agents configured."})]})})}):null]}),a.jsxs(Gf,{value:"scenarios",children:[!V&&a.jsx(Qe,{className:"mb-4",children:a.jsxs(Je,{className:"pt-4 space-y-3",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",children:[a.jsxs(Mn,{value:A,onValueChange:E,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{placeholder:"Select scenario from library"})}),a.jsx(kn,{children:[...x].sort((K,pe)=>Hn(K.name,K.id).localeCompare(Hn(pe.name,pe.id))).map(K=>a.jsx(ut,{value:K.id,children:Hn(K.name,K.id)},K.id))})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!A,onClick:Ze,children:"Add Ref"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!A,onClick:Ee,children:"Import Inline"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",onClick:Re,children:"Add scenario"})]})]}),a.jsxs("div",{className:"space-y-2",children:[O.map((K,pe)=>{const Ae=K.kind==="referenced"?an(K.ref):null,Ke=K.kind==="inline"?Hn(K.scenario.name,K.scenario.id):Hn(Ae?.name,K.ref),te=K.kind==="inline"&&Hn(K.scenario.name).length===0,Le=K.kind==="referenced"&&le.has(K.ref),ot=K.kind==="referenced"&&Array.isArray(K.mcpServers),Ut=K.kind==="inline"&&!!X[K.scenario.id];return a.jsxs("div",{className:"rounded-md border text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>Ft(pe,-1),disabled:pe===0,"aria-label":"Move scenario up",children:a.jsx(_s,{className:"h-3 w-3"})}),a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>Ft(pe,1),disabled:pe===O.length-1,"aria-label":"Move scenario down",children:a.jsx(Jt,{className:"h-3 w-3"})})]}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[pe+1,"."]}),a.jsx("span",{className:"truncate font-medium",children:Ke}),a.jsx(et,{variant:K.kind==="inline"?"secondary":"outline",children:K.kind==="inline"?"Inline":"Referenced"}),ot&&a.jsx(et,{variant:"secondary",children:"Override"}),te&&a.jsx(et,{variant:"destructive",children:"Name required"}),Le&&a.jsx(et,{variant:"destructive",children:"Missing"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[K.kind==="inline"&&a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-7 w-7",onClick:()=>L(Te=>({...Te,[K.scenario.id]:!Te[K.scenario.id]})),"aria-label":Ut?"Collapse scenario details":"Expand scenario details",children:a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${Ut?"rotate-180":""}`})}),K.kind==="referenced"&&a.jsx(a.Fragment,{children:a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>zt(pe),disabled:Le,children:"Convert to inline"})}),a.jsx(Z,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>ht(pe),"aria-label":"Remove scenario entry",children:a.jsx(Xa,{className:"h-3.5 w-3.5"})})]})]}),K.kind==="inline"&&Ut&&a.jsx("div",{className:"border-t px-3 py-3",children:a.jsx(YN,{scenarios:[K.scenario],scenarioOrigins:["inline"],agents:[...C.agents,...ln],servers:vt,configId:C.id,configPath:C.sourcePath,defaultAssistantAgentName:C.runDefaults?.selectedAgentNames?.[0],onChange:Te=>{const Qt=Te[0];if(!Qt)return;const St=[...O];St[pe]={kind:"inline",scenario:Qt},Q(St)},readOnly:!1,allowAdd:!1,allowStructureEdits:!1})}),K.kind==="referenced"&&!Le&&a.jsxs("div",{className:"border-t px-3 py-3 space-y-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Optional MCP server override for this referenced scenario."}),a.jsx("div",{className:"flex flex-wrap gap-2",children:ve.map(Te=>{const Qt=(K.mcpServers??[]).some(St=>St.kind==="referenced"&&St.ref===Te.id);return a.jsx(Z,{type:"button",size:"sm",variant:Qt?"default":"outline",className:`h-7 text-xs ${Qt?"":"opacity-70"}`,onClick:()=>{const St=(K.mcpServers??[]).filter(Xn=>Xn.kind==="referenced").map(Xn=>Xn.ref),Gt=St.includes(Te.id)?St.filter(Xn=>Xn!==Te.id):[...St,Te.id];Ce(pe,Gt)},children:Hn(Te.name,Te.id)},`${K.ref}-override-server-${Te.id}`)})}),ot&&a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>_e(pe),children:"Reset override"})]})]},`scenario-entry-${pe}-${K.kind==="inline"?K.scenario.id:K.ref}`)}),O.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No scenarios configured yet. Add inline scenarios or references."})]}),U.length>0&&a.jsxs("p",{className:"text-xs text-destructive",children:["Missing scenario refs: ",U.join(", ")]})]})}),V?a.jsx(Qe,{children:a.jsx(Je,{className:"pt-4",children:a.jsx(YN,{scenarios:Xe.map(K=>K.scenario),scenarioOrigins:Xe.map(K=>K.origin),scenarioOverrides:Xe.map(K=>K.hasMcpServerOverride),agents:kt,servers:vt,configId:C.id,configPath:C.sourcePath,defaultAssistantAgentName:C.runDefaults?.selectedAgentNames?.[0],testCaseReturnToPath:M,onChange:()=>{},readOnly:!0})})}):null]})]})]})};var Tye=Symbol("radix.slottable");function Oye(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Tye,t}var lq="AlertDialog",[Mye]=kr(lq,[aL]),Ho=aL(),cq=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ho(t);return a.jsx(lv,{...r,...n,modal:!0})};cq.displayName=lq;var Iye="AlertDialogTrigger",$ye=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(wQ,{...s,...r,ref:t})});$ye.displayName=Iye;var Dye="AlertDialogPortal",uq=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ho(t);return a.jsx(cv,{...r,...n})};uq.displayName=Dye;var Lye="AlertDialogOverlay",dq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(Ru,{...s,...r,ref:t})});dq.displayName=Lye;var Wc="AlertDialogContent",[Fye,zye]=Mye(Wc),Bye=Oye("AlertDialogContent"),fq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,o=Ho(n),i=h.useRef(null),c=Ot(t,i),u=h.useRef(null);return a.jsx(vQ,{contentName:Wc,titleName:pq,docsSlug:"alert-dialog",children:a.jsx(Fye,{scope:n,cancelRef:u,children:a.jsxs(Tu,{role:"alertdialog",...o,...s,ref:c,onOpenAutoFocus:Ue(s.onOpenAutoFocus,f=>{f.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[a.jsx(Bye,{children:r}),a.jsx(Uye,{contentRef:i})]})})})});fq.displayName=Wc;var pq="AlertDialogTitle",hq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(ip,{...s,...r,ref:t})});hq.displayName=pq;var mq="AlertDialogDescription",gq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(lp,{...s,...r,ref:t})});gq.displayName=mq;var qye="AlertDialogAction",vq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(uv,{...s,...r,ref:t})});vq.displayName=qye;var xq="AlertDialogCancel",yq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=zye(xq,n),o=Ho(n),i=Ot(t,s);return a.jsx(uv,{...o,...r,ref:i})});yq.displayName=xq;var Uye=({contentRef:e})=>{const t=`\`${Wc}\` requires a description for the component to be accessible for screen reader users.
133
+ `);_e(Lt),zt(!0)},Vo=async()=>{if(!(!pa||S)){it(!0),Ge(null);try{const ie=Bn.filter(Yt=>i.find(Lt=>Lt.id===Yt)?.authType==="oauth2");await Po({serverNames:ie,source:C});const rt=new Set;for(const Yt of Bn){const Pt=await C.discoverToolsForAnalysis({serverNames:[Yt]});for(const Lt of Pt.servers)for(const tn of Lt.tools)rt.add(tn.name)}at(Array.from(rt).sort((Yt,Pt)=>Yt.localeCompare(Pt)))}catch(ie){Ge(ie instanceof Error?ie.message:"Failed to load tools")}finally{it(!1)}}};return a.jsx(Ss,{open:Oe,onOpenChange:Ve,children:a.jsxs(Qe,{className:S?"rounded-md border shadow-none":"border-dashed",children:[a.jsxs($t,{className:`${S?"px-3 py-3":"pb-3"} flex-row items-center justify-between space-y-0 cursor-pointer`,onClick:U,children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[!S&&a.jsx(Ba,{asChild:!0,children:a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${Oe?"rotate-0":"-rotate-90"}`})})}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[r+1,"."]}),a.jsx(Dt,{className:"truncate text-sm font-medium",children:e.name||`Scenario ${r+1}`}),S&&t==="referenced"&&a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 px-2 text-xs",asChild:!0,children:a.jsx(Et,{to:`/libraries/test-cases/${encodeURIComponent(e.id)}${v?`?returnTo=${encodeURIComponent(v)}`:""}`,children:"Edit test"})})]}),S?a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx(et,{variant:t==="inline"?"secondary":"outline",children:t==="referenced"?"Referenced":"Inline"}),n&&a.jsx(et,{variant:"secondary",children:"Override"}),a.jsx(Ba,{asChild:!0,children:a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-8 w-8","aria-label":Oe?"Collapse scenario details":"Expand scenario details",children:a.jsx(Jt,{className:`h-4 w-4 transition-transform ${Oe?"rotate-180":""}`})})})]}):N&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>zt(!0),title:o.length===0?"Add at least one agent in the config":e.serverIds.length===0?"Select at least one server for this scenario":"Open Scenario Assistant",children:[a.jsx(sa,{className:"h-3.5 w-3.5 text-amber-500"}),"Ask Assistant"]}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:j,disabled:r===0,"aria-label":"Move scenario up",children:a.jsx(_s,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:y,disabled:r===s-1,"aria-label":"Move scenario down",children:a.jsx(Jt,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:b,children:a.jsx(Xa,{className:"h-3.5 w-3.5 text-destructive"})})]})]}),a.jsx(Ns,{children:a.jsxs(Je,{className:"space-y-3",children:[a.jsx(xye,{open:Ft,onOpenChange:ie=>{zt(ie),ie||_e("")},configId:c,configPath:u,scenario:e,agents:o,servers:i,defaultAssistantAgentName:f,initialUserMessage:ln||m,onApplyPatch:ie=>x({...ie.prompt!==void 0?{prompt:ie.prompt}:{},...ie.evalRules!==void 0?{evalRules:ie.evalRules}:{},...ie.extractRules!==void 0?{extractRules:ie.extractRules}:{}})}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Name"}),a.jsx(_t,{value:e.name,onChange:ie=>x({name:ie.target.value}),disabled:S,placeholder:"e.g. List directory"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Servers"}),a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.map(ie=>a.jsx(et,{variant:e.serverIds.includes(ie.id)?"default":"outline",className:`cursor-pointer text-xs ${e.serverIds.includes(ie.id)?"":"opacity-50"}`,onClick:()=>!S&&Te(ie.id),children:ie.name||ie.id},ie.id)),i.length===0&&a.jsx("span",{className:"text-xs text-muted-foreground",children:"Add servers above first"})]})]}),a.jsxs(Qe,{className:"border bg-card",children:[a.jsxs($t,{className:"pb-2",children:[a.jsx(Dt,{className:"text-sm",children:"Prompt"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"The instruction sent to the agent for this scenario. Be explicit about the task, expected output, and constraints."})]}),a.jsxs(Je,{className:"space-y-3 pt-0",children:[a.jsx(Ts,{value:e.prompt,onChange:ie=>x({prompt:ie.target.value}),disabled:S,placeholder:"The prompt to send to the agent...",rows:4,className:"text-xs"}),a.jsxs("div",{children:[a.jsx("input",{ref:ze,type:"file",accept:[...aq,...sq,".md"].join(","),multiple:!0,className:"hidden",onChange:ie=>Xe(ie.target.files)}),(e.attachments?.length??0)>0?a.jsxs("div",{className:"flex flex-wrap items-start gap-2",children:[e.attachments?.map((ie,rt)=>a.jsxs("div",{className:"group relative",title:`${ie.name??`attachment ${rt+1}`}`,children:[a.jsx("div",{className:"flex h-16 w-16 items-center justify-center overflow-hidden rounded border bg-muted",children:ie.type==="image"?a.jsx("img",{src:`data:${ie.media_type};base64,${ie.data}`,alt:ie.name??`attachment ${rt+1}`,className:"h-full w-full object-cover"}):a.jsx(GS,{className:"h-6 w-6 text-muted-foreground"})}),ie.name&&a.jsx("p",{className:"mt-0.5 max-w-[64px] truncate text-center text-xs text-muted-foreground",children:ie.name}),!S&&a.jsx("button",{type:"button",onClick:()=>kt(rt),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full bg-destructive text-destructive-foreground group-hover:flex","aria-label":"Remove attachment",children:a.jsx(ca,{className:"h-2.5 w-2.5"})})]},rt)),!S&&a.jsx("button",{type:"button",onClick:()=>ze.current?.click(),className:"flex h-16 w-16 items-center justify-center self-start rounded border border-dashed text-muted-foreground hover:border-foreground hover:text-foreground","aria-label":"Attach file",title:"Attach file (image or document)",children:a.jsx(iP,{className:"h-4 w-4"})})]}):!S&&a.jsxs("button",{type:"button",onClick:()=>ze.current?.click(),className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[a.jsx(iP,{className:"h-3.5 w-3.5"}),"Attach file"]})]})]})]}),!S&&a.jsxs(Qe,{className:"border bg-muted/20",children:[a.jsxs($t,{className:"pb-2",children:[a.jsx(Dt,{className:"text-sm",children:"Run Prompt Preview"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Execute the current draft prompt once and inspect final answer, conversation trace, tool calls, and check outcomes."})]}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Agent"}),a.jsxs(Mn,{value:jt,onValueChange:rn,children:[a.jsx(_n,{className:"h-8 text-xs",children:a.jsx(In,{placeholder:"Select agent"})}),a.jsx(kn,{children:o.map(ie=>a.jsx(ut,{value:ie.id,children:ie.name||ie.id},ie.id))})]})]}),a.jsx("div",{className:"flex items-end",children:a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1.5 px-2 text-xs",onClick:()=>{En()},disabled:an||!jt||!e.prompt.trim()||e.serverIds.length===0,children:an?a.jsxs(a.Fragment,{children:[a.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}),"Running..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ks,{className:"h-3.5 w-3.5"}),"Run Prompt"]})})})]}),!e.prompt.trim()&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Add a prompt to run preview."}),e.serverIds.length===0&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Select at least one server to run preview."}),Zt&&a.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:Zt}),vt&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[a.jsx(et,{variant:vt.run.passed?"default":"destructive",children:vt.run.passed?"Passed":"Failed"}),a.jsxs(et,{variant:"outline",children:[vt.run.duration,"ms"]}),a.jsxs(et,{variant:"outline",children:[vt.run.toolCalls.length," tool calls"]}),a.jsx(et,{variant:"outline",className:"font-mono",children:vt.agentName}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"ml-auto h-6 gap-1.5 px-2 text-[11px]",onClick:Hu,children:[a.jsx(sa,{className:"h-3.5 w-3.5 text-amber-500"}),"Send to Assistant"]})]}),e.evalRules.length===0?a.jsxs("div",{className:"rounded-md border bg-muted/20 p-2",children:[a.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Check results"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"No checks configured for this scenario."})]}):(()=>{const ie=pD(e.evalRules,vt.run.failureReasons,vt.run.checkResults),rt=ie.filter(Pt=>Pt.status==="passed"),Yt=ie.filter(Pt=>Pt.status==="failed");return a.jsxs("div",{className:"rounded-md border bg-muted/20 p-2",children:[a.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Checks"}),a.jsxs(et,{variant:"outline",className:"h-5 border-success/30 bg-success/10 text-success text-[10px]",children:[rt.length," passed"]}),a.jsxs(et,{variant:"outline",className:`h-5 text-[10px] ${Yt.length>0?"border-destructive/30 bg-destructive/10 text-destructive":""}`,children:[Yt.length," failed"]})]}),a.jsx("div",{className:"space-y-1",children:ie.map((Pt,Lt)=>a.jsxs("div",{className:`flex items-start justify-between gap-2 rounded-md border px-2 py-1.5 text-xs ${Pt.status==="failed"?"border-destructive/20 bg-destructive/5":"border-success/20 bg-success/5"}`,children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[Pt.status==="failed"?a.jsx(ll,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):a.jsx(Va,{className:"h-3.5 w-3.5 shrink-0 text-success"}),a.jsx("span",{className:"font-medium",children:Eye(Pt.rule)})]}),Pt.failureReason&&a.jsx("p",{className:"mt-1 pl-5 text-[11px] text-muted-foreground",children:Pye(Pt.failureReason)})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${Pt.status==="failed"?"border-destructive/30 text-destructive":"border-success/30 text-success"}`,children:Pt.status})]},`${e.id}-preview-check-${Lt}`))})]})})(),vt.run.failureReasons.length>0&&a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2",children:[a.jsx("p",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-destructive",children:"Check failures"}),a.jsx("ul",{className:"list-disc space-y-1 pl-4 text-xs text-destructive",children:vt.run.failureReasons.map((ie,rt)=>a.jsx("li",{children:ie},`${vt.runId}-failure-${rt}`))})]}),Object.keys(vt.run.extractedValues).length>0&&a.jsxs("div",{className:"rounded-md border bg-background p-2",children:[a.jsx("p",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Extracted values"}),a.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:Object.entries(vt.run.extractedValues).map(([ie,rt])=>a.jsxs("div",{className:"rounded border bg-muted/20 px-2 py-1 text-xs",children:[a.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:ie}),a.jsx("div",{className:"break-all",children:String(rt)})]},ie))})]}),a.jsx(Sye,{run:vt.run,fallbackUserPrompt:e.prompt})]})]})]}),a.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[a.jsxs(Qe,{className:"border bg-muted/20",children:[a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Dt,{className:"text-sm",children:"Checks"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Checks determine pass/fail for the scenario. Add tool checks or text pattern checks for the final answer."})]}),!S&&a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs shrink-0",onClick:()=>zt(!0),title:"Ask for help improving checks",children:[a.jsx(sa,{className:"h-3.5 w-3.5 text-amber-500"}),"Ask Assistant"]})})]})}),a.jsx(Je,{className:"space-y-2",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{className:"text-xs",children:"Checks (pass / fail)"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"These determine whether the scenario passes. Add tool checks (required/forbidden) or text pattern checks for the final answer."}),a.jsx("div",{className:"space-y-1.5",children:e.evalRules.length===0?a.jsx("p",{className:"rounded-md border border-dashed bg-background/60 px-2 py-2 text-xs text-muted-foreground",children:"No checks yet. Add tool checks or text pattern checks below."}):e.evalRules.map((ie,rt)=>a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-md border bg-background px-2 py-2 text-xs",children:[a.jsx("div",{className:"min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`rounded-full border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${St[ie.type]}`,children:Qt[ie.type]}),ie.type==="agent_check"?a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium leading-tight",children:ie.label||"Unnamed check"}),ie.prompt&&a.jsx("div",{className:"mt-0.5 break-words text-[11px] leading-snug text-muted-foreground",children:ie.prompt})]}):ie.type==="tool_sequence"?a.jsx("span",{className:"font-mono break-all",children:oq(ie.sequence??[])}):hm(ie.type)?a.jsx("span",{className:"font-mono break-all",children:ie.type==="tool_input_contains"?`${ie.tool} contains ${String(ie.value)}`:ie.type==="tool_input_regex"?`${ie.tool} matches ${String(ie.value)}`:`${ie.tool} · ${ie.path} · ${ie.equals!==void 0?`== ${String(ie.equals)}`:"exists"}`}):a.jsx("span",{className:"font-mono break-all",children:ie.path?ie.equals!==void 0?`${ie.path} == ${String(ie.equals)}`:ie.path:ie.value})]})}),!S&&a.jsxs("div",{className:"flex items-center gap-1",children:[(ie.type==="tool_sequence"||ie.type==="agent_check"||Le.includes(ie.type))&&a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-[11px]",onClick:()=>{if(ie.type==="tool_sequence"){A("tool_sequence"),B(ie.sequence??[]),ae(ie),V(!0);return}if(ie.type==="agent_check"){A("agent_check"),se(ie),I(ie.label??""),q(ie.prompt??""),oe(!0);return}A(ie.type),De(ie),P(String(ie.value??"")),$(ie.tool??""),H(ie.path??""),X(ie.equals!==void 0?String(ie.equals):"")},"aria-label":`Edit check ${rt+1}`,children:a.jsx(LW,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>te(rt),"aria-label":`Remove check ${rt+1}`,children:a.jsx(ca,{className:"h-3.5 w-3.5"})})]})]},rt))}),!S&&a.jsxs("div",{className:"space-y-2",children:[Xl?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx(dD,{value:k,onValueChange:A,className:"h-8 w-[14.5rem] shrink-0 text-xs"}),a.jsx(_t,{value:L,onChange:ie=>I(ie.target.value),placeholder:"Prompt name",className:"h-8 text-xs"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:W,children:ue!==null?"Update check":"Add check"})]}),a.jsx(Ts,{value:M,onChange:ie=>q(ie.target.value),placeholder:"Judge prompt. Example: Confirm the answer includes a valid earliest and latest timestamp range, and that neither is 'Not available'.",className:"min-h-[64px] text-xs"})]}):a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx(dD,{value:k,onValueChange:A,className:"h-8 w-[14.5rem] shrink-0 text-xs",hideToolSequence:Ae&&k!=="tool_sequence"}),zn?a.jsxs(a.Fragment,{children:[a.jsx(_t,{value:Y,onChange:ie=>H(ie.target.value),placeholder:"JSONPath (e.g. $.status)",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),W())}),k==="response_jsonpath"&&a.jsx(_t,{value:F,onChange:ie=>X(ie.target.value),placeholder:"Equals (optional)",className:"h-8 w-[12rem] text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),W())})]}):Xn?a.jsxs(a.Fragment,{children:[we&&we.length>0?a.jsxs(Mn,{value:T,onValueChange:$,children:[a.jsx(_n,{className:"h-8 text-xs font-mono",children:a.jsx(In,{placeholder:"Select tool"})}),a.jsx(kn,{children:we.map(ie=>a.jsx(ut,{value:ie,children:ie},ie))})]}):a.jsx(_t,{value:T,onChange:ie=>$(ie.target.value),placeholder:"Tool name",className:"h-8 text-xs font-mono"}),k==="tool_input_jsonpath"&&a.jsx(_t,{value:Y,onChange:ie=>H(ie.target.value),placeholder:"JSONPath (e.g. $.query)",className:"h-8 text-xs font-mono"}),k==="tool_input_jsonpath"?a.jsx(_t,{value:F,onChange:ie=>X(ie.target.value),placeholder:"Equals (optional)",className:"h-8 w-[10rem] text-xs font-mono"}):a.jsx(_t,{value:E,onChange:ie=>P(ie.target.value),placeholder:k==="tool_input_regex"?"Regex pattern":"Text present in input",className:"h-8 w-[10rem] text-xs font-mono"})]}):Ra?a.jsxs("div",{className:"min-w-0 flex-1 flex items-end gap-2",children:[a.jsx(_t,{value:G,onChange:ie=>O(ie.target.value),placeholder:"Tool name",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),ye())}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:ye,children:"Add step"})]}):a.jsx(_t,{value:E,onChange:ie=>P(ie.target.value),placeholder:"Value",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),W())}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:W,children:de!==null?"Update check":"Add"})]}),Ra&&a.jsxs("div",{className:"space-y-2 rounded-md border bg-background px-2 py-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Sequence steps"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Require these tools in order. Other tools may appear between them."})]}),!S&&Q.length>0&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-[11px]",onClick:()=>B([]),children:"Clear"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-[11px]",onClick:()=>Ke(Q),children:Ae?"Update sequence":"Add sequence"})]})]}),Q.length===0?a.jsx("p",{className:"rounded-md border border-dashed bg-muted/20 px-2 py-2 text-xs text-muted-foreground",children:"No ordered tool sequence yet."}):a.jsx("div",{className:"space-y-1.5",children:Q.map((ie,rt)=>a.jsxs("div",{className:"flex items-center gap-2 rounded-md border bg-muted/10 px-2 py-1.5",children:[a.jsxs("span",{className:"text-xs font-medium",children:[rt+1,"."]}),a.jsx("span",{className:"min-w-0 flex-1 font-mono text-xs break-all",children:ie}),!S&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ve(rt,-1),disabled:rt===0,"aria-label":`Move tool ${rt+1} up`,children:a.jsx(_s,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ve(rt,1),disabled:rt===Q.length-1,"aria-label":`Move tool ${rt+1} down`,children:a.jsx(Jt,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ke(rt),"aria-label":`Remove tool ${rt+1}`,children:a.jsx(ca,{className:"h-3.5 w-3.5"})})]})]},`${e.id}-tool-sequence-draft-${rt}`))})]}),Gt&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx(We,{className:"mb-1 block text-[11px] text-muted-foreground",children:"Pick from selected server tools (optional)"}),a.jsxs(Mn,{value:me,onValueChange:ie=>{ge(ie),P(ie)},disabled:tt||!we||we.length===0,children:[a.jsx(_n,{className:"h-8 text-xs",children:a.jsx(In,{placeholder:tt?"Loading tools...":we&&we.length>0?"Select tool to insert in value field":"Load tools first"})}),a.jsx(kn,{children:(we??[]).map(ie=>a.jsx(ut,{value:ie,children:ie},ie))})]})]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:Vo,disabled:!pa||tt,children:tt?"Loading...":we?"Refresh tools":"Load tools"})]}),!pa&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Select at least one server in this scenario to load tool names."}),At&&a.jsxs("p",{className:"text-[11px] text-destructive",children:["Could not load tools: ",At]})]})]})]})})]}),a.jsxs(Qe,{className:"border bg-muted/10",children:[a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Dt,{className:"text-sm",children:"Value Capture Rules"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Formerly “Extract Rules”. These do not fail the run. They capture structured values from the final answer for reporting and comparisons."})]}),!S&&a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs shrink-0",onClick:()=>zt(!0),title:"Ask for help improving value capture rules",children:[a.jsx(sa,{className:"h-3.5 w-3.5 text-amber-500"}),"Ask Assistant"]})]})}),a.jsx(Je,{className:"space-y-2",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{className:"text-xs",children:"Value Capture Rules"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use regex patterns to capture values like max concentration, product names, date ranges, or IDs from the final answer text."}),a.jsx("div",{className:"space-y-1.5",children:e.extractRules.length===0?a.jsx("p",{className:"w-full rounded-md border border-dashed bg-background/60 px-2 py-2 text-xs text-muted-foreground",children:"No value capture rules yet. Add one below to capture structured output from the final answer."}):e.extractRules.map((ie,rt)=>a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border bg-background px-2 py-2 text-xs",children:[a.jsx("div",{className:"min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"rounded-full border border-violet-300/60 bg-violet-500/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-violet-700",children:ie.name}),a.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground",children:"regex:"}),a.jsx("code",{className:"font-mono break-all text-foreground",children:ie.pattern})]})}),!S&&a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>Ut(rt),"aria-label":`Remove value capture rule ${rt+1}`,children:a.jsx(ca,{className:"h-3.5 w-3.5"})})]},rt))}),!S&&a.jsxs("div",{className:"flex gap-2 items-end",children:[a.jsx(_t,{value:Ee,onChange:ie=>Re(ie.target.value),placeholder:"Field name",className:"h-8 text-xs w-36"}),a.jsx(_t,{value:Ze,onChange:ie=>ht(ie.target.value),placeholder:"Regex pattern",className:"h-8 text-xs font-mono",onKeyDown:ie=>ie.key==="Enter"&&(ie.preventDefault(),ot())}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:ot,children:"Add"})]})]})})]})]}),e.evalRules.some(ie=>ie.type==="agent_check")&&a.jsxs(Qe,{className:"border bg-muted/10",children:[a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx(Dt,{className:"text-sm",children:"Judge context"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Extra context is shared across all judge checks in this scenario and sent once in the batched judge request."})]})}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(br,{id:`judge-ctx-prompt-${e.id}`,checked:e.agentContext?.include_prompt??!1,disabled:S,className:"mt-0.5",onCheckedChange:ie=>{x({agentContext:{...e.agentContext,include_prompt:ie===!0}})}}),a.jsxs("div",{children:[a.jsx(We,{htmlFor:`judge-ctx-prompt-${e.id}`,className:"cursor-pointer text-xs font-medium",children:"Include prompt"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sends the scenario prompt so the judge can verify the answer addresses the original question."})]})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(br,{id:`judge-ctx-tools-${e.id}`,checked:e.agentContext?.include_tool_sequence??!1,disabled:S,className:"mt-0.5",onCheckedChange:ie=>{x({agentContext:{...e.agentContext,include_tool_sequence:ie===!0}})}}),a.jsxs("div",{children:[a.jsx(We,{htmlFor:`judge-ctx-tools-${e.id}`,className:"cursor-pointer text-xs font-medium",children:"Include tool sequence"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sends the list of called tool names so the judge can reason about which tools were used."})]})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(br,{id:`judge-ctx-inputs-${e.id}`,checked:e.agentContext?.include_tool_inputs??!1,disabled:S,className:"mt-0.5",onCheckedChange:ie=>{x({agentContext:{...e.agentContext,include_tool_inputs:ie===!0}})}}),a.jsxs("div",{children:[a.jsx(We,{htmlFor:`judge-ctx-inputs-${e.id}`,className:"cursor-pointer text-xs font-medium",children:"Include tool inputs"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sends the called MCP tools and their arguments so the judge can verify how the tools were used."})]})]})]})]})]})})]})})}function pD(e,t,n){return nq({evalRules:e,failureReasons:t,checkResults:n})}function Aye(e){return e.type==="agent_check"?`${e.type}: ${e.label??""} — ${e.prompt??""}`:e.type==="tool_sequence"?`${e.type}: ${oq(e.sequence??[])}`:hm(e.type)?`${e.type}: ${e.tool??""}: ${hD(e)}`:e.path?`${e.type}: ${hD(e)}`:`${e.type}: ${e.value??""}`}function hD(e){return e.path?e.equals!==void 0?`${e.path} == ${String(e.equals)}`:e.path:String(e.value??"")}const Eye=cx;function Pye(e){const t=String(e??"").trim(),n=t.match(/^Regex assertion failed:\s*(.+)$/i);return n?`Text match failed: ${n[1]}`:t}function iq(e){const t=e.name?.trim()||e.id||"Server",n=e.authValue?.trim()||"",r=e.oauthTokenUrl?.trim()||"";return e.authType==="bearer"&&n.length===0?`${t}: bearer token is required.`:e.authType==="api-key"&&r.length===0&&n.length===0?`${t}: API key value is required.`:null}const Pg=0;function Xf(e){return e??Pg}const Rye=()=>({id:`cfg-${Date.now()}`,name:"",configName:"",description:"",servers:[],serverEntries:[],agents:[],agentEntries:[],scenarios:[],scenarioEntries:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),mD=()=>{const{id:e,tab:t}=Bl(),n=Kr(),r=is(),[s,o]=zo(),{getConfig:i,addConfig:c,updateConfig:u,loading:f}=up(),{source:m}=$n(),{servers:p,agents:v,scenarios:x}=Is(),j=e==="new",y=!j&&!!e,b=y?i(e):void 0,[S,N]=h.useState(j||t==="edit"),[C,k]=h.useState(()=>b?structuredClone(b):Rye()),[A,E]=h.useState(""),[P,T]=h.useState(""),[$,Y]=h.useState({}),[H,F]=h.useState({}),[X,L]=h.useState({}),I=h.useMemo(()=>{const K=t||s.get("tab");return K==="agents"||K==="scenarios"?K:"scenarios"},[t,s]),M=`${n.pathname}${n.search}`;h.useEffect(()=>{b&&!S&&k(structuredClone(b))},[b,S]),h.useEffect(()=>{t==="edit"&&!j&&N(!0)},[t,j]);const q=K=>k(pe=>({...pe,...K})),G=h.useMemo(()=>C.serverEntries&&C.serverEntries.length>0?C.serverEntries:(C.servers??[]).map(K=>({kind:"inline",server:K})),[C.serverEntries,C.servers]),O=h.useMemo(()=>C.scenarioEntries&&C.scenarioEntries.length>0?C.scenarioEntries:C.scenarios.map(K=>({kind:"inline",scenario:K})),[C.scenarioEntries,C.scenarios]),Q=K=>{q({scenarioEntries:K,scenarios:K.filter(pe=>pe.kind==="inline").map(pe=>pe.scenario)})},B=h.useMemo(()=>C.agentEntries&&C.agentEntries.length>0?C.agentEntries:C.agents.map(K=>({kind:"inline",agent:K})),[C.agentEntries,C.agents]),z=K=>{q({agentEntries:K,agents:K.filter(pe=>pe.kind==="inline").map(pe=>pe.agent)})},V=!S,ee=C.runDefaults?.selectedAgentNames??[],ae=async()=>{if(!C.name.trim()){$e({title:"Validation Error",description:"Config ID is required.",variant:"destructive"});return}const K=G.map(Te=>Te.kind==="referenced"?{kind:"referenced",ref:p.find(St=>St.id===Te.ref)?.id||Te.ref}:Te),pe=B.map(Te=>Te.kind==="referenced"?{kind:"referenced",ref:v.find(St=>St.id===Te.ref)?.id||Te.ref}:Te),Ae=O.map(Te=>{if(Te.kind==="referenced"){const Qt=x.find(Gt=>Gt.id===Te.ref),St=(Te.mcpServers??[]).map(Gt=>Gt.kind==="referenced"?{kind:"referenced",ref:p.find(zn=>zn.id===Gt.ref)?.id||Gt.ref}:Gt);return{kind:"referenced",ref:Qt?.id||Te.ref,...Te.mcpServers!==void 0?{mcpServers:St}:{}}}return Te}),Ke=K.filter(Te=>Te.kind==="inline").map(Te=>({server:Te.server,error:iq(Te.server)})).find(Te=>!!Te.error);if(Ke?.error){$e({title:"Validation Error",description:Ke.error,variant:"destructive"});return}if(Ae.filter(Te=>Te.kind==="inline").some(Te=>!Te.scenario.name?.trim())){$e({title:"Validation Error",description:"Inline scenarios must have a name before saving.",variant:"destructive"});return}const Le=new Set(pe.map(Te=>Te.kind==="inline"?Te.agent.id:Te.ref)),ot=(C.runDefaults?.selectedAgentNames??[]).filter(Te=>Le.has(Te)),Ut={...C,serverEntries:K,servers:K.filter(Te=>Te.kind==="inline").map(Te=>Te.server),agentEntries:pe,agents:pe.filter(Te=>Te.kind==="inline").map(Te=>Te.agent),scenarioEntries:Ae,scenarios:Ae.filter(Te=>Te.kind==="inline").map(Te=>Te.scenario),runDefaults:ot.length>0?{...C.runDefaults??{},selectedAgentNames:ot}:void 0,updatedAt:new Date().toISOString()};if(j){const Te=await c(Ut);k(Te);const Qt=Hn(Te.configName,Hn(Te.name,Te.id));$e({title:"MCP Evaluation Created",description:`"${Qt}" has been saved.`}),r(`/mcp-evaluations/${Te.id}`)}else{const Te=await u(C.id,Ut);k(Te);const Qt=Hn(Te.configName,Hn(Te.name,Te.id));$e({title:"MCP Evaluation Updated",description:`"${Qt}" has been updated.`}),N(!1),r(`/mcp-evaluations/${Te.id}`,{replace:!0})}},ue=Hn(C.configName,Hn(C.name,C.id)),se=j?"New MCP Evaluation":S?`Editing: ${ue}`:ue,xe=j?"/mcp-evaluations/new":`/mcp-evaluations/${encodeURIComponent(C.id||e||"")}`,oe=!!b?.loadError,de=h.useMemo(()=>v.map(K=>({id:K.id,ref:K.id,label:Hn(K.name,K.id),model:K.model})).sort((K,pe)=>K.label.localeCompare(pe.label)),[v]),De=(K,pe)=>{const Ae=pe?Array.from(new Set([...ee,K])):ee.filter(Ke=>Ke!==K);q({runDefaults:{...C.runDefaults??{},selectedAgentNames:Ae}})},me=K=>{const pe=new Set([...B.filter(Le=>Le.kind==="inline").map(Le=>Hn(Le.agent.name,Le.agent.id)),...v.map(Le=>Hn(Le.name,Le.id))]),Ae=`${K}-custom`;let Ke=Ae,te=2;for(;pe.has(Ke);)Ke=`${Ae}-${te}`,te+=1;return Ke},ge=()=>{const pe={id:`agt-${Date.now()}`,name:"",provider:"openai",model:"gpt-4o",temperature:Pg,maxTokens:4096};z([{kind:"inline",agent:pe},...B]),Y(Ae=>({...Ae,[pe.id]:!0}))},we=()=>{const K=v.find(Ke=>Ke.id===P);if(!K)return;const pe=K.id;new Set(B.filter(Ke=>Ke.kind==="referenced").map(Ke=>Ke.ref)).has(pe)||z([...B,{kind:"referenced",ref:pe}]),T("")},at=()=>{const K=new Set(B.filter(Ae=>Ae.kind==="referenced").map(Ae=>Ae.ref)),pe=v.filter(Ae=>!K.has(Ae.id)).map(Ae=>({kind:"referenced",ref:Ae.id}));pe.length>0&&z([...B,...pe])},tt=()=>{const K=v.find(te=>te.id===P);if(!K)return;const pe=Hn(K.name,K.id),Ae=me(pe),Ke={...structuredClone(K),id:`agt-${Date.now()}`,name:Ae};z([...B,{kind:"inline",agent:Ke}]),Y(te=>({...te,[Ke.id]:!0})),T(""),$e({title:"Imported agent as inline",description:Ae})},it=K=>{const pe=B[K];if(!pe)return;const Ae=pe.kind==="inline"?pe.agent.id:pe.ref,Ke=ee.filter(te=>te!==Ae);q({runDefaults:{...C.runDefaults??{},selectedAgentNames:Ke}}),pe.kind==="inline"&&Y(te=>{const Le={...te};return delete Le[pe.agent.id],Le}),z(B.filter((te,Le)=>Le!==K))},At=(K,pe)=>{const Ae=K+pe;if(Ae<0||Ae>=B.length)return;const Ke=[...B],[te]=Ke.splice(K,1);Ke.splice(Ae,0,te),z(Ke)},Ge=K=>{const pe=B[K];if(!pe||pe.kind!=="referenced")return;const Ae=rn(pe.ref);if(!Ae){$e({title:"Referenced agent not found",variant:"destructive"});return}const Ke=Hn(Ae.name,Ae.id),te=me(Ke),Le={...structuredClone(Ae),id:`agt-${Date.now()}`,name:te},ot=[...B];if(ot[K]={kind:"inline",agent:Le},z(ot),ee.includes(pe.ref)){const Ut=ee.map(Te=>Te===pe.ref?Le.id:Te);q({runDefaults:{...C.runDefaults??{},selectedAgentNames:Array.from(new Set(Ut))}})}Y(Ut=>({...Ut,[Le.id]:!0})),$e({title:"Referenced agent converted to inline",description:te})},Ee=()=>{const K=x.find(Ae=>Ae.id===A);if(!K)return;const pe={...structuredClone(K),id:`scn-${Date.now()}`,serverIds:[...K.serverIds]};Q([...O,{kind:"inline",scenario:pe}]),L(Ae=>({...Ae,[pe.id]:!0})),E("")},Re=()=>{const pe={id:`scn-${Date.now()}`,name:"",serverIds:[],prompt:"",evalRules:[],extractRules:[]};Q([{kind:"inline",scenario:pe},...O]),L(Ae=>({...Ae,[pe.id]:!0}))},Ze=()=>{const K=x.find(Ke=>Ke.id===A);if(!K)return;const pe=K.id;new Set(O.filter(Ke=>Ke.kind==="referenced").map(Ke=>Ke.ref)).has(pe)||Q([...O,{kind:"referenced",ref:pe}]),E("")},ht=K=>{const pe=O[K];pe?.kind==="inline"&&L(Ae=>{const Ke={...Ae};return delete Ke[pe.scenario.id],Ke}),Q(O.filter((Ae,Ke)=>Ke!==K))},Ft=(K,pe)=>{const Ae=K+pe;if(Ae<0||Ae>=O.length)return;const Ke=[...O],[te]=Ke.splice(K,1);Ke.splice(Ae,0,te),Q(Ke)},zt=K=>{const pe=O[K];if(!pe||pe.kind!=="referenced")return;const Ae=an(pe.ref);if(!Ae){$e({title:"Referenced scenario not found",variant:"destructive"});return}const Ke=new Set(O.filter(St=>St.kind==="inline").map(St=>St.scenario.name?.trim().toLowerCase()).filter(Boolean)),te=`${Hn(Ae.name,Ae.id)}-custom`;let Le=te,ot=2;for(;Ke.has(Le.toLowerCase());)Le=`${te}-${ot}`,ot+=1;const Ut=Date.now(),Te={...structuredClone(Ae),id:`scn-${Ut}`,name:Le,serverIds:pe.mcpServers&&pe.mcpServers.length>0?pe.mcpServers.map(St=>St.kind==="referenced"?St.ref:St.server.id):[...Ae.serverIds]},Qt=[...O];Qt[K]={kind:"inline",scenario:Te},Q(Qt),L(St=>({...St,[Te.id]:!0})),$e({title:"Referenced scenario converted to inline",description:Le})},jt=K=>p.find(pe=>pe.id===K),rn=K=>v.find(pe=>pe.id===K),an=K=>x.find(pe=>pe.id===K),qt=G.filter(K=>K.kind==="referenced").map(K=>K.ref),Zt=qt.map(jt).filter(K=>!!K),sn=B.filter(K=>K.kind==="referenced").map(K=>K.ref),ln=sn.map(rn).filter(K=>!!K);B.filter(K=>K.kind==="inline");const _e=B.flatMap(K=>{if(K.kind==="referenced"){const pe=rn(K.ref);return pe?[{agent:pe,origin:"referenced",ref:K.ref}]:[]}return[{agent:K.agent,origin:"inline",ref:void 0}]}),ze=O.filter(K=>K.kind==="referenced").map(K=>K.ref),Xe=O.flatMap(K=>{if(K.kind==="referenced"){const pe=an(K.ref);if(!pe)return[];if(K.mcpServers===void 0)return[{scenario:pe,origin:"referenced",hasMcpServerOverride:!1}];const Ae=K.mcpServers.flatMap(Ke=>Ke.kind==="referenced"?[Ke.ref]:[Ke.server.id]);return[{scenario:{...pe,serverIds:Ae},origin:"referenced",hasMcpServerOverride:!0}]}return[{scenario:K.scenario,origin:"inline",hasMcpServerOverride:!1}]}),kt=Array.from(new Map([...v,...C.agents,...ln].map(K=>[K.id,K])).values()),vt=Array.from(new Map([...p,...C.servers??[],...Zt].map(K=>[K.id,K])).values()),fe=O.filter(K=>K.kind==="referenced").flatMap(K=>(K.mcpServers??[]).filter(pe=>pe.kind==="referenced").map(pe=>pe.ref)),Oe=Array.from(new Set([...qt,...fe].filter(K=>!jt(K)))),Ve=sn.filter(K=>!rn(K)),U=ze.filter(K=>!an(K));new Set(Oe);const le=new Set(U),W=B.length,ye=O.length,ve=[...p],ke=(K,pe)=>{const Ae=O[K];if(!Ae||Ae.kind!=="referenced")return;const Ke=[...O];Ke[K]={kind:"referenced",ref:Ae.ref,mcpServers:pe.map(te=>({kind:"referenced",ref:te}))},Q(Ke)},Ce=K=>{const pe=O[K];if(!pe||pe.kind!=="referenced")return;const Ae=[...O];Ae[K]={kind:"referenced",ref:pe.ref},Q(Ae)};return h.useEffect(()=>{if(!P)return;v.some(pe=>pe.id===P)||T("")},[v,P]),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Z,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",children:a.jsx(Et,{to:"/mcp-evaluations",children:a.jsx(Si,{className:"h-4 w-4"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-2xl font-bold truncate",children:se}),a.jsxs("p",{className:"text-sm text-muted-foreground flex flex-wrap items-center gap-x-2 gap-y-1",children:[j?"Create a new MCP evaluation":f?"Loading configuration...":b?b.loadError?"MCP evaluation could not be fully loaded":a.jsxs(a.Fragment,{children:["Last updated ",a.jsx("span",{children:new Date(C.updatedAt).toLocaleDateString()})]}):"MCP evaluation not found",!j&&pm(C)&&a.jsxs("span",{"aria-label":"Evaluation file",className:"inline-flex min-w-0 items-center gap-1 text-xs font-mono",children:[a.jsx("span",{"aria-hidden":"true",children:"·"}),a.jsx(_W,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),a.jsx("span",{className:"truncate",children:pm(C)})]})]})]}),a.jsxs("div",{className:"flex gap-2 shrink-0",children:[y&&!S&&a.jsx(Z,{size:"sm",onClick:()=>{N(!0),r(`${xe}/edit`)},children:"Edit"}),y&&!S&&b&&!oe&&a.jsx(Z,{size:"sm",variant:"outline",asChild:!0,children:a.jsxs(Et,{to:`/run?configId=${encodeURIComponent(b.id)}`,children:[a.jsx(ks,{className:"h-3.5 w-3.5"}),"Run Evaluation"]})}),y&&!S&&oe&&a.jsxs(et,{variant:"destructive",className:"py-1 px-3 text-xs",children:[a.jsx(sm,{className:"mr-1 h-3 w-3"}),"Broken config"]}),S&&a.jsxs(a.Fragment,{children:[!j&&a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>{k(structuredClone(b)),N(!1),r(xe)},children:"Cancel"}),a.jsxs(Z,{size:"sm",onClick:()=>{ae()},children:[a.jsx(IW,{className:"mr-1.5 h-3.5 w-3.5"}),"Save"]})]})]})]}),oe&&!S&&a.jsx(Qe,{className:"border-destructive/40",children:a.jsxs(Je,{className:"pt-6 space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(sm,{className:"mt-0.5 h-5 w-5 text-destructive"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold",children:"This configuration is broken"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"The file is still present, but it could not be loaded because one or more references or fields are invalid."})]})]}),a.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[a.jsx("p",{className:"text-xs font-medium mb-1",children:"File"}),a.jsx("p",{className:"text-xs font-mono break-all",children:b&&pm(b)})]}),a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-3",children:[a.jsx("p",{className:"text-xs font-medium mb-1 text-destructive",children:"Load Error"}),a.jsx("p",{className:"text-xs break-all text-destructive",children:b?.loadError})]}),(Oe.length>0||Ve.length>0||U.length>0)&&a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-background p-3 space-y-1.5",children:[a.jsx("p",{className:"text-xs font-medium",children:"Broken references"}),Oe.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Servers:"," ",a.jsx("span",{className:"text-destructive",children:Oe.join(", ")})]}),Ve.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Agents: ",a.jsx("span",{className:"text-destructive",children:Ve.join(", ")})]}),U.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Scenarios:"," ",a.jsx("span",{className:"text-destructive",children:U.join(", ")})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Valid items still render below. Only the missing references are marked as broken."})]})}),!oe&&(C.loadWarnings?.length??0)>0&&a.jsx(Qe,{className:"border-amber-500/30",children:a.jsxs(Je,{className:"pt-4 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-700 dark:text-amber-300",children:[a.jsx(sm,{className:"h-4 w-4"}),"Migration warnings"]}),C.loadWarnings?.map((K,pe)=>a.jsx("p",{className:"text-xs text-muted-foreground",children:K},`${K}-${pe}`))]})}),a.jsxs("div",{className:"flex gap-4",children:[a.jsx(et,{variant:I==="scenarios"?"default":"outline",className:"py-1 px-3 text-xs",children:a.jsxs(Et,{to:`${xe}/scenarios`,className:"inline-flex items-center gap-1.5 whitespace-nowrap",children:[a.jsx(GS,{className:"h-3 w-3"}),ye," scenario",ye!==1?"s":""]})}),a.jsx(et,{variant:I==="agents"?"default":"outline",className:"py-1 px-3 text-xs",children:a.jsxs(Et,{to:`${xe}/agents`,className:"inline-flex items-center gap-1.5 whitespace-nowrap",children:[a.jsx(Wr,{className:"h-3 w-3"}),W," agent",W!==1?"s":""]})})]}),a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6 space-y-3",children:a.jsxs("div",{className:`grid gap-4 ${V||!j?"sm:grid-cols-2":"sm:grid-cols-3"}`,children:[!V&&j&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Config ID"}),a.jsx(_t,{value:C.name,onChange:K=>q({name:K.target.value}),disabled:V,placeholder:"e.g. check-weather"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Name"}),a.jsx(_t,{value:C.configName||"",onChange:K=>q({configName:K.target.value}),disabled:V,placeholder:"e.g. Weather checks baseline"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Description"}),a.jsx(_t,{value:C.description||"",onChange:K=>q({description:K.target.value}),disabled:V,placeholder:"Brief description..."})]})]})})}),a.jsxs(ax,{value:I,onValueChange:K=>{if(K!=="servers"&&K!=="agents"&&K!=="scenarios")return;const pe=new URLSearchParams(s);if(pe.delete("tab"),o(pe,{replace:!0}),e&&e!=="new"){r(`/mcp-evaluations/${encodeURIComponent(e)}/${K}`,{replace:!0});return}r(`/mcp-evaluations/${e??"new"}/${K}`,{replace:!0})},className:"space-y-4",children:[a.jsxs(Cp,{children:[a.jsxs(Xs,{value:"scenarios",className:"gap-1.5",children:[a.jsx(GS,{className:"h-3.5 w-3.5"}),"Scenarios"]}),a.jsxs(Xs,{value:"agents",className:"gap-1.5",children:[a.jsx(Wr,{className:"h-3.5 w-3.5"}),"Agents"]})]}),a.jsxs(Gf,{value:"agents",children:[!V&&a.jsx(Qe,{className:"mb-4",children:a.jsxs(Je,{className:"pt-4 space-y-3",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",children:[a.jsxs(Mn,{value:P,onValueChange:T,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{placeholder:"Select agent from library"})}),a.jsx(kn,{children:de.map(K=>a.jsx(ut,{value:K.id,children:K.label},K.id))})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!P,onClick:we,children:"Add Ref"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!P,onClick:tt,children:"Import Inline"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:v.length===0||v.every(K=>B.some(pe=>pe.kind==="referenced"&&pe.ref===K.id)),onClick:at,children:"Add All Refs"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",onClick:ge,children:"Add agent"})]})]}),a.jsxs("div",{className:"space-y-2",children:[B.map((K,pe)=>{const Ae=K.kind==="referenced"?rn(K.ref):null,Ke=K.kind==="inline"?Hn(K.agent.name,K.agent.id):Hn(Ae?.name,K.ref),te=K.kind==="inline"?K.agent.model:Ae?.model||"unknown",Le=K.kind==="inline"?K.agent.id:K.ref,ot=K.kind==="referenced"&&!Ae,Ut=K.kind==="inline"?K.agent.id:K.ref,Te=ee.includes(Ut),Qt=K.kind==="inline"&&!!$[K.agent.id];return a.jsxs("div",{className:"rounded-md border text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>At(pe,-1),disabled:pe===0,"aria-label":"Move agent up",children:a.jsx(_s,{className:"h-3 w-3"})}),a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>At(pe,1),disabled:pe===B.length-1,"aria-label":"Move agent down",children:a.jsx(Jt,{className:"h-3 w-3"})})]}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[pe+1,"."]}),a.jsx("span",{className:"truncate font-medium",children:Ke}),a.jsx(et,{variant:K.kind==="inline"?"secondary":"outline",children:K.kind==="inline"?"Inline":"Referenced"}),a.jsx(et,{variant:"outline",className:"font-mono text-[10px]",children:te}),Te&&a.jsx(et,{variant:"outline",className:"text-xs border-emerald-300 text-emerald-700 bg-emerald-50",children:"Default"}),ot&&a.jsx(et,{variant:"destructive",children:"Missing"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("label",{className:"mx-2 flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx("input",{type:"checkbox",checked:Te,onChange:St=>De(Ut,St.target.checked)}),a.jsx("span",{children:"Default"})]}),K.kind==="inline"&&a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Y(St=>({...St,[K.agent.id]:!St[K.agent.id]})),children:Qt?"Collapse":"Expand"}),K.kind==="referenced"&&a.jsx(a.Fragment,{children:a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>Ge(pe),disabled:ot,children:"Convert to inline"})}),a.jsx(Z,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>it(pe),"aria-label":"Remove agent entry",children:a.jsx(Xa,{className:"h-3.5 w-3.5"})})]})]}),K.kind==="inline"&&Qt&&a.jsxs("div",{className:"border-t px-3 py-3 space-y-3",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Name"}),a.jsx(_t,{value:K.agent.name,onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,name:St.target.value}},z(Gt)},placeholder:"e.g. GPT-5 Mini custom"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Provider"}),a.jsxs(Mn,{value:K.agent.provider,onValueChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,provider:St}},z(Gt)},children:[a.jsx(_n,{children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"openai",children:"OpenAI"}),a.jsx(ut,{value:"anthropic",children:"Anthropic"}),a.jsx(ut,{value:"azure",children:"Azure OpenAI"}),a.jsx(ut,{value:"google",children:"Google"}),a.jsx(ut,{value:"custom",children:"Custom"})]})]})]})]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Model"}),a.jsx(_t,{value:K.agent.model,onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,model:St.target.value}},z(Gt)},className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Max Tokens"}),a.jsx(_t,{type:"number",min:1,max:128e3,value:K.agent.maxTokens,onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,maxTokens:parseInt(St.target.value)||0}},z(Gt)},className:"font-mono text-xs"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"Temperature"}),a.jsx(_t,{type:"number",min:0,max:2,step:.01,value:Xf(K.agent.temperature),onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,temperature:Number(St.target.value)||Pg}},z(Gt)},className:"font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(We,{className:"text-xs",children:"System Prompt"}),a.jsx(Ts,{value:K.agent.systemPrompt||"",onChange:St=>{const Gt=[...B];Gt[pe]={kind:"inline",agent:{...K.agent,systemPrompt:St.target.value}},z(Gt)},rows:3,className:"text-xs"})]})]})]},`agent-entry-${pe}-${Le}`)}),B.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents configured yet. Add inline agents or references."})]}),Ve.length>0&&a.jsxs("p",{className:"text-xs text-destructive",children:["Missing agent refs: ",Ve.join(", ")]})]})}),V?a.jsx(Qe,{children:a.jsx(Je,{className:"pt-4",children:a.jsxs("div",{className:"space-y-2",children:[_e.map((K,pe)=>{const Ae=Hn(K.agent.name,K.agent.id),Ke=ee.includes(K.origin==="inline"?K.agent.id:K.ref||K.agent.id),te=K.ref??K.agent.id,Le=!!H[te];return a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:[pe+1,"."]}),a.jsx("div",{className:"truncate font-medium text-sm",children:Ae})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[Ke&&a.jsx(et,{variant:"outline",className:"text-xs border-emerald-300 text-emerald-700 bg-emerald-50",children:"Default"}),a.jsx(et,{variant:K.origin==="inline"?"secondary":"outline",children:K.origin==="inline"?"Inline":"Referenced"}),a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-8 w-8",onClick:()=>F(ot=>({...ot,[te]:!ot[te]})),"aria-label":Le?"Collapse agent details":"Expand agent details",children:a.jsx(Jt,{className:`h-4 w-4 transition-transform ${Le?"rotate-180":""}`})})]})]}),Le&&a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 border-t pt-2",children:[a.jsx(j8,{provider:K.agent.provider}),a.jsx(et,{variant:"outline",className:"text-xs font-mono",children:K.agent.model}),a.jsxs(et,{variant:"outline",className:"text-xs font-mono",children:["max_tokens: ",K.agent.maxTokens]}),a.jsxs(et,{variant:"outline",className:"text-xs font-mono",children:["temperature: ",Xf(K.agent.temperature)]})]})]},`agent-view-${pe}-${K.ref??K.agent.id}`)}),_e.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No agents configured."})]})})}):null]}),a.jsxs(Gf,{value:"scenarios",children:[!V&&a.jsx(Qe,{className:"mb-4",children:a.jsxs(Je,{className:"pt-4 space-y-3",children:[a.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",children:[a.jsxs(Mn,{value:A,onValueChange:E,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{placeholder:"Select scenario from library"})}),a.jsx(kn,{children:[...x].sort((K,pe)=>Hn(K.name,K.id).localeCompare(Hn(pe.name,pe.id))).map(K=>a.jsx(ut,{value:K.id,children:Hn(K.name,K.id)},K.id))})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!A,onClick:Ze,children:"Add Ref"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",disabled:!A,onClick:Ee,children:"Import Inline"}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-8",onClick:Re,children:"Add scenario"})]})]}),a.jsxs("div",{className:"space-y-2",children:[O.map((K,pe)=>{const Ae=K.kind==="referenced"?an(K.ref):null,Ke=K.kind==="inline"?Hn(K.scenario.name,K.scenario.id):Hn(Ae?.name,K.ref),te=K.kind==="inline"&&Hn(K.scenario.name).length===0,Le=K.kind==="referenced"&&le.has(K.ref),ot=K.kind==="referenced"&&Array.isArray(K.mcpServers),Ut=K.kind==="inline"&&!!X[K.scenario.id];return a.jsxs("div",{className:"rounded-md border text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>Ft(pe,-1),disabled:pe===0,"aria-label":"Move scenario up",children:a.jsx(_s,{className:"h-3 w-3"})}),a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-6 w-6",onClick:()=>Ft(pe,1),disabled:pe===O.length-1,"aria-label":"Move scenario down",children:a.jsx(Jt,{className:"h-3 w-3"})})]}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[pe+1,"."]}),a.jsx("span",{className:"truncate font-medium",children:Ke}),a.jsx(et,{variant:K.kind==="inline"?"secondary":"outline",children:K.kind==="inline"?"Inline":"Referenced"}),ot&&a.jsx(et,{variant:"secondary",children:"Override"}),te&&a.jsx(et,{variant:"destructive",children:"Name required"}),Le&&a.jsx(et,{variant:"destructive",children:"Missing"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[K.kind==="inline"&&a.jsx(Z,{type:"button",size:"icon",variant:"outline",className:"h-7 w-7",onClick:()=>L(Te=>({...Te,[K.scenario.id]:!Te[K.scenario.id]})),"aria-label":Ut?"Collapse scenario details":"Expand scenario details",children:a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${Ut?"rotate-180":""}`})}),K.kind==="referenced"&&a.jsx(a.Fragment,{children:a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>zt(pe),disabled:Le,children:"Convert to inline"})}),a.jsx(Z,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>ht(pe),"aria-label":"Remove scenario entry",children:a.jsx(Xa,{className:"h-3.5 w-3.5"})})]})]}),K.kind==="inline"&&Ut&&a.jsx("div",{className:"border-t px-3 py-3",children:a.jsx(YN,{scenarios:[K.scenario],scenarioOrigins:["inline"],agents:[...C.agents,...ln],servers:vt,configId:C.id,configPath:C.sourcePath,defaultAssistantAgentName:C.runDefaults?.selectedAgentNames?.[0],onChange:Te=>{const Qt=Te[0];if(!Qt)return;const St=[...O];St[pe]={kind:"inline",scenario:Qt},Q(St)},readOnly:!1,allowAdd:!1,allowStructureEdits:!1})}),K.kind==="referenced"&&!Le&&a.jsxs("div",{className:"border-t px-3 py-3 space-y-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Optional MCP server override for this referenced scenario."}),a.jsx("div",{className:"flex flex-wrap gap-2",children:ve.map(Te=>{const Qt=(K.mcpServers??[]).some(St=>St.kind==="referenced"&&St.ref===Te.id);return a.jsx(Z,{type:"button",size:"sm",variant:Qt?"default":"outline",className:`h-7 text-xs ${Qt?"":"opacity-70"}`,onClick:()=>{const St=(K.mcpServers??[]).filter(Xn=>Xn.kind==="referenced").map(Xn=>Xn.ref),Gt=St.includes(Te.id)?St.filter(Xn=>Xn!==Te.id):[...St,Te.id];ke(pe,Gt)},children:Hn(Te.name,Te.id)},`${K.ref}-override-server-${Te.id}`)})}),ot&&a.jsx(Z,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>Ce(pe),children:"Reset override"})]})]},`scenario-entry-${pe}-${K.kind==="inline"?K.scenario.id:K.ref}`)}),O.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No scenarios configured yet. Add inline scenarios or references."})]}),U.length>0&&a.jsxs("p",{className:"text-xs text-destructive",children:["Missing scenario refs: ",U.join(", ")]})]})}),V?a.jsx(Qe,{children:a.jsx(Je,{className:"pt-4",children:a.jsx(YN,{scenarios:Xe.map(K=>K.scenario),scenarioOrigins:Xe.map(K=>K.origin),scenarioOverrides:Xe.map(K=>K.hasMcpServerOverride),agents:kt,servers:vt,configId:C.id,configPath:C.sourcePath,defaultAssistantAgentName:C.runDefaults?.selectedAgentNames?.[0],testCaseReturnToPath:M,onChange:()=>{},readOnly:!0})})}):null]})]})]})};var Tye=Symbol("radix.slottable");function Oye(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Tye,t}var lq="AlertDialog",[Mye]=kr(lq,[aL]),Ho=aL(),cq=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ho(t);return a.jsx(lv,{...r,...n,modal:!0})};cq.displayName=lq;var Iye="AlertDialogTrigger",$ye=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(wQ,{...s,...r,ref:t})});$ye.displayName=Iye;var Dye="AlertDialogPortal",uq=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ho(t);return a.jsx(cv,{...r,...n})};uq.displayName=Dye;var Lye="AlertDialogOverlay",dq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(Ru,{...s,...r,ref:t})});dq.displayName=Lye;var Wc="AlertDialogContent",[Fye,zye]=Mye(Wc),Bye=Oye("AlertDialogContent"),fq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,o=Ho(n),i=h.useRef(null),c=Ot(t,i),u=h.useRef(null);return a.jsx(vQ,{contentName:Wc,titleName:pq,docsSlug:"alert-dialog",children:a.jsx(Fye,{scope:n,cancelRef:u,children:a.jsxs(Tu,{role:"alertdialog",...o,...s,ref:c,onOpenAutoFocus:Ue(s.onOpenAutoFocus,f=>{f.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[a.jsx(Bye,{children:r}),a.jsx(Uye,{contentRef:i})]})})})});fq.displayName=Wc;var pq="AlertDialogTitle",hq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(ip,{...s,...r,ref:t})});hq.displayName=pq;var mq="AlertDialogDescription",gq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(lp,{...s,...r,ref:t})});gq.displayName=mq;var qye="AlertDialogAction",vq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ho(n);return a.jsx(uv,{...s,...r,ref:t})});vq.displayName=qye;var xq="AlertDialogCancel",yq=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=zye(xq,n),o=Ho(n),i=Ot(t,s);return a.jsx(uv,{...o,...r,ref:i})});yq.displayName=xq;var Uye=({contentRef:e})=>{const t=`\`${Wc}\` requires a description for the component to be accessible for screen reader users.
134
134
 
135
135
  You can add a description to the \`${Wc}\` by passing a \`${mq}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
136
136
 
@@ -143,9 +143,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
143
143
 
144
144
  Defaulting to \`null\`.`}var hU=uU,j0e=fU;const px=h.forwardRef(({className:e,value:t,...n},r)=>a.jsx(hU,{ref:r,className:Me("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:a.jsx(j0e,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));px.displayName=hU.displayName;function mU(e){const t=e.toLowerCase();return t.includes("side-effectful prefix")||t.includes("destructive behavior")||t.includes("destructivehint")||t.includes("non-read-only behavior")||t.includes("readonlyhint: false")||t.includes("additive behavior")}function Tg(e){try{return JSON.stringify(e,null,2)}catch{return"[schema not serializable]"}}function S0e(e){return typeof e.type=="string"?e.type:Array.isArray(e.type)?e.type.join(" | "):e.properties&&typeof e.properties=="object"?"object":e.items&&typeof e.items=="object"?"array":"any"}function tf(e,t=new Set){if(!e||typeof e!="object"||Array.isArray(e))return 0;const n=e;if(t.has(n))return 0;const r=new Set(t);r.add(n);const s=n.properties&&typeof n.properties=="object"&&!Array.isArray(n.properties)?n.properties:void 0,o=s?Object.values(s).reduce((u,f)=>u+tf(f,r),0):0,i=tf(n.items,r),c=[...Array.isArray(n.oneOf)?n.oneOf:[],...Array.isArray(n.anyOf)?n.anyOf:[]].reduce((u,f)=>u+tf(f,r),0);return(s?Object.keys(s).length:0)+o+i+c}function nf({name:e,schema:t,required:n=!1,depth:r=0,seen:s=new Set,expandAll:o=null}){const[i,c]=h.useState(r===0);if(h.useEffect(()=>{o!==null&&c(o)},[o]),!t||typeof t!="object"||Array.isArray(t))return a.jsx("div",{className:"text-xs",children:e});const u=t;if(s.has(u))return a.jsxs("div",{className:"text-xs text-muted-foreground",children:[e," (circular)"]});const f=new Set(s);f.add(u);const m=u.properties&&typeof u.properties=="object"&&!Array.isArray(u.properties)?u.properties:void 0,p=new Set(Array.isArray(u.required)?u.required.filter(y=>typeof y=="string"):[]),v=u.items&&typeof u.items=="object"?u.items:void 0,x=[...Array.isArray(u.oneOf)?u.oneOf:[],...Array.isArray(u.anyOf)?u.anyOf:[]],j=m&&Object.keys(m).length>0||!!v||x.length>0;return a.jsxs("div",{className:"min-w-0 space-y-1",style:{marginLeft:r*12},children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 text-xs",children:[j?a.jsxs("button",{type:"button",className:"inline-flex min-w-0 max-w-full items-center gap-1 text-left font-medium hover:underline","aria-label":`${i?"Collapse":"Expand"} ${e}`,"aria-expanded":i,onClick:()=>c(y=>!y),children:[i?a.jsx(Jt,{className:"h-3 w-3 shrink-0"}):a.jsx(zg,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{className:"break-words",children:e})]}):a.jsx("span",{className:"break-words font-medium",children:e}),a.jsx(et,{variant:"outline",className:"text-[10px]",children:S0e(u)}),n&&a.jsx("span",{className:"text-[10px] text-rose-600",children:"required"})]}),typeof u.description=="string"&&a.jsx("div",{className:"max-w-full break-words text-[11px] text-muted-foreground",children:u.description}),Array.isArray(u.enum)&&a.jsxs("div",{className:"max-w-full break-words text-[11px] text-muted-foreground",children:["Enum: ",u.enum.map(y=>String(y)).join(", ")]}),u.default!==void 0&&a.jsxs("div",{className:"max-w-full break-words text-[11px] text-muted-foreground",children:["Default: ",Tg(u.default)]}),i&&j&&a.jsxs("div",{className:"min-w-0 space-y-2 border-l pl-2",children:[m&&Object.keys(m).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:"Properties"}),Object.entries(m).map(([y,b])=>a.jsx(nf,{name:y,schema:b,required:p.has(y),depth:r+1,seen:f,expandAll:o},y))]}),v&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:"Items"}),a.jsx(nf,{name:"item",schema:v,depth:r+1,seen:f,expandAll:o})]}),x.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:"Variants"}),x.map((y,b)=>a.jsx(nf,{name:`variant ${b+1}`,schema:y,depth:r+1,seen:f,expandAll:o},b))]})]})]})}function ED({propertyCount:e,onExpandAll:t,onCollapseAll:n}){return a.jsxs("span",{className:"flex flex-wrap items-center gap-1",children:[a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e," Properties"]}),a.jsx("button",{type:"button",className:"rounded border px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground",onClick:t,children:"Expand All"}),a.jsx("button",{type:"button",className:"rounded border px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground",onClick:n,children:"Collapse All"})]})}function Zh({title:e,schema:t,explorerControls:n}){const r=e.toLowerCase(),s=async()=>{try{await navigator.clipboard.writeText(Tg(t)),$e({title:`${e} copied`})}catch(o){$e({title:`Could not copy ${e.toLowerCase()}`,description:o instanceof Error?o.message:String(o),variant:"destructive"})}};return a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[a.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:e}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-1.5",children:[n,a.jsxs("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":`Copy ${r} JSON`,title:`Copy ${r} JSON`,onClick:()=>{s()},children:[a.jsx(Hr,{className:"h-3 w-3"}),"Copy JSON"]})]})]})}function gU({inputSchema:e,outputSchema:t,mode:n,onModeChange:r}){const[s,o]=h.useState("explorer"),[i,c]=h.useState(null),[u,f]=h.useState(null),m=n??s,p=v=>{r?.(v),n||o(v)};return e===void 0&&t===void 0?null:a.jsxs("details",{className:"group/schema min-w-0 max-w-full overflow-hidden rounded border bg-muted/10 p-2",onClick:v=>v.stopPropagation(),children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-2 text-xs font-medium",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:["Schemas",e!==void 0&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"input"}),t!==void 0&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"output"})]}),a.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex rounded-md border bg-muted p-0.5",role:"tablist","aria-label":"Schema view mode",children:["json","explorer"].map(v=>a.jsx("button",{type:"button",role:"tab","aria-selected":m===v,className:"rounded px-2 py-0.5 text-[11px] font-medium capitalize data-[active=true]:bg-background data-[active=true]:shadow-sm","data-active":m===v,onClick:x=>{x.preventDefault(),x.stopPropagation(),p(v)},children:v.toUpperCase()},v))}),a.jsx(Jt,{className:"h-4 w-4 text-muted-foreground transition-transform group-open/schema:rotate-180"})]})]}),a.jsxs("div",{className:"mt-2",children:[m==="json"&&a.jsxs("div",{className:"mt-2 space-y-2",children:[e!==void 0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(Zh,{title:"Input schema",schema:e}),a.jsx("pre",{className:"max-h-52 max-w-full overflow-auto whitespace-pre-wrap break-words rounded border bg-muted/20 p-2 text-[11px]",children:Tg(e)})]}),t!==void 0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(Zh,{title:"Output schema",schema:t}),a.jsx("pre",{className:"max-h-52 max-w-full overflow-auto whitespace-pre-wrap break-words rounded border bg-muted/20 p-2 text-[11px]",children:Tg(t)})]})]}),m==="explorer"&&a.jsxs("div",{className:"mt-2 min-w-0 space-y-2",children:[e!==void 0&&a.jsxs("div",{className:"min-w-0 space-y-2 rounded border bg-muted/10 p-2",children:[a.jsx(Zh,{title:"Input schema",schema:e,explorerControls:a.jsx(ED,{propertyCount:tf(e),onExpandAll:()=>c(!0),onCollapseAll:()=>c(!1)})}),a.jsx(nf,{name:"root",schema:e,expandAll:i})]}),t!==void 0&&a.jsxs("div",{className:"min-w-0 space-y-2 rounded border bg-muted/10 p-2",children:[a.jsx(Zh,{title:"Output schema",schema:t,explorerControls:a.jsx(ED,{propertyCount:tf(t),onExpandAll:()=>f(!0),onCollapseAll:()=>f(!1)})}),a.jsx(nf,{name:"root",schema:t,expandAll:u})]})]})]})]})}function vU(e,t){const n=typeof navigator<"u"?navigator.language:void 0;return e.toLocaleString(n)}function N0e(e,t){let n=0,r=!1;for(const s of e){const o=s.tokenEstimate;if(!o)continue;r=!0;const i=new Set(t[s.serverName]??[]);n+=o.tools.filter(c=>i.has(c.name)).reduce((c,u)=>c+u.total,0)}return r?n:void 0}function Og({total:e,title:t="Estimated tokens for this tool definition and its schemas",className:n}){return typeof e!="number"?null:a.jsxs(et,{variant:"outline",className:Me("bg-background font-mono text-xs font-normal",n),title:t,children:["~",vU(e),"tok"]})}const rl=["critical","high","medium","low","info"];function em(e){switch(e){case"critical":return"border-red-300 bg-red-100 text-red-900";case"high":return"border-orange-300 bg-orange-100 text-orange-900";case"medium":return"border-amber-300 bg-amber-100 text-amber-900";case"low":return"border-sky-300 bg-sky-100 text-sky-900";default:return"border-slate-300 bg-slate-100 text-slate-800"}}function C0e(e){switch(e){case"critical":return"border-red-300 bg-background text-red-900";case"high":return"border-orange-300 bg-background text-orange-900";case"medium":return"border-amber-300 bg-background text-amber-900";case"low":return"border-sky-300 bg-background text-sky-900";default:return"border-slate-300 bg-background text-slate-800"}}function PD(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"tool"}async function PS(e,t){const n=typeof t=="string"?t:JSON.stringify(t,null,2);try{await navigator.clipboard.writeText(n),$e({title:`${e} copied`})}catch(r){$e({title:`Could not copy ${e.toLowerCase()}`,description:r instanceof Error?r.message:String(r),variant:"destructive"})}}function RS({text:e}){return a.jsxs("div",{className:"mt-2 rounded-md border px-2.5 py-2 text-[11px] text-slate-800",children:[a.jsxs("div",{className:"mb-1 inline-flex items-center gap-1 font-medium text-slate-700",children:[a.jsx(RW,{className:"h-3.5 w-3.5"}),"Suggested improvement"]}),a.jsx("p",{children:e})]})}function _0e({label:e,reason:t,variantClassName:n}){return a.jsx(Js,{delayDuration:0,children:a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsx(et,{variant:"outline",className:n,children:e})}),a.jsx(Rs,{className:"max-w-sm text-xs",children:a.jsx("p",{children:t})})]})})}function bk(e){const t=[],n=(r,s)=>{t.push(`#### ${r}`),t.push("```json");try{t.push(JSON.stringify(s,null,2))}catch{t.push('"[schema not serializable]"')}t.push("```")};if(t.push("# MCP Tool Analysis Report",""),t.push(`- Created: ${e.createdAt}`),t.push(`- Assistant Agent: ${e.assistantAgentName}`),t.push(`- Assistant Model: ${e.assistantAgentModel}`),e.mcpServerVersions&&Object.keys(e.mcpServerVersions).length>0){const r=Object.entries(e.mcpServerVersions).map(([s,o])=>`${s}: ${o??"unknown"}`).join(", ");t.push(`- MCP Server Versions: ${r}`)}t.push(`- Modes: ${[e.modes.metadataReview?"metadata review":null,e.modes.deeperAnalysis?"deeper analysis":null].filter(Boolean).join(" + ")}`),t.push("","## Summary"),t.push(`- Servers analyzed: ${e.summary.serversAnalyzed}`),t.push(`- Tools analyzed: ${e.summary.toolsAnalyzed}`),t.push(`- Tools skipped: ${e.summary.toolsSkipped}`,"");for(const r of e.servers){t.push(`## Server: ${r.serverName}`),r.warnings.length>0&&t.push(...r.warnings.map(s=>`- Warning: ${s}`),"");for(const s of r.tools){if(t.push(`### ${s.publicToolName}`),s.title&&t.push(`- Title: ${s.title}`),t.push(`- Safety: ${s.safetyClassification} (${s.classificationReason})`),s.inputSchema!==void 0&&n("Input schema",s.inputSchema),s.outputSchema!==void 0&&n("Output schema",s.outputSchema),s.metadataReview?.issues.length){t.push("#### Metadata issues");for(const o of s.metadataReview.issues)t.push(` - [${o.severity}] ${o.title}: ${o.detail}`)}if(s.deeperAnalysis)if(!s.deeperAnalysis.attempted)t.push(`- Deeper analysis: skipped (${s.deeperAnalysis.skippedReason??"unknown"})`);else{t.push(`- Deeper analysis sample calls: ${s.deeperAnalysis.sampleCalls.length}`);for(const o of s.deeperAnalysis.sampleCalls){t.push(` - Call ${o.callIndex}: ${o.ok?"ok":"error"}${o.durationMs?` (${o.durationMs}ms)`:""}`),o.error&&t.push(` - Error: ${o.error}`);for(const i of o.observations)t.push(` - ${i}`)}}if(s.overallRecommendations.length>0){t.push("#### Recommendations");for(const o of s.overallRecommendations)t.push(` - ${o}`)}if(s.metadataReview?.evalReadinessNotes.length){t.push("#### Agent/Eval readiness notes");for(const o of s.metadataReview.evalReadinessNotes)t.push(` - ${o}`)}t.push("")}}return`${t.join(`
145
145
  `)}
146
- `}function xU({report:e,schemaMode:t,onSchemaModeChange:n}){const[r,s]=zo(),[o,i]=h.useState([...rl]),[c,u]=h.useState(new Set),[f,m]=h.useState(""),[p,v]=h.useState(!1),[x,j]=h.useState("explorer"),y=t??x,b=L=>{n?.(L),t||j(L)},S=r.get("groupBy")==="severity"?"severity":"tool",N=h.useRef(null),C=f.trim().toLowerCase(),k=h.useMemo(()=>new Set(o),[o]),A=L=>{i(I=>{const M=I.includes(L)?I.filter(q=>q!==L):[...I,L];return M.length===0?[...rl]:M})},E=L=>{const I=new URLSearchParams(r);L==="severity"?I.set("groupBy","severity"):I.delete("groupBy"),s(I,{replace:!0})},P=h.useMemo(()=>{const L={critical:[],high:[],medium:[],low:[],info:[]};for(const I of e.servers)for(const M of I.tools){const q=`tool-${PD(`${I.serverName}-${M.publicToolName}`)}`,G=`${I.serverName}::${M.publicToolName}`,O=M.publicToolName.split("::").pop()??M.publicToolName;for(const Q of M.metadataReview?.issues??[]){const B=Q.severity;L[B].push({key:`${G}-metadata-${Q.id}`,toolAnchorId:q,toolLabel:G,toolDisplayName:O,sourceLabel:"Metadata review",issue:{id:Q.id,title:Q.title,detail:Q.detail,severity:B,suggestion:Q.suggestion}})}for(const Q of M.deeperAnalysis?.sampleCalls??[])for(const B of Q.issues){const z=B.severity;L[z].push({key:`${G}-call-${Q.callIndex}-${B.id}`,toolAnchorId:q,toolLabel:G,toolDisplayName:O,sourceLabel:`Sample call ${Q.callIndex}`,issue:{id:B.id,title:B.title,detail:B.detail,severity:z,suggestion:B.suggestion}})}}return L},[e.servers]),T=h.useMemo(()=>Array.from(new Set(e.servers.flatMap(L=>L.tools.map(I=>I.publicToolName)).map(L=>L.split("::").pop()??L))).sort((L,I)=>L.localeCompare(I)),[e.servers]),$=L=>C.length===0?!0:(L.toLowerCase().split("::").pop()??L.toLowerCase()).includes(C),Y=L=>{if(!N.current)return;N.current.querySelectorAll("details").forEach(M=>{M.open=L})},H=()=>u(new Set(rl)),F=()=>u(new Set),X=L=>{u(I=>{const M=new Set(I);return M.has(L)?M.delete(L):M.add(L),M})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Tools analyzed"}),a.jsx("div",{className:"text-2xl font-semibold",children:e.summary.toolsAnalyzed})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Tools skipped"}),a.jsx("div",{className:"text-2xl font-semibold",children:e.summary.toolsSkipped})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Findings"}),a.jsx("div",{className:"text-2xl font-semibold",children:e.findings.length})]})})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Analysis Overview"}),a.jsx(Or,{children:"Visual breakdown of findings by severity. Click badges to filter the report."})]}),a.jsx(Je,{children:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[rl.filter(L=>e.summary.issueCounts[L]>0).map(L=>{const I=k.has(L);return a.jsx("button",{type:"button",onClick:()=>A(L),className:"rounded-full","aria-pressed":I,children:a.jsxs(et,{variant:"outline",className:`capitalize font-normal ${I?em(L):C0e(L)} ${I?"ring-1 ring-current":"opacity-70"}`,children:[L,": ",e.summary.issueCounts[L]]})},L)}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>i([...rl]),className:"h-7 px-2 text-xs",children:"Reset"})]})})]}),a.jsxs("div",{className:"space-y-0",children:[a.jsx(ax,{value:S,onValueChange:L=>{(L==="tool"||L==="severity")&&E(L)},className:"min-w-0 px-3 pt-1",children:a.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2 border-b",children:[a.jsxs(Cp,{className:"h-auto justify-start rounded-none bg-transparent p-0",children:[a.jsx(Xs,{value:"tool",className:"-mb-px h-10 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-6 text-sm font-semibold text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Report by Tool"}),a.jsx(Xs,{value:"severity",className:"-mb-px h-10 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-6 text-sm font-semibold text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"By Severity"})]}),a.jsxs("div",{className:"mb-2 flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"whitespace-nowrap text-xs text-muted-foreground",children:"Filter tools"}),a.jsxs(wi,{open:p,onOpenChange:v,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":p,"aria-controls":"tool-filter-command-list",className:"h-8 w-[320px] max-w-full justify-between text-xs font-normal",children:[a.jsx("span",{className:"truncate text-left",children:f||"All tools"}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(Ro,{className:"w-[320px] p-0",align:"end",children:a.jsxs(Tl,{children:[a.jsx(Ol,{placeholder:"Search tools..."}),a.jsxs(Ml,{id:"tool-filter-command-list",children:[a.jsx(Il,{children:"No tools found."}),a.jsxs($l,{children:[a.jsx(Na,{value:"all tools",onSelect:()=>{m(""),v(!1)},children:"All tools"}),T.map(L=>a.jsx(Na,{value:L,onSelect:()=>{m(L),v(!1)},children:L},L))]})]})]})})]}),S==="severity"&&a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:F,children:"Expand all"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:H,children:"Collapse all"})]}),S==="tool"&&a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>Y(!0),children:"Expand all"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>Y(!1),children:"Collapse all"})]})]})]})}),S==="severity"?a.jsx("div",{className:"space-y-4",children:rl.filter(L=>k.has(L)).map(L=>{const I=P[L].filter(q=>$(q.toolLabel));if(I.length===0)return null;const M=c.has(L);return a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base capitalize",children:L}),a.jsxs(Or,{children:[I.length," finding(s)"]})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>X(L),children:M?"Expand":"Collapse"})})]})}),!M&&a.jsx(Je,{className:"space-y-2",children:I.map((q,G)=>a.jsxs("div",{className:"rounded border p-2 text-xs",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:G+1}),a.jsx("span",{className:"min-w-0 font-bold leading-tight",children:q.issue.title})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${em(q.issue.severity)}`,children:q.issue.severity})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",q.issue.detail]}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[11px]",children:[a.jsx(et,{variant:"secondary",className:"font-normal",children:q.sourceLabel}),a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 font-mono text-[11px]",title:q.toolLabel,onClick:()=>{E("tool"),requestAnimationFrame(()=>{document.getElementById(q.toolAnchorId)?.scrollIntoView({behavior:"smooth",block:"start"})})},children:q.toolDisplayName})]}),q.issue.suggestion&&a.jsx(RS,{text:q.issue.suggestion})]},q.key))})]},L)})}):a.jsx("div",{ref:N,className:"space-y-4",children:e.servers.map(L=>{const I=L.tokenEstimate,M=L.tools.filter(q=>{const G=`${L.serverName}::${q.publicToolName}`;if(!$(G))return!1;const O=[...q.metadataReview?.issues??[],...q.deeperAnalysis?.sampleCalls.flatMap(Q=>Q.issues)??[]];return O.length===0?o.length===rl.length:O.some(Q=>k.has(Q.severity))});return M.length===0?null:a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[L.serverName,a.jsx(Og,{total:I?.total,title:"Estimated tokens for the analyzed tool definitions and their schemas"})]}),a.jsxs(Or,{children:["Discovered ",L.toolCountDiscovered," · Showing ",M.length," of"," ",L.toolCountAnalyzed," analyzed · Skipped ",L.toolCountSkipped]})]}),a.jsxs(Je,{className:"space-y-3",children:[L.warnings.length>0&&a.jsxs(vl,{children:[a.jsx(xl,{children:"Warnings"}),a.jsx(yl,{children:a.jsx("ul",{className:"ml-4 list-disc space-y-1",children:L.warnings.map(q=>a.jsx("li",{children:q},`${L.serverName}-${q}`))})})]}),M.map(q=>{const G=I?.tools.find(V=>V.name===q.toolName),O=q.publicToolName.split("::").pop()??q.publicToolName,Q=mU(q.classificationReason),B=q.safetyClassification==="read_only"?"read-only":Q?"write/delete":"unsafe/unknown",z=q.safetyClassification==="read_only"?"border-emerald-200 bg-emerald-50 text-emerald-700":Q?"border-amber-300 bg-amber-50 text-amber-800":"border-slate-300 bg-slate-100 text-slate-700";return a.jsxs("details",{id:`tool-${PD(`${L.serverName}-${q.publicToolName}`)}`,className:"group rounded-md border p-3",children:[a.jsx("summary",{className:"cursor-pointer list-none",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("div",{className:"min-w-0 truncate font-mono text-sm",title:q.publicToolName,children:O}),a.jsx(_0e,{label:B,reason:q.classificationReason,variantClassName:z}),a.jsx(Og,{total:G?.total,className:"text-[10px]"})]}),a.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),q.title&&a.jsx("p",{className:"text-sm text-foreground/85",children:q.title}),q.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:q.description})]})}),a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-[11px]",onClick:()=>{PS("Tool info",{server:L.serverName,name:q.publicToolName,title:q.title,description:q.description})},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy Tool Info"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-[11px]",onClick:()=>{PS("Schemas",{server:L.serverName,name:q.publicToolName,inputSchema:q.inputSchema,outputSchema:q.outputSchema})},disabled:q.inputSchema===void 0&&q.outputSchema===void 0,children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy Schemas"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-[11px]",onClick:()=>{PS("Metadata review",{server:L.serverName,name:q.publicToolName,metadataReview:q.metadataReview})},disabled:!q.metadataReview,children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy Metadata Review"]})]}),a.jsx(gU,{inputSchema:q.inputSchema,outputSchema:q.outputSchema,mode:y,onModeChange:b}),q.metadataReview&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Metadata review"}),q.metadataReview.issues.filter(V=>k.has(V.severity)).length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No metadata issues reported."}):a.jsx("div",{className:"space-y-1",children:q.metadataReview.issues.filter(V=>k.has(V.severity)).map((V,ee)=>a.jsxs("div",{className:"rounded border p-2 text-xs",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:ee+1}),a.jsx("span",{className:"min-w-0 font-bold leading-tight",children:V.title})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${em(V.severity)}`,children:V.severity})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",V.detail]}),V.suggestion&&a.jsx(RS,{text:V.suggestion})]},V.id))})]}),q.deeperAnalysis&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Deeper analysis"}),q.deeperAnalysis.attempted?a.jsx("div",{className:"space-y-2",children:q.deeperAnalysis.sampleCalls.map(V=>a.jsxs("div",{className:"rounded border p-2 text-xs",children:[a.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[a.jsx(et,{variant:V.ok?"secondary":"destructive",className:"text-[10px]",children:V.ok?"ok":"error"}),a.jsxs("span",{children:["Call ",V.callIndex]}),V.durationMs!==void 0&&a.jsxs("span",{className:"text-muted-foreground",children:[V.durationMs,"ms"]})]}),V.error&&a.jsx("p",{className:"text-destructive",children:V.error}),V.observations.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"mb-1 inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Observations"}),a.jsx("ul",{className:"ml-4 list-disc space-y-1",children:V.observations.map((ee,ae)=>a.jsx("li",{children:ee},`${q.publicToolName}-obs-${V.callIndex}-${ae}`))})]}),V.issues.filter(ee=>k.has(ee.severity)).length>0&&a.jsx("div",{className:"mt-2 space-y-1",children:V.issues.filter(ee=>k.has(ee.severity)).map((ee,ae)=>a.jsxs("div",{className:"rounded border p-2",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:ae+1}),a.jsx("span",{className:"min-w-0 font-bold leading-tight",children:ee.title})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${em(ee.severity)}`,children:ee.severity})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",ee.detail]}),ee.suggestion&&a.jsx(RS,{text:ee.suggestion})]},`${V.callIndex}-${ee.id}`))})]},`${q.publicToolName}-call-${V.callIndex}`))}):a.jsx("p",{className:"text-xs text-muted-foreground",children:q.deeperAnalysis.skippedReason??"Skipped"})]})]})]},q.publicToolName)})]})]},L.serverName)})})]})]})}function yU(e){return{reportId:e.reportId,createdAt:e.createdAt,tools:e.report.servers.flatMap(t=>t.tools.map(n=>({server:t.serverName,name:n.publicToolName,title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema})))}}function k0e(e){const t=e.selectedToolNames?.length?new Set(e.selectedToolNames):null;return{serverName:e.serverName,tools:e.tools.filter(n=>!t||t.has(n.name)).map(n=>({name:n.name,title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema}))}}function RD(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function A0e(e,t){const n=["tool-info",RD(e)],r=t?.trim();return r&&n.push(`v${RD(r)}`),`${n.filter(Boolean).join("-")}.json`}function E0e(e){let t=0;const n=new Set,r=new Set;for(const o of e){const i=typeof o.payload?.message=="string"?o.payload.message:"";if(!i)continue;const c=i.match(/\((\d+)\s+selected\s+of\s+\d+\s+discovered\)/i);c&&(t=Math.max(t,Number(c[1])||0));const u=i.match(/^Started\s+(.+)$/);u&&n.add(u[1]);const f=i.match(/^Finished\s+(.+)$/);f&&r.add(f[1])}const s=t>0?Math.max(0,Math.min(100,Math.round(r.size/t*100))):0;return{totalTools:t,startedTools:n.size,finishedTools:r.size,percent:s}}const TS="mcplab.toolAnalysis.activeJobId";function OS(e,t,n){const r=new Blob([t],{type:n}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=e,o.click(),URL.revokeObjectURL(s)}async function P0e(e,t){try{await navigator.clipboard.writeText(t),$e({title:`${e} copied`})}catch(n){$e({title:`Could not copy ${e.toLowerCase()}`,description:n instanceof Error?n.message:String(n),variant:"destructive"})}}function TD({text:e}){return a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsx("button",{type:"button",className:"inline-flex h-4 w-4 items-center justify-center rounded text-muted-foreground hover:text-foreground",onClick:t=>t.preventDefault(),"aria-label":e,children:a.jsx(SW,{className:"h-3.5 w-3.5"})})}),a.jsx(Rs,{className:"max-w-xs text-xs",children:a.jsx("p",{children:e})})]})}function R0e(e,t){const n=t.toLowerCase();return n.includes("failed to load tools")||n.includes("failed to connect to mcp server")?`Could not load tools from '${e}'. Check that the MCP server is running and reachable, then try Refresh Servers / Discover Tools again.`:t}function T0e({label:e,reason:t,variantClassName:n}){return a.jsx(Js,{delayDuration:0,children:a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsx(et,{variant:"outline",className:n,children:e})}),a.jsx(Rs,{className:"max-w-sm text-xs",children:a.jsx("p",{children:t})})]})})}const O0e=()=>{const e=ke=>`tool-analysis-${Date.now()}.${ke}`,{source:t}=$n(),{servers:n,agents:r,loading:s,reload:o}=Is(),[i,c]=h.useState(""),[u,f]=h.useState([]),[m,p]=h.useState(!1),[v,x]=h.useState([]),[j,y]=h.useState({}),[b,S]=h.useState(""),[N,C]=h.useState(!0),[k,A]=h.useState(!1),[E,P]=h.useState(2),[T,$]=h.useState(1),[Y,H]=h.useState(1e4),[F,X]=h.useState(null),[L,I]=h.useState([]),[M,q]=h.useState(null),[G,O]=h.useState(null),[Q,B]=h.useState(!1),[z,V]=h.useState("configure"),[ee,ae]=h.useState("explorer"),[ue,se]=h.useState("idle"),[xe,oe]=h.useState(!1),de=h.useRef(null),De=h.useRef(null),me=i||r[0]?.name||"",ge=h.useMemo(()=>E0e(L),[L]);h.useEffect(()=>{let ke=!0;return t.getWorkspaceSettings().then(ze=>{!ke||!ze||c(ze.scenarioAssistantAgentName??"")}).catch(()=>{ke&&c("")}),()=>{ke=!1}},[t]),h.useEffect(()=>()=>{de.current?.()},[]),h.useEffect(()=>{const ke=De.current;ke&&requestAnimationFrame(()=>{ke.scrollTop=ke.scrollHeight})},[L.length]);const we=()=>{try{sessionStorage.removeItem(TS)}catch{}},at=ke=>{try{sessionStorage.setItem(TS,ke)}catch{}},tt=ke=>{de.current?.(),de.current=t.subscribeToolAnalysisJob(ke,ze=>{if(I(Xe=>[...Xe,ze]),ze.type==="completed")t.getToolAnalysisResult(ke).then(Xe=>{q(Xe.report),O(Xe.savedReportId??null)}).catch(Xe=>$e({title:"Could not load analysis report",description:Xe instanceof Error?Xe.message:String(Xe),variant:"destructive"})).finally(()=>{we(),X(null),B(!1),se("idle"),V("run")});else if(ze.type==="error"){const Xe=String(ze.payload?.message??"");we(),se(Xe.toLowerCase().includes("abort")?"stopped":"error"),X(null),B(!1)}})};h.useEffect(()=>{if(F||M)return;let ke="";try{ke=sessionStorage.getItem(TS)??""}catch{ke=""}if(ke)return V("run"),se("running"),B(!0),X(ke),I([]),tt(ke),()=>{}},[t,F,M]);const it=async()=>{if(u.length===0){x([]),y({});return}const ke=u.filter(ze=>n.find(kt=>kt.id===ze)?.authType==="oauth2");try{ke.length>0&&(oe(!0),await Po({serverNames:ke,source:t,onServerAuthStart:ze=>{$e({title:`OAuth login required for ${ze}`,description:"Complete login in the opened browser tab. Discovery will continue automatically."})}}))}catch(ze){$e({title:"OAuth login failed",description:ze instanceof Error?ze.message:String(ze),variant:"destructive"}),oe(!1);return}finally{oe(!1)}p(!0);try{const ze=await t.discoverToolsForAnalysis({serverNames:u});x(ze.servers),y(Xe=>{const kt={};for(const vt of ze.servers){const fe=Xe[vt.serverName]??[],Oe=vt.tools.map(U=>U.name),Ve=fe.filter(U=>Oe.includes(U));kt[vt.serverName]=Ve.length>0?Ve:Oe}return kt})}catch(ze){$e({title:"Could not discover MCP tools",description:ze instanceof Error?ze.message:String(ze),variant:"destructive"})}finally{p(!1)}};h.useEffect(()=>{it()},[u.join("|")]);const At=h.useMemo(()=>{const ke=b.trim().toLowerCase();return ke?v.map(ze=>({...ze,tools:ze.tools.filter(Xe=>Xe.name.toLowerCase().includes(ke)||(Xe.description||"").toLowerCase().includes(ke))})).filter(ze=>ze.tools.length>0):v},[v,b]),Ge=h.useMemo(()=>Object.values(j).reduce((ke,ze)=>ke+ze.length,0),[j]),Ee=h.useMemo(()=>N0e(v,j),[v,j]),Re=u[0]??"",Ze=async()=>{if(!N&&!k){$e({title:"Select at least one mode",variant:"destructive"});return}if(u.length!==1){$e({title:"Select exactly one server",variant:"destructive"});return}if(Ge===0){$e({title:"Select at least one tool",variant:"destructive"});return}B(!0),I([]),q(null),O(null),V("run"),se("running");try{const ke=u[0];n.find(kt=>kt.id===ke)?.authType==="oauth2"&&(oe(!0),await Po({serverNames:[ke],source:t,onServerAuthStart:kt=>{$e({title:`OAuth login required for ${kt}`,description:"Complete login in the opened browser tab. Analysis will continue automatically."})}}));const{jobId:Xe}=await t.startToolAnalysis({serverNames:u,selectedToolsByServer:j,maxParallelTools:E,modes:{metadataReview:N,deeperAnalysis:k},deeperAnalysisOptions:{autoRunPolicy:"read_only_allowlist",sampleCallsPerTool:T,toolCallTimeoutMs:Y}});X(Xe),at(Xe),tt(Xe)}catch(ke){B(!1),se("error"),V("run"),$e({title:"Could not start tool analysis",description:ke instanceof Error?ke.message:String(ke),variant:"destructive"})}finally{oe(!1)}},ht=()=>{const ke=u[0],ze=v.find(kt=>kt.serverName===ke);if(!ke||!ze){$e({title:"No discovered tool info available",description:"Select a server and discover tools before downloading tool info.",variant:"destructive"});return}const Xe=k0e({serverName:ze.serverName,tools:ze.tools,selectedToolNames:j[ze.serverName]});OS(A0e(ze.serverName,ze.mcpServerVersion),`${JSON.stringify(Xe,null,2)}
147
- `,"application/json")},Ft=async()=>{if(!F)return;const ke=F;try{const ze=await t.stopToolAnalysis(ke);if(ze.status==="completed"){de.current?.(),de.current=null;const Xe=await t.getToolAnalysisResult(ke);q(Xe.report),O(Xe.savedReportId??null),we(),X(null),B(!1),se("idle"),V("run"),$e({title:"Analysis already finished",description:"Showing the result overview."});return}if(ze.status==="stopped"){de.current?.(),de.current=null,we(),X(null),B(!1),se("stopped"),$e({title:"Analysis stopped"});return}if(ze.status==="error"){de.current?.(),de.current=null,we(),X(null),B(!1),se("error"),$e({title:"Analysis already ended with an error",description:"Review the progress log and return to Configure Analysis."});return}$e({title:"Stopping analysis..."})}catch(ze){$e({title:"Could not stop analysis",description:ze instanceof Error?ze.message:String(ze),variant:"destructive"})}},zt=()=>{V("configure"),se("idle"),X(null)},jt=(ke,ze)=>{f(Xe=>ze?[ke]:Xe.filter(kt=>kt!==ke))},rn=(ke,ze,Xe)=>{y(kt=>{const vt=new Set(kt[ke]??[]);return Xe?vt.add(ze):vt.delete(ze),{...kt,[ke]:Array.from(vt)}})},an=(ke,ze)=>{y(Xe=>({...Xe,[ke]:ze}))},qt=!0,Zt=F!==null||L.length>0||ue==="stopped"||ue==="error",sn=!!M,ln=ke=>{if(ke==="configure"&&qt){V("configure");return}if(ke==="run"&&Zt){V("run");return}ke==="report"&&sn&&V("report")};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(_5,{className:"h-6 w-6"}),"Analyze MCP Tools"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Review MCP tools for schema quality, ergonomics, and agent/eval readiness."})]}),a.jsxs("div",{className:"hidden flex-wrap items-center gap-2 md:flex",children:[a.jsx("button",{type:"button",onClick:()=>ln("configure"),className:"rounded-full","aria-label":"Open Configure Analysis",children:a.jsx(et,{variant:z==="configure"?"default":"outline",className:"cursor-pointer",children:"Configure Analysis"})}),a.jsx("button",{type:"button",onClick:()=>ln("run"),disabled:!Zt,className:"rounded-full disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open Run Analysis",children:a.jsx(et,{variant:z==="run"?"default":"outline",className:Zt?"cursor-pointer":"cursor-not-allowed",children:"Run Analysis"})}),a.jsx("button",{type:"button",onClick:()=>ln("report"),disabled:!sn,className:"rounded-full disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open Report",children:a.jsx(et,{variant:z==="report"?"default":"outline",className:sn?"cursor-pointer":"cursor-not-allowed",children:"Report"})})]})]}),z==="configure"&&a.jsxs(Qe,{children:[a.jsxs($t,{children:[a.jsx(Dt,{className:"text-base",children:"Run MCP analysis"}),a.jsx(Or,{children:"Select servers and tools, choose metadata review and/or deeper sample-call analysis, then run the report."})]}),a.jsxs(Je,{className:"space-y-5",children:[!me&&a.jsxs(vl,{children:[a.jsx(xl,{children:"No assistant agent available"}),a.jsxs(yl,{children:["Add a library agent in"," ",a.jsx(Et,{to:"/libraries/agents",className:"underline",children:"Agents"})," ","and optionally set the default Scenario Assistant Agent in"," ",a.jsx(Et,{to:"/settings",className:"underline",children:"Settings"}),"."]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(We,{className:"text-xs",children:"Servers"}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{o()},disabled:s||xe,children:[a.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Refresh Servers"]})]}),a.jsx("div",{className:"grid gap-2 rounded-md border p-3 md:grid-cols-2",children:n.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No library servers configured."}):n.map(ke=>{const ze=u.includes(ke.id);return a.jsxs("label",{className:"flex items-start gap-2 rounded-md border p-2 text-sm",children:[a.jsx(br,{checked:ze,onCheckedChange:Xe=>jt(ke.id,!!Xe)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium",children:ke.name||ke.id}),ke.url&&a.jsx("div",{className:"truncate text-xs text-muted-foreground",children:ke.url})]})]},ke.id)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Select exactly one MCP server for analysis."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{className:"text-xs",children:"Filter visible tools"}),a.jsxs("div",{className:"relative",children:[a.jsx(xC,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx(_t,{className:"h-9 pl-8",placeholder:"Filter tools by name or description...",value:b,onChange:ke=>S(ke.target.value)})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Filtering only changes what is shown; selected tools remain selected."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(We,{className:"text-xs",children:Re?`Tools for ${Re}`:"Tools"}),a.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:ht,disabled:m||xe||u.length===0||v.length===0,children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Download Tool Info"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{it()},disabled:m||xe||u.length===0,children:[m&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Discover Tools"]})]})]}),a.jsx("div",{className:"space-y-3 rounded-md border p-3",children:u.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a server to discover tools."}):m&&v.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading tools..."}):At.length===0&&!m?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No discovered tools match the current filters."}):At.map(ke=>{const ze=new Set(j[ke.serverName]??[]);return a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("div",{className:"font-medium",children:ke.serverName}),a.jsx(Og,{total:ke.tokenEstimate?.total,title:"Estimated tokens for all discovered tool definitions and their schemas"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>{P0e("Tool list",`${JSON.stringify({server:ke.serverName,tools:ke.tools.map(Xe=>({name:Xe.name,title:Xe.title,description:Xe.description}))},null,2)}
148
- `)},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>an(ke.serverName,ke.tools.map(Xe=>Xe.name)),children:"Select all"}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>an(ke.serverName,[]),children:"Clear"})]})]}),ke.warnings.length>0&&a.jsx("div",{className:"mb-2 space-y-1",children:ke.warnings.map(Xe=>a.jsx("div",{className:"text-xs text-amber-700",children:R0e(ke.serverName,Xe)},`${ke.serverName}-${Xe}`))}),a.jsx("div",{className:"grid gap-2",children:ke.tools.map(Xe=>{const kt=ke.tokenEstimate?.tools.find(Ve=>Ve.name===Xe.name),vt=mU(Xe.classificationReason),fe=Xe.safetyClassification==="read_only"?"read-only":vt?"write/delete":"unsafe/unknown",Oe=Xe.safetyClassification==="read_only"?"border-emerald-200 bg-emerald-50 text-emerald-700":vt?"border-amber-300 bg-amber-50 text-amber-800":"border-slate-300 bg-slate-100 text-slate-700";return a.jsxs("label",{className:"flex items-start gap-2 rounded border p-2",children:[a.jsx(br,{checked:ze.has(Xe.name),onCheckedChange:Ve=>rn(ke.serverName,Xe.name,!!Ve)}),a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"font-mono text-xs",children:Xe.name}),Xe.title&&a.jsx("span",{className:"text-xs text-muted-foreground",children:Xe.title}),a.jsx(T0e,{label:fe,reason:Xe.classificationReason,variantClassName:Oe}),Xe.inputSchema&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"schema: input"}),Xe.outputSchema&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"schema: output"}),a.jsx(Og,{total:kt?.total,className:"text-[10px]"})]}),Xe.description&&a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:Xe.description}),a.jsx(gU,{inputSchema:Xe.inputSchema,outputSchema:Xe.outputSchema,mode:ee,onModeChange:ae})]})]},`${ke.serverName}-${Xe.name}`)})})]},ke.serverName)})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Selected tools: ",Ge,Ee!==void 0&&` · estimated context: ~${vU(Ee)} tokens`]})]}),a.jsxs("div",{className:"space-y-3 rounded-md border p-3",children:[a.jsx("div",{className:"text-sm font-medium",children:"Analysis Modes"}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(br,{checked:N,onCheckedChange:ke=>C(!!ke)}),a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Metadata / schema review",a.jsx(TD,{text:"No tool execution. Reviews tool names, descriptions, and schemas only."})]})]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(br,{checked:k,onCheckedChange:ke=>A(!!ke)}),a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Deeper analysis",a.jsx(TD,{text:"Runs sample MCP tool calls automatically for read-only tools only (based on the safety allowlist)."})]})]}),a.jsxs("div",{className:"grid gap-3 rounded-md border bg-muted/20 p-3 md:grid-cols-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Max parallel tools"}),a.jsx(_t,{type:"number",min:1,max:8,value:E,onChange:ke=>P(Math.max(1,Math.min(8,Number(ke.target.value)||2))),className:"h-8"})]}),k?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Safety profile"}),a.jsx("div",{className:"text-sm",children:"Read-only allowlist only"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Sample calls per tool"}),a.jsx(_t,{type:"number",min:1,max:5,value:T,onChange:ke=>$(Math.max(1,Math.min(5,Number(ke.target.value)||1))),className:"h-8"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Tool call timeout (ms)"}),a.jsx(_t,{type:"number",min:1e3,max:6e4,step:500,value:Y,onChange:ke=>H(Math.max(1e3,Math.min(6e4,Number(ke.target.value)||1e4))),className:"h-8"})]}),a.jsx("div",{className:"md:col-span-3 text-xs text-amber-700",children:"Deeper analysis may execute read-only MCP tools automatically."})]}):null]})]}),a.jsx("div",{className:"flex flex-wrap items-center gap-2",children:a.jsxs(Z,{type:"button",onClick:()=>{Ze()},disabled:Q||xe||!!F,children:[(Q||!!F)&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Analyze Tools"]})})]})]}),z==="run"&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"flex items-center gap-2 text-base",children:a.jsx("span",{children:"Progress"})}),a.jsx(Or,{children:F?"Live tool-analysis job events:":M?"Analysis finished. Review the summary below or open the saved report details.":ue==="stopped"?"Analysis was stopped. You can return to Configure Analysis.":ue==="error"?"Analysis ended with an error. Review the log and go back to Configure Analysis.":"Analysis finished."})]}),F?a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{Ft()},children:"Stop Analysis"}):a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:zt,children:"Back to Configure Analysis"})]})}),a.jsxs(Je,{className:"space-y-2",children:[F&&a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-md border bg-muted/20 px-2.5 py-1 text-xs text-muted-foreground",children:[a.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}),"Analysis is still running..."]}),(ge.totalTools>0||F)&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:ge.totalTools>0?`${ge.finishedTools}/${ge.totalTools} tools finished`:"Preparing analysis..."}),a.jsx("span",{children:ge.totalTools>0?`${ge.percent}%`:"0%"})]}),a.jsx(px,{value:ge.totalTools>0?ge.percent:0,className:"h-2"})]}),L.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:F?"Starting analysis...":"No progress events captured."}):a.jsx("div",{ref:De,className:"max-h-64 space-y-1 overflow-auto rounded border bg-muted/20 p-2",children:L.map((ke,ze)=>a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"mr-2 font-mono text-muted-foreground",children:new Date(ke.ts).toLocaleTimeString()}),a.jsx(et,{variant:"outline",className:"mr-2 text-[10px]",children:ke.type}),a.jsx("span",{className:"break-all",children:typeof ke.payload.message=="string"?ke.payload.message:JSON.stringify(ke.payload)})]},`${ke.ts}-${ze}`))}),!F&&M&&a.jsx(Qe,{className:"mt-2 border-green-200 bg-green-50/40 dark:border-green-900/40 dark:bg-green-950/10",children:a.jsxs(Je,{className:"pt-4 space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold",children:"Result overview"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[M.summary.toolsAnalyzed," tools analyzed, ",M.summary.toolsSkipped," ","skipped, across ",M.summary.serversAnalyzed," server",M.summary.serversAnalyzed!==1?"s":"","."]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[G&&a.jsx(Z,{asChild:!0,size:"sm",children:a.jsx(Et,{to:`/tool-analysis-results/${G}`,children:"Open result details"})}),a.jsx(Z,{asChild:!0,size:"sm",variant:"outline",children:a.jsx(Et,{to:"/tool-analysis-results",children:"View all results"})}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>ln("report"),children:"View inline report"})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[M.summary.issueCounts.critical>0&&a.jsxs(et,{className:"bg-red-600 text-white hover:bg-red-600",children:["Critical: ",M.summary.issueCounts.critical]}),M.summary.issueCounts.high>0&&a.jsxs(et,{className:"bg-orange-500 text-white hover:bg-orange-500",children:["High: ",M.summary.issueCounts.high]}),M.summary.issueCounts.medium>0&&a.jsxs(et,{className:"bg-amber-500 text-white hover:bg-amber-500",children:["Medium: ",M.summary.issueCounts.medium]}),M.summary.issueCounts.low>0&&a.jsxs(et,{className:"bg-blue-500 text-white hover:bg-blue-500",children:["Low: ",M.summary.issueCounts.low]}),M.summary.issueCounts.info>0&&a.jsxs(et,{variant:"outline",children:["Info: ",M.summary.issueCounts.info]}),Object.values(M.summary.issueCounts).every(ke=>ke===0)&&a.jsx(et,{className:"bg-green-600 text-white hover:bg-green-600",children:"No findings"})]})]})})]})]}),z==="report"&&M&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold",children:"Report"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[M.summary.toolsAnalyzed," tools analyzed across"," ",M.summary.serversAnalyzed," server",M.summary.serversAnalyzed!==1?"s":"","."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:zt,children:"Back to Configure Analysis"}),G&&a.jsxs(a.Fragment,{children:[a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx(Et,{to:`/tool-analysis-results/${G}`,children:"Open saved report"})}),a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx(Et,{to:"/tool-analysis-results",children:"View all reports"})})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>OS(e("json"),`${JSON.stringify(M,null,2)}
146
+ `}function xU({report:e,schemaMode:t,onSchemaModeChange:n}){const[r,s]=zo(),[o,i]=h.useState([...rl]),[c,u]=h.useState(new Set),[f,m]=h.useState(""),[p,v]=h.useState(!1),[x,j]=h.useState("explorer"),y=t??x,b=L=>{n?.(L),t||j(L)},S=r.get("groupBy")==="severity"?"severity":"tool",N=h.useRef(null),C=f.trim().toLowerCase(),k=h.useMemo(()=>new Set(o),[o]),A=L=>{i(I=>{const M=I.includes(L)?I.filter(q=>q!==L):[...I,L];return M.length===0?[...rl]:M})},E=L=>{const I=new URLSearchParams(r);L==="severity"?I.set("groupBy","severity"):I.delete("groupBy"),s(I,{replace:!0})},P=h.useMemo(()=>{const L={critical:[],high:[],medium:[],low:[],info:[]};for(const I of e.servers)for(const M of I.tools){const q=`tool-${PD(`${I.serverName}-${M.publicToolName}`)}`,G=`${I.serverName}::${M.publicToolName}`,O=M.publicToolName.split("::").pop()??M.publicToolName;for(const Q of M.metadataReview?.issues??[]){const B=Q.severity;L[B].push({key:`${G}-metadata-${Q.id}`,toolAnchorId:q,toolLabel:G,toolDisplayName:O,sourceLabel:"Metadata review",issue:{id:Q.id,title:Q.title,detail:Q.detail,severity:B,suggestion:Q.suggestion}})}for(const Q of M.deeperAnalysis?.sampleCalls??[])for(const B of Q.issues){const z=B.severity;L[z].push({key:`${G}-call-${Q.callIndex}-${B.id}`,toolAnchorId:q,toolLabel:G,toolDisplayName:O,sourceLabel:`Sample call ${Q.callIndex}`,issue:{id:B.id,title:B.title,detail:B.detail,severity:z,suggestion:B.suggestion}})}}return L},[e.servers]),T=h.useMemo(()=>Array.from(new Set(e.servers.flatMap(L=>L.tools.map(I=>I.publicToolName)).map(L=>L.split("::").pop()??L))).sort((L,I)=>L.localeCompare(I)),[e.servers]),$=L=>C.length===0?!0:(L.toLowerCase().split("::").pop()??L.toLowerCase()).includes(C),Y=L=>{if(!N.current)return;N.current.querySelectorAll("details").forEach(M=>{M.open=L})},H=()=>u(new Set(rl)),F=()=>u(new Set),X=L=>{u(I=>{const M=new Set(I);return M.has(L)?M.delete(L):M.add(L),M})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Tools analyzed"}),a.jsx("div",{className:"text-2xl font-semibold",children:e.summary.toolsAnalyzed})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Tools skipped"}),a.jsx("div",{className:"text-2xl font-semibold",children:e.summary.toolsSkipped})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Findings"}),a.jsx("div",{className:"text-2xl font-semibold",children:e.findings.length})]})})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Analysis Overview"}),a.jsx(Or,{children:"Visual breakdown of findings by severity. Click badges to filter the report."})]}),a.jsx(Je,{children:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[rl.filter(L=>e.summary.issueCounts[L]>0).map(L=>{const I=k.has(L);return a.jsx("button",{type:"button",onClick:()=>A(L),className:"rounded-full","aria-pressed":I,children:a.jsxs(et,{variant:"outline",className:`capitalize font-normal ${I?em(L):C0e(L)} ${I?"ring-1 ring-current":"opacity-70"}`,children:[L,": ",e.summary.issueCounts[L]]})},L)}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>i([...rl]),className:"h-7 px-2 text-xs",children:"Reset"})]})})]}),a.jsxs("div",{className:"space-y-0",children:[a.jsx(ax,{value:S,onValueChange:L=>{(L==="tool"||L==="severity")&&E(L)},className:"min-w-0 px-3 pt-1",children:a.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2 border-b",children:[a.jsxs(Cp,{className:"h-auto justify-start rounded-none bg-transparent p-0",children:[a.jsx(Xs,{value:"tool",className:"-mb-px h-10 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-6 text-sm font-semibold text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Report by Tool"}),a.jsx(Xs,{value:"severity",className:"-mb-px h-10 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-6 text-sm font-semibold text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"By Severity"})]}),a.jsxs("div",{className:"mb-2 flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"whitespace-nowrap text-xs text-muted-foreground",children:"Filter tools"}),a.jsxs(wi,{open:p,onOpenChange:v,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":p,"aria-controls":"tool-filter-command-list",className:"h-8 w-[320px] max-w-full justify-between text-xs font-normal",children:[a.jsx("span",{className:"truncate text-left",children:f||"All tools"}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(Ro,{className:"w-[320px] p-0",align:"end",children:a.jsxs(Tl,{children:[a.jsx(Ol,{placeholder:"Search tools..."}),a.jsxs(Ml,{id:"tool-filter-command-list",children:[a.jsx(Il,{children:"No tools found."}),a.jsxs($l,{children:[a.jsx(Na,{value:"all tools",onSelect:()=>{m(""),v(!1)},children:"All tools"}),T.map(L=>a.jsx(Na,{value:L,onSelect:()=>{m(L),v(!1)},children:L},L))]})]})]})})]}),S==="severity"&&a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:F,children:"Expand all"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:H,children:"Collapse all"})]}),S==="tool"&&a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>Y(!0),children:"Expand all"}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>Y(!1),children:"Collapse all"})]})]})]})}),S==="severity"?a.jsx("div",{className:"space-y-4",children:rl.filter(L=>k.has(L)).map(L=>{const I=P[L].filter(q=>$(q.toolLabel));if(I.length===0)return null;const M=c.has(L);return a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base capitalize",children:L}),a.jsxs(Or,{children:[I.length," finding(s)"]})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>X(L),children:M?"Expand":"Collapse"})})]})}),!M&&a.jsx(Je,{className:"space-y-2",children:I.map((q,G)=>a.jsxs("div",{className:"rounded border p-2 text-xs",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:G+1}),a.jsx("span",{className:"min-w-0 font-bold leading-tight",children:q.issue.title})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${em(q.issue.severity)}`,children:q.issue.severity})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",q.issue.detail]}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[11px]",children:[a.jsx(et,{variant:"secondary",className:"font-normal",children:q.sourceLabel}),a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 font-mono text-[11px]",title:q.toolLabel,onClick:()=>{E("tool"),requestAnimationFrame(()=>{document.getElementById(q.toolAnchorId)?.scrollIntoView({behavior:"smooth",block:"start"})})},children:q.toolDisplayName})]}),q.issue.suggestion&&a.jsx(RS,{text:q.issue.suggestion})]},q.key))})]},L)})}):a.jsx("div",{ref:N,className:"space-y-4",children:e.servers.map(L=>{const I=L.tokenEstimate,M=L.tools.filter(q=>{const G=`${L.serverName}::${q.publicToolName}`;if(!$(G))return!1;const O=[...q.metadataReview?.issues??[],...q.deeperAnalysis?.sampleCalls.flatMap(Q=>Q.issues)??[]];return O.length===0?o.length===rl.length:O.some(Q=>k.has(Q.severity))});return M.length===0?null:a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[L.serverName,a.jsx(Og,{total:I?.total,title:"Estimated tokens for the analyzed tool definitions and their schemas"})]}),a.jsxs(Or,{children:["Discovered ",L.toolCountDiscovered," · Showing ",M.length," of"," ",L.toolCountAnalyzed," analyzed · Skipped ",L.toolCountSkipped]})]}),a.jsxs(Je,{className:"space-y-3",children:[L.warnings.length>0&&a.jsxs(vl,{children:[a.jsx(xl,{children:"Warnings"}),a.jsx(yl,{children:a.jsx("ul",{className:"ml-4 list-disc space-y-1",children:L.warnings.map(q=>a.jsx("li",{children:q},`${L.serverName}-${q}`))})})]}),M.map(q=>{const G=I?.tools.find(V=>V.name===q.toolName),O=q.publicToolName.split("::").pop()??q.publicToolName,Q=mU(q.classificationReason),B=q.safetyClassification==="read_only"?"read-only":Q?"write/delete":"unsafe/unknown",z=q.safetyClassification==="read_only"?"border-emerald-200 bg-emerald-50 text-emerald-700":Q?"border-amber-300 bg-amber-50 text-amber-800":"border-slate-300 bg-slate-100 text-slate-700";return a.jsxs("details",{id:`tool-${PD(`${L.serverName}-${q.publicToolName}`)}`,className:"group rounded-md border p-3",children:[a.jsx("summary",{className:"cursor-pointer list-none",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("div",{className:"min-w-0 truncate font-mono text-sm",title:q.publicToolName,children:O}),a.jsx(_0e,{label:B,reason:q.classificationReason,variantClassName:z}),a.jsx(Og,{total:G?.total,className:"text-[10px]"})]}),a.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),q.title&&a.jsx("p",{className:"text-sm text-foreground/85",children:q.title}),q.description&&a.jsx("p",{className:"text-xs text-muted-foreground",children:q.description})]})}),a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-[11px]",onClick:()=>{PS("Tool info",{server:L.serverName,name:q.publicToolName,title:q.title,description:q.description})},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy Tool Info"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-[11px]",onClick:()=>{PS("Schemas",{server:L.serverName,name:q.publicToolName,inputSchema:q.inputSchema,outputSchema:q.outputSchema})},disabled:q.inputSchema===void 0&&q.outputSchema===void 0,children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy Schemas"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-[11px]",onClick:()=>{PS("Metadata review",{server:L.serverName,name:q.publicToolName,metadataReview:q.metadataReview})},disabled:!q.metadataReview,children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy Metadata Review"]})]}),a.jsx(gU,{inputSchema:q.inputSchema,outputSchema:q.outputSchema,mode:y,onModeChange:b}),q.metadataReview&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Metadata review"}),q.metadataReview.issues.filter(V=>k.has(V.severity)).length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No metadata issues reported."}):a.jsx("div",{className:"space-y-1",children:q.metadataReview.issues.filter(V=>k.has(V.severity)).map((V,ee)=>a.jsxs("div",{className:"rounded border p-2 text-xs",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:ee+1}),a.jsx("span",{className:"min-w-0 font-bold leading-tight",children:V.title})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${em(V.severity)}`,children:V.severity})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",V.detail]}),V.suggestion&&a.jsx(RS,{text:V.suggestion})]},V.id))})]}),q.deeperAnalysis&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Deeper analysis"}),q.deeperAnalysis.attempted?a.jsx("div",{className:"space-y-2",children:q.deeperAnalysis.sampleCalls.map(V=>a.jsxs("div",{className:"rounded border p-2 text-xs",children:[a.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[a.jsx(et,{variant:V.ok?"secondary":"destructive",className:"text-[10px]",children:V.ok?"ok":"error"}),a.jsxs("span",{children:["Call ",V.callIndex]}),V.durationMs!==void 0&&a.jsxs("span",{className:"text-muted-foreground",children:[V.durationMs,"ms"]})]}),V.error&&a.jsx("p",{className:"text-destructive",children:V.error}),V.observations.length>0&&a.jsxs("div",{className:"mt-2",children:[a.jsx("div",{className:"mb-1 inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Observations"}),a.jsx("ul",{className:"ml-4 list-disc space-y-1",children:V.observations.map((ee,ae)=>a.jsx("li",{children:ee},`${q.publicToolName}-obs-${V.callIndex}-${ae}`))})]}),V.issues.filter(ee=>k.has(ee.severity)).length>0&&a.jsx("div",{className:"mt-2 space-y-1",children:V.issues.filter(ee=>k.has(ee.severity)).map((ee,ae)=>a.jsxs("div",{className:"rounded border p-2",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:ae+1}),a.jsx("span",{className:"min-w-0 font-bold leading-tight",children:ee.title})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${em(ee.severity)}`,children:ee.severity})]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",ee.detail]}),ee.suggestion&&a.jsx(RS,{text:ee.suggestion})]},`${V.callIndex}-${ee.id}`))})]},`${q.publicToolName}-call-${V.callIndex}`))}):a.jsx("p",{className:"text-xs text-muted-foreground",children:q.deeperAnalysis.skippedReason??"Skipped"})]})]})]},q.publicToolName)})]})]},L.serverName)})})]})]})}function yU(e){return{reportId:e.reportId,createdAt:e.createdAt,tools:e.report.servers.flatMap(t=>t.tools.map(n=>({server:t.serverName,name:n.publicToolName,title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema})))}}function k0e(e){const t=e.selectedToolNames?.length?new Set(e.selectedToolNames):null;return{serverName:e.serverName,tools:e.tools.filter(n=>!t||t.has(n.name)).map(n=>({name:n.name,title:n.title,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema}))}}function RD(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function A0e(e,t){const n=["tool-info",RD(e)],r=t?.trim();return r&&n.push(`v${RD(r)}`),`${n.filter(Boolean).join("-")}.json`}function E0e(e){let t=0;const n=new Set,r=new Set;for(const o of e){const i=typeof o.payload?.message=="string"?o.payload.message:"";if(!i)continue;const c=i.match(/\((\d+)\s+selected\s+of\s+\d+\s+discovered\)/i);c&&(t=Math.max(t,Number(c[1])||0));const u=i.match(/^Started\s+(.+)$/);u&&n.add(u[1]);const f=i.match(/^Finished\s+(.+)$/);f&&r.add(f[1])}const s=t>0?Math.max(0,Math.min(100,Math.round(r.size/t*100))):0;return{totalTools:t,startedTools:n.size,finishedTools:r.size,percent:s}}const TS="mcplab.toolAnalysis.activeJobId";function OS(e,t,n){const r=new Blob([t],{type:n}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=e,o.click(),URL.revokeObjectURL(s)}async function P0e(e,t){try{await navigator.clipboard.writeText(t),$e({title:`${e} copied`})}catch(n){$e({title:`Could not copy ${e.toLowerCase()}`,description:n instanceof Error?n.message:String(n),variant:"destructive"})}}function TD({text:e}){return a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsx("button",{type:"button",className:"inline-flex h-4 w-4 items-center justify-center rounded text-muted-foreground hover:text-foreground",onClick:t=>t.preventDefault(),"aria-label":e,children:a.jsx(SW,{className:"h-3.5 w-3.5"})})}),a.jsx(Rs,{className:"max-w-xs text-xs",children:a.jsx("p",{children:e})})]})}function R0e(e,t){const n=t.toLowerCase();return n.includes("failed to load tools")||n.includes("failed to connect to mcp server")?`Could not load tools from '${e}'. Check that the MCP server is running and reachable, then try Refresh Servers / Discover Tools again.`:t}function T0e({label:e,reason:t,variantClassName:n}){return a.jsx(Js,{delayDuration:0,children:a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsx(et,{variant:"outline",className:n,children:e})}),a.jsx(Rs,{className:"max-w-sm text-xs",children:a.jsx("p",{children:t})})]})})}const O0e=()=>{const e=_e=>`tool-analysis-${Date.now()}.${_e}`,{source:t}=$n(),{servers:n,agents:r,loading:s,reload:o}=Is(),[i,c]=h.useState(""),[u,f]=h.useState([]),[m,p]=h.useState(!1),[v,x]=h.useState([]),[j,y]=h.useState({}),[b,S]=h.useState(""),[N,C]=h.useState(!0),[k,A]=h.useState(!1),[E,P]=h.useState(2),[T,$]=h.useState(1),[Y,H]=h.useState(1e4),[F,X]=h.useState(null),[L,I]=h.useState([]),[M,q]=h.useState(null),[G,O]=h.useState(null),[Q,B]=h.useState(!1),[z,V]=h.useState("configure"),[ee,ae]=h.useState("explorer"),[ue,se]=h.useState("idle"),[xe,oe]=h.useState(!1),de=h.useRef(null),De=h.useRef(null),me=i||r[0]?.name||"",ge=h.useMemo(()=>E0e(L),[L]);h.useEffect(()=>{let _e=!0;return t.getWorkspaceSettings().then(ze=>{!_e||!ze||c(ze.scenarioAssistantAgentName??"")}).catch(()=>{_e&&c("")}),()=>{_e=!1}},[t]),h.useEffect(()=>()=>{de.current?.()},[]),h.useEffect(()=>{const _e=De.current;_e&&requestAnimationFrame(()=>{_e.scrollTop=_e.scrollHeight})},[L.length]);const we=()=>{try{sessionStorage.removeItem(TS)}catch{}},at=_e=>{try{sessionStorage.setItem(TS,_e)}catch{}},tt=_e=>{de.current?.(),de.current=t.subscribeToolAnalysisJob(_e,ze=>{if(I(Xe=>[...Xe,ze]),ze.type==="completed")t.getToolAnalysisResult(_e).then(Xe=>{q(Xe.report),O(Xe.savedReportId??null)}).catch(Xe=>$e({title:"Could not load analysis report",description:Xe instanceof Error?Xe.message:String(Xe),variant:"destructive"})).finally(()=>{we(),X(null),B(!1),se("idle"),V("run")});else if(ze.type==="error"){const Xe=String(ze.payload?.message??"");we(),se(Xe.toLowerCase().includes("abort")?"stopped":"error"),X(null),B(!1)}})};h.useEffect(()=>{if(F||M)return;let _e="";try{_e=sessionStorage.getItem(TS)??""}catch{_e=""}if(_e)return V("run"),se("running"),B(!0),X(_e),I([]),tt(_e),()=>{}},[t,F,M]);const it=async()=>{if(u.length===0){x([]),y({});return}const _e=u.filter(ze=>n.find(kt=>kt.id===ze)?.authType==="oauth2");try{_e.length>0&&(oe(!0),await Po({serverNames:_e,source:t,onServerAuthStart:ze=>{$e({title:`OAuth login required for ${ze}`,description:"Complete login in the opened browser tab. Discovery will continue automatically."})}}))}catch(ze){$e({title:"OAuth login failed",description:ze instanceof Error?ze.message:String(ze),variant:"destructive"}),oe(!1);return}finally{oe(!1)}p(!0);try{const ze=await t.discoverToolsForAnalysis({serverNames:u});x(ze.servers),y(Xe=>{const kt={};for(const vt of ze.servers){const fe=Xe[vt.serverName]??[],Oe=vt.tools.map(U=>U.name),Ve=fe.filter(U=>Oe.includes(U));kt[vt.serverName]=Ve.length>0?Ve:Oe}return kt})}catch(ze){$e({title:"Could not discover MCP tools",description:ze instanceof Error?ze.message:String(ze),variant:"destructive"})}finally{p(!1)}};h.useEffect(()=>{it()},[u.join("|")]);const At=h.useMemo(()=>{const _e=b.trim().toLowerCase();return _e?v.map(ze=>({...ze,tools:ze.tools.filter(Xe=>Xe.name.toLowerCase().includes(_e)||(Xe.description||"").toLowerCase().includes(_e))})).filter(ze=>ze.tools.length>0):v},[v,b]),Ge=h.useMemo(()=>Object.values(j).reduce((_e,ze)=>_e+ze.length,0),[j]),Ee=h.useMemo(()=>N0e(v,j),[v,j]),Re=u[0]??"",Ze=async()=>{if(!N&&!k){$e({title:"Select at least one mode",variant:"destructive"});return}if(u.length!==1){$e({title:"Select exactly one server",variant:"destructive"});return}if(Ge===0){$e({title:"Select at least one tool",variant:"destructive"});return}B(!0),I([]),q(null),O(null),V("run"),se("running");try{const _e=u[0];n.find(kt=>kt.id===_e)?.authType==="oauth2"&&(oe(!0),await Po({serverNames:[_e],source:t,onServerAuthStart:kt=>{$e({title:`OAuth login required for ${kt}`,description:"Complete login in the opened browser tab. Analysis will continue automatically."})}}));const{jobId:Xe}=await t.startToolAnalysis({serverNames:u,selectedToolsByServer:j,maxParallelTools:E,modes:{metadataReview:N,deeperAnalysis:k},deeperAnalysisOptions:{autoRunPolicy:"read_only_allowlist",sampleCallsPerTool:T,toolCallTimeoutMs:Y}});X(Xe),at(Xe),tt(Xe)}catch(_e){B(!1),se("error"),V("run"),$e({title:"Could not start tool analysis",description:_e instanceof Error?_e.message:String(_e),variant:"destructive"})}finally{oe(!1)}},ht=()=>{const _e=u[0],ze=v.find(kt=>kt.serverName===_e);if(!_e||!ze){$e({title:"No discovered tool info available",description:"Select a server and discover tools before downloading tool info.",variant:"destructive"});return}const Xe=k0e({serverName:ze.serverName,tools:ze.tools,selectedToolNames:j[ze.serverName]});OS(A0e(ze.serverName,ze.mcpServerVersion),`${JSON.stringify(Xe,null,2)}
147
+ `,"application/json")},Ft=async()=>{if(!F)return;const _e=F;try{const ze=await t.stopToolAnalysis(_e);if(ze.status==="completed"){de.current?.(),de.current=null;const Xe=await t.getToolAnalysisResult(_e);q(Xe.report),O(Xe.savedReportId??null),we(),X(null),B(!1),se("idle"),V("run"),$e({title:"Analysis already finished",description:"Showing the result overview."});return}if(ze.status==="stopped"){de.current?.(),de.current=null,we(),X(null),B(!1),se("stopped"),$e({title:"Analysis stopped"});return}if(ze.status==="error"){de.current?.(),de.current=null,we(),X(null),B(!1),se("error"),$e({title:"Analysis already ended with an error",description:"Review the progress log and return to Configure Analysis."});return}$e({title:"Stopping analysis..."})}catch(ze){$e({title:"Could not stop analysis",description:ze instanceof Error?ze.message:String(ze),variant:"destructive"})}},zt=()=>{V("configure"),se("idle"),X(null)},jt=(_e,ze)=>{f(Xe=>ze?[_e]:Xe.filter(kt=>kt!==_e))},rn=(_e,ze,Xe)=>{y(kt=>{const vt=new Set(kt[_e]??[]);return Xe?vt.add(ze):vt.delete(ze),{...kt,[_e]:Array.from(vt)}})},an=(_e,ze)=>{y(Xe=>({...Xe,[_e]:ze}))},qt=!0,Zt=F!==null||L.length>0||ue==="stopped"||ue==="error",sn=!!M,ln=_e=>{if(_e==="configure"&&qt){V("configure");return}if(_e==="run"&&Zt){V("run");return}_e==="report"&&sn&&V("report")};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(_5,{className:"h-6 w-6"}),"Analyze MCP Tools"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Review MCP tools for schema quality, ergonomics, and agent/eval readiness."})]}),a.jsxs("div",{className:"hidden flex-wrap items-center gap-2 md:flex",children:[a.jsx("button",{type:"button",onClick:()=>ln("configure"),className:"rounded-full","aria-label":"Open Configure Analysis",children:a.jsx(et,{variant:z==="configure"?"default":"outline",className:"cursor-pointer",children:"Configure Analysis"})}),a.jsx("button",{type:"button",onClick:()=>ln("run"),disabled:!Zt,className:"rounded-full disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open Run Analysis",children:a.jsx(et,{variant:z==="run"?"default":"outline",className:Zt?"cursor-pointer":"cursor-not-allowed",children:"Run Analysis"})}),a.jsx("button",{type:"button",onClick:()=>ln("report"),disabled:!sn,className:"rounded-full disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open Report",children:a.jsx(et,{variant:z==="report"?"default":"outline",className:sn?"cursor-pointer":"cursor-not-allowed",children:"Report"})})]})]}),z==="configure"&&a.jsxs(Qe,{children:[a.jsxs($t,{children:[a.jsx(Dt,{className:"text-base",children:"Run MCP analysis"}),a.jsx(Or,{children:"Select servers and tools, choose metadata review and/or deeper sample-call analysis, then run the report."})]}),a.jsxs(Je,{className:"space-y-5",children:[!me&&a.jsxs(vl,{children:[a.jsx(xl,{children:"No assistant agent available"}),a.jsxs(yl,{children:["Add a library agent in"," ",a.jsx(Et,{to:"/libraries/agents",className:"underline",children:"Agents"})," ","and optionally set the default Scenario Assistant Agent in"," ",a.jsx(Et,{to:"/settings",className:"underline",children:"Settings"}),"."]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(We,{className:"text-xs",children:"Servers"}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{o()},disabled:s||xe,children:[a.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Refresh Servers"]})]}),a.jsx("div",{className:"grid gap-2 rounded-md border p-3 md:grid-cols-2",children:n.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No library servers configured."}):n.map(_e=>{const ze=u.includes(_e.id);return a.jsxs("label",{className:"flex items-start gap-2 rounded-md border p-2 text-sm",children:[a.jsx(br,{checked:ze,onCheckedChange:Xe=>jt(_e.id,!!Xe)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"font-medium",children:_e.name||_e.id}),_e.url&&a.jsx("div",{className:"truncate text-xs text-muted-foreground",children:_e.url})]})]},_e.id)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Select exactly one MCP server for analysis."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{className:"text-xs",children:"Filter visible tools"}),a.jsxs("div",{className:"relative",children:[a.jsx(xC,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx(_t,{className:"h-9 pl-8",placeholder:"Filter tools by name or description...",value:b,onChange:_e=>S(_e.target.value)})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Filtering only changes what is shown; selected tools remain selected."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(We,{className:"text-xs",children:Re?`Tools for ${Re}`:"Tools"}),a.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:ht,disabled:m||xe||u.length===0||v.length===0,children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Download Tool Info"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{it()},disabled:m||xe||u.length===0,children:[m&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Discover Tools"]})]})]}),a.jsx("div",{className:"space-y-3 rounded-md border p-3",children:u.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a server to discover tools."}):m&&v.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading tools..."}):At.length===0&&!m?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No discovered tools match the current filters."}):At.map(_e=>{const ze=new Set(j[_e.serverName]??[]);return a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("div",{className:"font-medium",children:_e.serverName}),a.jsx(Og,{total:_e.tokenEstimate?.total,title:"Estimated tokens for all discovered tool definitions and their schemas"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>{P0e("Tool list",`${JSON.stringify({server:_e.serverName,tools:_e.tools.map(Xe=>({name:Xe.name,title:Xe.title,description:Xe.description}))},null,2)}
148
+ `)},children:[a.jsx(Hr,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy"]}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>an(_e.serverName,_e.tools.map(Xe=>Xe.name)),children:"Select all"}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>an(_e.serverName,[]),children:"Clear"})]})]}),_e.warnings.length>0&&a.jsx("div",{className:"mb-2 space-y-1",children:_e.warnings.map(Xe=>a.jsx("div",{className:"text-xs text-amber-700",children:R0e(_e.serverName,Xe)},`${_e.serverName}-${Xe}`))}),a.jsx("div",{className:"grid gap-2",children:_e.tools.map(Xe=>{const kt=_e.tokenEstimate?.tools.find(Ve=>Ve.name===Xe.name),vt=mU(Xe.classificationReason),fe=Xe.safetyClassification==="read_only"?"read-only":vt?"write/delete":"unsafe/unknown",Oe=Xe.safetyClassification==="read_only"?"border-emerald-200 bg-emerald-50 text-emerald-700":vt?"border-amber-300 bg-amber-50 text-amber-800":"border-slate-300 bg-slate-100 text-slate-700";return a.jsxs("label",{className:"flex items-start gap-2 rounded border p-2",children:[a.jsx(br,{checked:ze.has(Xe.name),onCheckedChange:Ve=>rn(_e.serverName,Xe.name,!!Ve)}),a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"font-mono text-xs",children:Xe.name}),Xe.title&&a.jsx("span",{className:"text-xs text-muted-foreground",children:Xe.title}),a.jsx(T0e,{label:fe,reason:Xe.classificationReason,variantClassName:Oe}),Xe.inputSchema&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"schema: input"}),Xe.outputSchema&&a.jsx(et,{variant:"outline",className:"border-border text-[10px] text-muted-foreground",children:"schema: output"}),a.jsx(Og,{total:kt?.total,className:"text-[10px]"})]}),Xe.description&&a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:Xe.description}),a.jsx(gU,{inputSchema:Xe.inputSchema,outputSchema:Xe.outputSchema,mode:ee,onModeChange:ae})]})]},`${_e.serverName}-${Xe.name}`)})})]},_e.serverName)})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Selected tools: ",Ge,Ee!==void 0&&` · estimated context: ~${vU(Ee)} tokens`]})]}),a.jsxs("div",{className:"space-y-3 rounded-md border p-3",children:[a.jsx("div",{className:"text-sm font-medium",children:"Analysis Modes"}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(br,{checked:N,onCheckedChange:_e=>C(!!_e)}),a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Metadata / schema review",a.jsx(TD,{text:"No tool execution. Reviews tool names, descriptions, and schemas only."})]})]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(br,{checked:k,onCheckedChange:_e=>A(!!_e)}),a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Deeper analysis",a.jsx(TD,{text:"Runs sample MCP tool calls automatically for read-only tools only (based on the safety allowlist)."})]})]}),a.jsxs("div",{className:"grid gap-3 rounded-md border bg-muted/20 p-3 md:grid-cols-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Max parallel tools"}),a.jsx(_t,{type:"number",min:1,max:8,value:E,onChange:_e=>P(Math.max(1,Math.min(8,Number(_e.target.value)||2))),className:"h-8"})]}),k?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Safety profile"}),a.jsx("div",{className:"text-sm",children:"Read-only allowlist only"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Sample calls per tool"}),a.jsx(_t,{type:"number",min:1,max:5,value:T,onChange:_e=>$(Math.max(1,Math.min(5,Number(_e.target.value)||1))),className:"h-8"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Tool call timeout (ms)"}),a.jsx(_t,{type:"number",min:1e3,max:6e4,step:500,value:Y,onChange:_e=>H(Math.max(1e3,Math.min(6e4,Number(_e.target.value)||1e4))),className:"h-8"})]}),a.jsx("div",{className:"md:col-span-3 text-xs text-amber-700",children:"Deeper analysis may execute read-only MCP tools automatically."})]}):null]})]}),a.jsx("div",{className:"flex flex-wrap items-center gap-2",children:a.jsxs(Z,{type:"button",onClick:()=>{Ze()},disabled:Q||xe||!!F,children:[(Q||!!F)&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Analyze Tools"]})})]})]}),z==="run"&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"flex items-center gap-2 text-base",children:a.jsx("span",{children:"Progress"})}),a.jsx(Or,{children:F?"Live tool-analysis job events:":M?"Analysis finished. Review the summary below or open the saved report details.":ue==="stopped"?"Analysis was stopped. You can return to Configure Analysis.":ue==="error"?"Analysis ended with an error. Review the log and go back to Configure Analysis.":"Analysis finished."})]}),F?a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{Ft()},children:"Stop Analysis"}):a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:zt,children:"Back to Configure Analysis"})]})}),a.jsxs(Je,{className:"space-y-2",children:[F&&a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-md border bg-muted/20 px-2.5 py-1 text-xs text-muted-foreground",children:[a.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}),"Analysis is still running..."]}),(ge.totalTools>0||F)&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:ge.totalTools>0?`${ge.finishedTools}/${ge.totalTools} tools finished`:"Preparing analysis..."}),a.jsx("span",{children:ge.totalTools>0?`${ge.percent}%`:"0%"})]}),a.jsx(px,{value:ge.totalTools>0?ge.percent:0,className:"h-2"})]}),L.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:F?"Starting analysis...":"No progress events captured."}):a.jsx("div",{ref:De,className:"max-h-64 space-y-1 overflow-auto rounded border bg-muted/20 p-2",children:L.map((_e,ze)=>a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"mr-2 font-mono text-muted-foreground",children:new Date(_e.ts).toLocaleTimeString()}),a.jsx(et,{variant:"outline",className:"mr-2 text-[10px]",children:_e.type}),a.jsx("span",{className:"break-all",children:typeof _e.payload.message=="string"?_e.payload.message:JSON.stringify(_e.payload)})]},`${_e.ts}-${ze}`))}),!F&&M&&a.jsx(Qe,{className:"mt-2 border-green-200 bg-green-50/40 dark:border-green-900/40 dark:bg-green-950/10",children:a.jsxs(Je,{className:"pt-4 space-y-3",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-semibold",children:"Result overview"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[M.summary.toolsAnalyzed," tools analyzed, ",M.summary.toolsSkipped," ","skipped, across ",M.summary.serversAnalyzed," server",M.summary.serversAnalyzed!==1?"s":"","."]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[G&&a.jsx(Z,{asChild:!0,size:"sm",children:a.jsx(Et,{to:`/tool-analysis-results/${G}`,children:"Open result details"})}),a.jsx(Z,{asChild:!0,size:"sm",variant:"outline",children:a.jsx(Et,{to:"/tool-analysis-results",children:"View all results"})}),a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>ln("report"),children:"View inline report"})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[M.summary.issueCounts.critical>0&&a.jsxs(et,{className:"bg-red-600 text-white hover:bg-red-600",children:["Critical: ",M.summary.issueCounts.critical]}),M.summary.issueCounts.high>0&&a.jsxs(et,{className:"bg-orange-500 text-white hover:bg-orange-500",children:["High: ",M.summary.issueCounts.high]}),M.summary.issueCounts.medium>0&&a.jsxs(et,{className:"bg-amber-500 text-white hover:bg-amber-500",children:["Medium: ",M.summary.issueCounts.medium]}),M.summary.issueCounts.low>0&&a.jsxs(et,{className:"bg-blue-500 text-white hover:bg-blue-500",children:["Low: ",M.summary.issueCounts.low]}),M.summary.issueCounts.info>0&&a.jsxs(et,{variant:"outline",children:["Info: ",M.summary.issueCounts.info]}),Object.values(M.summary.issueCounts).every(_e=>_e===0)&&a.jsx(et,{className:"bg-green-600 text-white hover:bg-green-600",children:"No findings"})]})]})})]})]}),z==="report"&&M&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold",children:"Report"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[M.summary.toolsAnalyzed," tools analyzed across"," ",M.summary.serversAnalyzed," server",M.summary.serversAnalyzed!==1?"s":"","."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:zt,children:"Back to Configure Analysis"}),G&&a.jsxs(a.Fragment,{children:[a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx(Et,{to:`/tool-analysis-results/${G}`,children:"Open saved report"})}),a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx(Et,{to:"/tool-analysis-results",children:"View all reports"})})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>OS(e("json"),`${JSON.stringify(M,null,2)}
149
149
  `,"application/json"),children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export JSON"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>OS(e("md"),bk(M),"text/markdown"),children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export Markdown"]})]})]}),a.jsx(xU,{report:M,schemaMode:ee,onSchemaModeChange:ae})]})]})};function Su({versions:e,showPrefix:t=!0,className:n}){const r=Object.entries(e??{}).sort((s,o)=>s[0].localeCompare(o[0])).map(([s,o])=>`${s}@${o??"unknown"}`).join(", ");return r?a.jsx(Js,{delayDuration:0,children:a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsxs("span",{tabIndex:0,className:Me("inline-flex max-w-[18rem] min-w-0 items-center rounded-sm border border-border/60 bg-muted/30 px-1.5 py-1 text-[11px] leading-none text-muted-foreground",n),children:[t?a.jsx("span",{className:"font-medium",children:"MCP:"}):null,a.jsx("span",{className:Me(t?"ml-1":"","min-w-0 truncate font-mono"),children:r})]})}),a.jsx(Rs,{className:"max-w-md break-words text-xs",children:a.jsx("span",{className:"font-mono",children:r})})]})}):null}function hx(e){const[t,n]=h.useState(0),[r,s]=h.useState(!1),[o,i]=h.useState(0),c=h.useCallback(()=>{n(v=>Math.max(0,v-e))},[e]),u=h.useCallback(()=>{n(v=>v+e)},[e]),f=h.useCallback(()=>n(0),[]),m=h.useCallback(v=>{s(v.has_more),i(v.total_count)},[]),p=h.useCallback(v=>o<=0||v<=0?"Showing 0 of 0":`Showing ${t+1}-${Math.min(t+v,o)} of ${o}`,[t,o]);return h.useMemo(()=>({limit:e,offset:t,hasMore:r,totalCount:o,setOffset:n,setHasMore:s,setTotalCount:i,prev:c,next:u,reset:f,updateMeta:m,rangeLabel:p}),[r,e,u,t,c,p,f,o,m])}function MS(e,t,n){const r=new Blob([t],{type:n}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=e,o.click(),URL.revokeObjectURL(s)}function M0e(){const{source:e}=$n(),[t,n]=h.useState([]),[r,s]=h.useState(!0),[o,i]=h.useState(null),[c,u]=h.useState(!1),[f,m]=h.useState("all"),[p,v]=h.useState(!1),[x,j]=h.useState([]),y=100,b=hx(y),{offset:S,hasMore:N}=b,C=async()=>{s(!0);try{if(e.listToolAnalysisResultsPage){const P=await e.listToolAnalysisResultsPage({limit:y,offset:S,server:f==="all"?void 0:f});n(P.data),b.updateMeta(P)}else n(await e.listToolAnalysisResults({limit:y,offset:S,server:f==="all"?void 0:f}))}catch(P){$e({title:"Could not load tool analysis results",description:P instanceof Error?P.message:String(P),variant:"destructive"})}finally{s(!1)}};h.useEffect(()=>{C()},[S,f]),h.useEffect(()=>{e.listToolAnalysisServers&&e.listToolAnalysisServers().then(P=>j(P)).catch(()=>{j([])})},[e]),h.useEffect(()=>{e.listToolAnalysisServers||j(Array.from(new Set(t.flatMap(P=>P.serverNames))).sort((P,T)=>P.localeCompare(T)))},[t,e]),h.useEffect(()=>{b.reset()},[b.reset,f]);const k=h.useMemo(()=>t.find(P=>P.reportId===o)??null,[t,o]),A=async()=>{if(o){u(!0);try{await e.deleteToolAnalysisSavedResult(o),n(P=>P.filter(T=>T.reportId!==o)),$e({title:"Tool analysis report deleted"}),i(null)}catch(P){$e({title:"Could not delete report",description:P instanceof Error?P.message:String(P),variant:"destructive"})}finally{u(!1)}}},E=async(P,T)=>{try{const $=await e.getToolAnalysisSavedResult(P);T==="json"?MS(`${P}.json`,`${JSON.stringify($,null,2)}
150
150
  `,"application/json"):T==="tool_schemas"?MS(`${P}-tool-schemas.json`,`${JSON.stringify(yU($),null,2)}
151
151
  `,"application/json"):MS(`${P}.md`,bk($.report),"text/markdown")}catch($){$e({title:"Could not export saved report",description:$ instanceof Error?$.message:String($),variant:"destructive"})}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(k5,{className:"h-6 w-6"}),"Tool Analysis Results"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse persisted Analyze MCP Tools reports."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"MCP server"}),a.jsxs(wi,{open:p,onOpenChange:v,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":p,"aria-controls":"tool-analysis-server-command-list",className:`h-9 w-[240px] justify-between font-normal ${f!=="all"?"border-primary/40":""}`,children:[a.jsx("span",{className:"truncate text-left",children:f==="all"?"All servers":f}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(Ro,{className:"w-[240px] p-0",align:"start",children:a.jsxs(Tl,{children:[a.jsx(Ol,{placeholder:"Search MCP servers..."}),a.jsxs(Ml,{id:"tool-analysis-server-command-list",children:[a.jsx(Il,{children:"No servers found."}),a.jsxs($l,{children:[a.jsx(Na,{value:"all servers",onSelect:()=>{m("all"),v(!1)},children:"All servers"}),x.map(P=>a.jsx(Na,{value:P,onSelect:()=>{m(P),v(!1)},children:P},P))]})]})]})})]})]}),a.jsx(Z,{variant:"outline",onClick:()=>{C()},disabled:r,children:r?"Refreshing...":"Refresh"}),a.jsx(Z,{variant:"outline",onClick:b.prev,disabled:r||S===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:b.next,disabled:r||!N,children:"Next"}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:"/tool-analysis",children:"Analyze MCP Tools"})})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:b.rangeLabel(t.length)}),a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:r?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Loading tool analysis results..."}):t.length===0?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"No saved tool analysis reports yet."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-b px-4 py-3",children:a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing ",a.jsx("span",{className:"font-medium text-foreground",children:t.length})," ","reports"]})}),t.length===0?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"No reports for the selected MCP server."}):a.jsxs(oa,{children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{children:"Report ID"}),a.jsx(ct,{children:"Evaluated"}),a.jsx(ct,{children:"Timestamp"}),a.jsx(ct,{children:"Issues"}),a.jsx(ct,{children:"Modes"}),a.jsx(ct,{className:"w-10"})]})}),a.jsx(la,{children:t.map(P=>a.jsxs(Wt,{children:[a.jsx(qe,{children:a.jsxs("div",{className:"space-y-1",children:[a.jsx(Et,{to:`/tool-analysis-results/${P.reportId}`,className:"font-mono text-xs text-primary hover:underline",children:P.reportId}),a.jsx("div",{className:"text-[11px] text-muted-foreground",children:P.assistantAgentName})]})}),a.jsx(qe,{className:"text-[11px] text-muted-foreground",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Servers:"," ",a.jsx("span",{className:"font-medium text-foreground",children:P.serverNames.length})," ","· Tools:"," ",a.jsx("span",{className:"font-medium text-foreground",children:P.summary.toolsAnalyzed})," · ","Skipped:"," ",a.jsx("span",{className:"font-medium text-foreground",children:P.summary.toolsSkipped})]}),Object.keys(P.mcpServerVersions??{}).length>0?a.jsx(Su,{versions:P.mcpServerVersions,showPrefix:!1}):a.jsxs("div",{className:"font-mono text-xs text-foreground/80",children:[P.serverNames.slice(0,2).join(", "),P.serverNames.length>2?` +${P.serverNames.length-2}`:""]})]})}),a.jsx(qe,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(P.createdAt).toLocaleString()]})}),a.jsx(qe,{children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[["critical","high","medium","low","info"].map(T=>P.summary.issueCounts[T]>0?a.jsxs(et,{variant:"outline",className:"capitalize",children:[T,": ",P.summary.issueCounts[T]]},`${P.reportId}-${T}`):null),Object.values(P.summary.issueCounts).every(T=>T===0)&&a.jsx(et,{variant:"outline",children:"No issues"})]})}),a.jsx(qe,{children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[P.modes.metadataReview&&a.jsx(et,{variant:"outline",children:"metadata"}),P.modes.deeperAnalysis&&a.jsx(et,{variant:"outline",children:"deeper"})]})}),a.jsx(qe,{children:a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Bg,{className:"h-4 w-4"})})}),a.jsxs(Bu,{align:"end",children:[a.jsx(Mr,{asChild:!0,children:a.jsx(Et,{to:`/tool-analysis-results/${P.reportId}`,children:"View"})}),a.jsxs(Mr,{onSelect:()=>{E(P.reportId,"json")},children:[a.jsx(zr,{className:"mr-2 h-3.5 w-3.5"})," Export JSON"]}),a.jsxs(Mr,{onSelect:()=>{E(P.reportId,"markdown")},children:[a.jsx(zr,{className:"mr-2 h-3.5 w-3.5"})," Export Markdown"]}),a.jsxs(Mr,{className:"text-destructive",onSelect:T=>{T.preventDefault(),i(P.reportId)},children:[a.jsx(Xa,{className:"mr-2 h-3.5 w-3.5"})," Delete"]}),a.jsxs(Mr,{onSelect:()=>{E(P.reportId,"tool_schemas")},children:[a.jsx(zr,{className:"mr-2 h-3.5 w-3.5"})," Export MCP Info"]})]})]})})]},P.reportId))})]})]})})}),a.jsx(Os,{open:!!o,onOpenChange:P=>!P&&i(null),children:a.jsxs(Za,{children:[a.jsxs(es,{children:[a.jsx(ns,{children:"Delete tool analysis report?"}),a.jsx(rs,{children:k?`Delete saved report '${k.reportId}' from disk? This cannot be undone.`:"Delete this saved report from disk? This cannot be undone."})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:c,children:"Cancel"}),a.jsx(as,{onClick:P=>{P.preventDefault(),A()},disabled:c,children:c?"Deleting...":"Delete"})]})]})})]})}function IS(e,t,n){const r=new Blob([t],{type:n}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=e,o.click(),URL.revokeObjectURL(s)}function I0e(){const{id:e=""}=Bl(),t=is(),{source:n}=$n(),[r,s]=h.useState(null),[o,i]=h.useState(!0),[c,u]=h.useState(!1),[f,m]=h.useState(!1),[p,v]=h.useState(!1);h.useEffect(()=>{let j=!0;return i(!0),u(!1),n.getToolAnalysisSavedResult(e).then(y=>{j&&s(y)}).catch(y=>{if(!j)return;const b=y instanceof Error?y.message:String(y);if(b.includes("(404)")){u(!0),s(null);return}$e({title:"Could not load saved tool analysis report",description:b,variant:"destructive"})}).finally(()=>{j&&i(!1)}),()=>{j=!1}},[e,n]);const x=async()=>{v(!0);try{await n.deleteToolAnalysisSavedResult(e),$e({title:"Tool analysis report deleted"}),t("/tool-analysis-results")}catch(j){$e({title:"Could not delete report",description:j instanceof Error?j.message:String(j),variant:"destructive"})}finally{v(!1),m(!1)}};return o?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading saved tool analysis report..."}):c||!r?a.jsxs("div",{className:"space-y-4",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Tool Analysis Result"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Saved report not found."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:"/tool-analysis-results",children:"Back to Tool Analysis Results"})})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-mono text-xl font-semibold",children:r.reportId}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[a.jsx(Ea,{className:"h-3 w-3 shrink-0"}),new Date(r.createdAt).toLocaleString()]})," ","·"," ",[r.report.assistantAgentProvider?Yf(r.report.assistantAgentProvider):null,r.report.assistantAgentModel].filter(Boolean).join(" · ")||r.serverNames.join(", ")||"—"]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Su,{versions:r.report.mcpServerVersions}),a.jsx(Z,{asChild:!0,size:"sm",variant:"outline",children:a.jsx(Et,{to:"/tool-analysis-results",children:"Back to results"})}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>IS(`${r.reportId}.json`,`${JSON.stringify(r,null,2)}
@@ -153,8 +153,8 @@ Defaulting to \`null\`.`}var hU=uU,j0e=fU;const px=h.forwardRef(({className:e,va
153
153
  `,"application/json"),children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export MCP info"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>m(!0),children:[a.jsx(Xa,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]}),a.jsx(xU,{report:r.report}),a.jsx(Os,{open:f,onOpenChange:m,children:a.jsxs(Za,{children:[a.jsxs(es,{children:[a.jsx(ns,{children:"Delete tool analysis report?"}),a.jsxs(rs,{children:["Delete saved report '",r.reportId,"' from disk? This cannot be undone."]})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:p,children:"Cancel"}),a.jsx(as,{onClick:j=>{j.preventDefault(),x()},disabled:p,children:p?"Deleting...":"Delete"})]})]})})]})}const $0e=[{id:"configure",label:"Configure Debug Session"},{id:"run",label:"Run / Inspect Flow"},{id:"report",label:"Report / Export"}],D0e="resolve_target_metadata",L0e="token_exchange",F0e="resource_probe";function Lr({text:e}){return a.jsx(Js,{delayDuration:200,children:a.jsxs(Zs,{children:[a.jsx(eo,{type:"button",className:"inline-flex shrink-0 items-center",onClick:t=>t.preventDefault(),children:a.jsx(PW,{className:"h-3.5 w-3.5 text-muted-foreground/50 hover:text-muted-foreground"})}),a.jsx(Rs,{className:"max-w-xs text-xs leading-relaxed",children:e})]})})}function OD(e){return navigator.clipboard.writeText(e)}function $S(){return typeof window>"u"?"":window.location.port==="8685"?"http://127.0.0.1:8787":""}function DS(e){if(!e)return"No metadata payload captured.";try{return JSON.stringify(JSON.parse(e),null,2)}catch{return`Non-JSON response body:
154
154
  ${e}`}}function z0e(e,t){const n=[];n.push("# OAuth Debugger Report"),n.push(""),n.push(`- Session ID: ${e.id}`),n.push(`- Status: ${e.status}`),n.push(`- Registration method: ${e.registrationMethod}`),n.push(`- Profile: ${e.profile}`),n.push(""),n.push("## Steps");for(const r of e.stepStates)n.push(`- ${r.title}: ${r.status}${r.outcomeSummary?` — ${r.outcomeSummary}`:""}`);if(n.push(""),n.push("## Validation Findings"),e.validations.length===0)n.push("- None");else for(const r of e.validations)n.push(`- [${r.severity}] ${r.title} (${r.stepId})`),n.push(` - ${r.detail}`),r.recommendation&&n.push(` - Recommendation: ${r.recommendation}`);n.push(""),n.push("## Event Log");for(const r of t){const s=typeof r.payload.message=="string"?r.payload.message:JSON.stringify(r.payload);n.push(`- ${new Date(r.ts).toLocaleTimeString()} [${r.type}] ${s}`)}return`${n.join(`
155
155
  `)}
156
- `}function B0e(){const{source:e}=$n(),{servers:t,reload:n,loading:r}=Is(),[s,o]=h.useState("configure"),[i,c]=h.useState(""),[u,f]=h.useState("pre_registered"),[m,p]=h.useState("local_callback"),[v,x]=h.useState(!0),[j,y]=h.useState(!0),[b,S]=h.useState(!0),[N,C]=h.useState(""),[k,A]=h.useState(""),[E,P]=h.useState(""),[T,$]=h.useState(""),[Y,H]=h.useState("__default__"),[F,X]=h.useState("{}"),[L,I]=h.useState(""),[M,q]=h.useState(""),[G,O]=h.useState(""),[Q,B]=h.useState(""),[z,V]=h.useState(""),[ee,ae]=h.useState(""),[ue,se]=h.useState(""),[xe,oe]=h.useState(""),[de,De]=h.useState(null),[me,ge]=h.useState(null),[we,at]=h.useState([]),[tt,it]=h.useState(!1),[At,Ge]=h.useState(!1),[Ee,Re]=h.useState(!1),[Ze,ht]=h.useState("all"),[Ft,zt]=h.useState("all"),[jt,rn]=h.useState("inspector"),an=h.useRef(null),qt=h.useRef(null),Zt=h.useRef(!1),sn=h.useRef(j);h.useEffect(()=>{sn.current=j},[j]),h.useEffect(()=>()=>{an.current?.(),an.current=null},[]),h.useEffect(()=>{qt.current?.scrollIntoView({behavior:"smooth",block:"end"})},[we.length]);const ln=h.useMemo(()=>t.filter(te=>te.authType==="oauth2").slice().sort((te,Le)=>(te.name||te.id).localeCompare(Le.name||Le.id,void 0,{sensitivity:"base"})),[t]),ke=ln.find(te=>te.id===i);h.useEffect(()=>{i&&(ln.some(te=>te.id===i)||c(""))},[ln,i]),h.useEffect(()=>{ke&&(ke.oauthMode==="dcr"?(f("dcr"),P(""),$("")):(f("pre_registered"),P(ke.oauthClientId??""),$(ke.oauthClientSecret??"")),C(ke.oauthScope??""),B(ke.oauthAuthorizationUrl??""),V(ke.oauthTokenEndpoint??""))},[ke?.id]);const ze=h.useMemo(()=>{const te=de?.stepStates.length??0,Le=de?.stepStates.filter(Te=>Te.status==="completed"||Te.status==="skipped").length??0,ot=de?.stepStates.filter(Te=>Te.status==="failed").length??0,Ut=te>0?Math.round((Le+ot)/te*100):0;return{total:te,completed:Le,failed:ot,percent:Ut}},[de]),Xe=h.useMemo(()=>{const te=de?.network??[],Le=new Map,ot=[],Ut=Te=>`${Te.stepId}::${Te.label}::${Te.url}`;for(const Te of te){if(Te.phase==="request"){const Xn=ot.length;ot.push({key:Te.id,stepId:Te.stepId,label:Te.label,method:Te.method,url:Te.url,request:Te});const zn=Ut(Te),Ra=Le.get(zn)??[];Ra.push(Xn),Le.set(zn,Ra);continue}const Qt=Ut(Te),St=Le.get(Qt),Gt=St?.shift();if(typeof Gt=="number"){ot[Gt]={...ot[Gt],response:Te},St&&St.length>0?Le.set(Qt,St):Le.delete(Qt);continue}ot.push({key:Te.id,stepId:Te.stepId,label:Te.label,method:Te.method,url:Te.url,response:Te})}return ot.filter(Te=>Ze!=="all"&&Te.stepId!==Ze?!1:Ft==="error"?typeof Te.response?.status=="number"&&Te.response.status>=400:Ft==="ok"?typeof Te.response?.status=="number"&&Te.response.status<400:!0)},[de?.network,Ze,Ft]),kt=!!me,vt=!!(de&&(de.status==="completed"||de.status==="error"||de.status==="stopped")),fe=h.useMemo(()=>{const te=new Map;return(de?.stepStates??[]).forEach((Le,ot)=>{te.set(Le.id,ot+1)}),te},[de?.stepStates]),Oe=h.useMemo(()=>{const te=(de?.network??[]).filter(ot=>ot.phase==="response"),Le=ot=>{const Ut=te.filter(Te=>Te.label===ot);return[...Ut].reverse().find(Te=>typeof Te.status=="number"&&Te.status<400)??[...Ut].reverse()[0]};return{resourceMetadata:Le("Protected Resource Metadata"),authorizationServerMetadata:Le("Authorization Server Metadata")}},[de?.network]),Ve=h.useMemo(()=>{const te=new Map;for(const Le of de?.network??[]){const ot=te.get(Le.stepId)??{requests:[],responses:[]};Le.phase==="request"&&ot.requests.push(Le),Le.phase==="response"&&ot.responses.push(Le),te.set(Le.stepId,ot)}return te},[de?.network]),U=te=>{if(te==="configure"||te==="run"&&kt||te==="report"&&vt)return o(te)},le=()=>{let te;if(u==="dcr"&&F.trim())try{te=JSON.parse(F)}catch{throw new Error("DCR metadata JSON is invalid")}if(!ke)throw new Error("Select an MCP server");return{profile:"latest",target:{serverName:ke.id,overrides:{authorizationServerMetadataUrl:G||void 0,authorizationEndpoint:Q||void 0,tokenEndpoint:z||void 0,registrationEndpoint:ee||void 0,cimdUrl:L||void 0,resourceBaseUrl:ue||void 0}},registrationMethod:u,clientConfig:{preRegistered:u==="pre_registered"?{clientId:E.trim(),clientSecret:T.trim()||void 0,tokenEndpointAuthMethod:Y==="__default__"?void 0:Y||void 0}:void 0,dcr:u==="dcr"?{metadata:te,tokenEndpointAuthMethod:Y==="__default__"?void 0:Y||void 0}:void 0,cimd:u==="cimd"?{cimdUrl:L||void 0,expectedClientId:M||void 0}:void 0},runtime:{redirectMode:m,scopes:N.split(/[,\s]+/).map(Le=>Le.trim()).filter(Boolean),resource:k.trim()||void 0,usePkce:b,codeChallengeMethod:"S256"},display:{showSensitiveValues:v}}},W=te=>{an.current?.(),an.current=e.subscribeOAuthDebuggerSession(te,Le=>{at(Ut=>[...Ut,Le]),(Le.type==="completed"||Le.type==="error"||Le.type==="stopped")&&it(!1),e.getOAuthDebuggerSession(te).then(Ut=>{De(Ut.session),Ut.session.uiHints.authorizationUrl&&ye(`${$S()}/api/oauth-debugger/sessions/${te}/authorize`),Ut.session.status==="completed"&&o("report")}).catch(()=>{})})},ye=te=>{!sn.current||Zt.current||!te||(Zt.current=!0,window.open(te,"_blank","noopener,noreferrer"))},ve=async()=>{Ge(!0),Zt.current=!1;try{const te=le(),Le=await e.createOAuthDebuggerSession(te);ge(Le.sessionId),De(Le.session),at([]),o("run"),W(Le.sessionId);const ot=await e.startOAuthDebuggerSession(Le.sessionId);De(ot.session),it(!0),(ot.session.status==="waiting_for_user"||ot.session.status==="waiting_for_browser_callback")&&(it(!1),ot.session.uiHints.authorizationUrl&&ye(`${$S()}/api/oauth-debugger/sessions/${Le.sessionId}/authorize`))}catch(te){$e({title:"Could not start OAuth Debugger session",description:te instanceof Error?te.message:String(te),variant:"destructive"})}finally{Ge(!1)}},Ce=async()=>{if(me)try{Ge(!0);const te=await e.submitOAuthDebuggerManualCallback(me,{redirectUrl:xe.trim()||void 0});De(te.session),oe(""),it(!0)}catch(te){$e({title:"Could not submit callback",description:te instanceof Error?te.message:String(te),variant:"destructive"})}finally{Ge(!1)}},_e=async()=>{if(me){Re(!0);try{const te=await e.stopOAuthDebuggerSession(me);if(it(!1),te.status!=="running"){const Le=await e.getOAuthDebuggerSession(me);De(Le.session),Le.session.status==="completed"?o("report"):o("run")}}catch(te){$e({title:"Could not stop session",description:te instanceof Error?te.message:String(te),variant:"destructive"})}finally{Re(!1)}}},K=async()=>{an.current?.(),an.current=null,De(null),ge(null),at([]),it(!1),Re(!1),Ge(!1),oe(""),ht("all"),zt("all"),rn("inspector"),o("run"),await ve()},pe=async te=>{if(!(!me||!de))try{const Le=await e.exportOAuthDebuggerSession(me,te);let ot="";const Ut=te==="json"?"json":te==="raw"?"txt":"md";typeof Le=="string"?ot=Le:ot=`${JSON.stringify(Le,null,2)}
157
- `;const Te=new Blob([ot],{type:"text/plain;charset=utf-8"}),Qt=URL.createObjectURL(Te),St=document.createElement("a");St.href=Qt,St.download=`oauth-debugger-${me}.${Ut}`,St.click(),URL.revokeObjectURL(Qt)}catch(Le){if(te==="markdown"){const ot=z0e(de,we),Ut=new Blob([ot],{type:"text/markdown;charset=utf-8"}),Te=URL.createObjectURL(Ut),Qt=document.createElement("a");Qt.href=Te,Qt.download=`oauth-debugger-${de.id}.md`,Qt.click(),URL.revokeObjectURL(Te);return}$e({title:"Export failed",description:Le instanceof Error?Le.message:String(Le),variant:"destructive"})}},Ae=me?`${$S()}/api/oauth-debugger/sessions/${me}/authorize`:void 0,Ke=te=>te==="error"?"destructive":te==="warning"?"outline":"secondary";return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"OAuth Debugger"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Step-by-step OAuth flow debugging for MCP servers (latest MCP authorization draft profile)."})]}),a.jsx("div",{className:"flex flex-wrap items-center gap-2",children:$0e.map(te=>{const Le=s===te.id,ot=te.id==="configure"||te.id==="run"&&kt||te.id==="report"&&vt;return a.jsx("button",{type:"button",onClick:()=>ot&&U(te.id),disabled:!ot,className:"rounded-full",children:a.jsx(et,{variant:Le?"default":"outline",className:ot?"":"opacity-50",children:te.label})},te.id)})})]}),s==="configure"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base",children:"Target MCP Server"}),a.jsx(Or,{children:"Select one MCP server from Libraries and optionally override endpoints."})]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>{n()},disabled:r,children:[a.jsx(Ya,{className:`mr-2 h-4 w-4 ${r?"animate-spin":""}`}),"Refresh Servers"]})]})}),a.jsx(Je,{className:"space-y-3",children:a.jsxs("div",{className:"max-w-xl space-y-2",children:[a.jsx(We,{children:"MCP Server"}),a.jsxs(Mn,{value:i,onValueChange:c,children:[a.jsx(_n,{children:a.jsx(In,{placeholder:"Select an MCP server"})}),a.jsx(kn,{children:ln.map(te=>a.jsx(ut,{value:te.id,children:te.name||te.id},te.id))})]}),ln.length===0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["No MCP servers with OAuth configured found. Add OAuth 2.0 auth in"," ",a.jsx("a",{href:"/libraries/servers",className:"underline text-primary",children:"Manage Servers"}),"."]}),ke&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[ke.transport," ·"," ",ke.url||ke.command||"No URL/command"," · ",a.jsxs("span",{className:"text-primary",children:[ke.oauthMode==="dcr"?"DCR":"pre-registered"," fields pre-filled"]})]})]})})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Client Registration Method"}),a.jsx(Or,{children:"How your OAuth client is identified with the authorization server."})]}),a.jsxs(Je,{className:"space-y-3",children:[a.jsx("div",{className:"grid gap-2 md:grid-cols-3",children:[{id:"pre_registered",label:"Pre-registered client",hint:"You already have a client_id issued by the authorization server."},{id:"dcr",label:"Dynamic Client Registration",hint:"The server issues a client_id automatically at the start of the flow (RFC 7591)."},{id:"cimd",label:"Client ID Metadata Document",hint:"The client identifies itself via a hosted JSON metadata document at a public URL (RFC 9728)."}].map(te=>a.jsxs("button",{type:"button",onClick:()=>f(te.id),className:"rounded-md border p-3 text-left",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${u===te.id?"bg-primary":"bg-muted-foreground/30"}`}),a.jsx("span",{className:"text-sm font-medium",children:te.label})]}),a.jsx("p",{className:"mt-1 pl-5 text-xs text-muted-foreground",children:te.hint})]},te.id))}),a.jsx("div",{className:"grid gap-3 md:grid-cols-1",children:a.jsxs("div",{className:"max-w-md space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Redirect mode",a.jsx(Lr,{text:"Local callback (recommended): MCP Lab automatically captures the redirect after you log in — no copy-pasting needed. Manual: you complete the browser login and then paste the final redirect URL back here."})]}),a.jsxs(Mn,{value:m,onValueChange:te=>p(te),children:[a.jsx(_n,{children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"local_callback",children:"Local callback (recommended)"}),a.jsx(ut,{value:"manual",children:"Manual paste redirect URL"})]})]})]})}),u==="pre_registered"&&a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["client_id",a.jsx(Lr,{text:"The unique identifier for your application, issued by the authorization server when you registered the client."})]}),a.jsx(_t,{value:E,onChange:te=>P(te.target.value)})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["client_secret",a.jsx(Lr,{text:"Leave empty for public clients (e.g. SPAs or mobile apps). Required for confidential clients that authenticate with the token endpoint."})]}),a.jsx(XN,{value:T,onChange:te=>$(te.target.value),placeholder:"optional"})]})]}),u==="cimd"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["CIMD URL",a.jsx(Lr,{text:"A publicly reachable URL hosting a JSON document that describes this client. The authorization server fetches it to identify the client."})]}),a.jsx(_t,{value:L,onChange:te=>I(te.target.value),placeholder:"https://.../client-metadata.json"})]})]})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Runtime OAuth Inputs"}),a.jsx(Or,{children:"Parameters sent in the authorization request."})]}),a.jsxs(Je,{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Scopes"}),a.jsx(_t,{value:N,onChange:te=>C(te.target.value),placeholder:"openid profile email"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Space or comma separated. Leave empty to use scopes auto-discovered from the server metadata."})]}),a.jsxs("div",{className:"flex items-center gap-2 md:col-span-2",children:[a.jsx(br,{checked:b,onCheckedChange:te=>S(!!te)}),a.jsxs(We,{className:"flex items-center gap-1",children:["Use PKCE (S256)",a.jsx(Lr,{text:"Proof Key for Code Exchange — generates a one-time code verifier so the authorization code can't be hijacked. Recommended for all clients; required for public clients."})]})]}),a.jsxs("div",{className:"flex items-center gap-2 md:col-span-2",children:[a.jsx(br,{checked:j,onCheckedChange:te=>y(!!te)}),a.jsx(We,{children:"Auto-open browser when authorization URL is ready"})]})]})]}),a.jsxs("details",{className:"rounded-md border bg-card p-3 shadow-sm",children:[a.jsx("summary",{className:"cursor-pointer text-sm font-medium",children:"Advanced"}),a.jsxs("div",{className:"mt-3 space-y-4",children:[a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Token endpoint auth method",a.jsx(Lr,{text:"How your client authenticates when exchanging the authorization code for a token. Choose 'none' for public clients (no secret). Leave as server default if unsure."})]}),a.jsxs(Mn,{value:Y,onValueChange:H,children:[a.jsx(_n,{children:a.jsx(In,{placeholder:"Server default (recommended)"})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"__default__",children:"Server default (let the server decide)"}),a.jsx(ut,{value:"client_secret_basic",children:"client_secret_basic — credentials in Authorization header"}),a.jsx(ut,{value:"client_secret_post",children:"client_secret_post — credentials in request body"}),a.jsx(ut,{value:"none",children:"none — public client, no secret"}),a.jsx(ut,{value:"private_key_jwt",children:"private_key_jwt — signed JWT assertion"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'Use "server default" unless the server requires a specific method.'})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Resource / audience",a.jsx(Lr,{text:"Some servers (RFC 8707) require the target API's URI in the token request to scope the token. Only set this if your server explicitly requires it."})]}),a.jsx(_t,{value:k,onChange:te=>A(te.target.value),placeholder:"https://api.example.com"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Only needed for servers that use resource indicators."})]})]}),u==="dcr"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["DCR metadata JSON",a.jsx(Lr,{text:'Extra fields for the dynamic client registration request (RFC 7591), e.g. {"client_name": "My App"}. redirect_uris and grant_types are always added automatically.'})]}),a.jsx(Ts,{value:F,onChange:te=>X(te.target.value),className:"min-h-32 font-mono text-xs"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional extra fields for the registration request body."})]}),u==="cimd"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Expected client_id",a.jsx(Lr,{text:"If you know what client_id the server should assign from the metadata document, enter it here for verification. Leave blank to accept whatever the server returns."})]}),a.jsx(_t,{value:M,onChange:te=>q(te.target.value),placeholder:"optional"})]}),a.jsxs("div",{className:"rounded-md border bg-background p-3",children:[a.jsx("div",{className:"mb-1 text-sm font-medium",children:"Endpoint overrides"}),a.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Override specific endpoints if auto-discovery fails or you want to test against a specific URL. Leave blank to use what the server advertises."}),a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Authorization server metadata URL",a.jsx(Lr,{text:"The /.well-known/oauth-authorization-server URL. Override if the server uses a non-standard path."})]}),a.jsx(_t,{value:G,onChange:te=>O(te.target.value),placeholder:"https://.../.well-known/oauth-authorization-server"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Resource server base URL",a.jsx(Lr,{text:"The MCP server's base URL used to look up its /.well-known/oauth-protected-resource metadata. Override if the server uses a different base path."})]}),a.jsx(_t,{value:ue,onChange:te=>se(te.target.value),placeholder:"https://resource.example.com"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Authorization endpoint",a.jsx(Lr,{text:"The URL where users are redirected to log in and grant consent. Normally discovered automatically from the server metadata."})]}),a.jsx(_t,{value:Q,onChange:te=>B(te.target.value),placeholder:"https://.../authorize"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Token endpoint",a.jsx(Lr,{text:"The URL your app calls to exchange the authorization code for an access token. Normally discovered automatically."})]}),a.jsx(_t,{value:z,onChange:te=>V(te.target.value),placeholder:"https://.../token"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Registration endpoint (DCR)",a.jsx(Lr,{text:"The URL used to dynamically register a new client (RFC 7591). Only relevant when using DCR. Override if the server doesn't advertise it in its metadata."})]}),a.jsx(_t,{value:ee,onChange:te=>ae(te.target.value),placeholder:"https://.../register"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["CIMD URL override",a.jsx(Lr,{text:"Override the Client ID Metadata Document URL. Use this if the server doesn't discover it automatically or you want to test with a specific metadata document."})]}),a.jsx(_t,{value:L,onChange:te=>I(te.target.value),placeholder:"https://.../client-metadata.json"})]})]})]}),a.jsxs(vl,{children:[a.jsx(eb,{className:"h-4 w-4"}),a.jsx(xl,{children:"Secrets display"}),a.jsxs(yl,{className:"space-y-2",children:[a.jsx("p",{children:"By default, full tokens and secrets are visible in the network inspector and exports — useful for debugging but not for sharing."}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(br,{checked:!v,onCheckedChange:te=>x(te===!1)}),a.jsx(We,{children:"Hide sensitive values in inspector"})]})]})]})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(Z,{type:"button",onClick:()=>{ve()},disabled:At,children:[At&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Start OAuth Debug Session"]})})]}),s==="run"&&a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 xl:grid-cols-[1.2fr_1fr]",children:[a.jsxs(Qe,{className:"xl:col-span-1 min-w-0",children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base",children:"Progress"}),a.jsx(Or,{children:"Visual OAuth flow guide with live session events and next-step actions."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[de?.uiHints.authorizationUrl&&Ae&&a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsxs("a",{href:Ae,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Vc,{className:"mr-2 h-4 w-4"}),"Open Authorization URL"]})}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{K()},disabled:At,children:[a.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Restart"]}),me&&a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{_e()},disabled:Ee||!me,children:[(Ee||tt)&&Ee&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),a.jsx(Vd,{className:"mr-2 h-4 w-4"}),"Stop Debug Session"]})]})]})}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[ze.completed+ze.failed,"/",ze.total," steps"]}),a.jsxs("span",{children:[ze.percent,"%"]})]}),a.jsx(px,{value:ze.percent,className:"h-2"})]}),de?.status==="waiting_for_user"&&a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4 space-y-2",children:[a.jsx("div",{className:"text-sm font-medium",children:"Manual callback required"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Open the authorization URL, complete authentication, then paste the final redirect URL here."}),a.jsx(Ts,{value:xe,onChange:te=>oe(te.target.value),placeholder:"Paste the final redirect URL (with code and state)",className:"min-h-24 text-xs font-mono"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",onClick:()=>{Ce()},disabled:At||!xe.trim(),children:[At&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Continue"]}),de.uiHints.authorizationUrl&&Ae&&a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx("a",{href:Ae,target:"_blank",rel:"noopener noreferrer",children:"Open Authorization URL"})})]})]})}),de?.status==="waiting_for_browser_callback"&&a.jsxs(vl,{children:[a.jsx(eb,{className:"h-4 w-4"}),a.jsx(xl,{children:"Waiting for browser callback"}),a.jsxs(yl,{className:"space-y-1",children:[a.jsx("p",{className:"text-xs",children:"Complete the authorization flow in your browser. MCP Lab is listening for the callback at:"}),a.jsx("p",{className:"text-xs font-mono break-all",children:de.uiHints.callbackUrl}),de.uiHints.authorizationUrl&&Ae&&a.jsx("div",{className:"pt-2",children:a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsxs("a",{href:Ae,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Vc,{className:"mr-2 h-4 w-4"}),"Open Authorization URL"]})})})]})]}),a.jsx("div",{className:"space-y-2",children:de?.stepStates.map(te=>{const Le=fe.get(te.id),ot=Ve.get(te.id),Ut=te.id===L0e||te.id===F0e,Te=!!(ot&&(ot.requests.length>0||ot.responses.length>0)),Qt=Ut&&te.status!=="pending"&&Te;return a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border bg-muted text-xs font-semibold",children:Le}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"inline-flex items-center gap-1 text-sm font-medium",children:[a.jsx("span",{children:te.title}),te.status==="completed"&&a.jsx(Va,{className:"h-4 w-4 shrink-0 text-emerald-600","aria-hidden":"true"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:te.description})]})]}),a.jsx(et,{variant:te.status==="failed"?"destructive":te.status==="completed"?"outline":te.status==="active"?"secondary":"outline",className:te.status==="completed"?"border-emerald-300 bg-emerald-50 text-emerald-700":void 0,children:te.status})]}),te.outcomeSummary&&a.jsx("p",{className:"mt-2 text-xs text-muted-foreground break-all whitespace-pre-line",children:te.outcomeSummary}),te.id===D0e&&a.jsxs("details",{className:"mt-3 rounded-md border bg-muted/20 p-3",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-semibold text-muted-foreground",children:"OAuth Metadata Sources"}),a.jsxs("div",{className:"mt-3 space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Resource Metadata"}),a.jsxs("p",{className:"text-xs text-muted-foreground break-all",children:["From ",Oe.resourceMetadata?.url??"not captured"]}),a.jsx("pre",{className:"max-h-56 overflow-x-auto rounded-md bg-muted p-2 text-xs",children:DS(Oe.resourceMetadata?.bodyText)})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Authorization Server Metadata"}),a.jsxs("p",{className:"text-xs text-muted-foreground break-all",children:["From"," ",Oe.authorizationServerMetadata?.url??"not captured"]}),a.jsx("pre",{className:"max-h-56 overflow-x-auto rounded-md bg-muted p-2 text-xs",children:DS(Oe.authorizationServerMetadata?.bodyText)})]})]})]}),Qt&&ot&&a.jsxs("details",{className:"mt-3 rounded-md border bg-muted/20 p-3",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-semibold text-muted-foreground",children:"Captured exchange details"}),a.jsx("div",{className:"mt-3 space-y-3",children:Array.from({length:Math.max(ot.requests.length,ot.responses.length)}).map((St,Gt)=>{const Xn=ot.requests[Gt],zn=ot.responses[Gt];return a.jsxs("div",{className:"rounded-md border bg-background p-2",children:[a.jsx("div",{className:"text-xs font-medium",children:Xn?.label??zn?.label??`Exchange ${Gt+1}`}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground break-all",children:[Xn?.method?`${Xn.method} `:"",Xn?.url??zn?.url??"-"]}),typeof zn?.status=="number"&&a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["HTTP ",zn.status]}),Xn?.bodyText&&a.jsx("pre",{className:"mt-2 max-h-40 overflow-auto rounded bg-muted p-2 text-xs",children:Xn.bodyText}),zn?.bodyText&&a.jsx("pre",{className:"mt-2 max-h-48 overflow-auto rounded bg-muted p-2 text-xs",children:DS(zn.bodyText)})]},`${te.id}-exchange-${Gt}`)})})]})]},te.id)})||a.jsx("p",{className:"text-sm text-muted-foreground",children:"No steps yet."})})]})]}),a.jsx("div",{className:"space-y-4 xl:col-span-1 min-w-0",children:a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base",children:"Inspect"}),a.jsx(Or,{children:"Live events and network requests/responses for the OAuth flow."})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{pe("raw")},disabled:!me||!de,children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Copy/Export Raw Trace"]})]})}),a.jsx(Je,{className:"space-y-3",children:a.jsxs(ax,{value:jt,onValueChange:te=>rn(te),className:"min-w-0",children:[a.jsxs(Cp,{className:"grid grid-cols-2",children:[a.jsx(Xs,{value:"inspector",children:"Network Inspector"}),a.jsx(Xs,{value:"events",children:"Live Debug"})]}),a.jsx(Gf,{value:"events",className:"mt-3",children:a.jsxs("div",{className:"max-h-64 space-y-1 overflow-auto rounded-md border bg-muted/10 p-3 text-xs",children:[we.length===0?a.jsx("p",{className:"text-muted-foreground",children:"No events yet."}):we.map((te,Le)=>a.jsxs("div",{className:"break-all",children:[a.jsx("span",{className:"mr-2 font-mono text-muted-foreground",children:new Date(te.ts).toLocaleTimeString()}),a.jsx(et,{variant:"outline",className:"mr-2 text-[10px]",children:te.type}),typeof te.payload.message=="string"?te.payload.message:JSON.stringify(te.payload)]},`${te.ts}-${Le}`)),a.jsx("div",{ref:qt})]})}),a.jsxs(Gf,{value:"inspector",className:"space-y-3 mt-3",children:[a.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Filter by step"}),a.jsxs(Mn,{value:Ze,onValueChange:ht,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"all",children:"All steps"}),(de?.stepStates??[]).map(te=>a.jsxs(ut,{value:te.id,children:[fe.get(te.id),". ",te.title]},te.id))]})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Filter by status"}),a.jsxs(Mn,{value:Ft,onValueChange:zt,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"all",children:"All"}),a.jsx(ut,{value:"ok",children:"Successful responses"}),a.jsx(ut,{value:"error",children:"Error responses"})]})]})]})]}),a.jsx("div",{className:"max-h-[34rem] min-w-0 space-y-2 overflow-auto",children:Xe.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No network exchanges captured yet."}):Xe.map(te=>a.jsxs("details",{className:"rounded-md border p-3",children:[a.jsx("summary",{className:"cursor-pointer list-none",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border bg-muted text-xs font-semibold",children:fe.get(te.stepId)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-sm font-medium",children:te.label}),a.jsxs("div",{className:"text-xs text-muted-foreground break-all",children:[te.method?`${te.method} `:"",te.url]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(et,{variant:"outline",children:"request"}),a.jsx(et,{variant:"outline",children:"response"}),typeof te.response?.status=="number"&&a.jsx(et,{variant:te.response.status>=400?"destructive":"secondary",children:te.response.status})]})]})}),a.jsxs("div",{className:"mt-3 space-y-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Request Headers"}),a.jsx("pre",{className:"max-h-40 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:JSON.stringify(te.request?.headers??{},null,2)})]}),te.request?.bodyText&&a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Request Body"}),a.jsx("pre",{className:"max-h-64 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:te.request.bodyText})]}),a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Response Headers"}),a.jsx("pre",{className:"max-h-40 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:JSON.stringify(te.response?.headers??{},null,2)})]}),te.response?.bodyText&&a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Response Body"}),a.jsx("pre",{className:"max-h-64 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:te.response.bodyText})]}),a.jsx("div",{className:"flex gap-2",children:a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{OD(JSON.stringify(te,null,2))},children:[a.jsx(Hr,{className:"mr-2 h-4 w-4"}),"Copy JSON"]})})]})]},te.key))})]})]})})]})})]})}),s==="report"&&de&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold",children:"Report / Export"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"OAuth debug session summary, validations, and trace exports."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>o("configure"),children:"Back to Configure"}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{pe("json")},children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export JSON"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{pe("markdown")},children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export Markdown"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{pe("raw")},children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Copy/Export Raw Trace"]})]})]}),a.jsxs(vl,{children:[a.jsx(eb,{className:"h-4 w-4"}),a.jsx(xl,{children:"Secrets display mode"}),a.jsx(yl,{children:de.summary?.showSensitiveValues?"This session is configured to show full tokens and secrets in network logs/exports.":"Sensitive values are hidden in the inspector for this session."})]}),a.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Status"}),a.jsx("div",{className:"text-lg font-semibold",children:de.status})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Requests"}),a.jsx("div",{className:"text-lg font-semibold",children:de.networkSummary.requestCount})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Network errors"}),a.jsx("div",{className:"text-lg font-semibold",children:de.networkSummary.errorCount})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Validation findings"}),a.jsx("div",{className:"text-lg font-semibold",children:de.validations.length})]})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Key values"})}),a.jsxs(Je,{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Issuer"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.issuer||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Client ID"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.clientId||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Redirect URI"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.redirectUri||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Token endpoint status"}),a.jsx("p",{className:"text-sm",children:de.summary?.tokenEndpointStatus??"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Token type"}),a.jsx("p",{className:"text-sm",children:de.summary?.tokenType||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Scopes granted"}),a.jsx("p",{className:"text-sm break-all",children:(de.summary?.grantedScopes??[]).join(", ")||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Token validity"}),a.jsxs("p",{className:"text-sm",children:[typeof de.summary?.accessTokenValidForSeconds=="number"?`${KN(de.summary.accessTokenValidForSeconds)} remaining`:typeof de.summary?.accessTokenExpiresInSeconds=="number"?`${KN(de.summary.accessTokenExpiresInSeconds)} from issuance`:"No expiry advertised by token endpoint",de.summary?.accessTokenExpiresAt?a.jsxs(a.Fragment,{children:[" (until ",a.jsx("span",{children:new Date(de.summary.accessTokenExpiresAt).toLocaleTimeString()}),")"]}):""]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Source:"," ",de.summary?.accessTokenExpirySource==="expires_in"?"token endpoint expires_in":de.summary?.accessTokenExpirySource==="jwt_exp"?"JWT exp claim":"not available"]})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Refresh option"}),a.jsx("p",{className:"text-sm",children:de.summary?.refreshTokenAvailable?"Refresh token available (silent refresh possible)":"No refresh token in response (full login likely required after expiry)"})]}),de.summary?.accessToken&&a.jsxs("div",{className:"md:col-span-2 space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Access token"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("code",{className:"flex-1 truncate rounded bg-muted px-2 py-1 text-xs font-mono text-muted-foreground",children:[de.summary.accessToken.slice(0,48),"…"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"shrink-0 h-7 px-2 text-xs",onClick:()=>{OD(de.summary.accessToken)},children:[a.jsx(Hr,{className:"mr-1 h-3 w-3"}),"Copy token"]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:['Visible because "Hide sensitive values" is off. Use this token with the CLI via'," ",a.jsx("code",{className:"font-mono",children:"--oauth-token"}),"."]})]})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Validation findings"})}),a.jsx(Je,{className:"space-y-2",children:de.validations.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No validation findings recorded."}):de.validations.map((te,Le)=>a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:Le+1}),a.jsx("span",{className:"font-bold",children:te.title})]}),a.jsx(et,{variant:Ke(te.severity),children:te.severity})]}),a.jsxs("p",{className:"text-sm",children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",te.detail]}),te.recommendation&&a.jsxs("div",{className:"mt-2 rounded-md border px-2.5 py-2 text-xs",children:[a.jsx("div",{className:"mb-1 font-medium text-muted-foreground",children:"Suggested improvement"}),a.jsx("p",{children:te.recommendation})]}),a.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Step: ",te.stepId,te.specReference&&a.jsxs(a.Fragment,{children:[" · ",a.jsx("a",{href:te.specReference,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"Spec reference"})]})]})]},te.id))})]})]})]})}var mx="Switch",[q0e]=kr(mx),[U0e,W0e]=q0e(mx),bU=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:o,required:i,disabled:c,value:u="on",onCheckedChange:f,form:m,...p}=e,[v,x]=h.useState(null),j=Ot(t,C=>x(C)),y=h.useRef(!1),b=v?m||!!v.closest("form"):!0,[S,N]=Aa({prop:s,defaultProp:o??!1,onChange:f,caller:mx});return a.jsxs(U0e,{scope:n,checked:S,disabled:c,children:[a.jsx(lt.button,{type:"button",role:"switch","aria-checked":S,"aria-required":i,"data-state":NU(S),"data-disabled":c?"":void 0,disabled:c,value:u,...p,ref:j,onClick:Ue(e.onClick,C=>{N(k=>!k),b&&(y.current=C.isPropagationStopped(),y.current||C.stopPropagation())})}),b&&a.jsx(SU,{control:v,bubbles:!y.current,name:r,value:u,checked:S,required:i,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});bU.displayName=mx;var wU="SwitchThumb",jU=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=W0e(wU,n);return a.jsx(lt.span,{"data-state":NU(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});jU.displayName=wU;var H0e="SwitchBubbleInput",SU=h.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...s},o)=>{const i=h.useRef(null),c=Ot(i,o),u=Zv(n),f=Vg(t);return h.useEffect(()=>{const m=i.current;if(!m)return;const p=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(p,"checked").set;if(u!==n&&x){const j=new Event("click",{bubbles:r});x.call(m,n),m.dispatchEvent(j)}},[u,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SU.displayName=H0e;function NU(e){return e?"checked":"unchecked"}var CU=bU,V0e=jU;const Mg=h.forwardRef(({className:e,...t},n)=>a.jsx(CU,{className:Me("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input 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",e),...t,ref:n,children:a.jsx(V0e,{className:Me("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Mg.displayName=CU.displayName;function K0e(e){const t=e.filter(n=>typeof n.sourcePath=="string"&&n.sourcePath.trim().length>0&&typeof n.relativePath=="string"&&n.relativePath.trim().length>0).map(n=>[n.sourcePath,n.relativePath]);return new Map(t)}function G0e(e){const t=e.filter(n=>typeof n.sourcePath=="string"&&n.sourcePath.trim().length>0).map(n=>[n.sourcePath,n.configName?.trim()||n.name]);return new Map(t)}function Y0e(e,t){const n=new Map;for(const r of e){if(!r.sourcePath)continue;const s=new Map,o=r.scenarioEntries&&r.scenarioEntries.length>0?r.scenarioEntries:r.scenarios.map(i=>({kind:"inline",scenario:i}));for(const i of o){if(i.kind==="inline"){s.set(i.scenario.id,i.scenario.name?.trim()||i.scenario.id);continue}const c=t.find(u=>u.id===i.ref);s.set(i.ref,c?.name?.trim()||i.ref)}n.set(r.sourcePath,s)}return n}function LS(e,t){const n=t.get(e);if(n)return n;const r=e.replace(/\\/g,"/"),s="/evals/",o=r.lastIndexOf(s);if(o>=0)return r.slice(o+s.length);const i=r.split("/").filter(Boolean);return i.length<=1?r:i.slice(-3).join("/")}function FS(e,t,n){const r=t.get(n);if(!e||e.length===0){if(r&&r.size===1){const o=r.values().next().value;if(o)return o}return"All scenarios"}if(!r)return e.length===1?e[0]:`${e[0]} +${e.length-1}`;const s=e.map(o=>r.get(o)??o);return s.length===1?s[0]:`${s[0]} +${s.length-1}`}const zS="mcplab.runEvaluation.activeJobId";function X0e(e){return e.configName?.trim()||e.name}function Q0e(e){if(e.suitePath?.trim())return e.suitePath.trim();if(e.relativePath?.includes("/")){const t=e.relativePath.lastIndexOf("/");return e.relativePath.slice(0,t)}return null}function Gn(){return new Date().toLocaleTimeString()}const J0e=()=>{const[e]=zo(),[t,n]=h.useState(""),[r,s]=h.useState("1"),[o,i]=h.useState(!1),[c,u]=h.useState(0),[f,m]=h.useState([]),[p,v]=h.useState(!1),[x,j]=h.useState(!1),[y,b]=h.useState(""),[S,N]=h.useState(null),[C,k]=h.useState([]),[A,E]=h.useState([]),[P,T]=h.useState(!1),[$,Y]=h.useState([]),[H,F]=h.useState({}),[X,L]=h.useState({}),[I,M]=h.useState(""),[q,G]=h.useState([]),[O,Q]=h.useState([]),[B,z]=h.useState([]),[V,ee]=h.useState(!1),[ae,ue]=h.useState(null),se=h.useRef(null),xe=h.useRef(null),oe=h.useRef(!1),{configs:de,reload:De}=up(),{source:me}=$n(),{agents:ge,scenarios:we,servers:at,reload:tt}=Is(),it=y.trim(),At=it?`/results/${encodeURIComponent(it)}${t?`?configId=${encodeURIComponent(t)}`:""}`:"/results",Ge=de.find(fe=>fe.id===t),Ee=h.useMemo(()=>K0e(de),[de]),Re=h.useMemo(()=>G0e(de),[de]),Ze=h.useMemo(()=>Y0e(de,we),[de,we]),ht=O[0]??null,Ft=e.get("configId"),zt=h.useMemo(()=>{if(!Ge)return[];const fe=new Map,Oe=Ge.agentEntries&&Ge.agentEntries.length>0?Ge.agentEntries:Ge.agents.map(Ve=>({kind:"inline",agent:Ve}));for(const Ve of Oe){if(Ve.kind==="inline"){const le=Ve.agent.id;fe.has(le)||fe.set(le,Ve.agent);continue}const U=ge.find(le=>le.id===Ve.ref);U&&!fe.has(U.id)&&fe.set(U.id,U)}for(const Ve of ge)fe.has(Ve.id)||fe.set(Ve.id,Ve);return Array.from(fe.values())},[Ge,ge]),jt=h.useMemo(()=>{if(!Ge)return[];const fe=new Map,Oe=Ge.scenarioEntries&&Ge.scenarioEntries.length>0?Ge.scenarioEntries:Ge.scenarios.map(Ve=>({kind:"inline",scenario:Ve}));for(const Ve of Oe){if(Ve.kind==="inline"){fe.has(Ve.scenario.id)||fe.set(Ve.scenario.id,Ve.scenario);continue}const U=we.find(le=>le.id===Ve.ref);U&&!fe.has(U.id)&&fe.set(U.id,U)}return Array.from(fe.values())},[Ge,we]),rn=h.useMemo(()=>{const fe=new Map;for(const Oe of at)fe.has(Oe.id)||fe.set(Oe.id,{id:Oe.id,name:Oe.name});for(const Oe of Ge?.servers??[])fe.set(Oe.id,{id:Oe.id,name:Oe.name});return Array.from(fe.values()).sort((Oe,Ve)=>Oe.id.localeCompare(Ve.id))},[Ge?.servers,at]);h.useEffect(()=>{Ft&&de.some(fe=>fe.id===Ft)&&n(Ft)},[Ft,de]);const an=h.useRef("");h.useEffect(()=>{const fe=Ge?`${Ge.id}::${Ge.sourcePath??""}`:"";if(fe===an.current)return;if(an.current=fe,!Ge){k([]),E([]),T(!1),Y([]),F({}),L({});return}const Oe=WN(Ge);k(Oe.length>0?Oe:zt.map(Ve=>Ve.id)),E(jt.map(Ve=>Ve.id)),T(!1),Y([]),F({}),L({})},[Ge?.id,Ge?.sourcePath,zt,jt]);const qt=async()=>{if(!Ge?.sourcePath){m(_e=>[..._e,`[${Gn()}] Missing source path for selected config.`]);return}const fe=zt.filter(_e=>C.includes(_e.id));if(fe.length===0){m(_e=>[..._e,`[${Gn()}] Select at least one agent.`]);return}const Oe=jt.filter(_e=>A.includes(_e.id)),Ve=new Set(Oe.map(_e=>_e.id)),U=P||Object.values(H).some(Boolean),le=Object.fromEntries(Object.entries(X).filter(([_e])=>Ve.has(_e)&&H[_e])),W=Oe.map(_e=>{const K=le[_e.id]??(P?$:_e.serverIds||[]);return`${_e.id}=[${K.join(", ")}]`}).join("; ");if(Oe.length===0){m(_e=>[..._e,`[${Gn()}] Select at least one test.`]);return}if(P&&$.length===0){m(_e=>[..._e,`[${Gn()}] Select at least one server for "Override MCP Servers for Selected Tests", or turn that override off.`]);return}const ye=Object.entries(le).filter(([,_e])=>!Array.isArray(_e)||_e.length===0).map(([_e])=>_e);if(ye.length>0){m(_e=>[..._e,`[${Gn()}] Select at least one server for per-scenario overrides on: ${ye.join(", ")}, or turn those overrides off.`]);return}const ve=Array.from(new Set(Oe.flatMap(_e=>U?le[_e.id]?le[_e.id]??[]:P?$:_e.serverIds||[]:_e.serverIds||[]).filter(_e=>{const K=(Ge.servers??[]).find(Ae=>Ae.id===_e),pe=at.find(Ae=>Ae.id===_e);return(K||pe)?.authType==="oauth2"})));try{ve.length>0&&(ee(!0),await Po({serverNames:ve,source:me,onServerAuthStart:_e=>{m(K=>[...K,`[${Gn()}] OAuth login required for '${_e}'. Complete the browser sign-in flow...`])}}),m(_e=>[..._e,`[${Gn()}] OAuth login completed for required server(s): ${ve.join(", ")}.`]))}catch(_e){const K=_e instanceof Error?_e.message:String(_e);m(pe=>[...pe,`[${Gn()}] OAuth error: ${K}`]),ee(!1);return}finally{ee(!1)}i(!0),v(!1),j(!1),b("");const Ce=(Ge.serverEntries??[]).some(_e=>_e.kind==="referenced")||(Ge.agentEntries??[]).some(_e=>_e.kind==="referenced")||(Ge.scenarioEntries??[]).some(_e=>_e.kind==="referenced")?"refs-composed":"single-file/inline";m([`[${Gn()}] Starting evaluation run...`,`[${Gn()}] Config=${Ge.name} mode=${Ce} agents=${fe.map(_e=>_e.name||_e.id).join(", ")} tests=${Oe.map(_e=>_e.id).join(", ")} runs=${Number(r)}${I.trim()?` note=${I.trim()}`:""}`,`[${Gn()}] Effective MCP servers per selected test: ${W||"(none)"}`]),u(10);try{const{jobId:_e}=await me.startRun({configPath:Ge.sourcePath,runsPerScenario:Number(r),agents:fe.map(K=>K.id),scenarioIds:Oe.map(K=>K.id),...U&&P?{serverOverrideAll:$}:{},...U&&Object.keys(le).length>0?{scenarioServerOverrides:le}:{},runNote:I.trim()?I.trim():void 0});N(_e),ke(_e),vt(_e),ze()}catch(_e){const K=_e instanceof Error?_e.message:String(_e),pe=K.includes("Anthropic model not found")?" Hint: this usually means the API key works but the model ID is not enabled for that Anthropic account. Change the agent model in Manage Agents (library) or inline config.":"";m(Ae=>[...Ae,`[${Gn()}] Error: ${K}${pe}`]),i(!1),u(0),N(null),ee(!1)}},Zt=()=>{qt()},sn=()=>{S&&me.stopRun(S),xe.current?.(),xe.current=null,ln(),N(null),i(!1),v(!1),j(!0),m(fe=>[...fe,`[${Gn()}] Run aborted by user.`]),ze()};h.useEffect(()=>{se.current&&(se.current.scrollTop=se.current.scrollHeight)},[f]),h.useEffect(()=>()=>{xe.current?.()},[]),h.useEffect(()=>{if(S||p)return;let fe="";try{fe=sessionStorage.getItem(zS)??""}catch{fe=""}if(fe)return N(fe),i(!0),v(!1),j(!1),m(Oe=>Oe.length>0?Oe:[`[${Gn()}] Reattached to in-progress evaluation run...`]),vt(fe),()=>{}},[S,p]);const ln=()=>{try{sessionStorage.removeItem(zS)}catch{}},ke=fe=>{try{sessionStorage.setItem(zS,fe)}catch{}},ze=async()=>{try{const fe=await me.getRunQueue();G(fe.queued),Q(fe.active_jobs??(fe.active?[fe.active]:[])),z(fe.admitting_jobs??[]);const Oe=S==null?void 0:fe.queued.find(Ve=>Ve.jobId===S&&Ve.status==="blocked_auth"&&Ve.blockedReason==="oauth_required");Oe&&(Oe.requiredServers??[]).length>0?ue(Ve=>Ve?.jobId===Oe.jobId?Ve:{jobId:Oe.jobId,servers:Oe.requiredServers}):(ae?.jobId&&ae.jobId!==S||S!=null&&!fe.queued.some(Ve=>Ve.jobId===S&&Ve.status==="blocked_auth"&&Ve.blockedReason==="oauth_required"))&&ue(null)}catch{}},Xe=()=>{De(),tt()};h.useEffect(()=>{Xe(),ze();const fe=()=>{Xe(),ze()};return window.addEventListener("focus",fe),()=>{window.removeEventListener("focus",fe)}},[De,tt]);const kt=async fe=>{try{await me.removeQueuedRun(fe),G(Oe=>Oe.filter(Ve=>Ve.jobId!==fe))}catch(Oe){const Ve=Oe instanceof Error?Oe.message:String(Oe);if(Ve.includes("Use the /stop endpoint"))try{await me.stopRun(fe)}catch{}else $e({title:"Could not remove queued run",description:Ve,variant:"destructive"})}ze()},vt=fe=>{S===fe&&xe.current||(xe.current?.(),xe.current=me.subscribeRunJob(fe,Oe=>{const Ve=new Date(Oe.ts).toLocaleTimeString();if(Oe.type==="queued"){m(U=>{const le=Oe.payload.position?` (position ${Oe.payload.position})`:"",W=`[${Ve}] Run queued${le}. Waiting for active run to finish...`;return U.includes(W)?U:[...U,W]}),u(5);return}if(Oe.type==="oauth_required"){const U=Array.isArray(Oe.payload.servers)?Oe.payload.servers:[],le=String(Oe.payload.jobId??"");ue({jobId:le,servers:U}),m(W=>{const ye=`[${Ve}] OAuth required for server(s): ${U.join(", ")}. Click "Connect & Resume" to authenticate.`;return W.includes(ye)?W:[...W,ye]});return}if(Oe.type==="started"&&(ue(null),oe.current=!1,i(!0),v(!1),j(!1),m(U=>{const le=`[${Ve}] Run started.`;return U.includes(le)?U:[...U,le]}),u(U=>Math.max(U,30)),ze()),Oe.type==="log"){const U=String(Oe.payload.message??"").trim();U&&(m(le=>{const W=`[${Ve}] ${U}`;return le.includes(W)?le:[...le,W]}),u(le=>{const W=U.toLowerCase();if(W.startsWith("loading mcp evaluation config"))return Math.max(le,15);if(W.startsWith("loaded config"))return Math.max(le,20);if(W.startsWith("selected "))return Math.max(le,30);if(W.startsWith("using requested agents")||W.startsWith("using run default agents")||W.startsWith("using config-declared agents"))return Math.max(le,35);if(W.startsWith("expanded to "))return Math.max(le,45);if(W.startsWith("running evaluation"))return Math.max(le,50);const ye=W.match(/^scenario (\d+)\/(\d+) finished:/);if(ye){const ve=Number(ye[1]),Ce=Number(ye[2]);return Math.max(le,50+Math.round(ve/Ce*25))}return W.startsWith("evaluation execution finished")?Math.max(le,78):W.startsWith("writing results to ")?Math.max(le,94):W.startsWith("run finished:")?Math.max(le,98):le}))}if(Oe.type==="completed"){const U=String(Oe.payload.runId??"").trim();ue(null),oe.current=!1,m(le=>{const W=`[${Ve}] Run completed.`;return le.includes(W)?le:[...le,W]}),u(100),i(!1),v(!0),j(!1),b(U),ln(),N(null),xe.current?.(),xe.current=null,ze()}if(Oe.type==="error"){const U=String(Oe.payload.message??"Unknown error"),le=U.includes("Anthropic model not found")?" Hint: this usually means the API key works but the model ID is not enabled for that Anthropic account. Change the agent model in Manage Agents (library) or inline config.":"";ue(null),oe.current=!1,m(W=>[...W,`[${Ve}] Error: ${U}${le}`]),i(!1),v(!1),j(!1),u(0),ln(),N(null),xe.current?.(),xe.current=null,ze()}}))};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(ks,{className:"h-6 w-6"}),"Run Evaluation"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Execute evaluation scenarios against MCP servers"})]}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6 space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{children:"MCP Evaluation"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Mn,{value:t,onValueChange:n,children:[a.jsx(_n,{children:a.jsx(In,{placeholder:"Select a config"})}),a.jsx(kn,{children:de.map(fe=>{const Oe=Q0e(fe);return a.jsxs(ut,{value:fe.id,children:[a.jsx("span",{children:X0e(fe)}),Oe&&a.jsxs("span",{className:"ml-2 text-muted-foreground",children:["(",Oe,")"]})]},fe.id)})})]}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0",onClick:Xe,"aria-label":"Refresh configs",title:"Refresh configs",children:a.jsx(Ya,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{children:"Variance Runs"}),a.jsx(_t,{type:"number",min:"1",max:"10",value:r,onChange:fe=>s(fe.target.value)})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{htmlFor:"run-note",children:"Run Note"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[I.length,"/500"]})]}),a.jsx(Ts,{id:"run-note",value:I,onChange:fe=>M(fe.target.value.slice(0,500)),placeholder:"Optional context for this run (for example: mcp-server v1.8.2 #staging)",rows:2})]}),Ge&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{children:"Agents"}),a.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>k(zt.map(fe=>fe.id)),children:"Select all"}),a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>k([]),children:"Clear"})]})]}),a.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:zt.map(fe=>{const Oe=C.includes(fe.id);return a.jsxs("label",{className:"flex items-center gap-2 text-sm rounded-md border p-2",children:[a.jsx(br,{checked:Oe,onCheckedChange:Ve=>{const U=Ve===!0;k(le=>U?[...le,fe.id]:le.filter(W=>W!==fe.id))}}),a.jsx("span",{children:fe.name||fe.id})]},fe.id)})}),zt.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents available. Add agents to your workspace library, or define inline agents in this config."})]}),Ge&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{children:"Tests"}),a.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>E(jt.map(fe=>fe.id)),children:"Select all"}),a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>E([]),children:"Clear"})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[A.length," of ",jt.length," selected"]}),a.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:jt.map(fe=>{const Oe=A.includes(fe.id),Ve=X[fe.id],U=!!H[fe.id],le=U&&Array.isArray(Ve),W=new Set(fe.serverIds||[]);return a.jsxs("div",{className:"flex flex-col gap-2 text-sm rounded-md border p-2 cursor-pointer",onClick:ye=>{const ve=ye.target;ve&&(ve.closest("button, a, input, select, textarea, [role='button']")||E(Ce=>Oe?Ce.filter(_e=>_e!==fe.id):[...Ce,fe.id]))},children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(br,{checked:Oe,onCheckedChange:ye=>{const ve=ye===!0;E(Ce=>ve?[...Ce,fe.id]:Ce.filter(_e=>_e!==fe.id))}}),a.jsxs("span",{className:"min-w-0",children:[a.jsxs("span",{className:"block font-medium",children:[fe.name||fe.id," ",le&&a.jsx("span",{className:"rounded bg-primary/10 px-1.5 py-0.5 text-[10px] text-primary",children:"Override"})]}),a.jsx("span",{className:"block font-mono text-xs text-muted-foreground truncate",children:fe.id})]})]}),Oe&&a.jsxs("div",{className:"pl-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{className:"text-[11px] text-muted-foreground",children:'Per-scenario: "Override MCP Servers"'}),a.jsx(Mg,{checked:U,onCheckedChange:ye=>{if(F(ve=>({...ve,[fe.id]:ye})),!ye)L(ve=>{const Ce={...ve};return delete Ce[fe.id],Ce});else if(!X[fe.id]){const ve=P&&$.length>0?[...$]:[...fe.serverIds||[]];L(Ce=>({...Ce,[fe.id]:ve}))}}})]}),U&&a.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:rn.map(ye=>{const ve=ye.id,Ce=(Ve??[]).includes(ve),_e=W.has(ve);return a.jsx(et,{variant:Ce?"default":"outline",className:`cursor-pointer text-xs ${Ce?"":"opacity-60 hover:opacity-100"}`,style:!Ce&&_e?{borderColor:"hsl(var(--primary))"}:void 0,onClick:K=>{K.stopPropagation(),L(pe=>{const Ae=pe[fe.id]??[],Ke=Ae.includes(ve)?Ae.filter(te=>te!==ve):[...Ae,ve];return{...pe,[fe.id]:Ke}})},children:ye.name?.trim()?ye.name:ve},ve)})})]})]},fe.id)})}),a.jsxs("div",{className:"space-y-1 rounded-md border p-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{children:"Override MCP Servers for selected Tests "}),a.jsx("span",{className:"text-muted-foreground",children:"Selected tests run against the servers you choose here. Applies only to this run."})]}),a.jsx(Mg,{checked:P,onCheckedChange:T})]}),P&&a.jsx("div",{className:"flex flex-wrap gap-1.5",children:rn.map(fe=>{const Oe=fe.id,Ve=$.includes(Oe);return a.jsx(et,{variant:Ve?"default":"outline",className:`cursor-pointer text-xs ${Ve?"":"opacity-60 hover:opacity-100"}`,onClick:()=>Y(U=>U.includes(Oe)?U.filter(le=>le!==Oe):[...U,Oe]),children:fe.name?.trim()?fe.name:Oe},Oe)})})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{onClick:Zt,disabled:!t||V||zt.length>0&&C.length===0||jt.length>0&&A.length===0,children:[a.jsx(ks,{className:"mr-2 h-4 w-4"}),ht?"Queue Run":"Run"]}),o&&a.jsxs(Z,{variant:"destructive",onClick:sn,children:[a.jsx(Vd,{className:"mr-2 h-4 w-4"}),"Stop"]})]})]})}),(o||f.length>0)&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Dt,{className:"text-base",children:"Progress"}),a.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[Math.round(c),"%"]})]})}),a.jsxs(Je,{className:"space-y-4",children:[a.jsx(px,{value:c,className:"h-2"}),ae&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-yellow-500/40 bg-yellow-500/10 px-3 py-2 text-sm",children:[a.jsxs("span",{className:"text-yellow-700 dark:text-yellow-400",children:["OAuth required for: ",a.jsx("strong",{children:ae.servers.join(", ")})]}),a.jsx(Z,{size:"sm",variant:"outline",disabled:V,onClick:()=>{oe.current||(oe.current=!0,ee(!0),Po({serverNames:ae.servers,source:me,onServerAuthStart:fe=>{m(Oe=>[...Oe,`[${Gn()}] OAuth sign-in opened for '${fe}'...`])}}).then(()=>me.resumeQueue()).then(()=>{const fe=ae?.jobId;m(Oe=>[...Oe,`[${Gn()}] OAuth complete. Resuming run...`]),fe&&(N(fe),ke(fe),i(!0),v(!1),vt(fe))}).catch(fe=>{const Oe=fe instanceof Error?fe.message:String(fe);m(Ve=>[...Ve,`[${Gn()}] OAuth error: ${Oe}`]),oe.current=!1}).finally(()=>{ee(!1)}))},children:V?"Connecting...":"Connect & Resume"})]}),a.jsx("div",{ref:se,className:"h-64 overflow-auto rounded-md border bg-muted/30 p-3 font-mono text-xs space-y-0.5",children:f.map((fe,Oe)=>a.jsx("div",{className:fe.includes("✓")?"text-success":fe.includes("aborted")?"text-destructive":"text-foreground",children:fe},Oe))})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Dt,{className:"inline-flex items-center gap-2 text-base",children:[a.jsx(Ea,{className:"h-4 w-4"}),"Run Queue"]}),a.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>{ze()},children:a.jsx(Ya,{className:"h-3 w-3"})})]})}),a.jsx(Je,{children:!ht&&B.length===0&&q.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No active or queued runs. Start a run above."}):a.jsxs("div",{className:"space-y-2",children:[O.map(fe=>a.jsxs("div",{role:"button",tabIndex:0,className:`flex items-center justify-between rounded-md border border-primary/30 bg-primary/5 p-2 text-sm cursor-pointer hover:bg-primary/10 transition-colors ${S===fe.jobId?"ring-2 ring-primary/40":""}`,onClick:()=>{S!==fe.jobId&&(N(fe.jobId),ke(fe.jobId),i(!0),v(!1),j(!1),m([`[${Gn()}] Attached to running job ${fe.jobId}...`]),u(10),vt(fe.jobId))},onKeyDown:Oe=>{Oe.key!=="Enter"&&Oe.key!==" "||S!==fe.jobId&&(Oe.preventDefault(),N(fe.jobId),ke(fe.jobId),i(!0),v(!1),j(!1),m([`[${Gn()}] Attached to running job ${fe.jobId}...`]),u(10),vt(fe.jobId))},title:"Click to view progress",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:"Running"}),a.jsx("span",{className:"text-xs font-bold",children:Re.get(fe.runParams.configPath)||FS(fe.runParams.scenarioIds,Ze,fe.runParams.configPath)}),a.jsx("span",{className:"font-mono text-xs",children:LS(fe.runParams.configPath,Ee)}),fe.runParams.agents&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["agents: ",fe.runParams.agents.join(", ")]}),fe.runParams.runNote&&a.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["note: ",fe.runParams.runNote]})]}),a.jsxs(Z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive hover:bg-destructive/10",onClick:Oe=>{Oe.stopPropagation(),me.stopRun(fe.jobId),ze()},title:"Stop running job",children:[a.jsx(Vd,{className:"mr-1 h-3 w-3"}),"Stop"]})]},fe.jobId)),B.map(fe=>{const Oe=LS(fe.runParams.configPath,Ee),Ve=FS(fe.runParams.scenarioIds,Ze,fe.runParams.configPath),U=Re.get(fe.runParams.configPath)||Ve,le=fe.status==="blocked_auth";return a.jsx("div",{className:`flex items-center justify-between rounded-md border p-2 text-sm ${le?"border-yellow-500/40 bg-yellow-500/5":"border-primary/20 bg-primary/5"}`,children:a.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${le?"bg-yellow-500/15 text-yellow-700 dark:text-yellow-400":"bg-primary/10 text-primary"}`,children:le?"Retrying OAuth":"Starting"}),a.jsx("span",{className:"text-xs font-bold",children:U}),a.jsx("span",{className:"font-mono text-xs",children:Oe}),le&&(fe.requiredServers??[]).length>0&&a.jsxs("span",{className:"text-xs text-yellow-700 dark:text-yellow-400",children:["OAuth: ",fe.requiredServers.join(", ")]})]})},fe.jobId)}),q.map((fe,Oe)=>{const Ve=LS(fe.runParams.configPath,Ee),U=FS(fe.runParams.scenarioIds,Ze,fe.runParams.configPath),le=Re.get(fe.runParams.configPath)||U,W=fe.status==="blocked_auth";return a.jsxs("div",{className:`flex items-center justify-between rounded-md border p-2 text-sm ${W?"border-yellow-500/40 bg-yellow-500/5":""}`,children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-wrap",children:[W?a.jsxs("span",{className:"inline-flex items-center rounded-full bg-yellow-500/15 px-2 py-0.5 text-xs font-medium text-yellow-700 dark:text-yellow-400",children:["#",Oe+1," Blocked"]}):a.jsxs("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:["#",Oe+1," Queued"]}),a.jsx("span",{className:"text-xs font-bold",children:le}),a.jsx("span",{className:"font-mono text-xs",children:Ve}),W&&(fe.requiredServers??[]).length>0&&a.jsxs("span",{className:"text-xs text-yellow-700 dark:text-yellow-400",children:["OAuth: ",fe.requiredServers.join(", ")]}),!W&&fe.runParams.agents&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["agents: ",fe.runParams.agents.join(", ")]}),fe.runParams.runNote&&a.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["note: ",fe.runParams.runNote]})]}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[W&&a.jsx(Z,{size:"sm",variant:"outline",className:"h-7 text-xs border-yellow-500/50 text-yellow-700 dark:text-yellow-400 hover:bg-yellow-500/10",disabled:V,onClick:()=>{if(oe.current)return;const ye=fe.requiredServers??[];ye.length!==0&&(oe.current=!0,ue({jobId:fe.jobId,servers:ye}),ee(!0),Po({serverNames:ye,source:me,onServerAuthStart:ve=>{m(Ce=>[...Ce,`[${Gn()}] OAuth sign-in opened for '${ve}'...`])}}).then(()=>me.resumeQueue()).then(()=>{m(ve=>[...ve,`[${Gn()}] OAuth complete. Resuming run...`]),N(fe.jobId),ke(fe.jobId),i(!0),v(!1),vt(fe.jobId)}).catch(ve=>{const Ce=ve instanceof Error?ve.message:String(ve);m(_e=>[..._e,`[${Gn()}] OAuth error: ${Ce}`]),oe.current=!1}).finally(()=>{ee(!1)}))},children:V&&ae?.jobId===fe.jobId?"Connecting...":"Connect & Resume"}),a.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:()=>{kt(fe.jobId)},title:"Remove from queue",children:a.jsx(ca,{className:"h-4 w-4"})})]})]},fe.jobId)})]})})]}),x&&!o&&!p&&a.jsx(Qe,{className:"border-amber-300/60 bg-amber-50/40",children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx(Vd,{className:"h-5 w-5 text-amber-700"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium",children:"Run stopped"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"The evaluation was stopped before completion. You can start it again or clear the progress log."})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx(Z,{type:"button",variant:"outline",onClick:()=>{m([]),u(0),j(!1)},children:"Clear Progress"}),a.jsxs(Z,{type:"button",onClick:Zt,disabled:!t,children:[a.jsx(ks,{className:"mr-2 h-4 w-4"}),"Run Again"]})]})]})})}),p&&a.jsx(Qe,{className:"border-success/50",children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Va,{className:"h-6 w-6 text-success"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"Evaluation Complete"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"All scenarios have been evaluated successfully."})]}),a.jsx(Z,{asChild:!0,className:"ml-auto",children:a.jsx(Et,{to:At,children:it?"View Results":"View Runs"})})]})})})]})};function _U({title:e,description:t,expanded:n,onToggleExpanded:r,onHide:s,messages:o,pendingToolCalls:i,loading:c,input:u,onInputChange:f,onSend:m,onCancel:p,inputPlaceholder:v,snippets:x,snippetsLabel:j="Result Assistant Snippets",onSnippetSelect:y,onApproveToolCall:b,onDenyToolCall:S,chatEndRef:N,inputRef:C,renderMessage:k,renderMessageExtras:A,className:E="min-w-0 overflow-hidden xl:flex xl:h-full xl:min-h-0 xl:flex-col",contentClassName:P="flex h-[70vh] min-h-[520px] flex-col p-0 xl:h-auto xl:min-h-0 xl:flex-1"}){return a.jsxs(Qe,{className:E,children:[a.jsx($t,{className:"border-b px-4 py-3",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),e]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:r,children:[n?a.jsx(XS,{className:"h-3.5 w-3.5"}):a.jsx(QS,{className:"h-3.5 w-3.5"}),n?"Compact":"Expand"]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:s,children:"Hide"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:t})]})}),a.jsxs(Je,{className:P,children:[a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-muted/15 px-4 py-4",children:a.jsxs("div",{className:"space-y-3 pr-2",children:[o.map((T,$)=>{const Y=T.role==="user",H=T.role==="assistant",F=T.role==="system",X=T.role==="tool",L=T.pendingToolCallId?i.find(M=>M.id===T.pendingToolCallId):void 0;return k?k({message:T,index:$,linkedPendingToolCall:L,isUser:Y,isAssistant:H,isSystem:F,isTool:X}):H&&!!T.pendingToolCallId?a.jsxs("div",{className:"rounded-md border bg-background p-3",children:[a.jsx(Ga,{text:T.text,className:"text-sm"}),L&&a.jsx(HN,{call:L,loading:c,onApprove:b,onDeny:S,className:"mt-3"})]},`${T.id??`${T.role}-${$}`}-tool`):a.jsx(M8,{message:T},T.id??`${T.role}-${$}`)}),A,c&&a.jsx(I8,{}),a.jsx("div",{ref:N})]})}),a.jsx("div",{className:"border-t bg-background px-4 py-3",children:a.jsx($8,{input:u,onInputChange:f,onSend:m,onCancel:p,inputPlaceholder:v,snippets:x,snippetsLabel:j,onSnippetSelect:y,loading:c,inputRef:C})})]})]})}function aa(e,t){if(!Number.isFinite(e)||e<=0)return"0ms";if(e<1e3)return`${Math.round(e)}ms`;if(t?.preciseUnderTenSeconds&&e<1e4){const i=e/1e3,c=Math.round(i*10)/10;return`${Number.isInteger(c)?c.toFixed(0):c.toFixed(1)}s`}const n=Math.floor(e/1e3),r=Math.floor(n/3600),s=Math.floor(n%3600/60),o=n%60;return r>0?`${r}h ${s}m ${o}s`:s>0?`${s}m ${o}s`:`${o}s`}function nC(e){return e.runs.length>0?e.runs.reduce((t,n)=>t+n.duration,0):e.avgDuration}function Ig(e){return e.scenarios.some(n=>n.runs.length>0)?e.scenarios.reduce((n,r)=>n+nC(r),0):typeof e.totalDurationMs=="number"&&e.totalDurationMs>=0?e.totalDurationMs:null}function rC(e){return e.runs.length>0?e.runs.reduce((t,n)=>t+n.toolCalls.reduce((r,s)=>r+s.duration,0),0):0}function $g(e){return e.scenarios.some(n=>n.runs.length>0)?e.scenarios.reduce((n,r)=>n+rC(r),0):typeof e.totalToolDurationMs=="number"&&e.totalToolDurationMs>=0?e.totalToolDurationMs:null}const MD="hsl(152, 69%, 40%)",ID="hsl(0, 72%, 51%)",$D="hsl(215, 16%, 47%)";function wo(e,t=0){return e.toLocaleString(void 0,{maximumFractionDigits:t,minimumFractionDigits:t})}function Dg({title:e,passed:t,failed:n,notEvaluated:r=0}){const s=[{name:"Passed",value:t,color:MD},{name:"Failed",value:n,color:ID},...r>0?[{name:"Not evaluated",value:r,color:$D}]:[]];return a.jsxs(Qe,{children:[a.jsx($t,{className:"p-2.5 pb-0",children:a.jsx(Dt,{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:e})}),a.jsxs(Je,{className:"flex h-[92px] items-center justify-center gap-2 p-0",children:[a.jsx("div",{className:"h-[82px] w-[82px] shrink-0",children:a.jsx(hf,{width:"100%",height:"100%",children:a.jsxs(ige,{children:[a.jsx(Wo,{data:s,dataKey:"value",nameKey:"name",innerRadius:"55%",outerRadius:"78%",paddingAngle:3,children:s.map(o=>a.jsx(Sv,{fill:o.color},o.name))}),a.jsx(ra,{})]})})}),a.jsxs("div",{className:"space-y-0.5 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:MD}}),wo(t)," passed"]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:ID}}),wo(n)," failed"]}),r>0&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:$D}}),wo(r)," not evaluated"]})]})]})]})}function Z0e({runs:e,loading:t}){const n=h.useMemo(()=>{const r=e.reduce((v,x)=>v+Math.max(0,x.totalRuns),0),s=e.reduce((v,x)=>v+Math.round(Math.max(0,x.totalRuns)*x.overallPassRate),0),o=Math.max(0,r-s),i=e.reduce((v,x)=>v+Math.max(0,x.totalScenarios),0),c=e.reduce((v,x)=>(v.passed+=x.checkCounts?.passed??0,v.failed+=x.checkCounts?.failed??0,v.not_evaluated+=x.checkCounts?.not_evaluated??0,v.total+=x.checkCounts?.total??0,v),{passed:0,failed:0,not_evaluated:0,total:0}),u=v=>r===0?0:e.reduce((x,j)=>x+v(j)*Math.max(0,j.totalRuns),0)/r,f=e.reduce((v,x)=>v+(x.toolTokenUsage?.totalTokens??0),0),m=e.reduce((v,x)=>v+(x.totalDurationMs??0),0),p=e.reduce((v,x)=>v+(x.totalToolDurationMs??0),0);return{totalRuns:r,passedRuns:s,failedRuns:o,checkCounts:c,totalScenarios:i,passRate:r===0?0:s/r,avgToolCalls:u(v=>v.avgToolCalls),avgLatency:u(v=>v.avgLatency),totalTokens:f,totalDurationMs:m,totalToolDurationMs:p}},[e]);return t?a.jsx(Qe,{children:a.jsx(Je,{className:"p-6 text-sm text-muted-foreground",children:"Calculating dashboard…"})}):e.length===0?a.jsx(Qe,{children:a.jsx(Je,{className:"p-6 text-sm text-muted-foreground",children:"No results in the selected range."})}):a.jsx("div",{className:"space-y-2","data-testid":"results-dashboard",children:a.jsxs("div",{className:"grid gap-3 lg:grid-cols-4",children:[a.jsx(Dg,{title:"Runs Pass / Fail",passed:n.passedRuns,failed:n.failedRuns}),a.jsx(Dg,{title:"Checks Pass / Fail",passed:n.checkCounts.passed,failed:n.checkCounts.failed,notEvaluated:n.checkCounts.not_evaluated}),a.jsxs("div",{className:"grid self-start content-start gap-3 sm:grid-cols-2 lg:col-span-2 lg:grid-cols-4",children:[a.jsx(nr,{compact:!0,title:"Scenarios",value:wo(n.totalScenarios),icon:gm}),a.jsx(nr,{compact:!0,title:"Total Runs",value:wo(n.totalRuns),icon:hC}),a.jsx(nr,{compact:!0,title:"Pass Rate",value:`${wo(n.passRate*100,1)}%`,icon:bl}),a.jsx(nr,{compact:!0,title:"Avg Tool Calls",value:wo(n.avgToolCalls,1),icon:Va}),a.jsx(nr,{compact:!0,title:"Avg Latency",value:`${wo(n.avgLatency)}ms`,icon:bC}),a.jsx(nr,{compact:!0,title:"Tool Tokens",value:wo(n.totalTokens),icon:Ua}),n.totalDurationMs>0?a.jsx(nr,{compact:!0,title:"Total Time",value:aa(n.totalDurationMs),icon:Ea}):null,n.totalToolDurationMs>0?a.jsx(nr,{compact:!0,title:"Tool Duration",value:aa(n.totalToolDurationMs),icon:Ea}):null]})]})})}function Ld(e){return e instanceof GC&&e.status===404}function kU(e){const{source:t,open:n,scope:r,runId:s,onSessionSync:o}=e,[i,c]=h.useState(null),[u,f]=h.useState([]),[m,p]=h.useState([]),[v,x]=h.useState(""),[j,y]=h.useState(!1),[b,S]=h.useState(!1),N=h.useRef(null),C=h.useRef(null),k=h.useRef(0),A=h.useRef(t),E=h.useRef(o),P=h.useRef(null),T=h.useRef(null);h.useEffect(()=>{N.current=i},[i]),h.useEffect(()=>{A.current=t},[t]),h.useEffect(()=>{E.current=o},[o]);const $=h.useCallback(()=>{const O=C.current;O&&O.controller.abort()},[]),Y=h.useCallback((O,Q)=>{c(Q??O.id),f(B=>B.length>O.messages.length?B:O.messages),p(O.pendingToolCalls),E.current?.(O)},[]),H=h.useCallback(async(O,Q)=>{const B=Q.session.id||O;Y(Q.session,B)},[Y]),F=h.useCallback(()=>{const O=C.current;O&&($(),x(O.prompt),y(!1),S(!1))},[$]),X=h.useCallback(async()=>{const O=v.trim();if(!O||r==="run"&&!s)return;const Q=++k.current,B=new AbortController,z=`msg-local-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,V={id:z,role:"user",text:O,createdAt:new Date().toISOString()};C.current={id:Q,controller:B,prompt:O},S(!0),x(""),f(ee=>[...ee,V]),y(!0);try{let ee=i;if(!ee){const ae=r==="run"&&s?await t.createResultAssistantSession({runId:s,scope:"run"},B.signal):await t.createResultAssistantSession({scope:"all_runs"},B.signal);if(B.signal.aborted||C.current?.id!==Q)return;ee=ae.sessionId||ae.session.id,Y(ae.session,ee),f(ue=>ue.some(xe=>xe.id===z)?[...ae.session.messages,V]:ae.session.messages)}try{const ae=await t.sendResultAssistantMessage(ee,O,B.signal);if(B.signal.aborted||C.current?.id!==Q)return;await H(ee,ae)}catch(ae){if(VN(ae)||B.signal.aborted||C.current?.id!==Q)return;if(!Ld(ae))throw ae;const ue=r==="run"&&s?await t.createResultAssistantSession({runId:s,scope:"run"},B.signal):await t.createResultAssistantSession({scope:"all_runs"},B.signal);if(B.signal.aborted||C.current?.id!==Q)return;const se=ue.sessionId||ue.session.id;if(Y(ue.session,se),f(oe=>oe.some(De=>De.id===z)?[...ue.session.messages,V]:ue.session.messages),B.signal.aborted||C.current?.id!==Q)return;const xe=await t.sendResultAssistantMessage(se,O,B.signal);if(B.signal.aborted||C.current?.id!==Q)return;await H(se,xe)}}catch(ee){if(VN(ee)||B.signal.aborted||C.current?.id!==Q)return;f(ae=>ae.filter(ue=>ue.id!==z)),$e({title:"MCP Lab Assistant error",description:ee instanceof Error?ee.message:String(ee),variant:"destructive"})}finally{C.current?.id===Q&&(C.current=null,y(!1),S(!1))}},[v,r,s,i,t,Y,H]),L=h.useCallback(async O=>{if(i){S(!1),y(!0);try{const Q=await t.approveResultAssistantToolCall(i,O);await H(i,Q)}catch(Q){Ld(Q)&&(c(null),p([])),$e({title:"Could not approve assistant action",description:Ld(Q)?"Assistant session expired. Ask a new question to start a fresh session.":Q instanceof Error?Q.message:String(Q),variant:"destructive"})}finally{y(!1)}}},[i,t,H]),I=h.useCallback(async O=>{if(i){S(!1),y(!0);try{const Q=await t.denyResultAssistantToolCall(i,O);await H(i,Q)}catch(Q){Ld(Q)&&(c(null),p([])),$e({title:"Could not deny assistant action",description:Ld(Q)?"Assistant session expired. Ask a new question to start a fresh session.":Q instanceof Error?Q.message:String(Q),variant:"destructive"})}finally{y(!1)}}},[i,t,H]),M=h.useCallback(()=>{$();const O=N.current;O&&t.closeResultAssistantSession(O).catch(()=>{}),N.current=null,c(null),f([]),p([]),x(""),S(!1)},[$,t]),q=h.useCallback(O=>{f(Q=>Q.length>0?Q:[{id:`msg-${Date.now()}`,role:"assistant",text:O,createdAt:new Date().toISOString()}])},[]),G=h.useCallback(O=>{x(O),requestAnimationFrame(()=>T.current?.focus())},[]);return h.useEffect(()=>{if(!n)return;const O=window.setTimeout(()=>{P.current?.scrollIntoView({behavior:"smooth",block:"end"})},0);return()=>window.clearTimeout(O)},[n,u.length,j]),h.useEffect(()=>{const O=T.current;if(!O)return;O.style.height="0px";const Q=Math.min(O.scrollHeight,160);O.style.height=`${Math.max(40,Q)}px`},[v,n]),h.useEffect(()=>{if(!(!n||!i))return A.current.subscribeResultAssistantSessionEvents(i,O=>{Y(O.payload.session,O.payload.sessionId)})},[n,i,Y]),h.useEffect(()=>()=>{$();const O=N.current;O&&A.current.closeResultAssistantSession(O).catch(()=>{})},[$]),{assistantSessionId:i,assistantMessages:u,assistantPendingToolCalls:m,assistantInput:v,assistantLoading:j,assistantTurnCancelable:b,cancelAssistantTurn:F,assistantChatEndRef:P,assistantInputRef:T,setAssistantInput:x,setAssistantMessages:f,askAssistant:X,approveResultAssistantToolCall:L,denyResultAssistantToolCall:I,applyResultAssistantSnippet:G,ensureIntroMessage:q,resetAssistantSession:M}}function mm(e){const t=String(e??"").trim();return t&&(t.split("::").pop()??t).replace(/^mcplab__/,"").replace(/^mcplab_/,"").replace(/_/g," ").replace(/\s+/g," ").trim()||"unknown_tool"}async function AU(e,t){const n=t.configPath?.trim();if(!n)throw new Error("This run has no config path in metadata.");const s=await e.getResult(t.id)??t,o=s.rerunAgents&&s.rerunAgents.length>0?s.rerunAgents:Array.from(new Set(s.scenarios.map(i=>i.agentId).filter(Boolean)));await e.startRun({configPath:n,runsPerScenario:1,scenarioIds:s.rerunScenarioIds,agents:o.length>0?o:void 0,runNote:s.runNote,serverOverrideAll:s.rerunServerOverrideAll,scenarioServerOverrides:s.rerunScenarioServerOverrides})}const qa=[{value:"15min",label:"Last 15min",durationMs:900*1e3},{value:"30min",label:"Last 30min",durationMs:1800*1e3},{value:"1h",label:"Last hour",durationMs:3600*1e3},{value:"2h",label:"Last 2 hours",durationMs:7200*1e3},{value:"4h",label:"Last 4 hours",durationMs:14400*1e3},{value:"8h",label:"Last 8 hours",durationMs:480*60*1e3},{value:"24h",label:"Last 24 hours",durationMs:1440*60*1e3},{value:"7d",label:"Last 7 days",durationMs:10080*60*1e3},{value:"14d",label:"Last 14 days",durationMs:336*60*60*1e3},{value:"30d",label:"Last 30 days",durationMs:720*60*60*1e3}];function EU(e){return e==="all"||e==="last"||e==="custom"}function PU(e){return e==="15min"||e==="30min"||e==="1h"||e==="2h"||e==="4h"||e==="8h"||e==="24h"||e==="7d"||e==="14d"||e==="30d"}function aC(e){const t=e.get("time_filter"),n=e.get("time_preset");return{mode:EU(t)?t:"all",preset:PU(n)?n:"15min",start:e.get("time_start")??"",end:e.get("time_end")??""}}const DD=8,sC="mcplab:results:time-filter",RU="mcplab:results:dashboard-visible";function Dl(e){if(!e.trim())return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function BS(e,t,n,r){if(e==="all")return{};if(e==="last"){const i=qa.find(f=>f.value===t)??qa[0],c=new Date(Date.now());return{since:new Date(c.getTime()-i.durationMs).toISOString(),until:c.toISOString()}}const s=Dl(n),o=Dl(r);return s&&o?s.getTime()<=o.getTime()?{since:s.toISOString(),until:o.toISOString()}:{since:o.toISOString(),until:s.toISOString()}:s?{since:s.toISOString()}:o?{until:o.toISOString()}:{}}function tm(e){const t=Dl(e);return t?t.toLocaleString():""}function ewe(e){const t=Dl(e);if(!t)return e;const n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0");return`${n}-${r}-${s}`}function twe(e){const t=Dl(e);return t?t.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):"Unknown day"}function nwe(e){return e.has("time_filter")||e.has("time_preset")||e.has("time_start")||e.has("time_end")}function rwe(){try{const e=localStorage.getItem(sC);if(!e)return null;const t=JSON.parse(e),n=EU(typeof t.mode=="string"?t.mode:null)?t.mode:"all",r=PU(typeof t.preset=="string"?t.preset:null)?t.preset:"15min";return{mode:n,preset:r,start:typeof t.start=="string"?t.start:"",end:typeof t.end=="string"?t.end:""}}catch{return null}}function awe(){try{const e=localStorage.getItem(RU);return e===null?!0:e==="true"}catch{return!0}}const swe=[{label:"Summarize Run Trends",description:"Highlight the main changes across the selected runs.",prompt:"Summarize the main trends across these runs. Call out pass-rate changes, latency, and tool usage shifts."},{label:"Explain Failures",description:"Identify the most important failures and likely root causes.",prompt:"Identify the most important failures across these runs and explain likely root causes from the traces."},{label:"Compare Agents",description:"Compare agent behavior, tool use, and answer quality across runs.",prompt:"Compare agent behavior across these runs. Highlight differences in tool use, answer quality, and consistency."},{label:"Spot Anomalies",description:"Find outliers in latency, tool calls, or pass rate.",prompt:"Find unusual runs or outliers in latency, tool calls, or pass rate, and explain why they stand out."}],Fd=100,owe=()=>{const[e,t]=zo(),{source:n}=$n(),[r]=h.useState(()=>nwe(e)?aC(e):rwe()??aC(e)),[s,o]=h.useState([]),[i,c]=h.useState([]),u=h.useRef(0),[f,m]=h.useState(!0),[p,v]=h.useState(awe),[x,j]=h.useState(!1),[y,b]=h.useState(null),[S,N]=h.useState(!1),[C,k]=h.useState("timestamp"),[A,E]=h.useState("desc"),[P,T]=h.useState("all"),[$,Y]=h.useState(!1),[H,F]=h.useState(r.mode),[X,L]=h.useState(r.preset),[I,M]=h.useState(r.start),[q,G]=h.useState(r.end),[O,Q]=h.useState(!1),[B,z]=h.useState(!1),[V,ee]=h.useState(!1),{completionVersion:ae}=QL(),ue=hx(Fd),{offset:se,totalCount:xe,hasMore:oe}=ue,[de,De]=h.useState(null),me=P==="all"?void 0:P,ge=W=>{if(C===W){E(ye=>ye==="asc"?"desc":"asc");return}k(W),E(W==="timestamp"?"desc":"asc")},we=h.useCallback(async()=>{if(!p||!n.listRunSummaries)return;const W=++u.current;m(!0);try{const ye=await n.listRunSummaries({...BS(H,X,I,q),scenario:me});u.current===W&&c(ye.map(vi))}catch{u.current===W&&c([])}finally{u.current===W&&m(!1)}},[me,p,n,q,H,X,I]),at=async()=>{j(!0);try{const W=BS(H,X,I,q);if(n.listRunSummariesPage){const ye=await n.listRunSummariesPage({...W,scenario:me,limit:Fd,offset:se});ue.updateMeta(ye),o(ye.data.map(vi))}else if(n.listRunSummaries){const ye=await n.listRunSummaries({...W,scenario:me,limit:Fd,offset:se});ue.setTotalCount(ye.length),ue.setHasMore(!1),o(ye.map(vi))}else ue.setTotalCount(0),ue.setHasMore(!1),o(await n.listResults());we()}catch(W){$e({title:"Could not load results",description:W instanceof Error?W.message:String(W),variant:"destructive"})}finally{j(!1)}};h.useEffect(()=>{let W=!0;j(!0);const ye=BS(H,X,I,q);return(n.listRunSummariesPage?n.listRunSummariesPage({...ye,scenario:me,limit:Fd,offset:se}).then(Ce=>(W&&ue.updateMeta(Ce),Ce.data.map(vi))):n.listRunSummaries?n.listRunSummaries({...ye,scenario:me,limit:Fd,offset:se}).then(Ce=>(W&&(ue.setTotalCount(Ce.length),ue.setHasMore(!1)),Ce.map(vi))):n.listResults()).then(Ce=>{W&&o(Ce)}).catch(Ce=>{W&&$e({title:"Could not load results",description:Ce instanceof Error?Ce.message:String(Ce),variant:"destructive"})}).finally(()=>{W&&j(!1)}),()=>{W=!1}},[me,ae,se,n,q,H,X,I]),h.useEffect(()=>{try{localStorage.setItem(RU,String(p))}catch{}},[p]),h.useEffect(()=>{we()},[ae,we]),h.useEffect(()=>{if(!(p&&n.listRunSummaries)){if(!p){m(!1);return}c(s),m(!1)}},[p,s,n]);const{assistantMessages:tt,assistantPendingToolCalls:it,assistantInput:At,assistantLoading:Ge,assistantTurnCancelable:Ee,cancelAssistantTurn:Re,assistantChatEndRef:Ze,assistantInputRef:ht,setAssistantInput:Ft,askAssistant:zt,approveResultAssistantToolCall:jt,denyResultAssistantToolCall:rn,applyResultAssistantSnippet:an,ensureIntroMessage:qt}=kU({source:n,open:B,scope:"all_runs"}),Zt=h.useMemo(()=>{const W=new Map;return s.forEach(ye=>{ye.scenarios.forEach(ve=>{const Ce=String(ve.scenarioName??"").trim(),_e=String(ve.scenarioId??"").trim();if(_e){W.set(_e,Ce||_e);return}Ce&&W.set(Ce,Ce)})}),Array.from(W.entries()).map(([ye,ve])=>({value:ye,label:ve})).sort((ye,ve)=>ye.label.localeCompare(ve.label))},[s]);h.useEffect(()=>{const W=(e.get("scenario")??"").trim();if(W){if(Zt.some(ye=>ye.value===W||ye.label===W)){T(W);return}s.length>0&&T("all")}},[e,Zt,s.length]),h.useEffect(()=>{const W=new URLSearchParams(e);H==="all"?(W.delete("time_filter"),W.delete("time_preset"),W.delete("time_start"),W.delete("time_end")):H==="last"?(W.set("time_filter","last"),W.set("time_preset",X),W.delete("time_start"),W.delete("time_end")):(W.set("time_filter","custom"),W.delete("time_preset"),I.trim()?W.set("time_start",I.trim()):W.delete("time_start"),q.trim()?W.set("time_end",q.trim()):W.delete("time_end")),W.toString()!==e.toString()&&t(W,{replace:!0})},[e,t,q,H,X,I]),h.useEffect(()=>{try{if(H==="all"){localStorage.removeItem(sC);return}const W={mode:H,preset:X,start:I,end:q};localStorage.setItem(sC,JSON.stringify(W))}catch{}},[q,H,X,I]);const sn=h.useMemo(()=>{if(n.listRunSummariesPage)return s;const W=P==="all"?s:s.filter(pe=>pe.scenarios.some(Ae=>{const Ke=String(Ae.scenarioName??"").trim(),te=String(Ae.scenarioId??"").trim();return Ke===P||te===P}));if(H==="all")return W;const ye=Date.now();if(H==="last"){const pe=qa.find(Ke=>Ke.value===X)??qa[0],Ae=ye-pe.durationMs;return W.filter(Ke=>{const te=new Date(Ke.timestamp).getTime();return te>=Ae&&te<=ye})}const ve=Dl(I)?.getTime()??null,Ce=Dl(q)?.getTime()??null,_e=ve!==null&&Ce!==null?Math.min(ve,Ce):ve??null,K=ve!==null&&Ce!==null?Math.max(ve,Ce):Ce??null;return W.filter(pe=>{const Ae=new Date(pe.timestamp).getTime();return!(Number.isNaN(Ae)||_e!==null&&Ae<_e||K!==null&&Ae>K)})},[s,P,n.listRunSummariesPage,q,H,X,I]);h.useEffect(()=>{ue.reset()},[me,ue.reset,q,H,X,I]);const ln=h.useMemo(()=>P==="all"?"All scenarios":Zt.find(ye=>ye.value===P||ye.label===P)?.label??P,[P,Zt]),ke=h.useMemo(()=>{if(H==="all")return"All time";if(H==="last")return qa.find(ve=>ve.value===X)?.label??"Last range";const W=!!I.trim(),ye=!!q.trim();return!W&&!ye?"Custom range":W&&ye?`${tm(I)} - ${tm(q)}`:W?`From ${tm(I)}`:`Until ${tm(q)}`},[q,H,X,I]),ze=h.useMemo(()=>{const W=(ve,Ce)=>ve===null&&Ce===null?0:ve===null?1:Ce===null?-1:A==="asc"?ve-Ce:Ce-ve;return[...sn].sort((ve,Ce)=>{if(C==="toolTokens")return W(ve.toolTokenUsage?.totalTokens??null,Ce.toolTokenUsage?.totalTokens??null);let _e=0;return C==="id"&&(_e=ve.id.localeCompare(Ce.id)),C==="timestamp"&&(_e=new Date(ve.timestamp).getTime()-new Date(Ce.timestamp).getTime()),C==="passRate"&&(_e=ve.overallPassRate-Ce.overallPassRate),C==="scenarios"&&(_e=ve.totalScenarios-Ce.totalScenarios),C==="avgToolCalls"&&(_e=ve.avgToolCalls-Ce.avgToolCalls),A==="asc"?_e:-_e})},[sn,C,A]),Xe=h.useMemo(()=>{const W=[];let ye=null;for(const ve of ze){const Ce=ewe(ve.timestamp);Ce!==ye&&(W.push({type:"day-separator",dayKey:Ce,dayLabel:twe(ve.timestamp)}),ye=Ce),W.push({type:"run",run:ve})}return W},[ze]),kt=W=>C!==W?a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"}):A==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}),vt=W=>{const ye=W.toolTokenUsage?.totalTokens;return typeof ye=="number"?ye.toLocaleString():"n/a"},fe=()=>{F("all"),L("15min"),M(""),G("")},Oe=h.useMemo(()=>{const W=new Map;for(const ye of ze){if(ye.scenarios.length>0){W.set(ye.id,G_(ye));continue}const ve=ye.configName?.trim()||"",Ce=ye.configPath?.trim()||"",_e=ve&&Ce?`${ve} · ${Ce}`:ve||Ce;W.set(ye.id,{scenarioCount:ye.totalScenarios,agentCount:0,scopePreview:_e||"n/a",modelSummary:""})}return W},[ze]),Ve=()=>{z(!0),qt("Ask me to compare runs, explain regressions over time, or summarize historical drift patterns.")},U=async W=>{N(!0);try{await n.deleteResult(W),o(ye=>ye.filter(ve=>ve.id!==W)),c(ye=>ye.filter(ve=>ve.id!==W)),ue.setTotalCount(ye=>Math.max(0,ye-1)),$e({title:"Run deleted",description:W}),b(null)}catch(ye){$e({title:"Could not delete run",description:ye instanceof Error?ye.message:String(ye),variant:"destructive"})}finally{N(!1)}},le=async W=>{if(!W.configPath?.trim()){$e({title:"Cannot rerun",description:"This run has no config path in metadata.",variant:"destructive"});return}De(W.id);try{await AU(n,W),$e({title:"Rerun queued",description:`${W.id} queued with previous run settings.`})}catch(ve){$e({title:"Could not rerun",description:ve instanceof Error?ve.message:String(ve),variant:"destructive"})}finally{De(ve=>ve===W.id?null:ve)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsx(Os,{open:y!==null,onOpenChange:W=>{!W&&!S&&b(null)},children:a.jsxs(Za,{children:[a.jsxs(es,{children:[a.jsx(ns,{children:"Delete run?"}),a.jsxs(rs,{children:["This will permanently remove the run artifacts from disk for"," ",a.jsx("span",{className:"font-mono",children:y??""}),"."]})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:S,children:"Cancel"}),a.jsx(as,{disabled:S||!y,onClick:W=>{W.preventDefault(),y&&U(y)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:S?"Deleting...":"Delete run"})]})]})}),a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(bl,{className:"h-6 w-6"}),"Results"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse evaluation runs and open detailed results"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(wi,{open:$,onOpenChange:Y,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":$,"aria-controls":"results-scenario-command-list",className:`w-[260px] justify-between font-normal ${P!=="all"?"border-primary/40":""}`,children:[a.jsx("span",{className:"truncate text-left",children:ln}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(Ro,{className:"w-[260px] p-0",align:"start",children:a.jsxs(Tl,{children:[a.jsx(Ol,{placeholder:"Search scenarios..."}),a.jsxs(Ml,{id:"results-scenario-command-list",children:[a.jsx(Il,{children:"No scenarios found."}),a.jsxs($l,{children:[a.jsx(Na,{value:"all scenarios",onSelect:()=>{T("all"),Y(!1)},children:"All scenarios"}),Zt.map(W=>a.jsx(Na,{value:`${W.label} ${W.value}`,onSelect:()=>{T(W.value),Y(!1)},children:W.label},W.value))]})]})]})})]}),a.jsxs(wi,{open:O,onOpenChange:Q,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":O,"aria-controls":"results-time-command-list",className:`w-[320px] justify-between font-normal ${H!=="all"?"border-primary/40":""}`,children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate text-left",children:[a.jsx(w5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:ke})]}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(Ro,{className:"w-[360px] p-0",align:"start",children:[a.jsxs("div",{className:"border-b px-3 py-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Date and time filter"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Filter runs by timestamp."})]}),a.jsxs("div",{id:"results-time-command-list",className:"grid gap-1 p-2",children:[a.jsx(Z,{type:"button",variant:H==="all"?"secondary":"ghost",className:"justify-start",onClick:()=>{fe(),Q(!1)},children:"All time"}),qa.map(W=>a.jsx(Z,{type:"button",variant:H==="last"&&X===W.value?"secondary":"ghost",className:"justify-start",onClick:()=>{F("last"),L(W.value),Q(!1)},children:W.label},W.value)),a.jsx(Z,{type:"button",variant:H==="custom"?"secondary":"ghost",className:"justify-start",onClick:()=>F("custom"),children:"Custom date time range"})]}),H==="custom"&&a.jsxs("div",{className:"space-y-3 border-t p-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{htmlFor:"results-time-filter-start",children:"Start"}),a.jsx(_t,{id:"results-time-filter-start",type:"datetime-local",value:I,onChange:W=>M(W.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{htmlFor:"results-time-filter-end",children:"End"}),a.jsx(_t,{id:"results-time-filter-end",type:"datetime-local",value:q,onChange:W=>G(W.target.value)})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"px-2",onClick:fe,children:[a.jsx(ca,{className:"mr-1.5 h-3.5 w-3.5"}),"Clear"]}),a.jsx(Z,{type:"button",size:"sm",onClick:()=>Q(!1),children:"Done"})]})]})]})]}),a.jsx(Z,{variant:"outline",onClick:()=>{at()},disabled:x,children:x?"Refreshing...":"Refresh"}),a.jsx(Z,{variant:"outline",onClick:ue.prev,disabled:x||se===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:ue.next,disabled:x||!oe,children:"Next"}),a.jsxs(Z,{type:"button",variant:"outline",className:"gap-1.5",onClick:Ve,children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"MCP Lab Assistant"]})]})]}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:ue.rangeLabel(s.length)}),a.jsxs(Z,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs text-muted-foreground",onClick:()=>v(W=>!W),"aria-pressed":p,children:[a.jsx(gC,{className:"h-3 w-3"}),p?"Hide dashboard":"Show dashboard"]})]}),p?a.jsx("div",{className:"mt-2",children:a.jsx(Z0e,{runs:i,loading:f})}):null,a.jsxs("div",{className:`mt-4 grid gap-6 ${B?V?"xl:grid-cols-[minmax(0,1fr)_52rem]":"xl:grid-cols-[minmax(0,1fr)_30rem]":"grid-cols-1"}`,children:[a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(oa,{className:"table-fixed",children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-[22.5rem] max-w-[22.5rem]",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("id"),children:["Run ID",kt("id")]})}),a.jsx(ct,{className:"min-w-0",children:"Evaluation"}),a.jsx(ct,{className:"w-[11rem] min-w-[11rem] max-w-[11rem]",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("timestamp"),children:["Timestamp",kt("timestamp")]})}),a.jsx(ct,{className:"w-[7.5rem] min-w-[7.5rem] max-w-[7.5rem] text-center",children:a.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-end gap-1 hover:text-foreground",onClick:()=>ge("passRate"),children:["Pass Rate",kt("passRate")]})}),a.jsx(ct,{className:"w-[5.5rem] min-w-[5.5rem] max-w-[5.5rem] text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("scenarios"),children:["Scenarios",kt("scenarios")]})}),a.jsx(ct,{className:"w-[7.5rem] min-w-[7.5rem] max-w-[7.5rem] text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("avgToolCalls"),children:["Avg Tools",kt("avgToolCalls")]})}),a.jsx(ct,{className:"w-[9rem] min-w-[9rem] max-w-[9rem] text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("toolTokens"),children:["Tool Tokens",kt("toolTokens")]})}),a.jsx(ct,{className:"w-[9rem] min-w-[9rem] max-w-[9rem]"})]})}),a.jsx(la,{children:Xe.length===0?a.jsx(Wt,{children:a.jsx(qe,{colSpan:DD,className:"px-4 py-10 text-center text-sm text-muted-foreground",children:H==="all"&&P==="all"?"No runs yet.":"No runs match current filters."})}):Xe.map((W,ye)=>W.type==="day-separator"?a.jsx(Wt,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(qe,{colSpan:DD,className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border/70"}),a.jsx("span",{className:"shrink-0 rounded-full border border-border bg-background px-2.5 py-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:W.dayLabel}),a.jsx("div",{className:"h-px flex-1 bg-border/70"})]})})},`day-${W.dayKey}-${ye}`):a.jsxs(Wt,{children:[a.jsx(qe,{className:"w-[22.5rem] max-w-[22.5rem]",children:a.jsxs("div",{className:"space-y-1",children:[a.jsx(Et,{to:`/results/${W.run.id}`,className:"font-mono text-xs text-primary hover:underline",children:W.run.id}),a.jsx("div",{className:"min-w-0 truncate font-mono text-xs text-foreground/80",title:Oe.get(W.run.id)?.scopePreview??"n/a",children:Oe.get(W.run.id)?.scopePreview??"n/a"}),W.run.runNote?a.jsxs("div",{className:"text-[11px] text-muted-foreground break-words",children:["Note: ",W.run.runNote]}):null]})}),a.jsx(qe,{className:"min-w-0 text-[11px] text-muted-foreground",children:(()=>{const ve=Oe.get(W.run.id)??{scenarioCount:0,agentCount:0,modelSummary:""};return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 items-baseline gap-1.5",children:[a.jsxs("span",{className:"shrink-0 whitespace-nowrap",children:[ve.scenarioCount," scenario",ve.scenarioCount===1?"":"s"," · ",ve.agentCount," ","agent",ve.agentCount===1?"":"s"]}),ve.modelSummary?a.jsxs("span",{className:"min-w-0 truncate",title:ve.modelSummary,children:["· ",ve.modelSummary]}):null]}),a.jsx(Su,{versions:W.run.mcpServerVersions,showPrefix:!1,className:"max-w-[18rem]"})]})})()}),a.jsx(qe,{className:"w-[11rem] min-w-[11rem] max-w-[11rem] text-xs text-muted-foreground",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(W.run.timestamp).toLocaleString()]}),(()=>{const ve=Ig(W.run);return ve===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Total time: ",aa(ve)]})})()]})}),a.jsx(qe,{className:"w-[7.5rem] min-w-[7.5rem] max-w-[7.5rem] text-right",children:a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Ws,{rate:W.run.overallPassRate}),W.run.checkCounts&&W.run.checkCounts.total>0?a.jsxs("span",{className:"font-mono text-[11px] leading-none","aria-label":`${W.run.checkCounts.passed} checks passed, ${W.run.checkCounts.failed} checks failed`,title:`${W.run.checkCounts.passed} passed · ${W.run.checkCounts.failed} failed${W.run.checkCounts.not_evaluated>0?` · ${W.run.checkCounts.not_evaluated} not evaluated`:""}`,children:[a.jsxs("span",{className:"text-success",children:[W.run.checkCounts.passed," ✓"]}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{className:"text-destructive",children:[W.run.checkCounts.failed," ✕"]})]}):null,a.jsx(e4,{run:W.run})]})}),a.jsx(qe,{className:"w-[5.5rem] min-w-[5.5rem] max-w-[5.5rem] text-right font-mono text-sm",children:W.run.totalScenarios}),a.jsx(qe,{className:"w-[7.5rem] min-w-[7.5rem] max-w-[7.5rem] text-center font-mono text-sm",children:W.run.avgToolCalls.toFixed(0)}),a.jsx(qe,{className:"w-[9rem] min-w-[9rem] max-w-[9rem] text-right",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"font-mono text-sm",children:vt(W.run)}),(()=>{const ve=$g(W.run);return ve===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Tool time: ",aa(ve)]})})()]})}),a.jsx(qe,{className:"w-[9rem] min-w-[9rem] max-w-[9rem]",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs(Z,{size:"sm",variant:"outline",disabled:de===W.run.id,onClick:()=>{le(W.run)},children:[a.jsx(ks,{className:"mr-1.5 h-3.5 w-3.5"}),de===W.run.id?"Queueing...":"Rerun"]}),a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"More actions",children:a.jsx(Bg,{className:"h-4 w-4"})})}),a.jsxs(Bu,{align:"end",children:[a.jsx(Mr,{asChild:!0,children:a.jsxs(Et,{to:`/results/${W.run.id}`,children:[a.jsx(S5,{className:"mr-2 h-3.5 w-3.5"}),"View"]})}),Object.entries(W.run.langsmithTraceUrls??{}).map(([ve,Ce])=>a.jsx(Mr,{asChild:!0,children:a.jsxs("a",{href:Ce,target:"_blank",rel:"noreferrer",children:[a.jsx(Vc,{className:"mr-2 h-3.5 w-3.5"}),"LangSmith trace"]})},ve)),a.jsxs(Mr,{children:[a.jsx(zr,{className:"mr-2 h-3.5 w-3.5"}),"Export JSON"]}),a.jsxs(Mr,{className:"text-destructive",onSelect:ve=>{ve.preventDefault();const Ce=document.activeElement;Ce instanceof HTMLElement&&Ce.blur(),b(W.run.id)},children:[a.jsx(Xa,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]})]})})]},W.run.id))})]})})}),B&&a.jsx(_U,{title:"MCP Lab Assistant",description:"Analyze historical differences and trends across all result runs.",expanded:V,onToggleExpanded:()=>ee(W=>!W),onHide:()=>z(!1),messages:tt,pendingToolCalls:it,loading:Ge,onCancel:Ee?Re:void 0,input:At,onInputChange:Ft,onSend:()=>{zt()},inputPlaceholder:"Ask about historical run differences...",snippets:swe,onSnippetSelect:W=>{z(!0),an(W)},onApproveToolCall:W=>{jt(W)},onDenyToolCall:W=>{rn(W)},chatEndRef:Ze,inputRef:ht,className:"min-w-0 overflow-hidden xl:flex xl:h-[calc(100vh-14rem)] xl:min-h-0 xl:flex-col",renderMessage:({message:W,index:ye,linkedPendingToolCall:ve,isUser:Ce,isAssistant:_e,isSystem:K,isTool:pe})=>{const Ae=_e&&!!W.pendingToolCallId;if(pe&&/^(Approved|Denied) tool call\b/i.test(String(W.text??"").trim()))return null;if(Ae){const Ke=mm(ve?.tool??W.toolRequestName??ve?.publicToolName??W.toolRequestPublicName??"unknown_tool");return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("details",{open:!!ve,className:"group min-w-0 w-full max-w-[92%] overflow-hidden rounded-md border border-border/60 bg-background",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ua,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:`Tool call ${Ke}`}),a.jsx("span",{className:`shrink-0 whitespace-nowrap rounded px-1.5 py-0.5 text-[10px] font-semibold ${ve?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"}`,children:ve?"Needs approval":"Completed"})]})}),a.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsx("div",{className:"min-w-0 space-y-2 border-t border-border/50 px-3 py-2",children:a.jsx(Ga,{text:W.text,className:"text-sm"})})]})]},`${W.id??`${W.role}-${ye}`}:tool`)}return a.jsxs("div",{className:`flex items-start gap-2 ${Ce?"justify-end":"justify-start"}`,children:[!Ce&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:K?a.jsx(vC,{className:"h-3 w-3"}):a.jsx(Wr,{className:"h-3 w-3"})}),a.jsx("div",{className:`min-w-0 max-w-[92%] break-words rounded-md border p-3 text-sm ${Ce?"border-primary/20 bg-primary/10":K?"border-amber-400/30 bg-amber-50/70":pe?"border-blue-300/30 bg-blue-50/50":"border-border/80 bg-background shadow-sm"}`,children:Ce?a.jsx("p",{className:"whitespace-pre-wrap",children:W.text}):a.jsx(Ga,{text:W.text,className:"text-sm"})}),Ce&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(Kc,{className:"h-3 w-3"})})]},W.id??`${W.role}-${ye}`)}})]})]})};function iwe(e){const t=e.scenarios.reduce((c,u)=>c+u.runs.filter(f=>f.passed).length,0),n=e.totalRuns-t,r={};e.scenarios.forEach(c=>c.runs.forEach(u=>u.toolCalls.forEach(f=>{r[f.name]=(r[f.name]||0)+1})));const s=Object.keys(r),o=Object.values(r),i=e.scenarios.map(c=>`
156
+ `}function B0e(){const{source:e}=$n(),{servers:t,reload:n,loading:r}=Is(),[s,o]=h.useState("configure"),[i,c]=h.useState(""),[u,f]=h.useState("pre_registered"),[m,p]=h.useState("local_callback"),[v,x]=h.useState(!0),[j,y]=h.useState(!0),[b,S]=h.useState(!0),[N,C]=h.useState(""),[k,A]=h.useState(""),[E,P]=h.useState(""),[T,$]=h.useState(""),[Y,H]=h.useState("__default__"),[F,X]=h.useState("{}"),[L,I]=h.useState(""),[M,q]=h.useState(""),[G,O]=h.useState(""),[Q,B]=h.useState(""),[z,V]=h.useState(""),[ee,ae]=h.useState(""),[ue,se]=h.useState(""),[xe,oe]=h.useState(""),[de,De]=h.useState(null),[me,ge]=h.useState(null),[we,at]=h.useState([]),[tt,it]=h.useState(!1),[At,Ge]=h.useState(!1),[Ee,Re]=h.useState(!1),[Ze,ht]=h.useState("all"),[Ft,zt]=h.useState("all"),[jt,rn]=h.useState("inspector"),an=h.useRef(null),qt=h.useRef(null),Zt=h.useRef(!1),sn=h.useRef(j);h.useEffect(()=>{sn.current=j},[j]),h.useEffect(()=>()=>{an.current?.(),an.current=null},[]),h.useEffect(()=>{qt.current?.scrollIntoView({behavior:"smooth",block:"end"})},[we.length]);const ln=h.useMemo(()=>t.filter(te=>te.authType==="oauth2").slice().sort((te,Le)=>(te.name||te.id).localeCompare(Le.name||Le.id,void 0,{sensitivity:"base"})),[t]),_e=ln.find(te=>te.id===i);h.useEffect(()=>{i&&(ln.some(te=>te.id===i)||c(""))},[ln,i]),h.useEffect(()=>{_e&&(_e.oauthMode==="dcr"?(f("dcr"),P(""),$("")):(f("pre_registered"),P(_e.oauthClientId??""),$(_e.oauthClientSecret??"")),C(_e.oauthScope??""),B(_e.oauthAuthorizationUrl??""),V(_e.oauthTokenEndpoint??""))},[_e?.id]);const ze=h.useMemo(()=>{const te=de?.stepStates.length??0,Le=de?.stepStates.filter(Te=>Te.status==="completed"||Te.status==="skipped").length??0,ot=de?.stepStates.filter(Te=>Te.status==="failed").length??0,Ut=te>0?Math.round((Le+ot)/te*100):0;return{total:te,completed:Le,failed:ot,percent:Ut}},[de]),Xe=h.useMemo(()=>{const te=de?.network??[],Le=new Map,ot=[],Ut=Te=>`${Te.stepId}::${Te.label}::${Te.url}`;for(const Te of te){if(Te.phase==="request"){const Xn=ot.length;ot.push({key:Te.id,stepId:Te.stepId,label:Te.label,method:Te.method,url:Te.url,request:Te});const zn=Ut(Te),Ra=Le.get(zn)??[];Ra.push(Xn),Le.set(zn,Ra);continue}const Qt=Ut(Te),St=Le.get(Qt),Gt=St?.shift();if(typeof Gt=="number"){ot[Gt]={...ot[Gt],response:Te},St&&St.length>0?Le.set(Qt,St):Le.delete(Qt);continue}ot.push({key:Te.id,stepId:Te.stepId,label:Te.label,method:Te.method,url:Te.url,response:Te})}return ot.filter(Te=>Ze!=="all"&&Te.stepId!==Ze?!1:Ft==="error"?typeof Te.response?.status=="number"&&Te.response.status>=400:Ft==="ok"?typeof Te.response?.status=="number"&&Te.response.status<400:!0)},[de?.network,Ze,Ft]),kt=!!me,vt=!!(de&&(de.status==="completed"||de.status==="error"||de.status==="stopped")),fe=h.useMemo(()=>{const te=new Map;return(de?.stepStates??[]).forEach((Le,ot)=>{te.set(Le.id,ot+1)}),te},[de?.stepStates]),Oe=h.useMemo(()=>{const te=(de?.network??[]).filter(ot=>ot.phase==="response"),Le=ot=>{const Ut=te.filter(Te=>Te.label===ot);return[...Ut].reverse().find(Te=>typeof Te.status=="number"&&Te.status<400)??[...Ut].reverse()[0]};return{resourceMetadata:Le("Protected Resource Metadata"),authorizationServerMetadata:Le("Authorization Server Metadata")}},[de?.network]),Ve=h.useMemo(()=>{const te=new Map;for(const Le of de?.network??[]){const ot=te.get(Le.stepId)??{requests:[],responses:[]};Le.phase==="request"&&ot.requests.push(Le),Le.phase==="response"&&ot.responses.push(Le),te.set(Le.stepId,ot)}return te},[de?.network]),U=te=>{if(te==="configure"||te==="run"&&kt||te==="report"&&vt)return o(te)},le=()=>{let te;if(u==="dcr"&&F.trim())try{te=JSON.parse(F)}catch{throw new Error("DCR metadata JSON is invalid")}if(!_e)throw new Error("Select an MCP server");return{profile:"latest",target:{serverName:_e.id,overrides:{authorizationServerMetadataUrl:G||void 0,authorizationEndpoint:Q||void 0,tokenEndpoint:z||void 0,registrationEndpoint:ee||void 0,cimdUrl:L||void 0,resourceBaseUrl:ue||void 0}},registrationMethod:u,clientConfig:{preRegistered:u==="pre_registered"?{clientId:E.trim(),clientSecret:T.trim()||void 0,tokenEndpointAuthMethod:Y==="__default__"?void 0:Y||void 0}:void 0,dcr:u==="dcr"?{metadata:te,tokenEndpointAuthMethod:Y==="__default__"?void 0:Y||void 0}:void 0,cimd:u==="cimd"?{cimdUrl:L||void 0,expectedClientId:M||void 0}:void 0},runtime:{redirectMode:m,scopes:N.split(/[,\s]+/).map(Le=>Le.trim()).filter(Boolean),resource:k.trim()||void 0,usePkce:b,codeChallengeMethod:"S256"},display:{showSensitiveValues:v}}},W=te=>{an.current?.(),an.current=e.subscribeOAuthDebuggerSession(te,Le=>{at(Ut=>[...Ut,Le]),(Le.type==="completed"||Le.type==="error"||Le.type==="stopped")&&it(!1),e.getOAuthDebuggerSession(te).then(Ut=>{De(Ut.session),Ut.session.uiHints.authorizationUrl&&ye(`${$S()}/api/oauth-debugger/sessions/${te}/authorize`),Ut.session.status==="completed"&&o("report")}).catch(()=>{})})},ye=te=>{!sn.current||Zt.current||!te||(Zt.current=!0,window.open(te,"_blank","noopener,noreferrer"))},ve=async()=>{Ge(!0),Zt.current=!1;try{const te=le(),Le=await e.createOAuthDebuggerSession(te);ge(Le.sessionId),De(Le.session),at([]),o("run"),W(Le.sessionId);const ot=await e.startOAuthDebuggerSession(Le.sessionId);De(ot.session),it(!0),(ot.session.status==="waiting_for_user"||ot.session.status==="waiting_for_browser_callback")&&(it(!1),ot.session.uiHints.authorizationUrl&&ye(`${$S()}/api/oauth-debugger/sessions/${Le.sessionId}/authorize`))}catch(te){$e({title:"Could not start OAuth Debugger session",description:te instanceof Error?te.message:String(te),variant:"destructive"})}finally{Ge(!1)}},ke=async()=>{if(me)try{Ge(!0);const te=await e.submitOAuthDebuggerManualCallback(me,{redirectUrl:xe.trim()||void 0});De(te.session),oe(""),it(!0)}catch(te){$e({title:"Could not submit callback",description:te instanceof Error?te.message:String(te),variant:"destructive"})}finally{Ge(!1)}},Ce=async()=>{if(me){Re(!0);try{const te=await e.stopOAuthDebuggerSession(me);if(it(!1),te.status!=="running"){const Le=await e.getOAuthDebuggerSession(me);De(Le.session),Le.session.status==="completed"?o("report"):o("run")}}catch(te){$e({title:"Could not stop session",description:te instanceof Error?te.message:String(te),variant:"destructive"})}finally{Re(!1)}}},K=async()=>{an.current?.(),an.current=null,De(null),ge(null),at([]),it(!1),Re(!1),Ge(!1),oe(""),ht("all"),zt("all"),rn("inspector"),o("run"),await ve()},pe=async te=>{if(!(!me||!de))try{const Le=await e.exportOAuthDebuggerSession(me,te);let ot="";const Ut=te==="json"?"json":te==="raw"?"txt":"md";typeof Le=="string"?ot=Le:ot=`${JSON.stringify(Le,null,2)}
157
+ `;const Te=new Blob([ot],{type:"text/plain;charset=utf-8"}),Qt=URL.createObjectURL(Te),St=document.createElement("a");St.href=Qt,St.download=`oauth-debugger-${me}.${Ut}`,St.click(),URL.revokeObjectURL(Qt)}catch(Le){if(te==="markdown"){const ot=z0e(de,we),Ut=new Blob([ot],{type:"text/markdown;charset=utf-8"}),Te=URL.createObjectURL(Ut),Qt=document.createElement("a");Qt.href=Te,Qt.download=`oauth-debugger-${de.id}.md`,Qt.click(),URL.revokeObjectURL(Te);return}$e({title:"Export failed",description:Le instanceof Error?Le.message:String(Le),variant:"destructive"})}},Ae=me?`${$S()}/api/oauth-debugger/sessions/${me}/authorize`:void 0,Ke=te=>te==="error"?"destructive":te==="warning"?"outline":"secondary";return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"OAuth Debugger"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Step-by-step OAuth flow debugging for MCP servers (latest MCP authorization draft profile)."})]}),a.jsx("div",{className:"flex flex-wrap items-center gap-2",children:$0e.map(te=>{const Le=s===te.id,ot=te.id==="configure"||te.id==="run"&&kt||te.id==="report"&&vt;return a.jsx("button",{type:"button",onClick:()=>ot&&U(te.id),disabled:!ot,className:"rounded-full",children:a.jsx(et,{variant:Le?"default":"outline",className:ot?"":"opacity-50",children:te.label})},te.id)})})]}),s==="configure"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base",children:"Target MCP Server"}),a.jsx(Or,{children:"Select one MCP server from Libraries and optionally override endpoints."})]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>{n()},disabled:r,children:[a.jsx(Ya,{className:`mr-2 h-4 w-4 ${r?"animate-spin":""}`}),"Refresh Servers"]})]})}),a.jsx(Je,{className:"space-y-3",children:a.jsxs("div",{className:"max-w-xl space-y-2",children:[a.jsx(We,{children:"MCP Server"}),a.jsxs(Mn,{value:i,onValueChange:c,children:[a.jsx(_n,{children:a.jsx(In,{placeholder:"Select an MCP server"})}),a.jsx(kn,{children:ln.map(te=>a.jsx(ut,{value:te.id,children:te.name||te.id},te.id))})]}),ln.length===0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["No MCP servers with OAuth configured found. Add OAuth 2.0 auth in"," ",a.jsx("a",{href:"/libraries/servers",className:"underline text-primary",children:"Manage Servers"}),"."]}),_e&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[_e.transport," ·"," ",_e.url||_e.command||"No URL/command"," · ",a.jsxs("span",{className:"text-primary",children:[_e.oauthMode==="dcr"?"DCR":"pre-registered"," fields pre-filled"]})]})]})})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Client Registration Method"}),a.jsx(Or,{children:"How your OAuth client is identified with the authorization server."})]}),a.jsxs(Je,{className:"space-y-3",children:[a.jsx("div",{className:"grid gap-2 md:grid-cols-3",children:[{id:"pre_registered",label:"Pre-registered client",hint:"You already have a client_id issued by the authorization server."},{id:"dcr",label:"Dynamic Client Registration",hint:"The server issues a client_id automatically at the start of the flow (RFC 7591)."},{id:"cimd",label:"Client ID Metadata Document",hint:"The client identifies itself via a hosted JSON metadata document at a public URL (RFC 9728)."}].map(te=>a.jsxs("button",{type:"button",onClick:()=>f(te.id),className:"rounded-md border p-3 text-left",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${u===te.id?"bg-primary":"bg-muted-foreground/30"}`}),a.jsx("span",{className:"text-sm font-medium",children:te.label})]}),a.jsx("p",{className:"mt-1 pl-5 text-xs text-muted-foreground",children:te.hint})]},te.id))}),a.jsx("div",{className:"grid gap-3 md:grid-cols-1",children:a.jsxs("div",{className:"max-w-md space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Redirect mode",a.jsx(Lr,{text:"Local callback (recommended): MCP Lab automatically captures the redirect after you log in — no copy-pasting needed. Manual: you complete the browser login and then paste the final redirect URL back here."})]}),a.jsxs(Mn,{value:m,onValueChange:te=>p(te),children:[a.jsx(_n,{children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"local_callback",children:"Local callback (recommended)"}),a.jsx(ut,{value:"manual",children:"Manual paste redirect URL"})]})]})]})}),u==="pre_registered"&&a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["client_id",a.jsx(Lr,{text:"The unique identifier for your application, issued by the authorization server when you registered the client."})]}),a.jsx(_t,{value:E,onChange:te=>P(te.target.value)})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["client_secret",a.jsx(Lr,{text:"Leave empty for public clients (e.g. SPAs or mobile apps). Required for confidential clients that authenticate with the token endpoint."})]}),a.jsx(XN,{value:T,onChange:te=>$(te.target.value),placeholder:"optional"})]})]}),u==="cimd"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["CIMD URL",a.jsx(Lr,{text:"A publicly reachable URL hosting a JSON document that describes this client. The authorization server fetches it to identify the client."})]}),a.jsx(_t,{value:L,onChange:te=>I(te.target.value),placeholder:"https://.../client-metadata.json"})]})]})]}),a.jsxs(Qe,{children:[a.jsxs($t,{className:"pb-3",children:[a.jsx(Dt,{className:"text-base",children:"Runtime OAuth Inputs"}),a.jsx(Or,{children:"Parameters sent in the authorization request."})]}),a.jsxs(Je,{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Scopes"}),a.jsx(_t,{value:N,onChange:te=>C(te.target.value),placeholder:"openid profile email"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Space or comma separated. Leave empty to use scopes auto-discovered from the server metadata."})]}),a.jsxs("div",{className:"flex items-center gap-2 md:col-span-2",children:[a.jsx(br,{checked:b,onCheckedChange:te=>S(!!te)}),a.jsxs(We,{className:"flex items-center gap-1",children:["Use PKCE (S256)",a.jsx(Lr,{text:"Proof Key for Code Exchange — generates a one-time code verifier so the authorization code can't be hijacked. Recommended for all clients; required for public clients."})]})]}),a.jsxs("div",{className:"flex items-center gap-2 md:col-span-2",children:[a.jsx(br,{checked:j,onCheckedChange:te=>y(!!te)}),a.jsx(We,{children:"Auto-open browser when authorization URL is ready"})]})]})]}),a.jsxs("details",{className:"rounded-md border bg-card p-3 shadow-sm",children:[a.jsx("summary",{className:"cursor-pointer text-sm font-medium",children:"Advanced"}),a.jsxs("div",{className:"mt-3 space-y-4",children:[a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Token endpoint auth method",a.jsx(Lr,{text:"How your client authenticates when exchanging the authorization code for a token. Choose 'none' for public clients (no secret). Leave as server default if unsure."})]}),a.jsxs(Mn,{value:Y,onValueChange:H,children:[a.jsx(_n,{children:a.jsx(In,{placeholder:"Server default (recommended)"})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"__default__",children:"Server default (let the server decide)"}),a.jsx(ut,{value:"client_secret_basic",children:"client_secret_basic — credentials in Authorization header"}),a.jsx(ut,{value:"client_secret_post",children:"client_secret_post — credentials in request body"}),a.jsx(ut,{value:"none",children:"none — public client, no secret"}),a.jsx(ut,{value:"private_key_jwt",children:"private_key_jwt — signed JWT assertion"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'Use "server default" unless the server requires a specific method.'})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Resource / audience",a.jsx(Lr,{text:"Some servers (RFC 8707) require the target API's URI in the token request to scope the token. Only set this if your server explicitly requires it."})]}),a.jsx(_t,{value:k,onChange:te=>A(te.target.value),placeholder:"https://api.example.com"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Only needed for servers that use resource indicators."})]})]}),u==="dcr"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["DCR metadata JSON",a.jsx(Lr,{text:'Extra fields for the dynamic client registration request (RFC 7591), e.g. {"client_name": "My App"}. redirect_uris and grant_types are always added automatically.'})]}),a.jsx(Ts,{value:F,onChange:te=>X(te.target.value),className:"min-h-32 font-mono text-xs"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional extra fields for the registration request body."})]}),u==="cimd"&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Expected client_id",a.jsx(Lr,{text:"If you know what client_id the server should assign from the metadata document, enter it here for verification. Leave blank to accept whatever the server returns."})]}),a.jsx(_t,{value:M,onChange:te=>q(te.target.value),placeholder:"optional"})]}),a.jsxs("div",{className:"rounded-md border bg-background p-3",children:[a.jsx("div",{className:"mb-1 text-sm font-medium",children:"Endpoint overrides"}),a.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Override specific endpoints if auto-discovery fails or you want to test against a specific URL. Leave blank to use what the server advertises."}),a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Authorization server metadata URL",a.jsx(Lr,{text:"The /.well-known/oauth-authorization-server URL. Override if the server uses a non-standard path."})]}),a.jsx(_t,{value:G,onChange:te=>O(te.target.value),placeholder:"https://.../.well-known/oauth-authorization-server"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Resource server base URL",a.jsx(Lr,{text:"The MCP server's base URL used to look up its /.well-known/oauth-protected-resource metadata. Override if the server uses a different base path."})]}),a.jsx(_t,{value:ue,onChange:te=>se(te.target.value),placeholder:"https://resource.example.com"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Authorization endpoint",a.jsx(Lr,{text:"The URL where users are redirected to log in and grant consent. Normally discovered automatically from the server metadata."})]}),a.jsx(_t,{value:Q,onChange:te=>B(te.target.value),placeholder:"https://.../authorize"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Token endpoint",a.jsx(Lr,{text:"The URL your app calls to exchange the authorization code for an access token. Normally discovered automatically."})]}),a.jsx(_t,{value:z,onChange:te=>V(te.target.value),placeholder:"https://.../token"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["Registration endpoint (DCR)",a.jsx(Lr,{text:"The URL used to dynamically register a new client (RFC 7591). Only relevant when using DCR. Override if the server doesn't advertise it in its metadata."})]}),a.jsx(_t,{value:ee,onChange:te=>ae(te.target.value),placeholder:"https://.../register"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs(We,{className:"text-xs flex items-center gap-1",children:["CIMD URL override",a.jsx(Lr,{text:"Override the Client ID Metadata Document URL. Use this if the server doesn't discover it automatically or you want to test with a specific metadata document."})]}),a.jsx(_t,{value:L,onChange:te=>I(te.target.value),placeholder:"https://.../client-metadata.json"})]})]})]}),a.jsxs(vl,{children:[a.jsx(eb,{className:"h-4 w-4"}),a.jsx(xl,{children:"Secrets display"}),a.jsxs(yl,{className:"space-y-2",children:[a.jsx("p",{children:"By default, full tokens and secrets are visible in the network inspector and exports — useful for debugging but not for sharing."}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(br,{checked:!v,onCheckedChange:te=>x(te===!1)}),a.jsx(We,{children:"Hide sensitive values in inspector"})]})]})]})]})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(Z,{type:"button",onClick:()=>{ve()},disabled:At,children:[At&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Start OAuth Debug Session"]})})]}),s==="run"&&a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 xl:grid-cols-[1.2fr_1fr]",children:[a.jsxs(Qe,{className:"xl:col-span-1 min-w-0",children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base",children:"Progress"}),a.jsx(Or,{children:"Visual OAuth flow guide with live session events and next-step actions."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[de?.uiHints.authorizationUrl&&Ae&&a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsxs("a",{href:Ae,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Vc,{className:"mr-2 h-4 w-4"}),"Open Authorization URL"]})}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{K()},disabled:At,children:[a.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Restart"]}),me&&a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{Ce()},disabled:Ee||!me,children:[(Ee||tt)&&Ee&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),a.jsx(Vd,{className:"mr-2 h-4 w-4"}),"Stop Debug Session"]})]})]})}),a.jsxs(Je,{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[ze.completed+ze.failed,"/",ze.total," steps"]}),a.jsxs("span",{children:[ze.percent,"%"]})]}),a.jsx(px,{value:ze.percent,className:"h-2"})]}),de?.status==="waiting_for_user"&&a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4 space-y-2",children:[a.jsx("div",{className:"text-sm font-medium",children:"Manual callback required"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Open the authorization URL, complete authentication, then paste the final redirect URL here."}),a.jsx(Ts,{value:xe,onChange:te=>oe(te.target.value),placeholder:"Paste the final redirect URL (with code and state)",className:"min-h-24 text-xs font-mono"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{type:"button",size:"sm",onClick:()=>{ke()},disabled:At||!xe.trim(),children:[At&&a.jsx(_r,{className:"mr-2 h-4 w-4 animate-spin"}),"Continue"]}),de.uiHints.authorizationUrl&&Ae&&a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsx("a",{href:Ae,target:"_blank",rel:"noopener noreferrer",children:"Open Authorization URL"})})]})]})}),de?.status==="waiting_for_browser_callback"&&a.jsxs(vl,{children:[a.jsx(eb,{className:"h-4 w-4"}),a.jsx(xl,{children:"Waiting for browser callback"}),a.jsxs(yl,{className:"space-y-1",children:[a.jsx("p",{className:"text-xs",children:"Complete the authorization flow in your browser. MCP Lab is listening for the callback at:"}),a.jsx("p",{className:"text-xs font-mono break-all",children:de.uiHints.callbackUrl}),de.uiHints.authorizationUrl&&Ae&&a.jsx("div",{className:"pt-2",children:a.jsx(Z,{asChild:!0,type:"button",size:"sm",variant:"outline",children:a.jsxs("a",{href:Ae,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(Vc,{className:"mr-2 h-4 w-4"}),"Open Authorization URL"]})})})]})]}),a.jsx("div",{className:"space-y-2",children:de?.stepStates.map(te=>{const Le=fe.get(te.id),ot=Ve.get(te.id),Ut=te.id===L0e||te.id===F0e,Te=!!(ot&&(ot.requests.length>0||ot.responses.length>0)),Qt=Ut&&te.status!=="pending"&&Te;return a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border bg-muted text-xs font-semibold",children:Le}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"inline-flex items-center gap-1 text-sm font-medium",children:[a.jsx("span",{children:te.title}),te.status==="completed"&&a.jsx(Va,{className:"h-4 w-4 shrink-0 text-emerald-600","aria-hidden":"true"})]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:te.description})]})]}),a.jsx(et,{variant:te.status==="failed"?"destructive":te.status==="completed"?"outline":te.status==="active"?"secondary":"outline",className:te.status==="completed"?"border-emerald-300 bg-emerald-50 text-emerald-700":void 0,children:te.status})]}),te.outcomeSummary&&a.jsx("p",{className:"mt-2 text-xs text-muted-foreground break-all whitespace-pre-line",children:te.outcomeSummary}),te.id===D0e&&a.jsxs("details",{className:"mt-3 rounded-md border bg-muted/20 p-3",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-semibold text-muted-foreground",children:"OAuth Metadata Sources"}),a.jsxs("div",{className:"mt-3 space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Resource Metadata"}),a.jsxs("p",{className:"text-xs text-muted-foreground break-all",children:["From ",Oe.resourceMetadata?.url??"not captured"]}),a.jsx("pre",{className:"max-h-56 overflow-x-auto rounded-md bg-muted p-2 text-xs",children:DS(Oe.resourceMetadata?.bodyText)})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-medium",children:"Authorization Server Metadata"}),a.jsxs("p",{className:"text-xs text-muted-foreground break-all",children:["From"," ",Oe.authorizationServerMetadata?.url??"not captured"]}),a.jsx("pre",{className:"max-h-56 overflow-x-auto rounded-md bg-muted p-2 text-xs",children:DS(Oe.authorizationServerMetadata?.bodyText)})]})]})]}),Qt&&ot&&a.jsxs("details",{className:"mt-3 rounded-md border bg-muted/20 p-3",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-semibold text-muted-foreground",children:"Captured exchange details"}),a.jsx("div",{className:"mt-3 space-y-3",children:Array.from({length:Math.max(ot.requests.length,ot.responses.length)}).map((St,Gt)=>{const Xn=ot.requests[Gt],zn=ot.responses[Gt];return a.jsxs("div",{className:"rounded-md border bg-background p-2",children:[a.jsx("div",{className:"text-xs font-medium",children:Xn?.label??zn?.label??`Exchange ${Gt+1}`}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground break-all",children:[Xn?.method?`${Xn.method} `:"",Xn?.url??zn?.url??"-"]}),typeof zn?.status=="number"&&a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["HTTP ",zn.status]}),Xn?.bodyText&&a.jsx("pre",{className:"mt-2 max-h-40 overflow-auto rounded bg-muted p-2 text-xs",children:Xn.bodyText}),zn?.bodyText&&a.jsx("pre",{className:"mt-2 max-h-48 overflow-auto rounded bg-muted p-2 text-xs",children:DS(zn.bodyText)})]},`${te.id}-exchange-${Gt}`)})})]})]},te.id)})||a.jsx("p",{className:"text-sm text-muted-foreground",children:"No steps yet."})})]})]}),a.jsx("div",{className:"space-y-4 xl:col-span-1 min-w-0",children:a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx(Dt,{className:"text-base",children:"Inspect"}),a.jsx(Or,{children:"Live events and network requests/responses for the OAuth flow."})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{pe("raw")},disabled:!me||!de,children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Copy/Export Raw Trace"]})]})}),a.jsx(Je,{className:"space-y-3",children:a.jsxs(ax,{value:jt,onValueChange:te=>rn(te),className:"min-w-0",children:[a.jsxs(Cp,{className:"grid grid-cols-2",children:[a.jsx(Xs,{value:"inspector",children:"Network Inspector"}),a.jsx(Xs,{value:"events",children:"Live Debug"})]}),a.jsx(Gf,{value:"events",className:"mt-3",children:a.jsxs("div",{className:"max-h-64 space-y-1 overflow-auto rounded-md border bg-muted/10 p-3 text-xs",children:[we.length===0?a.jsx("p",{className:"text-muted-foreground",children:"No events yet."}):we.map((te,Le)=>a.jsxs("div",{className:"break-all",children:[a.jsx("span",{className:"mr-2 font-mono text-muted-foreground",children:new Date(te.ts).toLocaleTimeString()}),a.jsx(et,{variant:"outline",className:"mr-2 text-[10px]",children:te.type}),typeof te.payload.message=="string"?te.payload.message:JSON.stringify(te.payload)]},`${te.ts}-${Le}`)),a.jsx("div",{ref:qt})]})}),a.jsxs(Gf,{value:"inspector",className:"space-y-3 mt-3",children:[a.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Filter by step"}),a.jsxs(Mn,{value:Ze,onValueChange:ht,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"all",children:"All steps"}),(de?.stepStates??[]).map(te=>a.jsxs(ut,{value:te.id,children:[fe.get(te.id),". ",te.title]},te.id))]})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Filter by status"}),a.jsxs(Mn,{value:Ft,onValueChange:zt,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{})}),a.jsxs(kn,{children:[a.jsx(ut,{value:"all",children:"All"}),a.jsx(ut,{value:"ok",children:"Successful responses"}),a.jsx(ut,{value:"error",children:"Error responses"})]})]})]})]}),a.jsx("div",{className:"max-h-[34rem] min-w-0 space-y-2 overflow-auto",children:Xe.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No network exchanges captured yet."}):Xe.map(te=>a.jsxs("details",{className:"rounded-md border p-3",children:[a.jsx("summary",{className:"cursor-pointer list-none",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border bg-muted text-xs font-semibold",children:fe.get(te.stepId)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-sm font-medium",children:te.label}),a.jsxs("div",{className:"text-xs text-muted-foreground break-all",children:[te.method?`${te.method} `:"",te.url]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(et,{variant:"outline",children:"request"}),a.jsx(et,{variant:"outline",children:"response"}),typeof te.response?.status=="number"&&a.jsx(et,{variant:te.response.status>=400?"destructive":"secondary",children:te.response.status})]})]})}),a.jsxs("div",{className:"mt-3 space-y-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Request Headers"}),a.jsx("pre",{className:"max-h-40 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:JSON.stringify(te.request?.headers??{},null,2)})]}),te.request?.bodyText&&a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Request Body"}),a.jsx("pre",{className:"max-h-64 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:te.request.bodyText})]}),a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Response Headers"}),a.jsx("pre",{className:"max-h-40 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:JSON.stringify(te.response?.headers??{},null,2)})]}),te.response?.bodyText&&a.jsxs("div",{children:[a.jsx("div",{className:"mb-1 text-xs font-medium",children:"Response Body"}),a.jsx("pre",{className:"max-h-64 max-w-full overflow-auto whitespace-pre-wrap break-all rounded bg-muted p-2 text-xs",children:te.response.bodyText})]}),a.jsx("div",{className:"flex gap-2",children:a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{OD(JSON.stringify(te,null,2))},children:[a.jsx(Hr,{className:"mr-2 h-4 w-4"}),"Copy JSON"]})})]})]},te.key))})]})]})})]})})]})}),s==="report"&&de&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold",children:"Report / Export"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"OAuth debug session summary, validations, and trace exports."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>o("configure"),children:"Back to Configure"}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{pe("json")},children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export JSON"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{pe("markdown")},children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Export Markdown"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{pe("raw")},children:[a.jsx(zr,{className:"mr-2 h-4 w-4"}),"Copy/Export Raw Trace"]})]})]}),a.jsxs(vl,{children:[a.jsx(eb,{className:"h-4 w-4"}),a.jsx(xl,{children:"Secrets display mode"}),a.jsx(yl,{children:de.summary?.showSensitiveValues?"This session is configured to show full tokens and secrets in network logs/exports.":"Sensitive values are hidden in the inspector for this session."})]}),a.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Status"}),a.jsx("div",{className:"text-lg font-semibold",children:de.status})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Requests"}),a.jsx("div",{className:"text-lg font-semibold",children:de.networkSummary.requestCount})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Network errors"}),a.jsx("div",{className:"text-lg font-semibold",children:de.networkSummary.errorCount})]})}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-4",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:"Validation findings"}),a.jsx("div",{className:"text-lg font-semibold",children:de.validations.length})]})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Key values"})}),a.jsxs(Je,{className:"grid gap-3 md:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Issuer"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.issuer||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Client ID"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.clientId||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Redirect URI"}),a.jsx("p",{className:"text-sm break-all",children:de.summary?.redirectUri||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Token endpoint status"}),a.jsx("p",{className:"text-sm",children:de.summary?.tokenEndpointStatus??"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Token type"}),a.jsx("p",{className:"text-sm",children:de.summary?.tokenType||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Scopes granted"}),a.jsx("p",{className:"text-sm break-all",children:(de.summary?.grantedScopes??[]).join(", ")||"-"})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Token validity"}),a.jsxs("p",{className:"text-sm",children:[typeof de.summary?.accessTokenValidForSeconds=="number"?`${KN(de.summary.accessTokenValidForSeconds)} remaining`:typeof de.summary?.accessTokenExpiresInSeconds=="number"?`${KN(de.summary.accessTokenExpiresInSeconds)} from issuance`:"No expiry advertised by token endpoint",de.summary?.accessTokenExpiresAt?a.jsxs(a.Fragment,{children:[" (until ",a.jsx("span",{children:new Date(de.summary.accessTokenExpiresAt).toLocaleTimeString()}),")"]}):""]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Source:"," ",de.summary?.accessTokenExpirySource==="expires_in"?"token endpoint expires_in":de.summary?.accessTokenExpirySource==="jwt_exp"?"JWT exp claim":"not available"]})]}),a.jsxs("div",{children:[a.jsx(We,{className:"text-xs",children:"Refresh option"}),a.jsx("p",{className:"text-sm",children:de.summary?.refreshTokenAvailable?"Refresh token available (silent refresh possible)":"No refresh token in response (full login likely required after expiry)"})]}),de.summary?.accessToken&&a.jsxs("div",{className:"md:col-span-2 space-y-1",children:[a.jsx(We,{className:"text-xs",children:"Access token"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("code",{className:"flex-1 truncate rounded bg-muted px-2 py-1 text-xs font-mono text-muted-foreground",children:[de.summary.accessToken.slice(0,48),"…"]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"shrink-0 h-7 px-2 text-xs",onClick:()=>{OD(de.summary.accessToken)},children:[a.jsx(Hr,{className:"mr-1 h-3 w-3"}),"Copy token"]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:['Visible because "Hide sensitive values" is off. Use this token with the CLI via'," ",a.jsx("code",{className:"font-mono",children:"--oauth-token"}),"."]})]})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Validation findings"})}),a.jsx(Je,{className:"space-y-2",children:de.validations.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No validation findings recorded."}):de.validations.map((te,Le)=>a.jsxs("div",{className:"rounded-md border p-3",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full border bg-muted px-1 text-[10px] font-semibold text-muted-foreground",children:Le+1}),a.jsx("span",{className:"font-bold",children:te.title})]}),a.jsx(et,{variant:Ke(te.severity),children:te.severity})]}),a.jsxs("p",{className:"text-sm",children:[a.jsx("span",{className:"font-bold",children:"Finding:"})," ",te.detail]}),te.recommendation&&a.jsxs("div",{className:"mt-2 rounded-md border px-2.5 py-2 text-xs",children:[a.jsx("div",{className:"mb-1 font-medium text-muted-foreground",children:"Suggested improvement"}),a.jsx("p",{children:te.recommendation})]}),a.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Step: ",te.stepId,te.specReference&&a.jsxs(a.Fragment,{children:[" · ",a.jsx("a",{href:te.specReference,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"Spec reference"})]})]})]},te.id))})]})]})]})}var mx="Switch",[q0e]=kr(mx),[U0e,W0e]=q0e(mx),bU=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:o,required:i,disabled:c,value:u="on",onCheckedChange:f,form:m,...p}=e,[v,x]=h.useState(null),j=Ot(t,C=>x(C)),y=h.useRef(!1),b=v?m||!!v.closest("form"):!0,[S,N]=Aa({prop:s,defaultProp:o??!1,onChange:f,caller:mx});return a.jsxs(U0e,{scope:n,checked:S,disabled:c,children:[a.jsx(lt.button,{type:"button",role:"switch","aria-checked":S,"aria-required":i,"data-state":NU(S),"data-disabled":c?"":void 0,disabled:c,value:u,...p,ref:j,onClick:Ue(e.onClick,C=>{N(k=>!k),b&&(y.current=C.isPropagationStopped(),y.current||C.stopPropagation())})}),b&&a.jsx(SU,{control:v,bubbles:!y.current,name:r,value:u,checked:S,required:i,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});bU.displayName=mx;var wU="SwitchThumb",jU=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=W0e(wU,n);return a.jsx(lt.span,{"data-state":NU(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});jU.displayName=wU;var H0e="SwitchBubbleInput",SU=h.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...s},o)=>{const i=h.useRef(null),c=Ot(i,o),u=Zv(n),f=Vg(t);return h.useEffect(()=>{const m=i.current;if(!m)return;const p=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(p,"checked").set;if(u!==n&&x){const j=new Event("click",{bubbles:r});x.call(m,n),m.dispatchEvent(j)}},[u,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SU.displayName=H0e;function NU(e){return e?"checked":"unchecked"}var CU=bU,V0e=jU;const Mg=h.forwardRef(({className:e,...t},n)=>a.jsx(CU,{className:Me("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input 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",e),...t,ref:n,children:a.jsx(V0e,{className:Me("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Mg.displayName=CU.displayName;function K0e(e){const t=e.filter(n=>typeof n.sourcePath=="string"&&n.sourcePath.trim().length>0&&typeof n.relativePath=="string"&&n.relativePath.trim().length>0).map(n=>[n.sourcePath,n.relativePath]);return new Map(t)}function G0e(e){const t=e.filter(n=>typeof n.sourcePath=="string"&&n.sourcePath.trim().length>0).map(n=>[n.sourcePath,n.configName?.trim()||n.name]);return new Map(t)}function Y0e(e,t){const n=new Map;for(const r of e){if(!r.sourcePath)continue;const s=new Map,o=r.scenarioEntries&&r.scenarioEntries.length>0?r.scenarioEntries:r.scenarios.map(i=>({kind:"inline",scenario:i}));for(const i of o){if(i.kind==="inline"){s.set(i.scenario.id,i.scenario.name?.trim()||i.scenario.id);continue}const c=t.find(u=>u.id===i.ref);s.set(i.ref,c?.name?.trim()||i.ref)}n.set(r.sourcePath,s)}return n}function LS(e,t){const n=t.get(e);if(n)return n;const r=e.replace(/\\/g,"/"),s="/evals/",o=r.lastIndexOf(s);if(o>=0)return r.slice(o+s.length);const i=r.split("/").filter(Boolean);return i.length<=1?r:i.slice(-3).join("/")}function FS(e,t,n){const r=t.get(n);if(!e||e.length===0){if(r&&r.size===1){const o=r.values().next().value;if(o)return o}return"All scenarios"}if(!r)return e.length===1?e[0]:`${e[0]} +${e.length-1}`;const s=e.map(o=>r.get(o)??o);return s.length===1?s[0]:`${s[0]} +${s.length-1}`}const zS="mcplab.runEvaluation.activeJobId";function X0e(e){return e.configName?.trim()||e.name}function Q0e(e){if(e.suitePath?.trim())return e.suitePath.trim();if(e.relativePath?.includes("/")){const t=e.relativePath.lastIndexOf("/");return e.relativePath.slice(0,t)}return null}function Gn(){return new Date().toLocaleTimeString()}const J0e=()=>{const[e]=zo(),[t,n]=h.useState(""),[r,s]=h.useState("1"),[o,i]=h.useState(!1),[c,u]=h.useState(0),[f,m]=h.useState([]),[p,v]=h.useState(!1),[x,j]=h.useState(!1),[y,b]=h.useState(""),[S,N]=h.useState(null),[C,k]=h.useState([]),[A,E]=h.useState([]),[P,T]=h.useState(!1),[$,Y]=h.useState([]),[H,F]=h.useState({}),[X,L]=h.useState({}),[I,M]=h.useState(""),[q,G]=h.useState([]),[O,Q]=h.useState([]),[B,z]=h.useState([]),[V,ee]=h.useState(!1),[ae,ue]=h.useState(null),se=h.useRef(null),xe=h.useRef(null),oe=h.useRef(!1),{configs:de,reload:De}=up(),{source:me}=$n(),{agents:ge,scenarios:we,servers:at,reload:tt}=Is(),it=y.trim(),At=it?`/results/${encodeURIComponent(it)}${t?`?configId=${encodeURIComponent(t)}`:""}`:"/results",Ge=de.find(fe=>fe.id===t),Ee=h.useMemo(()=>K0e(de),[de]),Re=h.useMemo(()=>G0e(de),[de]),Ze=h.useMemo(()=>Y0e(de,we),[de,we]),ht=O[0]??null,Ft=e.get("configId"),zt=h.useMemo(()=>{if(!Ge)return[];const fe=new Map,Oe=Ge.agentEntries&&Ge.agentEntries.length>0?Ge.agentEntries:Ge.agents.map(Ve=>({kind:"inline",agent:Ve}));for(const Ve of Oe){if(Ve.kind==="inline"){const le=Ve.agent.id;fe.has(le)||fe.set(le,Ve.agent);continue}const U=ge.find(le=>le.id===Ve.ref);U&&!fe.has(U.id)&&fe.set(U.id,U)}for(const Ve of ge)fe.has(Ve.id)||fe.set(Ve.id,Ve);return Array.from(fe.values())},[Ge,ge]),jt=h.useMemo(()=>{if(!Ge)return[];const fe=new Map,Oe=Ge.scenarioEntries&&Ge.scenarioEntries.length>0?Ge.scenarioEntries:Ge.scenarios.map(Ve=>({kind:"inline",scenario:Ve}));for(const Ve of Oe){if(Ve.kind==="inline"){fe.has(Ve.scenario.id)||fe.set(Ve.scenario.id,Ve.scenario);continue}const U=we.find(le=>le.id===Ve.ref);U&&!fe.has(U.id)&&fe.set(U.id,U)}return Array.from(fe.values())},[Ge,we]),rn=h.useMemo(()=>{const fe=new Map;for(const Oe of at)fe.has(Oe.id)||fe.set(Oe.id,{id:Oe.id,name:Oe.name});for(const Oe of Ge?.servers??[])fe.set(Oe.id,{id:Oe.id,name:Oe.name});return Array.from(fe.values()).sort((Oe,Ve)=>Oe.id.localeCompare(Ve.id))},[Ge?.servers,at]);h.useEffect(()=>{Ft&&de.some(fe=>fe.id===Ft)&&n(Ft)},[Ft,de]);const an=h.useRef("");h.useEffect(()=>{const fe=Ge?`${Ge.id}::${Ge.sourcePath??""}`:"";if(fe===an.current)return;if(an.current=fe,!Ge){k([]),E([]),T(!1),Y([]),F({}),L({});return}const Oe=WN(Ge);k(Oe.length>0?Oe:zt.map(Ve=>Ve.id)),E(jt.map(Ve=>Ve.id)),T(!1),Y([]),F({}),L({})},[Ge?.id,Ge?.sourcePath,zt,jt]);const qt=async()=>{if(!Ge?.sourcePath){m(Ce=>[...Ce,`[${Gn()}] Missing source path for selected config.`]);return}const fe=zt.filter(Ce=>C.includes(Ce.id));if(fe.length===0){m(Ce=>[...Ce,`[${Gn()}] Select at least one agent.`]);return}const Oe=jt.filter(Ce=>A.includes(Ce.id)),Ve=new Set(Oe.map(Ce=>Ce.id)),U=P||Object.values(H).some(Boolean),le=Object.fromEntries(Object.entries(X).filter(([Ce])=>Ve.has(Ce)&&H[Ce])),W=Oe.map(Ce=>{const K=le[Ce.id]??(P?$:Ce.serverIds||[]);return`${Ce.id}=[${K.join(", ")}]`}).join("; ");if(Oe.length===0){m(Ce=>[...Ce,`[${Gn()}] Select at least one test.`]);return}if(P&&$.length===0){m(Ce=>[...Ce,`[${Gn()}] Select at least one server for "Override MCP Servers for Selected Tests", or turn that override off.`]);return}const ye=Object.entries(le).filter(([,Ce])=>!Array.isArray(Ce)||Ce.length===0).map(([Ce])=>Ce);if(ye.length>0){m(Ce=>[...Ce,`[${Gn()}] Select at least one server for per-scenario overrides on: ${ye.join(", ")}, or turn those overrides off.`]);return}const ve=Array.from(new Set(Oe.flatMap(Ce=>U?le[Ce.id]?le[Ce.id]??[]:P?$:Ce.serverIds||[]:Ce.serverIds||[]).filter(Ce=>{const K=(Ge.servers??[]).find(Ae=>Ae.id===Ce),pe=at.find(Ae=>Ae.id===Ce);return(K||pe)?.authType==="oauth2"})));try{ve.length>0&&(ee(!0),await Po({serverNames:ve,source:me,onServerAuthStart:Ce=>{m(K=>[...K,`[${Gn()}] OAuth login required for '${Ce}'. Complete the browser sign-in flow...`])}}),m(Ce=>[...Ce,`[${Gn()}] OAuth login completed for required server(s): ${ve.join(", ")}.`]))}catch(Ce){const K=Ce instanceof Error?Ce.message:String(Ce);m(pe=>[...pe,`[${Gn()}] OAuth error: ${K}`]),ee(!1);return}finally{ee(!1)}i(!0),v(!1),j(!1),b("");const ke=(Ge.serverEntries??[]).some(Ce=>Ce.kind==="referenced")||(Ge.agentEntries??[]).some(Ce=>Ce.kind==="referenced")||(Ge.scenarioEntries??[]).some(Ce=>Ce.kind==="referenced")?"refs-composed":"single-file/inline";m([`[${Gn()}] Starting evaluation run...`,`[${Gn()}] Config=${Ge.name} mode=${ke} agents=${fe.map(Ce=>Ce.name||Ce.id).join(", ")} tests=${Oe.map(Ce=>Ce.id).join(", ")} runs=${Number(r)}${I.trim()?` note=${I.trim()}`:""}`,`[${Gn()}] Effective MCP servers per selected test: ${W||"(none)"}`]),u(10);try{const{jobId:Ce}=await me.startRun({configPath:Ge.sourcePath,runsPerScenario:Number(r),agents:fe.map(K=>K.id),scenarioIds:Oe.map(K=>K.id),...U&&P?{serverOverrideAll:$}:{},...U&&Object.keys(le).length>0?{scenarioServerOverrides:le}:{},runNote:I.trim()?I.trim():void 0});N(Ce),_e(Ce),vt(Ce),ze()}catch(Ce){const K=Ce instanceof Error?Ce.message:String(Ce),pe=K.includes("Anthropic model not found")?" Hint: this usually means the API key works but the model ID is not enabled for that Anthropic account. Change the agent model in Manage Agents (library) or inline config.":"";m(Ae=>[...Ae,`[${Gn()}] Error: ${K}${pe}`]),i(!1),u(0),N(null),ee(!1)}},Zt=()=>{qt()},sn=()=>{S&&me.stopRun(S),xe.current?.(),xe.current=null,ln(),N(null),i(!1),v(!1),j(!0),m(fe=>[...fe,`[${Gn()}] Run aborted by user.`]),ze()};h.useEffect(()=>{se.current&&(se.current.scrollTop=se.current.scrollHeight)},[f]),h.useEffect(()=>()=>{xe.current?.()},[]),h.useEffect(()=>{if(S||p)return;let fe="";try{fe=sessionStorage.getItem(zS)??""}catch{fe=""}if(fe)return N(fe),i(!0),v(!1),j(!1),m(Oe=>Oe.length>0?Oe:[`[${Gn()}] Reattached to in-progress evaluation run...`]),vt(fe),()=>{}},[S,p]);const ln=()=>{try{sessionStorage.removeItem(zS)}catch{}},_e=fe=>{try{sessionStorage.setItem(zS,fe)}catch{}},ze=async()=>{try{const fe=await me.getRunQueue();G(fe.queued),Q(fe.active_jobs??(fe.active?[fe.active]:[])),z(fe.admitting_jobs??[]);const Oe=S==null?void 0:fe.queued.find(Ve=>Ve.jobId===S&&Ve.status==="blocked_auth"&&Ve.blockedReason==="oauth_required");Oe&&(Oe.requiredServers??[]).length>0?ue(Ve=>Ve?.jobId===Oe.jobId?Ve:{jobId:Oe.jobId,servers:Oe.requiredServers}):(ae?.jobId&&ae.jobId!==S||S!=null&&!fe.queued.some(Ve=>Ve.jobId===S&&Ve.status==="blocked_auth"&&Ve.blockedReason==="oauth_required"))&&ue(null)}catch{}},Xe=()=>{De(),tt()};h.useEffect(()=>{Xe(),ze();const fe=()=>{Xe(),ze()};return window.addEventListener("focus",fe),()=>{window.removeEventListener("focus",fe)}},[De,tt]);const kt=async fe=>{try{await me.removeQueuedRun(fe),G(Oe=>Oe.filter(Ve=>Ve.jobId!==fe))}catch(Oe){const Ve=Oe instanceof Error?Oe.message:String(Oe);if(Ve.includes("Use the /stop endpoint"))try{await me.stopRun(fe)}catch{}else $e({title:"Could not remove queued run",description:Ve,variant:"destructive"})}ze()},vt=fe=>{S===fe&&xe.current||(xe.current?.(),xe.current=me.subscribeRunJob(fe,Oe=>{const Ve=new Date(Oe.ts).toLocaleTimeString();if(Oe.type==="queued"){m(U=>{const le=Oe.payload.position?` (position ${Oe.payload.position})`:"",W=`[${Ve}] Run queued${le}. Waiting for active run to finish...`;return U.includes(W)?U:[...U,W]}),u(5);return}if(Oe.type==="oauth_required"){const U=Array.isArray(Oe.payload.servers)?Oe.payload.servers:[],le=String(Oe.payload.jobId??"");ue({jobId:le,servers:U}),m(W=>{const ye=`[${Ve}] OAuth required for server(s): ${U.join(", ")}. Click "Connect & Resume" to authenticate.`;return W.includes(ye)?W:[...W,ye]});return}if(Oe.type==="started"&&(ue(null),oe.current=!1,i(!0),v(!1),j(!1),m(U=>{const le=`[${Ve}] Run started.`;return U.includes(le)?U:[...U,le]}),u(U=>Math.max(U,30)),ze()),Oe.type==="log"){const U=String(Oe.payload.message??"").trim();U&&(m(le=>{const W=`[${Ve}] ${U}`;return le.includes(W)?le:[...le,W]}),u(le=>{const W=U.toLowerCase();if(W.startsWith("loading mcp evaluation config"))return Math.max(le,15);if(W.startsWith("loaded config"))return Math.max(le,20);if(W.startsWith("selected "))return Math.max(le,30);if(W.startsWith("using requested agents")||W.startsWith("using run default agents")||W.startsWith("using config-declared agents"))return Math.max(le,35);if(W.startsWith("expanded to "))return Math.max(le,45);if(W.startsWith("running evaluation"))return Math.max(le,50);const ye=W.match(/^scenario (\d+)\/(\d+) finished:/);if(ye){const ve=Number(ye[1]),ke=Number(ye[2]);return Math.max(le,50+Math.round(ve/ke*25))}return W.startsWith("evaluation execution finished")?Math.max(le,78):W.startsWith("writing results to ")?Math.max(le,94):W.startsWith("run finished:")?Math.max(le,98):le}))}if(Oe.type==="completed"){const U=String(Oe.payload.runId??"").trim();ue(null),oe.current=!1,m(le=>{const W=`[${Ve}] Run completed.`;return le.includes(W)?le:[...le,W]}),u(100),i(!1),v(!0),j(!1),b(U),ln(),N(null),xe.current?.(),xe.current=null,ze()}if(Oe.type==="error"){const U=String(Oe.payload.message??"Unknown error"),le=U.includes("Anthropic model not found")?" Hint: this usually means the API key works but the model ID is not enabled for that Anthropic account. Change the agent model in Manage Agents (library) or inline config.":"";ue(null),oe.current=!1,m(W=>[...W,`[${Ve}] Error: ${U}${le}`]),i(!1),v(!1),j(!1),u(0),ln(),N(null),xe.current?.(),xe.current=null,ze()}}))};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(ks,{className:"h-6 w-6"}),"Run Evaluation"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Execute evaluation scenarios against MCP servers"})]}),a.jsx(Qe,{children:a.jsxs(Je,{className:"pt-6 space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{children:"MCP Evaluation"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Mn,{value:t,onValueChange:n,children:[a.jsx(_n,{children:a.jsx(In,{placeholder:"Select a config"})}),a.jsx(kn,{children:de.map(fe=>{const Oe=Q0e(fe);return a.jsxs(ut,{value:fe.id,children:[a.jsx("span",{children:X0e(fe)}),Oe&&a.jsxs("span",{className:"ml-2 text-muted-foreground",children:["(",Oe,")"]})]},fe.id)})})]}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0",onClick:Xe,"aria-label":"Refresh configs",title:"Refresh configs",children:a.jsx(Ya,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{children:"Variance Runs"}),a.jsx(_t,{type:"number",min:"1",max:"10",value:r,onChange:fe=>s(fe.target.value)})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{htmlFor:"run-note",children:"Run Note"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[I.length,"/500"]})]}),a.jsx(Ts,{id:"run-note",value:I,onChange:fe=>M(fe.target.value.slice(0,500)),placeholder:"Optional context for this run (for example: mcp-server v1.8.2 #staging)",rows:2})]}),Ge&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{children:"Agents"}),a.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>k(zt.map(fe=>fe.id)),children:"Select all"}),a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>k([]),children:"Clear"})]})]}),a.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:zt.map(fe=>{const Oe=C.includes(fe.id);return a.jsxs("label",{className:"flex items-center gap-2 text-sm rounded-md border p-2",children:[a.jsx(br,{checked:Oe,onCheckedChange:Ve=>{const U=Ve===!0;k(le=>U?[...le,fe.id]:le.filter(W=>W!==fe.id))}}),a.jsx("span",{children:fe.name||fe.id})]},fe.id)})}),zt.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents available. Add agents to your workspace library, or define inline agents in this config."})]}),Ge&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{children:"Tests"}),a.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>E(jt.map(fe=>fe.id)),children:"Select all"}),a.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>E([]),children:"Clear"})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[A.length," of ",jt.length," selected"]}),a.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:jt.map(fe=>{const Oe=A.includes(fe.id),Ve=X[fe.id],U=!!H[fe.id],le=U&&Array.isArray(Ve),W=new Set(fe.serverIds||[]);return a.jsxs("div",{className:"flex flex-col gap-2 text-sm rounded-md border p-2 cursor-pointer",onClick:ye=>{const ve=ye.target;ve&&(ve.closest("button, a, input, select, textarea, [role='button']")||E(ke=>Oe?ke.filter(Ce=>Ce!==fe.id):[...ke,fe.id]))},children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(br,{checked:Oe,onCheckedChange:ye=>{const ve=ye===!0;E(ke=>ve?[...ke,fe.id]:ke.filter(Ce=>Ce!==fe.id))}}),a.jsxs("span",{className:"min-w-0",children:[a.jsxs("span",{className:"block font-medium",children:[fe.name||fe.id," ",le&&a.jsx("span",{className:"rounded bg-primary/10 px-1.5 py-0.5 text-[10px] text-primary",children:"Override"})]}),a.jsx("span",{className:"block font-mono text-xs text-muted-foreground truncate",children:fe.id})]})]}),Oe&&a.jsxs("div",{className:"pl-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(We,{className:"text-[11px] text-muted-foreground",children:'Per-scenario: "Override MCP Servers"'}),a.jsx(Mg,{checked:U,onCheckedChange:ye=>{if(F(ve=>({...ve,[fe.id]:ye})),!ye)L(ve=>{const ke={...ve};return delete ke[fe.id],ke});else if(!X[fe.id]){const ve=P&&$.length>0?[...$]:[...fe.serverIds||[]];L(ke=>({...ke,[fe.id]:ve}))}}})]}),U&&a.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:rn.map(ye=>{const ve=ye.id,ke=(Ve??[]).includes(ve),Ce=W.has(ve);return a.jsx(et,{variant:ke?"default":"outline",className:`cursor-pointer text-xs ${ke?"":"opacity-60 hover:opacity-100"}`,style:!ke&&Ce?{borderColor:"hsl(var(--primary))"}:void 0,onClick:K=>{K.stopPropagation(),L(pe=>{const Ae=pe[fe.id]??[],Ke=Ae.includes(ve)?Ae.filter(te=>te!==ve):[...Ae,ve];return{...pe,[fe.id]:Ke}})},children:ye.name?.trim()?ye.name:ve},ve)})})]})]},fe.id)})}),a.jsxs("div",{className:"space-y-1 rounded-md border p-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{children:"Override MCP Servers for selected Tests "}),a.jsx("span",{className:"text-muted-foreground",children:"Selected tests run against the servers you choose here. Applies only to this run."})]}),a.jsx(Mg,{checked:P,onCheckedChange:T})]}),P&&a.jsx("div",{className:"flex flex-wrap gap-1.5",children:rn.map(fe=>{const Oe=fe.id,Ve=$.includes(Oe);return a.jsx(et,{variant:Ve?"default":"outline",className:`cursor-pointer text-xs ${Ve?"":"opacity-60 hover:opacity-100"}`,onClick:()=>Y(U=>U.includes(Oe)?U.filter(le=>le!==Oe):[...U,Oe]),children:fe.name?.trim()?fe.name:Oe},Oe)})})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{onClick:Zt,disabled:!t||V||zt.length>0&&C.length===0||jt.length>0&&A.length===0,children:[a.jsx(ks,{className:"mr-2 h-4 w-4"}),ht?"Queue Run":"Run"]}),o&&a.jsxs(Z,{variant:"destructive",onClick:sn,children:[a.jsx(Vd,{className:"mr-2 h-4 w-4"}),"Stop"]})]})]})}),(o||f.length>0)&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Dt,{className:"text-base",children:"Progress"}),a.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[Math.round(c),"%"]})]})}),a.jsxs(Je,{className:"space-y-4",children:[a.jsx(px,{value:c,className:"h-2"}),ae&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-yellow-500/40 bg-yellow-500/10 px-3 py-2 text-sm",children:[a.jsxs("span",{className:"text-yellow-700 dark:text-yellow-400",children:["OAuth required for: ",a.jsx("strong",{children:ae.servers.join(", ")})]}),a.jsx(Z,{size:"sm",variant:"outline",disabled:V,onClick:()=>{oe.current||(oe.current=!0,ee(!0),Po({serverNames:ae.servers,source:me,onServerAuthStart:fe=>{m(Oe=>[...Oe,`[${Gn()}] OAuth sign-in opened for '${fe}'...`])}}).then(()=>me.resumeQueue()).then(()=>{const fe=ae?.jobId;m(Oe=>[...Oe,`[${Gn()}] OAuth complete. Resuming run...`]),fe&&(N(fe),_e(fe),i(!0),v(!1),vt(fe))}).catch(fe=>{const Oe=fe instanceof Error?fe.message:String(fe);m(Ve=>[...Ve,`[${Gn()}] OAuth error: ${Oe}`]),oe.current=!1}).finally(()=>{ee(!1)}))},children:V?"Connecting...":"Connect & Resume"})]}),a.jsx("div",{ref:se,className:"h-64 overflow-auto rounded-md border bg-muted/30 p-3 font-mono text-xs space-y-0.5",children:f.map((fe,Oe)=>a.jsx("div",{className:fe.includes("✓")?"text-success":fe.includes("aborted")?"text-destructive":"text-foreground",children:fe},Oe))})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Dt,{className:"inline-flex items-center gap-2 text-base",children:[a.jsx(Ea,{className:"h-4 w-4"}),"Run Queue"]}),a.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>{ze()},children:a.jsx(Ya,{className:"h-3 w-3"})})]})}),a.jsx(Je,{children:!ht&&B.length===0&&q.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No active or queued runs. Start a run above."}):a.jsxs("div",{className:"space-y-2",children:[O.map(fe=>a.jsxs("div",{role:"button",tabIndex:0,className:`flex items-center justify-between rounded-md border border-primary/30 bg-primary/5 p-2 text-sm cursor-pointer hover:bg-primary/10 transition-colors ${S===fe.jobId?"ring-2 ring-primary/40":""}`,onClick:()=>{S!==fe.jobId&&(N(fe.jobId),_e(fe.jobId),i(!0),v(!1),j(!1),m([`[${Gn()}] Attached to running job ${fe.jobId}...`]),u(10),vt(fe.jobId))},onKeyDown:Oe=>{Oe.key!=="Enter"&&Oe.key!==" "||S!==fe.jobId&&(Oe.preventDefault(),N(fe.jobId),_e(fe.jobId),i(!0),v(!1),j(!1),m([`[${Gn()}] Attached to running job ${fe.jobId}...`]),u(10),vt(fe.jobId))},title:"Click to view progress",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:"Running"}),a.jsx("span",{className:"text-xs font-bold",children:Re.get(fe.runParams.configPath)||FS(fe.runParams.scenarioIds,Ze,fe.runParams.configPath)}),a.jsx("span",{className:"font-mono text-xs",children:LS(fe.runParams.configPath,Ee)}),fe.runParams.agents&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["agents: ",fe.runParams.agents.join(", ")]}),fe.runParams.runNote&&a.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["note: ",fe.runParams.runNote]})]}),a.jsxs(Z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive hover:bg-destructive/10",onClick:Oe=>{Oe.stopPropagation(),me.stopRun(fe.jobId),ze()},title:"Stop running job",children:[a.jsx(Vd,{className:"mr-1 h-3 w-3"}),"Stop"]})]},fe.jobId)),B.map(fe=>{const Oe=LS(fe.runParams.configPath,Ee),Ve=FS(fe.runParams.scenarioIds,Ze,fe.runParams.configPath),U=Re.get(fe.runParams.configPath)||Ve,le=fe.status==="blocked_auth";return a.jsx("div",{className:`flex items-center justify-between rounded-md border p-2 text-sm ${le?"border-yellow-500/40 bg-yellow-500/5":"border-primary/20 bg-primary/5"}`,children:a.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${le?"bg-yellow-500/15 text-yellow-700 dark:text-yellow-400":"bg-primary/10 text-primary"}`,children:le?"Retrying OAuth":"Starting"}),a.jsx("span",{className:"text-xs font-bold",children:U}),a.jsx("span",{className:"font-mono text-xs",children:Oe}),le&&(fe.requiredServers??[]).length>0&&a.jsxs("span",{className:"text-xs text-yellow-700 dark:text-yellow-400",children:["OAuth: ",fe.requiredServers.join(", ")]})]})},fe.jobId)}),q.map((fe,Oe)=>{const Ve=LS(fe.runParams.configPath,Ee),U=FS(fe.runParams.scenarioIds,Ze,fe.runParams.configPath),le=Re.get(fe.runParams.configPath)||U,W=fe.status==="blocked_auth";return a.jsxs("div",{className:`flex items-center justify-between rounded-md border p-2 text-sm ${W?"border-yellow-500/40 bg-yellow-500/5":""}`,children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-wrap",children:[W?a.jsxs("span",{className:"inline-flex items-center rounded-full bg-yellow-500/15 px-2 py-0.5 text-xs font-medium text-yellow-700 dark:text-yellow-400",children:["#",Oe+1," Blocked"]}):a.jsxs("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:["#",Oe+1," Queued"]}),a.jsx("span",{className:"text-xs font-bold",children:le}),a.jsx("span",{className:"font-mono text-xs",children:Ve}),W&&(fe.requiredServers??[]).length>0&&a.jsxs("span",{className:"text-xs text-yellow-700 dark:text-yellow-400",children:["OAuth: ",fe.requiredServers.join(", ")]}),!W&&fe.runParams.agents&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["agents: ",fe.runParams.agents.join(", ")]}),fe.runParams.runNote&&a.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["note: ",fe.runParams.runNote]})]}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[W&&a.jsx(Z,{size:"sm",variant:"outline",className:"h-7 text-xs border-yellow-500/50 text-yellow-700 dark:text-yellow-400 hover:bg-yellow-500/10",disabled:V,onClick:()=>{if(oe.current)return;const ye=fe.requiredServers??[];ye.length!==0&&(oe.current=!0,ue({jobId:fe.jobId,servers:ye}),ee(!0),Po({serverNames:ye,source:me,onServerAuthStart:ve=>{m(ke=>[...ke,`[${Gn()}] OAuth sign-in opened for '${ve}'...`])}}).then(()=>me.resumeQueue()).then(()=>{m(ve=>[...ve,`[${Gn()}] OAuth complete. Resuming run...`]),N(fe.jobId),_e(fe.jobId),i(!0),v(!1),vt(fe.jobId)}).catch(ve=>{const ke=ve instanceof Error?ve.message:String(ve);m(Ce=>[...Ce,`[${Gn()}] OAuth error: ${ke}`]),oe.current=!1}).finally(()=>{ee(!1)}))},children:V&&ae?.jobId===fe.jobId?"Connecting...":"Connect & Resume"}),a.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:()=>{kt(fe.jobId)},title:"Remove from queue",children:a.jsx(ca,{className:"h-4 w-4"})})]})]},fe.jobId)})]})})]}),x&&!o&&!p&&a.jsx(Qe,{className:"border-amber-300/60 bg-amber-50/40",children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsx(Vd,{className:"h-5 w-5 text-amber-700"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium",children:"Run stopped"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"The evaluation was stopped before completion. You can start it again or clear the progress log."})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx(Z,{type:"button",variant:"outline",onClick:()=>{m([]),u(0),j(!1)},children:"Clear Progress"}),a.jsxs(Z,{type:"button",onClick:Zt,disabled:!t,children:[a.jsx(ks,{className:"mr-2 h-4 w-4"}),"Run Again"]})]})]})})}),p&&a.jsx(Qe,{className:"border-success/50",children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Va,{className:"h-6 w-6 text-success"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"Evaluation Complete"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"All scenarios have been evaluated successfully."})]}),a.jsx(Z,{asChild:!0,className:"ml-auto",children:a.jsx(Et,{to:At,children:it?"View Results":"View Runs"})})]})})})]})};function _U({title:e,description:t,expanded:n,onToggleExpanded:r,onHide:s,messages:o,pendingToolCalls:i,loading:c,input:u,onInputChange:f,onSend:m,onCancel:p,inputPlaceholder:v,snippets:x,snippetsLabel:j="Result Assistant Snippets",onSnippetSelect:y,onApproveToolCall:b,onDenyToolCall:S,chatEndRef:N,inputRef:C,renderMessage:k,renderMessageExtras:A,className:E="min-w-0 overflow-hidden xl:flex xl:h-full xl:min-h-0 xl:flex-col",contentClassName:P="flex h-[70vh] min-h-[520px] flex-col p-0 xl:h-auto xl:min-h-0 xl:flex-1"}){return a.jsxs(Qe,{className:E,children:[a.jsx($t,{className:"border-b px-4 py-3",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),e]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:r,children:[n?a.jsx(XS,{className:"h-3.5 w-3.5"}):a.jsx(QS,{className:"h-3.5 w-3.5"}),n?"Compact":"Expand"]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:s,children:"Hide"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:t})]})}),a.jsxs(Je,{className:P,children:[a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-muted/15 px-4 py-4",children:a.jsxs("div",{className:"space-y-3 pr-2",children:[o.map((T,$)=>{const Y=T.role==="user",H=T.role==="assistant",F=T.role==="system",X=T.role==="tool",L=T.pendingToolCallId?i.find(M=>M.id===T.pendingToolCallId):void 0;return k?k({message:T,index:$,linkedPendingToolCall:L,isUser:Y,isAssistant:H,isSystem:F,isTool:X}):H&&!!T.pendingToolCallId?a.jsxs("div",{className:"rounded-md border bg-background p-3",children:[a.jsx(Ga,{text:T.text,className:"text-sm"}),L&&a.jsx(HN,{call:L,loading:c,onApprove:b,onDeny:S,className:"mt-3"})]},`${T.id??`${T.role}-${$}`}-tool`):a.jsx(M8,{message:T},T.id??`${T.role}-${$}`)}),A,c&&a.jsx(I8,{}),a.jsx("div",{ref:N})]})}),a.jsx("div",{className:"border-t bg-background px-4 py-3",children:a.jsx($8,{input:u,onInputChange:f,onSend:m,onCancel:p,inputPlaceholder:v,snippets:x,snippetsLabel:j,onSnippetSelect:y,loading:c,inputRef:C})})]})]})}function aa(e,t){if(!Number.isFinite(e)||e<=0)return"0ms";if(e<1e3)return`${Math.round(e)}ms`;if(t?.preciseUnderTenSeconds&&e<1e4){const i=e/1e3,c=Math.round(i*10)/10;return`${Number.isInteger(c)?c.toFixed(0):c.toFixed(1)}s`}const n=Math.floor(e/1e3),r=Math.floor(n/3600),s=Math.floor(n%3600/60),o=n%60;return r>0?`${r}h ${s}m ${o}s`:s>0?`${s}m ${o}s`:`${o}s`}function nC(e){return e.runs.length>0?e.runs.reduce((t,n)=>t+n.duration,0):e.avgDuration}function Ig(e){return e.scenarios.some(n=>n.runs.length>0)?e.scenarios.reduce((n,r)=>n+nC(r),0):typeof e.totalDurationMs=="number"&&e.totalDurationMs>=0?e.totalDurationMs:null}function rC(e){return e.runs.length>0?e.runs.reduce((t,n)=>t+n.toolCalls.reduce((r,s)=>r+s.duration,0),0):0}function $g(e){return e.scenarios.some(n=>n.runs.length>0)?e.scenarios.reduce((n,r)=>n+rC(r),0):typeof e.totalToolDurationMs=="number"&&e.totalToolDurationMs>=0?e.totalToolDurationMs:null}const MD="hsl(152, 69%, 40%)",ID="hsl(0, 72%, 51%)",$D="hsl(215, 16%, 47%)";function wo(e,t=0){return e.toLocaleString(void 0,{maximumFractionDigits:t,minimumFractionDigits:t})}function Dg({title:e,passed:t,failed:n,notEvaluated:r=0}){const s=[{name:"Passed",value:t,color:MD},{name:"Failed",value:n,color:ID},...r>0?[{name:"Not evaluated",value:r,color:$D}]:[]];return a.jsxs(Qe,{children:[a.jsx($t,{className:"p-2.5 pb-0",children:a.jsx(Dt,{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:e})}),a.jsxs(Je,{className:"flex h-[92px] items-center justify-center gap-2 p-0",children:[a.jsx("div",{className:"h-[82px] w-[82px] shrink-0",children:a.jsx(hf,{width:"100%",height:"100%",children:a.jsxs(ige,{children:[a.jsx(Wo,{data:s,dataKey:"value",nameKey:"name",innerRadius:"55%",outerRadius:"78%",paddingAngle:3,children:s.map(o=>a.jsx(Sv,{fill:o.color},o.name))}),a.jsx(ra,{})]})})}),a.jsxs("div",{className:"space-y-0.5 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:MD}}),wo(t)," passed"]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:ID}}),wo(n)," failed"]}),r>0&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:$D}}),wo(r)," not evaluated"]})]})]})]})}function Z0e({runs:e,loading:t}){const n=h.useMemo(()=>{const r=e.reduce((v,x)=>v+Math.max(0,x.totalRuns),0),s=e.reduce((v,x)=>v+Math.round(Math.max(0,x.totalRuns)*x.overallPassRate),0),o=Math.max(0,r-s),i=e.reduce((v,x)=>v+Math.max(0,x.totalScenarios),0),c=e.reduce((v,x)=>(v.passed+=x.checkCounts?.passed??0,v.failed+=x.checkCounts?.failed??0,v.not_evaluated+=x.checkCounts?.not_evaluated??0,v.total+=x.checkCounts?.total??0,v),{passed:0,failed:0,not_evaluated:0,total:0}),u=v=>r===0?0:e.reduce((x,j)=>x+v(j)*Math.max(0,j.totalRuns),0)/r,f=e.reduce((v,x)=>v+(x.toolTokenUsage?.totalTokens??0),0),m=e.reduce((v,x)=>v+(x.totalDurationMs??0),0),p=e.reduce((v,x)=>v+(x.totalToolDurationMs??0),0);return{totalRuns:r,passedRuns:s,failedRuns:o,checkCounts:c,totalScenarios:i,passRate:r===0?0:s/r,avgToolCalls:u(v=>v.avgToolCalls),avgLatency:u(v=>v.avgLatency),totalTokens:f,totalDurationMs:m,totalToolDurationMs:p}},[e]);return t?a.jsx(Qe,{children:a.jsx(Je,{className:"p-6 text-sm text-muted-foreground",children:"Calculating dashboard…"})}):e.length===0?a.jsx(Qe,{children:a.jsx(Je,{className:"p-6 text-sm text-muted-foreground",children:"No results in the selected range."})}):a.jsx("div",{className:"space-y-2","data-testid":"results-dashboard",children:a.jsxs("div",{className:"grid gap-3 lg:grid-cols-4",children:[a.jsx(Dg,{title:"Runs Pass / Fail",passed:n.passedRuns,failed:n.failedRuns}),a.jsx(Dg,{title:"Checks Pass / Fail",passed:n.checkCounts.passed,failed:n.checkCounts.failed,notEvaluated:n.checkCounts.not_evaluated}),a.jsxs("div",{className:"grid self-start content-start gap-3 sm:grid-cols-2 lg:col-span-2 lg:grid-cols-4",children:[a.jsx(nr,{compact:!0,title:"Scenarios",value:wo(n.totalScenarios),icon:gm}),a.jsx(nr,{compact:!0,title:"Total Runs",value:wo(n.totalRuns),icon:hC}),a.jsx(nr,{compact:!0,title:"Pass Rate",value:`${wo(n.passRate*100,1)}%`,icon:bl}),a.jsx(nr,{compact:!0,title:"Avg Tool Calls",value:wo(n.avgToolCalls,1),icon:Va}),a.jsx(nr,{compact:!0,title:"Avg Latency",value:`${wo(n.avgLatency)}ms`,icon:bC}),a.jsx(nr,{compact:!0,title:"Tool Tokens",value:wo(n.totalTokens),icon:Ua}),n.totalDurationMs>0?a.jsx(nr,{compact:!0,title:"Total Time",value:aa(n.totalDurationMs),icon:Ea}):null,n.totalToolDurationMs>0?a.jsx(nr,{compact:!0,title:"Tool Duration",value:aa(n.totalToolDurationMs),icon:Ea}):null]})]})})}function Ld(e){return e instanceof GC&&e.status===404}function kU(e){const{source:t,open:n,scope:r,runId:s,onSessionSync:o}=e,[i,c]=h.useState(null),[u,f]=h.useState([]),[m,p]=h.useState([]),[v,x]=h.useState(""),[j,y]=h.useState(!1),[b,S]=h.useState(!1),N=h.useRef(null),C=h.useRef(null),k=h.useRef(0),A=h.useRef(t),E=h.useRef(o),P=h.useRef(null),T=h.useRef(null);h.useEffect(()=>{N.current=i},[i]),h.useEffect(()=>{A.current=t},[t]),h.useEffect(()=>{E.current=o},[o]);const $=h.useCallback(()=>{const O=C.current;O&&O.controller.abort()},[]),Y=h.useCallback((O,Q)=>{c(Q??O.id),f(B=>B.length>O.messages.length?B:O.messages),p(O.pendingToolCalls),E.current?.(O)},[]),H=h.useCallback(async(O,Q)=>{const B=Q.session.id||O;Y(Q.session,B)},[Y]),F=h.useCallback(()=>{const O=C.current;O&&($(),x(O.prompt),y(!1),S(!1))},[$]),X=h.useCallback(async()=>{const O=v.trim();if(!O||r==="run"&&!s)return;const Q=++k.current,B=new AbortController,z=`msg-local-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,V={id:z,role:"user",text:O,createdAt:new Date().toISOString()};C.current={id:Q,controller:B,prompt:O},S(!0),x(""),f(ee=>[...ee,V]),y(!0);try{let ee=i;if(!ee){const ae=r==="run"&&s?await t.createResultAssistantSession({runId:s,scope:"run"},B.signal):await t.createResultAssistantSession({scope:"all_runs"},B.signal);if(B.signal.aborted||C.current?.id!==Q)return;ee=ae.sessionId||ae.session.id,Y(ae.session,ee),f(ue=>ue.some(xe=>xe.id===z)?[...ae.session.messages,V]:ae.session.messages)}try{const ae=await t.sendResultAssistantMessage(ee,O,B.signal);if(B.signal.aborted||C.current?.id!==Q)return;await H(ee,ae)}catch(ae){if(VN(ae)||B.signal.aborted||C.current?.id!==Q)return;if(!Ld(ae))throw ae;const ue=r==="run"&&s?await t.createResultAssistantSession({runId:s,scope:"run"},B.signal):await t.createResultAssistantSession({scope:"all_runs"},B.signal);if(B.signal.aborted||C.current?.id!==Q)return;const se=ue.sessionId||ue.session.id;if(Y(ue.session,se),f(oe=>oe.some(De=>De.id===z)?[...ue.session.messages,V]:ue.session.messages),B.signal.aborted||C.current?.id!==Q)return;const xe=await t.sendResultAssistantMessage(se,O,B.signal);if(B.signal.aborted||C.current?.id!==Q)return;await H(se,xe)}}catch(ee){if(VN(ee)||B.signal.aborted||C.current?.id!==Q)return;f(ae=>ae.filter(ue=>ue.id!==z)),$e({title:"MCP Lab Assistant error",description:ee instanceof Error?ee.message:String(ee),variant:"destructive"})}finally{C.current?.id===Q&&(C.current=null,y(!1),S(!1))}},[v,r,s,i,t,Y,H]),L=h.useCallback(async O=>{if(i){S(!1),y(!0);try{const Q=await t.approveResultAssistantToolCall(i,O);await H(i,Q)}catch(Q){Ld(Q)&&(c(null),p([])),$e({title:"Could not approve assistant action",description:Ld(Q)?"Assistant session expired. Ask a new question to start a fresh session.":Q instanceof Error?Q.message:String(Q),variant:"destructive"})}finally{y(!1)}}},[i,t,H]),I=h.useCallback(async O=>{if(i){S(!1),y(!0);try{const Q=await t.denyResultAssistantToolCall(i,O);await H(i,Q)}catch(Q){Ld(Q)&&(c(null),p([])),$e({title:"Could not deny assistant action",description:Ld(Q)?"Assistant session expired. Ask a new question to start a fresh session.":Q instanceof Error?Q.message:String(Q),variant:"destructive"})}finally{y(!1)}}},[i,t,H]),M=h.useCallback(()=>{$();const O=N.current;O&&t.closeResultAssistantSession(O).catch(()=>{}),N.current=null,c(null),f([]),p([]),x(""),S(!1)},[$,t]),q=h.useCallback(O=>{f(Q=>Q.length>0?Q:[{id:`msg-${Date.now()}`,role:"assistant",text:O,createdAt:new Date().toISOString()}])},[]),G=h.useCallback(O=>{x(O),requestAnimationFrame(()=>T.current?.focus())},[]);return h.useEffect(()=>{if(!n)return;const O=window.setTimeout(()=>{P.current?.scrollIntoView({behavior:"smooth",block:"end"})},0);return()=>window.clearTimeout(O)},[n,u.length,j]),h.useEffect(()=>{const O=T.current;if(!O)return;O.style.height="0px";const Q=Math.min(O.scrollHeight,160);O.style.height=`${Math.max(40,Q)}px`},[v,n]),h.useEffect(()=>{if(!(!n||!i))return A.current.subscribeResultAssistantSessionEvents(i,O=>{Y(O.payload.session,O.payload.sessionId)})},[n,i,Y]),h.useEffect(()=>()=>{$();const O=N.current;O&&A.current.closeResultAssistantSession(O).catch(()=>{})},[$]),{assistantSessionId:i,assistantMessages:u,assistantPendingToolCalls:m,assistantInput:v,assistantLoading:j,assistantTurnCancelable:b,cancelAssistantTurn:F,assistantChatEndRef:P,assistantInputRef:T,setAssistantInput:x,setAssistantMessages:f,askAssistant:X,approveResultAssistantToolCall:L,denyResultAssistantToolCall:I,applyResultAssistantSnippet:G,ensureIntroMessage:q,resetAssistantSession:M}}function mm(e){const t=String(e??"").trim();return t&&(t.split("::").pop()??t).replace(/^mcplab__/,"").replace(/^mcplab_/,"").replace(/_/g," ").replace(/\s+/g," ").trim()||"unknown_tool"}async function AU(e,t){const n=t.configPath?.trim();if(!n)throw new Error("This run has no config path in metadata.");const s=await e.getResult(t.id)??t,o=s.rerunAgents&&s.rerunAgents.length>0?s.rerunAgents:Array.from(new Set(s.scenarios.map(i=>i.agentId).filter(Boolean)));await e.startRun({configPath:n,runsPerScenario:1,scenarioIds:s.rerunScenarioIds,agents:o.length>0?o:void 0,runNote:s.runNote,serverOverrideAll:s.rerunServerOverrideAll,scenarioServerOverrides:s.rerunScenarioServerOverrides})}const qa=[{value:"15min",label:"Last 15min",durationMs:900*1e3},{value:"30min",label:"Last 30min",durationMs:1800*1e3},{value:"1h",label:"Last hour",durationMs:3600*1e3},{value:"2h",label:"Last 2 hours",durationMs:7200*1e3},{value:"4h",label:"Last 4 hours",durationMs:14400*1e3},{value:"8h",label:"Last 8 hours",durationMs:480*60*1e3},{value:"24h",label:"Last 24 hours",durationMs:1440*60*1e3},{value:"7d",label:"Last 7 days",durationMs:10080*60*1e3},{value:"14d",label:"Last 14 days",durationMs:336*60*60*1e3},{value:"30d",label:"Last 30 days",durationMs:720*60*60*1e3}];function EU(e){return e==="all"||e==="last"||e==="custom"}function PU(e){return e==="15min"||e==="30min"||e==="1h"||e==="2h"||e==="4h"||e==="8h"||e==="24h"||e==="7d"||e==="14d"||e==="30d"}function aC(e){const t=e.get("time_filter"),n=e.get("time_preset");return{mode:EU(t)?t:"all",preset:PU(n)?n:"15min",start:e.get("time_start")??"",end:e.get("time_end")??""}}const DD=8,sC="mcplab:results:time-filter",RU="mcplab:results:dashboard-visible";function Dl(e){if(!e.trim())return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function BS(e,t,n,r){if(e==="all")return{};if(e==="last"){const i=qa.find(f=>f.value===t)??qa[0],c=new Date(Date.now());return{since:new Date(c.getTime()-i.durationMs).toISOString(),until:c.toISOString()}}const s=Dl(n),o=Dl(r);return s&&o?s.getTime()<=o.getTime()?{since:s.toISOString(),until:o.toISOString()}:{since:o.toISOString(),until:s.toISOString()}:s?{since:s.toISOString()}:o?{until:o.toISOString()}:{}}function tm(e){const t=Dl(e);return t?t.toLocaleString():""}function ewe(e){const t=Dl(e);if(!t)return e;const n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0");return`${n}-${r}-${s}`}function twe(e){const t=Dl(e);return t?t.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):"Unknown day"}function nwe(e){return e.has("time_filter")||e.has("time_preset")||e.has("time_start")||e.has("time_end")}function rwe(){try{const e=localStorage.getItem(sC);if(!e)return null;const t=JSON.parse(e),n=EU(typeof t.mode=="string"?t.mode:null)?t.mode:"all",r=PU(typeof t.preset=="string"?t.preset:null)?t.preset:"15min";return{mode:n,preset:r,start:typeof t.start=="string"?t.start:"",end:typeof t.end=="string"?t.end:""}}catch{return null}}function awe(){try{const e=localStorage.getItem(RU);return e===null?!0:e==="true"}catch{return!0}}const swe=[{label:"Summarize Run Trends",description:"Highlight the main changes across the selected runs.",prompt:"Summarize the main trends across these runs. Call out pass-rate changes, latency, and tool usage shifts."},{label:"Explain Failures",description:"Identify the most important failures and likely root causes.",prompt:"Identify the most important failures across these runs and explain likely root causes from the traces."},{label:"Compare Agents",description:"Compare agent behavior, tool use, and answer quality across runs.",prompt:"Compare agent behavior across these runs. Highlight differences in tool use, answer quality, and consistency."},{label:"Spot Anomalies",description:"Find outliers in latency, tool calls, or pass rate.",prompt:"Find unusual runs or outliers in latency, tool calls, or pass rate, and explain why they stand out."}],Fd=100,owe=()=>{const[e,t]=zo(),{source:n}=$n(),[r]=h.useState(()=>nwe(e)?aC(e):rwe()??aC(e)),[s,o]=h.useState([]),[i,c]=h.useState([]),u=h.useRef(0),[f,m]=h.useState(!0),[p,v]=h.useState(awe),[x,j]=h.useState(!1),[y,b]=h.useState(null),[S,N]=h.useState(!1),[C,k]=h.useState("timestamp"),[A,E]=h.useState("desc"),[P,T]=h.useState("all"),[$,Y]=h.useState(!1),[H,F]=h.useState(r.mode),[X,L]=h.useState(r.preset),[I,M]=h.useState(r.start),[q,G]=h.useState(r.end),[O,Q]=h.useState(!1),[B,z]=h.useState(!1),[V,ee]=h.useState(!1),{completionVersion:ae}=QL(),ue=hx(Fd),{offset:se,totalCount:xe,hasMore:oe}=ue,[de,De]=h.useState(null),me=P==="all"?void 0:P,ge=W=>{if(C===W){E(ye=>ye==="asc"?"desc":"asc");return}k(W),E(W==="timestamp"?"desc":"asc")},we=h.useCallback(async()=>{if(!p||!n.listRunSummaries)return;const W=++u.current;m(!0);try{const ye=await n.listRunSummaries({...BS(H,X,I,q),scenario:me});u.current===W&&c(ye.map(vi))}catch{u.current===W&&c([])}finally{u.current===W&&m(!1)}},[me,p,n,q,H,X,I]),at=async()=>{j(!0);try{const W=BS(H,X,I,q);if(n.listRunSummariesPage){const ye=await n.listRunSummariesPage({...W,scenario:me,limit:Fd,offset:se});ue.updateMeta(ye),o(ye.data.map(vi))}else if(n.listRunSummaries){const ye=await n.listRunSummaries({...W,scenario:me,limit:Fd,offset:se});ue.setTotalCount(ye.length),ue.setHasMore(!1),o(ye.map(vi))}else ue.setTotalCount(0),ue.setHasMore(!1),o(await n.listResults());we()}catch(W){$e({title:"Could not load results",description:W instanceof Error?W.message:String(W),variant:"destructive"})}finally{j(!1)}};h.useEffect(()=>{let W=!0;j(!0);const ye=BS(H,X,I,q);return(n.listRunSummariesPage?n.listRunSummariesPage({...ye,scenario:me,limit:Fd,offset:se}).then(ke=>(W&&ue.updateMeta(ke),ke.data.map(vi))):n.listRunSummaries?n.listRunSummaries({...ye,scenario:me,limit:Fd,offset:se}).then(ke=>(W&&(ue.setTotalCount(ke.length),ue.setHasMore(!1)),ke.map(vi))):n.listResults()).then(ke=>{W&&o(ke)}).catch(ke=>{W&&$e({title:"Could not load results",description:ke instanceof Error?ke.message:String(ke),variant:"destructive"})}).finally(()=>{W&&j(!1)}),()=>{W=!1}},[me,ae,se,n,q,H,X,I]),h.useEffect(()=>{try{localStorage.setItem(RU,String(p))}catch{}},[p]),h.useEffect(()=>{we()},[ae,we]),h.useEffect(()=>{if(!(p&&n.listRunSummaries)){if(!p){m(!1);return}c(s),m(!1)}},[p,s,n]);const{assistantMessages:tt,assistantPendingToolCalls:it,assistantInput:At,assistantLoading:Ge,assistantTurnCancelable:Ee,cancelAssistantTurn:Re,assistantChatEndRef:Ze,assistantInputRef:ht,setAssistantInput:Ft,askAssistant:zt,approveResultAssistantToolCall:jt,denyResultAssistantToolCall:rn,applyResultAssistantSnippet:an,ensureIntroMessage:qt}=kU({source:n,open:B,scope:"all_runs"}),Zt=h.useMemo(()=>{const W=new Map;return s.forEach(ye=>{ye.scenarios.forEach(ve=>{const ke=String(ve.scenarioName??"").trim(),Ce=String(ve.scenarioId??"").trim();if(Ce){W.set(Ce,ke||Ce);return}ke&&W.set(ke,ke)})}),Array.from(W.entries()).map(([ye,ve])=>({value:ye,label:ve})).sort((ye,ve)=>ye.label.localeCompare(ve.label))},[s]);h.useEffect(()=>{const W=(e.get("scenario")??"").trim();if(W){if(Zt.some(ye=>ye.value===W||ye.label===W)){T(W);return}s.length>0&&T("all")}},[e,Zt,s.length]),h.useEffect(()=>{const W=new URLSearchParams(e);H==="all"?(W.delete("time_filter"),W.delete("time_preset"),W.delete("time_start"),W.delete("time_end")):H==="last"?(W.set("time_filter","last"),W.set("time_preset",X),W.delete("time_start"),W.delete("time_end")):(W.set("time_filter","custom"),W.delete("time_preset"),I.trim()?W.set("time_start",I.trim()):W.delete("time_start"),q.trim()?W.set("time_end",q.trim()):W.delete("time_end")),W.toString()!==e.toString()&&t(W,{replace:!0})},[e,t,q,H,X,I]),h.useEffect(()=>{try{if(H==="all"){localStorage.removeItem(sC);return}const W={mode:H,preset:X,start:I,end:q};localStorage.setItem(sC,JSON.stringify(W))}catch{}},[q,H,X,I]);const sn=h.useMemo(()=>{if(n.listRunSummariesPage)return s;const W=P==="all"?s:s.filter(pe=>pe.scenarios.some(Ae=>{const Ke=String(Ae.scenarioName??"").trim(),te=String(Ae.scenarioId??"").trim();return Ke===P||te===P}));if(H==="all")return W;const ye=Date.now();if(H==="last"){const pe=qa.find(Ke=>Ke.value===X)??qa[0],Ae=ye-pe.durationMs;return W.filter(Ke=>{const te=new Date(Ke.timestamp).getTime();return te>=Ae&&te<=ye})}const ve=Dl(I)?.getTime()??null,ke=Dl(q)?.getTime()??null,Ce=ve!==null&&ke!==null?Math.min(ve,ke):ve??null,K=ve!==null&&ke!==null?Math.max(ve,ke):ke??null;return W.filter(pe=>{const Ae=new Date(pe.timestamp).getTime();return!(Number.isNaN(Ae)||Ce!==null&&Ae<Ce||K!==null&&Ae>K)})},[s,P,n.listRunSummariesPage,q,H,X,I]);h.useEffect(()=>{ue.reset()},[me,ue.reset,q,H,X,I]);const ln=h.useMemo(()=>P==="all"?"All scenarios":Zt.find(ye=>ye.value===P||ye.label===P)?.label??P,[P,Zt]),_e=h.useMemo(()=>{if(H==="all")return"All time";if(H==="last")return qa.find(ve=>ve.value===X)?.label??"Last range";const W=!!I.trim(),ye=!!q.trim();return!W&&!ye?"Custom range":W&&ye?`${tm(I)} - ${tm(q)}`:W?`From ${tm(I)}`:`Until ${tm(q)}`},[q,H,X,I]),ze=h.useMemo(()=>{const W=(ve,ke)=>ve===null&&ke===null?0:ve===null?1:ke===null?-1:A==="asc"?ve-ke:ke-ve;return[...sn].sort((ve,ke)=>{if(C==="toolTokens")return W(ve.toolTokenUsage?.totalTokens??null,ke.toolTokenUsage?.totalTokens??null);let Ce=0;return C==="id"&&(Ce=ve.id.localeCompare(ke.id)),C==="timestamp"&&(Ce=new Date(ve.timestamp).getTime()-new Date(ke.timestamp).getTime()),C==="passRate"&&(Ce=ve.overallPassRate-ke.overallPassRate),C==="scenarios"&&(Ce=ve.totalScenarios-ke.totalScenarios),C==="avgToolCalls"&&(Ce=ve.avgToolCalls-ke.avgToolCalls),A==="asc"?Ce:-Ce})},[sn,C,A]),Xe=h.useMemo(()=>{const W=[];let ye=null;for(const ve of ze){const ke=ewe(ve.timestamp);ke!==ye&&(W.push({type:"day-separator",dayKey:ke,dayLabel:twe(ve.timestamp)}),ye=ke),W.push({type:"run",run:ve})}return W},[ze]),kt=W=>C!==W?a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"}):A==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}),vt=W=>{const ye=W.toolTokenUsage?.totalTokens;return typeof ye=="number"?ye.toLocaleString():"n/a"},fe=()=>{F("all"),L("15min"),M(""),G("")},Oe=h.useMemo(()=>{const W=new Map;for(const ye of ze){if(ye.scenarios.length>0){W.set(ye.id,G_(ye));continue}const ve=ye.configName?.trim()||"",ke=ye.configPath?.trim()||"",Ce=ve||ke;W.set(ye.id,{scenarioCount:ye.totalScenarios,agentCount:0,scopePreview:Ce||"n/a",modelSummary:""})}return W},[ze]),Ve=()=>{z(!0),qt("Ask me to compare runs, explain regressions over time, or summarize historical drift patterns.")},U=async W=>{N(!0);try{await n.deleteResult(W),o(ye=>ye.filter(ve=>ve.id!==W)),c(ye=>ye.filter(ve=>ve.id!==W)),ue.setTotalCount(ye=>Math.max(0,ye-1)),$e({title:"Run deleted",description:W}),b(null)}catch(ye){$e({title:"Could not delete run",description:ye instanceof Error?ye.message:String(ye),variant:"destructive"})}finally{N(!1)}},le=async W=>{if(!W.configPath?.trim()){$e({title:"Cannot rerun",description:"This run has no config path in metadata.",variant:"destructive"});return}De(W.id);try{await AU(n,W),$e({title:"Rerun queued",description:`${W.id} queued with previous run settings.`})}catch(ve){$e({title:"Could not rerun",description:ve instanceof Error?ve.message:String(ve),variant:"destructive"})}finally{De(ve=>ve===W.id?null:ve)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsx(Os,{open:y!==null,onOpenChange:W=>{!W&&!S&&b(null)},children:a.jsxs(Za,{children:[a.jsxs(es,{children:[a.jsx(ns,{children:"Delete run?"}),a.jsxs(rs,{children:["This will permanently remove the run artifacts from disk for"," ",a.jsx("span",{className:"font-mono",children:y??""}),"."]})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:S,children:"Cancel"}),a.jsx(as,{disabled:S||!y,onClick:W=>{W.preventDefault(),y&&U(y)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:S?"Deleting...":"Delete run"})]})]})}),a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(bl,{className:"h-6 w-6"}),"Results"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse evaluation runs and open detailed results"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(wi,{open:$,onOpenChange:Y,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":$,"aria-controls":"results-scenario-command-list",className:`w-[260px] justify-between font-normal ${P!=="all"?"border-primary/40":""}`,children:[a.jsx("span",{className:"truncate text-left",children:ln}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(Ro,{className:"w-[260px] p-0",align:"start",children:a.jsxs(Tl,{children:[a.jsx(Ol,{placeholder:"Search scenarios..."}),a.jsxs(Ml,{id:"results-scenario-command-list",children:[a.jsx(Il,{children:"No scenarios found."}),a.jsxs($l,{children:[a.jsx(Na,{value:"all scenarios",onSelect:()=>{T("all"),Y(!1)},children:"All scenarios"}),Zt.map(W=>a.jsx(Na,{value:`${W.label} ${W.value}`,onSelect:()=>{T(W.value),Y(!1)},children:W.label},W.value))]})]})]})})]}),a.jsxs(wi,{open:O,onOpenChange:Q,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":O,"aria-controls":"results-time-command-list",className:`w-[320px] justify-between font-normal ${H!=="all"?"border-primary/40":""}`,children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate text-left",children:[a.jsx(w5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:_e})]}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(Ro,{className:"w-[360px] p-0",align:"start",children:[a.jsxs("div",{className:"border-b px-3 py-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Date and time filter"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Filter runs by timestamp."})]}),a.jsxs("div",{id:"results-time-command-list",className:"grid gap-1 p-2",children:[a.jsx(Z,{type:"button",variant:H==="all"?"secondary":"ghost",className:"justify-start",onClick:()=>{fe(),Q(!1)},children:"All time"}),qa.map(W=>a.jsx(Z,{type:"button",variant:H==="last"&&X===W.value?"secondary":"ghost",className:"justify-start",onClick:()=>{F("last"),L(W.value),Q(!1)},children:W.label},W.value)),a.jsx(Z,{type:"button",variant:H==="custom"?"secondary":"ghost",className:"justify-start",onClick:()=>F("custom"),children:"Custom date time range"})]}),H==="custom"&&a.jsxs("div",{className:"space-y-3 border-t p-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{htmlFor:"results-time-filter-start",children:"Start"}),a.jsx(_t,{id:"results-time-filter-start",type:"datetime-local",value:I,onChange:W=>M(W.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{htmlFor:"results-time-filter-end",children:"End"}),a.jsx(_t,{id:"results-time-filter-end",type:"datetime-local",value:q,onChange:W=>G(W.target.value)})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"px-2",onClick:fe,children:[a.jsx(ca,{className:"mr-1.5 h-3.5 w-3.5"}),"Clear"]}),a.jsx(Z,{type:"button",size:"sm",onClick:()=>Q(!1),children:"Done"})]})]})]})]}),a.jsx(Z,{variant:"outline",onClick:()=>{at()},disabled:x,children:x?"Refreshing...":"Refresh"}),a.jsx(Z,{variant:"outline",onClick:ue.prev,disabled:x||se===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:ue.next,disabled:x||!oe,children:"Next"}),a.jsxs(Z,{type:"button",variant:"outline",className:"gap-1.5",onClick:Ve,children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"MCP Lab Assistant"]})]})]}),a.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:ue.rangeLabel(s.length)}),a.jsxs(Z,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs text-muted-foreground",onClick:()=>v(W=>!W),"aria-pressed":p,children:[a.jsx(gC,{className:"h-3 w-3"}),p?"Hide dashboard":"Show dashboard"]})]}),p?a.jsx("div",{className:"mt-2",children:a.jsx(Z0e,{runs:i,loading:f})}):null,a.jsxs("div",{className:`mt-4 grid gap-6 ${B?V?"xl:grid-cols-[minmax(0,1fr)_52rem]":"xl:grid-cols-[minmax(0,1fr)_30rem]":"grid-cols-1"}`,children:[a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(oa,{className:"table-fixed",children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-[25rem] max-w-[25rem]",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("id"),children:["Run ID",kt("id")]})}),a.jsx(ct,{className:"min-w-0",children:"Evaluation"}),a.jsx(ct,{className:"w-[11rem] min-w-[11rem] max-w-[11rem]",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("timestamp"),children:["Timestamp",kt("timestamp")]})}),a.jsx(ct,{className:"w-[7.5rem] min-w-[7.5rem] max-w-[7.5rem] text-center",children:a.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-end gap-1 hover:text-foreground",onClick:()=>ge("passRate"),children:["Pass Rate",kt("passRate")]})}),a.jsx(ct,{className:"w-[5.5rem] min-w-[5.5rem] max-w-[5.5rem] text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("scenarios"),children:["Scenarios",kt("scenarios")]})}),a.jsx(ct,{className:"w-[7.5rem] min-w-[7.5rem] max-w-[7.5rem] text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("avgToolCalls"),children:["Avg Tools",kt("avgToolCalls")]})}),a.jsx(ct,{className:"w-[9rem] min-w-[9rem] max-w-[9rem] text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>ge("toolTokens"),children:["Tool Tokens",kt("toolTokens")]})}),a.jsx(ct,{className:"w-[9rem] min-w-[9rem] max-w-[9rem]"})]})}),a.jsx(la,{children:Xe.length===0?a.jsx(Wt,{children:a.jsx(qe,{colSpan:DD,className:"px-4 py-10 text-center text-sm text-muted-foreground",children:H==="all"&&P==="all"?"No runs yet.":"No runs match current filters."})}):Xe.map((W,ye)=>W.type==="day-separator"?a.jsx(Wt,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(qe,{colSpan:DD,className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border/70"}),a.jsx("span",{className:"shrink-0 rounded-full border border-border bg-background px-2.5 py-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:W.dayLabel}),a.jsx("div",{className:"h-px flex-1 bg-border/70"})]})})},`day-${W.dayKey}-${ye}`):a.jsxs(Wt,{children:[a.jsx(qe,{className:"w-[25rem] max-w-[25rem]",children:a.jsxs("div",{className:"space-y-1",children:[a.jsx(Et,{to:`/results/${W.run.id}`,className:"font-mono text-xs text-primary hover:underline",children:W.run.id}),a.jsx("div",{className:"min-w-0 truncate font-mono text-xs text-foreground/80",title:Oe.get(W.run.id)?.scopePreview??"n/a",children:Oe.get(W.run.id)?.scopePreview??"n/a"}),W.run.runNote?a.jsxs("div",{className:"text-[11px] text-muted-foreground break-words",children:["Note: ",W.run.runNote]}):null]})}),a.jsx(qe,{className:"min-w-0 text-[11px] text-muted-foreground",children:(()=>{const ve=Oe.get(W.run.id)??{scenarioCount:0,agentCount:0,modelSummary:""};return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 items-baseline gap-1.5",children:[a.jsxs("span",{className:"shrink-0 whitespace-nowrap",children:[ve.scenarioCount," scenario",ve.scenarioCount===1?"":"s"," · ",ve.agentCount," ","agent",ve.agentCount===1?"":"s"]}),ve.modelSummary?a.jsxs("span",{className:"min-w-0 truncate",title:ve.modelSummary,children:["· ",ve.modelSummary]}):null]}),a.jsx(Su,{versions:W.run.mcpServerVersions,showPrefix:!1,className:"max-w-[18rem]"})]})})()}),a.jsx(qe,{className:"w-[11rem] min-w-[11rem] max-w-[11rem] text-xs text-muted-foreground",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(W.run.timestamp).toLocaleString()]}),(()=>{const ve=Ig(W.run);return ve===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Total time: ",aa(ve)]})})()]})}),a.jsx(qe,{className:"w-[7.5rem] min-w-[7.5rem] max-w-[7.5rem] text-right",children:a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Ws,{rate:W.run.overallPassRate}),W.run.checkCounts&&W.run.checkCounts.total>0?a.jsxs("span",{className:"font-mono text-[11px] leading-none","aria-label":`${W.run.checkCounts.passed} checks passed, ${W.run.checkCounts.failed} checks failed`,title:`${W.run.checkCounts.passed} passed · ${W.run.checkCounts.failed} failed${W.run.checkCounts.not_evaluated>0?` · ${W.run.checkCounts.not_evaluated} not evaluated`:""}`,children:[a.jsxs("span",{className:"text-success",children:[W.run.checkCounts.passed," ✓"]}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{className:"text-destructive",children:[W.run.checkCounts.failed," ✕"]})]}):null,a.jsx(e4,{run:W.run})]})}),a.jsx(qe,{className:"w-[5.5rem] min-w-[5.5rem] max-w-[5.5rem] text-right font-mono text-sm",children:W.run.totalScenarios}),a.jsx(qe,{className:"w-[7.5rem] min-w-[7.5rem] max-w-[7.5rem] text-center font-mono text-sm",children:W.run.avgToolCalls.toFixed(0)}),a.jsx(qe,{className:"w-[9rem] min-w-[9rem] max-w-[9rem] text-right",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"font-mono text-sm",children:vt(W.run)}),(()=>{const ve=$g(W.run);return ve===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Tool time: ",aa(ve)]})})()]})}),a.jsx(qe,{className:"w-[9rem] min-w-[9rem] max-w-[9rem]",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsxs(Z,{size:"sm",variant:"outline",disabled:de===W.run.id,onClick:()=>{le(W.run)},children:[a.jsx(ks,{className:"mr-1.5 h-3.5 w-3.5"}),de===W.run.id?"Queueing...":"Rerun"]}),a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"More actions",children:a.jsx(Bg,{className:"h-4 w-4"})})}),a.jsxs(Bu,{align:"end",children:[a.jsx(Mr,{asChild:!0,children:a.jsxs(Et,{to:`/results/${W.run.id}`,children:[a.jsx(S5,{className:"mr-2 h-3.5 w-3.5"}),"View"]})}),Object.entries(W.run.langsmithTraceUrls??{}).map(([ve,ke])=>a.jsx(Mr,{asChild:!0,children:a.jsxs("a",{href:ke,target:"_blank",rel:"noreferrer",children:[a.jsx(Vc,{className:"mr-2 h-3.5 w-3.5"}),"LangSmith trace"]})},ve)),a.jsxs(Mr,{children:[a.jsx(zr,{className:"mr-2 h-3.5 w-3.5"}),"Export JSON"]}),a.jsxs(Mr,{className:"text-destructive",onSelect:ve=>{ve.preventDefault();const ke=document.activeElement;ke instanceof HTMLElement&&ke.blur(),b(W.run.id)},children:[a.jsx(Xa,{className:"mr-2 h-3.5 w-3.5"}),"Delete"]})]})]})]})})]},W.run.id))})]})})}),B&&a.jsx(_U,{title:"MCP Lab Assistant",description:"Analyze historical differences and trends across all result runs.",expanded:V,onToggleExpanded:()=>ee(W=>!W),onHide:()=>z(!1),messages:tt,pendingToolCalls:it,loading:Ge,onCancel:Ee?Re:void 0,input:At,onInputChange:Ft,onSend:()=>{zt()},inputPlaceholder:"Ask about historical run differences...",snippets:swe,onSnippetSelect:W=>{z(!0),an(W)},onApproveToolCall:W=>{jt(W)},onDenyToolCall:W=>{rn(W)},chatEndRef:Ze,inputRef:ht,className:"min-w-0 overflow-hidden xl:flex xl:h-[calc(100vh-14rem)] xl:min-h-0 xl:flex-col",renderMessage:({message:W,index:ye,linkedPendingToolCall:ve,isUser:ke,isAssistant:Ce,isSystem:K,isTool:pe})=>{const Ae=Ce&&!!W.pendingToolCallId;if(pe&&/^(Approved|Denied) tool call\b/i.test(String(W.text??"").trim()))return null;if(Ae){const Ke=mm(ve?.tool??W.toolRequestName??ve?.publicToolName??W.toolRequestPublicName??"unknown_tool");return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("details",{open:!!ve,className:"group min-w-0 w-full max-w-[92%] overflow-hidden rounded-md border border-border/60 bg-background",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ua,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:`Tool call ${Ke}`}),a.jsx("span",{className:`shrink-0 whitespace-nowrap rounded px-1.5 py-0.5 text-[10px] font-semibold ${ve?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"}`,children:ve?"Needs approval":"Completed"})]})}),a.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsx("div",{className:"min-w-0 space-y-2 border-t border-border/50 px-3 py-2",children:a.jsx(Ga,{text:W.text,className:"text-sm"})})]})]},`${W.id??`${W.role}-${ye}`}:tool`)}return a.jsxs("div",{className:`flex items-start gap-2 ${ke?"justify-end":"justify-start"}`,children:[!ke&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:K?a.jsx(vC,{className:"h-3 w-3"}):a.jsx(Wr,{className:"h-3 w-3"})}),a.jsx("div",{className:`min-w-0 max-w-[92%] break-words rounded-md border p-3 text-sm ${ke?"border-primary/20 bg-primary/10":K?"border-amber-400/30 bg-amber-50/70":pe?"border-blue-300/30 bg-blue-50/50":"border-border/80 bg-background shadow-sm"}`,children:ke?a.jsx("p",{className:"whitespace-pre-wrap",children:W.text}):a.jsx(Ga,{text:W.text,className:"text-sm"})}),ke&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(Kc,{className:"h-3 w-3"})})]},W.id??`${W.role}-${ye}`)}})]})]})};function iwe(e){const t=e.scenarios.reduce((c,u)=>c+u.runs.filter(f=>f.passed).length,0),n=e.totalRuns-t,r={};e.scenarios.forEach(c=>c.runs.forEach(u=>u.toolCalls.forEach(f=>{r[f.name]=(r[f.name]||0)+1})));const s=Object.keys(r),o=Object.values(r),i=e.scenarios.map(c=>`
158
158
  <div class="scenario-card">
159
159
  <div class="scenario-header" onclick="this.parentElement.classList.toggle('open')">
160
160
  <span class="chevron">▶</span>
@@ -254,5 +254,5 @@ new Chart(document.getElementById('pieChart'),{type:'doughnut',data:{labels:['Pa
254
254
  new Chart(document.getElementById('barChart'),{type:'bar',data:{labels:${JSON.stringify(s)},datasets:[{data:${JSON.stringify(o)},backgroundColor:'#f59e0b',borderRadius:4}]},options:{indexAxis:'y',plugins:{legend:{display:false}},scales:{x:{grid:{display:false}},y:{grid:{display:false},ticks:{font:{family:'monospace',size:11}}}}}});
255
255
  <\/script>
256
256
  </body>
257
- </html>`}function al(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const lwe="mcplab.resultAssistantScenarioHandoff",cwe=[{label:"Summarize Run Results",description:"Highlight failures first, then notable tool usage and extracted values.",prompt:"Summarize the scenario results in this run. Highlight failed scenarios/checks first, then mention notable tool usage and extracted values."},{label:"Compare Agent Answer Quality",description:"Rank agents by completeness, depth, and recommendation quality.",prompt:"Compare the answer quality across all agents for this run. Rank them by completeness, analytical depth, and usefulness of recommendations. Highlight concrete differences in tool usage."},{label:"Explain Key Failures",description:"Use traces and tool outputs to identify likely root causes.",prompt:"Identify the most important failures in this run and explain likely root causes using the trace and tool outputs."},{label:"Compare With Previous Run",description:"Summarize changes in outcomes, tool usage, and extracted values.",prompt:"Compare this run with the previous run and summarize changes in outcomes, tool usage, and extracted values."}];function LD(e){const t=new Date().toISOString().replace(/[:]/g,"-").replace(/\..+/,"");return`mcplab/reports/result-assistant/${e}-${t}.md`}function FD(e){const t=e.toFixed(1);return t.endsWith(".0")?t.slice(0,-2):t}const uwe=()=>{const{id:e}=Bl(),t=is(),[n]=zo(),{source:r}=$n(),s=n.get("embed")==="1",{configs:o}=up(),{scenarios:i}=Is(),[c,u]=h.useState(void 0),[f,m]=h.useState(!0),[p,v]=h.useState(!1),[x,j]=h.useState(""),[y,b]=h.useState(!1),[S,N]=h.useState(new Set),[C,k]=h.useState(new Set),[A,E]=h.useState(""),[P,T]=h.useState(!1),[$,Y]=h.useState(!1),[H,F]=h.useState("assistant"),[X,L]=h.useState(null),[I,M]=h.useState(!1),[q,G]=h.useState(""),[O,Q]=h.useState(""),[B,z]=h.useState(!1),[V,ee]=h.useState(!1),[ae,ue]=h.useState(!1),[se,xe]=h.useState([]),[oe,de]=h.useState(!1),[De,me]=h.useState(""),[ge,we]=h.useState(null),[at,tt]=h.useState(!1),[it,At]=h.useState(null),[Ge,Ee]=h.useState(!1),[Re,Ze]=h.useState(!1),[ht,Ft]=h.useState(!1),zt=h.useRef(null),[jt,rn]=h.useState(!1),{assistantMessages:an,assistantPendingToolCalls:qt,assistantInput:Zt,assistantLoading:sn,assistantTurnCancelable:ln,cancelAssistantTurn:ke,assistantChatEndRef:ze,assistantInputRef:Xe,setAssistantInput:kt,askAssistant:vt,approveResultAssistantToolCall:fe,denyResultAssistantToolCall:Oe,applyResultAssistantSnippet:Ve,ensureIntroMessage:U,resetAssistantSession:le}=kU({source:r,open:P,scope:"run",runId:e,onSessionSync:void 0}),W=h.useCallback(async(ne,Ne)=>{de(!0);try{const Nt=(await r.listMarkdownReports()).filter(jn=>{const bn=String(jn.relativePath??""),mn=String(jn.name??"");return bn.includes(ne)||mn.includes(ne)});if(xe(Nt),Ne&&Nt.length>0){const jn=Nt.find(bn=>bn.relativePath===Ne||bn.path===Ne||bn.relativePath.endsWith(Ne)||bn.path.endsWith(Ne));jn&&me(jn.relativePath)}return Nt}catch{return xe([]),[]}finally{de(!1)}},[r]);h.useEffect(()=>{if(!e)return;let ne=!0;return le(),m(!0),r.getResult(e).then(Ne=>{ne&&(u(Ne),j(Ne?.runNote??""),v(!1),m(!1))}),()=>{ne=!1}},[e,r,le]),h.useEffect(()=>{const ne=zt.current;if(!ne)return;const Ne=()=>{rn(ne.clientWidth<800)};if(Ne(),typeof ResizeObserver<"u"){const pt=new ResizeObserver(()=>Ne());return pt.observe(ne),()=>pt.disconnect()}return window.addEventListener("resize",Ne),()=>window.removeEventListener("resize",Ne)},[f]),h.useEffect(()=>{if(!c?.id){xe([]);return}let ne=!0;return(async()=>{const Ne=await W(c.id)})(),()=>{ne=!1}},[c?.id,W]),h.useEffect(()=>{if(se.length===0){me(""),we(null),At(null);return}(!De||!se.some(ne=>ne.relativePath===De))&&me(se[0].relativePath)},[se,De]),h.useEffect(()=>{if(!P||H!=="reports")return;if(!De){we(null),At(null);return}let ne=!0;return tt(!0),At(null),r.getMarkdownReport(De).then(Ne=>{ne&&we(Ne)}).catch(Ne=>{ne&&(we(null),At(Ne instanceof Error?Ne.message:String(Ne)))}).finally(()=>{ne&&tt(!1)}),()=>{ne=!1}},[P,H,De,r]);const ye=n.get("configId")??"",ve=(n.get("agent")??"").trim(),Ce=h.useMemo(()=>{const ne=ye?o.find(nn=>nn.id===ye):void 0;if(ne)return ne;if(!c)return;const Ne=c.configPath?.trim(),pt=c.configName?.trim(),Nt=o.find(nn=>nn.id===c.configId);if(Nt)return Nt;const jn=nn=>[nn.relativePath,nn.sourcePath,nn.suitePath],bn=Ne?o.find(nn=>jn(nn).some(sr=>sr?.trim()===Ne)):void 0;if(bn)return bn;const mn=Ne?o.find(nn=>jn(nn).some(sr=>sr?.endsWith(`/${Ne}`)===!0)):void 0;return mn||o.find(nn=>pt?nn.name===pt||nn.configName===pt:!1)},[o,ye,c]),_e=h.useMemo(()=>{const ne=c?.configName?.trim();if(ne)return ne;const Ne=c?.configPath?.trim();if(Ne)return Ne;const pt=Ce?.relativePath?.trim()||Ce?.name?.trim();return pt||c?.configId?.trim()||""},[c,Ce]),K=h.useMemo(()=>{const ne=c?.configName?.trim();return ne||Ce?.name?.trim()||""},[c,Ce]),pe=h.useMemo(()=>{const ne=c?.configPath?.trim();return ne||Ce?.relativePath?.trim()||""},[c,Ce]),Ae=h.useMemo(()=>{const ne=new Map;if(Ce){for(const Ne of Ce.scenarios)ne.set(Ne.id,Ne),Ne.name&&!ne.has(Ne.name)&&ne.set(Ne.name,Ne);for(const Ne of Ce.scenarioEntries??[]){if(Ne.kind!=="referenced")continue;const pt=i.find(Nt=>Nt.id===Ne.ref);pt&&(ne.set(pt.id,pt),pt.name&&ne.set(pt.name,pt),ne.has(Ne.ref)||ne.set(Ne.ref,pt))}}for(const Ne of i)ne.has(Ne.id)||ne.set(Ne.id,Ne),Ne.name&&!ne.has(Ne.name)&&ne.set(Ne.name,Ne);return ne},[Ce,i]),Ke=h.useMemo(()=>"",[]);h.useEffect(()=>{if(ye&&o.some(ne=>ne.id===ye)){E(ye);return}Ke&&E(ne=>ne||Ke)},[ye,o,Ke]);const{filteredScenarios:te,filteredTotalRuns:Le,filteredPassCount:ot,displayPassRate:Ut,displayAvgToolCalls:Te,displayAvgLatency:Qt,displayDurationMs:St,displayToolTimeMs:Gt,displayToolTokenUsage:Xn}=h.useMemo(()=>{if(!c)return{filteredScenarios:[],filteredTotalRuns:0,filteredPassCount:0,displayPassRate:0,displayAvgToolCalls:0,displayAvgLatency:0,displayDurationMs:null,displayToolTimeMs:null,displayToolTokenUsage:null};const ne=ve?c.scenarios.filter(mn=>mn.agentId===ve||mn.agentName===ve):c.scenarios,Ne=ne.reduce((mn,nn)=>mn+nn.runs.length,0),pt=ne.reduce((mn,nn)=>mn+nn.runs.filter(sr=>sr.passed).length,0),Nt=ne.reduce((mn,nn)=>mn+nn.runs.reduce((sr,Ct)=>sr+Ct.toolCalls.length,0),0),jn=Ig({...c,scenarios:ne}),bn=$g({...c,scenarios:ne});return{filteredScenarios:ne,filteredTotalRuns:Ne,filteredPassCount:pt,displayPassRate:Ne===0?0:pt/Ne,displayAvgToolCalls:Ne===0?0:Nt/Ne,displayAvgLatency:Ne===0||jn===null?0:Math.round(jn/Ne),displayDurationMs:jn,displayToolTimeMs:bn,displayToolTokenUsage:HQ(ne.map(mn=>mn.toolTokenUsage))}},[c,ve]),zn=h.useMemo(()=>{const ne={};return te.forEach(Ne=>Ne.runs.forEach(pt=>pt.toolCalls.forEach(Nt=>{ne[Nt.name]=(ne[Nt.name]||0)+1}))),Object.entries(ne).map(([Ne,pt])=>({name:Ne,count:pt})).sort((Ne,pt)=>pt.count-Ne.count)},[te]);if(f)return a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Loading result..."});if(!c)return a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Result not found"});const Ra=h1(te.flatMap(ne=>ne.runs.flatMap(Ne=>Ne.checkResults??[]))),Xl=ne=>{N(Ne=>{const pt=new Set(Ne);return pt.has(ne)?pt.delete(ne):pt.add(ne),pt})},Bn=(ne,Ne,pt,Nt)=>`${ne}:${Ne}:${pt}:${Nt}`,Li=(ne,Ne)=>`${ne}::${Ne}`,pa=ne=>{k(Ne=>{const pt=new Set(Ne);return pt.has(ne)?pt.delete(ne):pt.add(ne),pt})},jr=ne=>{const Ne=!ne.endsWith(":conversation");return C.has(ne)?!Ne:Ne},io=(ne,Ne)=>{F("assistant"),T(!0),L(Ne?.scenarioId??null),U("Ask me to explain failures, tool usage, or suggest what to inspect next in this result."),ne&&kt(ne)},Fi=qt.filter(ne=>ne.status==="pending"&&!an.some(Ne=>Ne.pendingToolCallId===ne.id)),Wu=ne=>{F("reports"),T(!0)},En=()=>{F("note"),T(!0)},Hu=ne=>{if(!c)return;if(!X){$e({title:"No scenario context",description:"Ask about a specific scenario or run first, then send the suggestion.",variant:"destructive"});return}const Ne=i.find(Nt=>Nt.id===X)??i.find(Nt=>Nt.name===X);if(!Ne){$e({title:"Scenario not found in library",description:`Could not find library scenario '${X}' to open in Scenario Assistant.`,variant:"destructive"});return}const pt=[`I am sending a suggestion from the Result Assistant for scenario '${X}' based on run '${c.id}'.`,"Please review the suggestion, check it against the current scenario configuration, and propose concrete updates to the Checks and/or Value Capture Rules if appropriate.","","Result Assistant suggestion:",ne].join(`
258
- `);try{window.sessionStorage.setItem(lwe,JSON.stringify({type:"result-assistant-handoff-v1",runId:c.id,configId:ye||c.configId||"",scenarioId:Ne.id,prompt:pt,sourceReply:ne})),t(`/libraries/test-cases/${encodeURIComponent(Ne.id)}?assistantHandoff=1`)}catch(Nt){$e({title:"Could not create handoff",description:Nt instanceof Error?Nt.message:String(Nt),variant:"destructive"})}},Vo=ne=>{c&&(ue(!1),G(ne),Q(LD(c.id)),z(!1),M(!0))},ie=()=>{c&&(ue(!0),G(""),Q(LD(c.id)),z(!1),M(!0))},rt=async()=>{if(!c)return;if(!q.trim()){$e({title:"No markdown to write",description:"The selected assistant response is empty.",variant:"destructive"});return}ee(!0);try{const Ne=await r.applyResultAssistantReport({runId:c.id,markdown:q,outputPath:O.trim()||void 0,overwrite:B});$e({title:"Markdown report written",description:typeof Ne.path=="string"&&Ne.path?Ne.path:Ne.outputPath}),await W(c.id,typeof Ne.path=="string"&&Ne.path||Ne.outputPath||void 0),P&&F("reports"),M(!1)}catch(Ne){$e({title:"Could not write markdown report",description:Ne instanceof Error?Ne.message:String(Ne),variant:"destructive"})}finally{ee(!1)}},Yt=async ne=>{try{await navigator.clipboard.writeText(ne),$e({title:"Copied"})}catch(Ne){$e({title:"Could not copy",description:Ne instanceof Error?Ne.message:String(Ne),variant:"destructive"})}},Pt=async()=>{if(c){b(!0);try{const ne=x.trim();await r.updateRunNote(c.id,ne||void 0),u(Ne=>Ne&&{...Ne,runNote:ne||void 0}),j(ne),v(!1),$e({title:"Run note saved"})}catch(ne){$e({title:"Could not save run note",description:ne instanceof Error?ne.message:String(ne),variant:"destructive"})}finally{b(!1)}}},Lt=async()=>{if(c?.id){Ze(!0);try{await r.deleteResult(c.id),$e({title:"Run deleted",description:c.id}),t("/results")}catch(ne){$e({title:"Could not delete run",description:ne instanceof Error?ne.message:String(ne),variant:"destructive"})}finally{Ze(!1),Ee(!1)}}},tn=async()=>{if(!c?.id)return;if(!pe.trim()){$e({title:"Cannot rerun",description:"This run has no config path in metadata.",variant:"destructive"});return}Ft(!0);try{await AU(r,c),$e({title:"Rerun queued",description:`${c.id} queued with previous run settings.`})}catch(Ne){$e({title:"Could not rerun",description:Ne instanceof Error?Ne.message:String(Ne),variant:"destructive"})}finally{Ft(!1)}};return a.jsxs("div",{className:`${P?"xl:flex xl:h-[calc(100vh-2rem-48px)] xl:min-h-0 xl:flex-col xl:overflow-hidden":""}`,children:[a.jsx("div",{className:`${P?"xl:shrink-0 xl:pb-6":"mb-6"}`,children:a.jsxs("div",{ref:zt,className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[!s&&a.jsx(Z,{variant:"ghost",size:"icon",asChild:!0,children:a.jsx(Et,{to:"/results",children:a.jsx(Si,{className:"h-4 w-4"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"text-2xl font-bold font-mono",children:c.id}),a.jsx(Ws,{rate:Ut})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[a.jsx(oP,{className:"h-3 w-3 shrink-0"}),new Date(c.timestamp).toLocaleString()]}),a.jsx("span",{className:"mx-1",children:"·"}),ve?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Agent: ",ve]}),a.jsx("span",{className:"mx-1",children:"·"})]}):null,K?a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Eval: ",a.jsx("span",{className:"ml-1 font-medium",children:K})]}):null,K&&pe?a.jsx("span",{className:"mx-1",children:"·"}):null,pe?a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Path: ",a.jsx("span",{className:"ml-1 font-mono",children:pe})]}):null,!K&&!pe&&_e?a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Config: ",a.jsx("span",{className:"ml-1 font-mono",children:_e})]}):null]})]})]}),a.jsxs("div",{className:"flex w-full min-w-0 items-center justify-between gap-2 sm:ml-auto sm:w-auto",children:[a.jsx(Su,{versions:c.mcpServerVersions}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:[Object.entries(c.langsmithTraceUrls??{}).map(([ne,Ne])=>a.jsxs("a",{href:Ne,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-input bg-background px-3 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground","aria-label":"LangSmith trace",title:"Open LangSmith trace",children:[a.jsx(Vc,{className:"h-3.5 w-3.5"}),!s&&"LangSmith trace"]},ne)),a.jsxs(Z,{variant:"outline",size:"sm",className:`max-w-full gap-1.5 ${s?"px-2":""}`,onClick:()=>{const ne=iwe(c),Ne=new Blob([ne],{type:"text/html"}),pt=URL.createObjectURL(Ne),Nt=document.createElement("a");Nt.href=pt,Nt.download=`mcplab-report-${c.id}.html`,Nt.click(),URL.revokeObjectURL(pt)},"aria-label":"Download Report",title:"Download Report",children:[a.jsx(zr,{className:"h-3.5 w-3.5"}),!s&&"Download Report"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5",onClick:()=>Wu(),disabled:oe,children:[a.jsx(Rc,{className:"h-3.5 w-3.5"}),oe?"Reports...":`Reports${se.length?` (${se.length})`:""}`]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5","aria-label":"Run Note",onClick:()=>En(),children:[a.jsx(Rc,{className:"h-3.5 w-3.5"}),jt?"Note":"Run Note"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5","aria-label":"MCP Lab Assistant",onClick:()=>io(),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),jt?"Assistant":"MCP Lab Assistant"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5",onClick:()=>{tn()},disabled:ht||!pe.trim(),children:[a.jsx(ks,{className:"h-3.5 w-3.5"}),ht?"Queueing...":"Rerun"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5 text-destructive",onClick:()=>Ee(!0),disabled:Re,"aria-label":Re?"Deleting run":"Delete run",children:[Re?a.jsx(_r,{className:"h-4 w-4 animate-spin"}):a.jsx(ll,{className:"h-4 w-4"}),jt?null:Re?"Deleting...":"Delete"]})]})]})]})}),a.jsxs("div",{className:`grid gap-6 items-start ${P?$?"xl:grid-cols-[minmax(0,1fr)_52rem] xl:flex-1 xl:min-h-0 xl:overflow-hidden":"xl:grid-cols-[minmax(0,1fr)_28rem] xl:flex-1 xl:min-h-0 xl:overflow-hidden":"grid-cols-1"}`,children:[a.jsxs("div",{className:`min-w-0 space-y-6 ${P?"xl:h-full xl:min-h-0 xl:overflow-y-auto xl:pr-2":""}`,children:[a.jsxs("div",{className:`grid gap-4 ${P?"grid-cols-3":"sm:grid-cols-2 lg:grid-cols-8"}`,children:[a.jsx(nr,{title:"Scenarios",value:te.length,icon:gm}),a.jsx(nr,{title:"Total Runs",value:Le,icon:hC}),a.jsx(nr,{title:"Pass Rate",value:`${Math.round(Ut*100)}%`,icon:bl}),a.jsx(nr,{title:"Avg Tool Calls",value:FD(Te),icon:Va}),a.jsx(nr,{title:"Avg Latency",value:`${Qt}ms`,icon:bC}),St!==null?a.jsx(nr,{title:"Total Time",value:aa(St),icon:Ea}):null,Gt!==null?a.jsx(nr,{title:"Tool Duration",value:aa(Gt),icon:Ea}):null,a.jsx(nr,{title:"Tool Tokens",value:ta(Xn?.totalTokens),icon:Ua})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-4",children:[a.jsx(Dg,{title:"Runs Pass / Fail",passed:ot,failed:Math.max(0,Le-ot)}),a.jsx(Dg,{title:"Checks Pass / Fail",passed:Ra.passed,failed:Ra.failed,notEvaluated:Ra.not_evaluated}),a.jsxs(Qe,{className:"lg:col-span-2",children:[a.jsx($t,{className:"p-2.5 pb-0",children:a.jsx(Dt,{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Tool Usage"})}),a.jsx(Je,{children:a.jsx(hf,{width:"100%",height:120,children:a.jsxs(oge,{data:zn,layout:"vertical",children:[a.jsx(_i,{type:"number",tick:{fontSize:11}}),a.jsx(ki,{type:"category",dataKey:"name",tick:{fontSize:11},width:120}),a.jsx(ra,{}),a.jsx(Kl,{dataKey:"count",fill:"hsl(38, 92%, 50%)",radius:[0,4,4,0]})]})})})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(Dt,{className:"text-base",children:"Scenarios"}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1.5 px-2 text-xs",onClick:()=>io("Summarize the scenario results in this run. Highlight failed scenarios/checks first, then mention notable tool usage and extracted values."),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"Ask Assistant"]})]})}),a.jsx(Je,{className:"p-0",children:a.jsxs(oa,{children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-8"}),a.jsx(ct,{children:"Scenario"}),a.jsx(ct,{children:"Agent"}),a.jsx(ct,{children:"Runs"}),a.jsx(ct,{children:"Pass Rate"}),a.jsx(ct,{children:"Checks"}),a.jsx(ct,{className:"text-right",children:"Total Time"}),a.jsx(ct,{className:"text-right",children:"Tool Calls"}),a.jsx(ct,{className:"text-right",children:"Tool Tokens"}),a.jsx(ct,{className:"text-right",children:"Tool Duration"})]})}),a.jsx(la,{children:te.map(ne=>{const Ne=Li(ne.scenarioId,ne.agentName),pt=ne.scenarioName||ne.scenarioId,Nt=h1(ne.runs.flatMap(Ct=>Ct.checkResults??[])),jn=ne.runs.some(Ct=>(Ct.checkResults?.length??0)>0),bn=Ce?.id||c?.configId?.trim(),mn=bn?`/mcp-evaluations/${encodeURIComponent(bn)}/scenarios`:null,nn=i.find(Ct=>Ct.id===ne.scenarioId),sr=nn?`/libraries/test-cases/${encodeURIComponent(nn.id)}?returnTo=${encodeURIComponent(`/results/${c?.id??e}`)}`:null;return a.jsx(Ss,{open:S.has(Ne),onOpenChange:()=>Xl(Ne),asChild:!0,children:a.jsxs(a.Fragment,{children:[a.jsx(Ba,{asChild:!0,children:a.jsxs(Wt,{className:"cursor-pointer hover:bg-muted/50",children:[a.jsx(qe,{children:a.jsx(Jt,{className:`h-4 w-4 transition-transform ${S.has(Ne)?"rotate-180":""}`})}),a.jsx(qe,{className:"font-medium text-sm",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{children:ne.scenarioName}),mn?a.jsx(Et,{to:mn,"aria-label":"Edit scenario",title:"Edit scenario",className:"inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",onClick:Ct=>Ct.stopPropagation(),children:a.jsx(Zf,{className:"h-3.5 w-3.5"})}):null]})}),a.jsxs(qe,{className:"text-sm",children:[a.jsx("div",{children:ne.agentName}),ne.provider||ne.model?a.jsx("div",{className:"text-xs text-muted-foreground",children:[ne.provider?Yf(ne.provider):null,ne.model].filter(Boolean).join(" · ")}):null]}),a.jsx(qe,{className:"font-mono text-sm",children:ne.runs.length}),a.jsx(qe,{children:a.jsx(Ws,{rate:ne.passRate})}),a.jsx(qe,{className:"font-mono text-sm",children:jn?a.jsxs("span",{title:`${Nt.passed} passed · ${Nt.failed} failed${Nt.not_evaluated?` · ${Nt.not_evaluated} not evaluated`:""}`,"aria-label":`${Nt.passed} checks passed, ${Nt.failed} checks failed${Nt.not_evaluated?`, ${Nt.not_evaluated} not evaluated`:""}`,children:[a.jsxs("span",{className:"text-success",children:[Nt.passed," ✓"]}),a.jsx("span",{className:"text-muted-foreground",children:" "}),a.jsxs("span",{className:"text-destructive",children:[Nt.failed," ✕"]}),Nt.not_evaluated>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground",children:" "}),a.jsxs("span",{children:[Nt.not_evaluated," ?"]})]})]}):"—"}),a.jsx(qe,{className:"text-right font-mono text-sm",children:aa(nC(ne),{preciseUnderTenSeconds:!0})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:FD(ne.avgToolCalls)}),a.jsx(qe,{className:"text-right font-mono text-sm",children:ta(ne.toolTokenUsage?.totalTokens)}),a.jsx(qe,{className:"text-right font-mono text-sm",children:aa(rC(ne),{preciseUnderTenSeconds:!0})})]})}),a.jsx(Ns,{asChild:!0,children:a.jsx("tr",{children:a.jsx("td",{colSpan:10,className:"p-0",children:a.jsxs("div",{className:"bg-muted/30 p-4 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border bg-card px-3 py-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs font-semibold",children:"Scenario details"}),a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[pt," · ",ne.agentName," ·"," ",Math.round(ne.passRate*100),"% pass rate ·"," ",jn?`Checks ${Nt.passed} ✓ · ${Nt.failed} ✕ · `:"",ta(ne.toolTokenUsage?.totalTokens)," tool tokens ·"," ",aa(nC(ne),{preciseUnderTenSeconds:!0})," ","total time ·"," ",aa(rC(ne),{preciseUnderTenSeconds:!0})," ","tool time"]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[sr?a.jsx(Z,{asChild:!0,type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs text-muted-foreground",children:a.jsxs(Et,{to:sr,"aria-label":"Edit test case",children:[a.jsx(mC,{className:"h-3.5 w-3.5"}),"Edit test case"]})}):null,a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>io(`Explain why scenario '${pt}' failed (agent: ${ne.agentName}). Summarize the likely cause from the result details and suggest what to inspect next.`,{scenarioId:ne.scenarioId}),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"Ask Assistant"]})]})]}),ne.runs.map(Ct=>a.jsxs("div",{className:"flex items-start gap-3 rounded-md border bg-card p-3 text-sm",children:[a.jsx("div",{className:"mt-0.5",children:Ct.passed?a.jsx(Va,{className:"h-4 w-4 text-success"}):a.jsx(ll,{className:"h-4 w-4 text-destructive"})}),a.jsxs("div",{className:"flex-1 space-y-1",children:[(()=>{const Zn=Ae.get(ne.scenarioId),Vn=Zn?pwe(Zn.evalRules,Ct.failureReasons,Ct.error,Ct.checkResults):[],Ir=Vn.filter(qn=>qn.status==="failed"),Ds=Vn.filter(qn=>qn.status==="passed"),us=Vn.filter(qn=>qn.status==="not_evaluated");return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["Run #",Ct.runIndex+1]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ct.duration,"ms"]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[ta(Ct.toolTokenUsage?.totalTokens)," ","tool tokens"]}),!Ct.passed&&a.jsx(et,{variant:"outline",className:"h-5 border-destructive/30 bg-destructive/10 text-destructive text-[10px]",children:"Failed"})]}),Ct.failureReasons.length>0&&a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-2",children:[a.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-destructive",children:[a.jsx(ll,{className:"h-3.5 w-3.5"}),"Failure reasons"]}),a.jsx("ul",{className:"space-y-1 text-xs text-destructive",children:Ct.failureReasons.map((qn,zi)=>a.jsxs("li",{children:["• ",UD(qn)]},zi))})]}),Vn.length>0&&a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"checks")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"checks")),children:a.jsxs("div",{className:"rounded-md border bg-muted/20 p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full flex-wrap items-center gap-2 text-left",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"checks"))?"rotate-180":""}`}),a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Checks"}),a.jsxs(et,{variant:"outline",className:"h-5 border-success/30 bg-success/10 text-success text-[10px]",children:[Ds.length," passed"]}),a.jsxs(et,{variant:"outline",className:`h-5 text-[10px] ${Ir.length>0?"border-destructive/30 bg-destructive/10 text-destructive":""}`,children:[Ir.length," failed"]}),us.length>0&&a.jsxs(et,{variant:"outline",className:"h-5 border-muted-foreground/30 bg-muted text-[10px] text-muted-foreground",children:[us.length," not evaluated"]})]})}),a.jsxs(Ns,{children:[us.length>0&&a.jsx("p",{className:"mb-2 text-[11px] text-muted-foreground",children:"Checks were not evaluated because this run failed before evaluation."}),a.jsx("div",{className:"space-y-1",children:Vn.map((qn,zi)=>a.jsxs("div",{className:`flex items-start justify-between gap-2 rounded-md border px-2 py-1.5 text-xs ${qn.status==="failed"?"border-destructive/20 bg-destructive/5":qn.status==="not_evaluated"?"border-muted-foreground/20 bg-muted/40":"border-success/20 bg-success/5"}`,children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[qn.status==="failed"?a.jsx(ll,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):qn.status==="not_evaluated"?a.jsx(oP,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):a.jsx(Va,{className:"h-3.5 w-3.5 shrink-0 text-success"}),a.jsx("span",{className:"font-medium",children:cx(qn.rule)})]}),qn.failureReason&&a.jsx("p",{className:"mt-1 pl-5 text-[11px] text-muted-foreground",children:UD(qn.failureReason)})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${qn.status==="failed"?"border-destructive/30 text-destructive":qn.status==="not_evaluated"?"border-muted-foreground/30 text-muted-foreground":"border-success/30 text-success"}`,children:qn.status})]},`${qn.rule.type}-${qn.rule.value??qn.rule.path??""}-${zi}`))})]})]})})]})})(),a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"extracts")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"extracts")),children:a.jsxs("div",{className:"rounded-md border border-violet-500/20 bg-violet-500/5 p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full flex-wrap items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"extracts"))?"rotate-180":""}`}),a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(gm,{className:"h-3.5 w-3.5 text-violet-600"}),"Extracted values"]})]}),a.jsxs(et,{variant:"outline",className:"h-5 text-[10px]",children:[Object.keys(Ct.extractedValues??{}).length," ","total"]})]})}),a.jsx(Ns,{children:Object.keys(Ct.extractedValues??{}).length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No extracted values captured for this run."}):a.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:Object.entries(Ct.extractedValues??{}).map(([Zn,Vn])=>a.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5 text-xs",children:[a.jsx("div",{className:"mb-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:Zn}),a.jsx("div",{className:"font-mono break-all text-foreground",children:Vn===null?"null":String(Vn)})]},Zn))})})]})}),a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"tools")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"tools")),children:a.jsxs("div",{className:"rounded-md border border-sky-500/20 bg-sky-500/5 p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full flex-wrap items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"tools"))?"rotate-180":""}`}),a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(Ua,{className:"h-3.5 w-3.5 text-sky-600"}),"Tool call sequence"]})]}),a.jsxs(et,{variant:"outline",className:"h-5 text-[10px]",children:[Ct.toolCalls.length," total"]})]})}),a.jsx(Ns,{children:Ct.toolCalls.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No tool calls captured for this run."}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"flex flex-wrap gap-1",children:a.jsx(Js,{delayDuration:0,children:Ct.toolCalls.map((Zn,Vn)=>{const Ir=Ct.conversation.filter(us=>us.kind==="tool_call")[Vn]?.estimatedTokens,Ds=typeof Ir?.totalTokens=="number";return a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsxs(et,{variant:"outline",className:"font-mono text-xs bg-background",children:[a.jsxs("span",{className:"mr-1 text-muted-foreground",children:["#",Vn+1]}),Zn.name,a.jsxs("span",{className:"ml-1 text-muted-foreground",children:[Zn.duration,"ms"]}),Ds&&a.jsxs("span",{className:"ml-1 text-muted-foreground",children:["·"," ",ta(Ir?.totalTokens),"tok"]})]})}),Ds&&a.jsx(Rs,{className:"text-xs",children:`${Zn.name} · tokens total: ${ta(Ir?.totalTokens)} · in: ${ta(Ir?.inputTokens)} · out: ${ta(Ir?.outputTokens)}`})]},Vn)})})}),a.jsxs("div",{className:"rounded-md border bg-background p-2",children:[a.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Tool token estimate"}),a.jsx(et,{variant:"outline",className:"h-5 text-[10px]",children:"estimated"})]}),Object.keys(Ct.toolTokenUsageByTool??{}).length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"n/a"}):a.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:Object.entries(Ct.toolTokenUsageByTool??{}).map(([Zn,Vn])=>a.jsxs("div",{className:"rounded border bg-muted/30 px-2 py-1.5 text-xs",children:[a.jsx("div",{className:"font-mono text-[11px]",children:Zn}),a.jsxs("div",{className:"text-muted-foreground",children:["total:"," ",ta(Vn.totalTokens)," ","· in:"," ",ta(Vn.inputTokens)," ","· out:"," ",ta(Vn.outputTokens)]})]},Zn))})]})]})})]})}),a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"final")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"final")),children:a.jsxs("div",{className:"rounded-md border border-muted-foreground/20 bg-card p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full items-center gap-2 text-left",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"final"))?"rotate-180":""}`}),a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(Wr,{className:"h-3.5 w-3.5"}),"Final answer"]})]})}),a.jsx(Ns,{children:a.jsx(oC,{text:Ct.finalAnswer||"No final answer captured.",maxLength:1200,className:"text-xs text-foreground"})})]})}),a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation")),children:a.jsxs("div",{className:"rounded-md border bg-muted/10 p-2",children:[a.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation"))?"rotate-180":""}`}),a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Conversation trace"})]})}),a.jsx("div",{className:"flex flex-wrap gap-2",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>io(`Explain Run #${Ct.runIndex+1} for scenario '${pt}'. It ${Ct.passed?"passed":"failed"} in ${Ct.duration}ms. Focus on the tool sequence and ${Ct.passed?"why it passed":"what caused the failure"}.`,{scenarioId:ne.scenarioId}),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"Ask Assistant"]})})]}),a.jsx(Ns,{children:a.jsx("div",{className:"space-y-2 rounded-md border bg-muted/20 p-2",children:Ct.conversation.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No conversation trace captured."}):Ct.conversation.map(Zn=>a.jsx(dwe,{item:Zn,fallbackUserPrompt:Ae.get(ne.scenarioId)?.prompt},Zn.id))})}),!jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation"))&&a.jsx("button",{type:"button",className:"text-xs text-muted-foreground underline decoration-dotted underline-offset-2 hover:text-foreground",onClick:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation")),children:"Expand to inspect user/assistant/tool messages for this run."})]})})]})]},Ct.runIndex))]})})})})]})},Ne)})})]})})]})]}),P&&a.jsxs("div",{className:"min-w-0 space-y-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx(ax,{value:H,onValueChange:ne=>F(ne),className:"min-w-0 -mb-px px-3 pt-1",children:a.jsxs(Cp,{className:"h-auto w-full justify-start rounded-none border-b bg-transparent p-0",children:[a.jsx(Xs,{value:"assistant",className:"-mb-px h-9 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-3 text-xs text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Assistant"}),a.jsx(Xs,{value:"reports",className:"-mb-px h-9 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-3 text-xs text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Reports"}),a.jsx(Xs,{value:"note",className:"-mb-px h-9 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-3 text-xs text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Note"})]})}),H==="assistant"?a.jsx(_U,{title:"MCP Lab Assistant",description:"Ask questions about this run result, failures, and tool usage.",expanded:$,onToggleExpanded:()=>Y(ne=>!ne),onHide:()=>T(!1),messages:an,pendingToolCalls:qt,loading:sn,onCancel:ln?ke:void 0,input:Zt,onInputChange:kt,onSend:()=>{vt()},inputPlaceholder:"Ask about this result...",snippets:cwe,onSnippetSelect:Ve,onApproveToolCall:ne=>{fe(ne)},onDenyToolCall:ne=>{Oe(ne)},chatEndRef:ze,inputRef:Xe,className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",renderMessage:({message:ne,index:Ne,linkedPendingToolCall:pt,isUser:Nt,isAssistant:jn,isSystem:bn,isTool:mn})=>{const nn=jn&&!!ne.pendingToolCallId;if(mn&&/^(Approved|Denied) tool call\\b/i.test(String(ne.text??"").trim()))return null;const sr=pt?.tool??ne.toolRequestName,Ct=pt?.publicToolName??ne.toolRequestPublicName,Zn=jn&&!nn&&fwe(ne.text,!!X);if(nn){const Ir=pt?.status==="pending",Ds=mm(sr??Ct??"unknown_tool");return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("details",{open:!!pt,className:"group min-w-0 w-full max-w-[92%] overflow-hidden rounded-md border border-border/60 bg-background",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ua,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:`Tool call ${Ds}`}),a.jsx("span",{className:`shrink-0 whitespace-nowrap rounded px-1.5 py-0.5 text-[10px] font-semibold ${Ir?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"}`,children:Ir?"Needs approval":"Completed"})]})}),a.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsxs("div",{className:"min-w-0 space-y-2 border-t border-border/50 px-3 py-2",children:[a.jsx(Ga,{text:ne.text,className:"text-sm"}),Ir&&pt&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"max-h-40 min-w-0 w-full max-w-full overflow-x-auto overflow-y-auto whitespace-pre-wrap break-words rounded border bg-muted/50 p-2 text-xs",children:a.jsx("code",{className:"break-words",children:JSON.stringify(pt.arguments??{},null,2)})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:sn,onClick:()=>{Oe(pt.id)},children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:sn,onClick:()=>{fe(pt.id)},children:"Approve"})]})]})]})]})]},`${ne.id??`${ne.role}-${Ne}`}:${pt?"pending":"completed"}`)}const Vn=Nt||jn&&!mn&&!bn;return a.jsxs("div",{className:`flex items-start gap-2 ${Nt?"justify-end":"justify-start"}`,children:[!Nt&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:bn?a.jsx(vC,{className:"h-3 w-3"}):a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("div",{className:"relative max-w-[92%]",children:[a.jsxs("div",{className:`max-w-full rounded-md border p-3 text-sm ${Nt?"border-primary/20 bg-primary/10":bn?"border-amber-400/30 bg-amber-50/70":mn?"border-blue-300/30 bg-blue-50/50":"border-border/80 bg-background shadow-sm"}`,children:[!(Nt||bn)&&a.jsx("p",{className:`mb-2 text-[11px] font-semibold text-muted-foreground ${Nt?"text-right":""}`,children:mn?"Tool":"Assistant"}),Nt?a.jsx("p",{className:"whitespace-pre-wrap",children:ne.text}):a.jsx(Ga,{text:ne.text,className:"text-sm"}),Zn&&a.jsxs("div",{className:"mt-3 flex max-w-full flex-wrap justify-end gap-2 overflow-x-auto pb-1",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>Hu(ne.text),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"Send to Scenario Assistant"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>Vo(ne.text),children:[a.jsx(Ua,{className:"h-3.5 w-3.5"}),"Apply: Write Markdown Report"]})]}),!Zn&&jn&&!nn&&a.jsx("div",{className:"mt-3 flex max-w-full justify-end overflow-x-auto pb-1",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>Vo(ne.text),children:[a.jsx(Ua,{className:"h-3.5 w-3.5"}),"Apply: Write Markdown Report"]})})]}),Vn&&a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"absolute -right-8 bottom-1 h-6 w-6 text-muted-foreground",onClick:()=>{Yt(ne.text)},"aria-label":"Copy message",title:"Copy message",children:a.jsx(Hr,{className:"h-3.5 w-3.5"})})]}),Nt&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(Kc,{className:"h-3 w-3"})})]},ne.id??`${ne.role}-${Ne}`)},renderMessageExtras:Fi.length>0?a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Pending actions (approve/deny)"}),Fi.map(ne=>a.jsxs("details",{open:!0,className:"group min-w-0 rounded-md border bg-background",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-2 p-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"break-all font-mono text-xs font-semibold",children:mm(ne.publicToolName)}),a.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:[ne.server,"::",mm(ne.tool)]})]}),a.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsxs("div",{className:"border-t px-3 pb-3 pt-2",children:[a.jsx("pre",{className:"max-h-48 min-w-0 w-full max-w-full overflow-x-auto overflow-y-auto whitespace-pre-wrap break-words rounded border bg-muted/50 p-2 text-xs",children:a.jsx("code",{className:"break-words",children:JSON.stringify(ne.arguments??{},null,2)})}),a.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:sn,onClick:()=>{Oe(ne.id)},children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:sn,onClick:()=>{fe(ne.id)},children:"Approve"})]})]})]},ne.id))]}):null}):H==="reports"?a.jsxs(Qe,{className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx($t,{className:"border-b px-4 py-3",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx(Rc,{className:"h-4 w-4 text-muted-foreground"}),"Reports"]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>Y(ne=>!ne),children:[$?a.jsx(XS,{className:"h-3.5 w-3.5"}):a.jsx(QS,{className:"h-3.5 w-3.5"}),$?"Compact":"Expand"]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>T(!1),children:"Hide"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Review markdown reports for this run while keeping the result visible."})]})}),a.jsxs(Je,{className:"flex h-[70vh] min-h-[520px] flex-col p-0 xl:h-auto xl:min-h-0 xl:flex-1",children:[(oe||se.length===0||se.length>1)&&a.jsx("div",{className:"border-b px-4 py-3",children:oe?a.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading reference reports..."}):se.length===0?a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No reference reports for this run yet."}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"shrink-0 gap-1.5",onClick:()=>ie(),children:[a.jsx(To,{className:"h-3.5 w-3.5"}),"New Report"]})]}):a.jsx("div",{className:"space-y-2",children:se.length>1?a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Selected report"}),a.jsxs(Mn,{value:De,onValueChange:me,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{placeholder:"Select a report"})}),a.jsx(kn,{children:se.map(ne=>a.jsx(ut,{value:ne.relativePath,children:ne.name},ne.path))})]})]}):null})}),a.jsx(hk,{className:"min-h-0 flex-1 bg-muted/15 px-4 py-4",children:se.length===0?a.jsx("div",{className:"text-sm text-muted-foreground",children:"No report selected."}):at?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),"Loading report..."]}):it?a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive",children:["Could not load report: ",it]}):ge?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"rounded-md border bg-background p-3",children:[a.jsx("p",{className:"font-mono text-xs font-semibold",children:ge.name}),a.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:ge.relativePath}),a.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:new Date(ge.mtime).toLocaleString()})]}),a.jsx("div",{className:"rounded-md border bg-background p-3",children:a.jsx(Ga,{text:ge.content,className:"text-sm"})})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"Select a report to preview."})})]})]}):a.jsxs(Qe,{className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx($t,{className:"border-b px-4 py-3",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx(Rc,{className:"h-4 w-4 text-muted-foreground"}),"Run Note"]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>Y(ne=>!ne),children:[$?a.jsx(XS,{className:"h-3.5 w-3.5"}):a.jsx(QS,{className:"h-3.5 w-3.5"}),$?"Compact":"Expand"]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>T(!1),children:"Hide"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Add context for this run, such as server version or environment details."})]})}),a.jsx(Je,{className:"flex h-[70vh] min-h-[520px] flex-col p-4 xl:h-auto xl:min-h-0 xl:flex-1",children:p?a.jsxs("div",{className:"w-full max-w-xl space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-xs font-medium",children:"Run note"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.length,"/500"]})]}),a.jsx(Ts,{value:x,onChange:ne=>j(ne.target.value.slice(0,500)),placeholder:"Optional context for this run",rows:3,className:"min-h-20 resize"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{size:"sm",onClick:()=>{Pt()},disabled:y,children:y?"Saving...":"Save note"}),a.jsx(Z,{size:"sm",variant:"outline",onClick:()=>{j(c.runNote??""),v(!1)},disabled:y,children:"Cancel"})]})]}):a.jsxs("div",{className:"flex w-full max-w-3xl items-center gap-2 rounded-md border bg-muted/20 px-2 py-1 text-xs",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"text-muted-foreground",children:"Run note:"}),a.jsx("span",{className:`break-words ${c.runNote?"text-foreground":"text-muted-foreground"}`,children:c.runNote||"none"})]}),a.jsx(Z,{size:"sm",variant:"ghost",className:"ml-auto h-6 px-2 text-xs",onClick:()=>v(!0),children:c.runNote?"Edit":"Add note"})]})})]})]}),a.jsx(Os,{open:I,onOpenChange:ne=>!V&&M(ne),children:a.jsxs(Za,{className:"max-w-2xl",children:[a.jsxs(es,{children:[a.jsx(ns,{children:ae?"Create markdown report":"Approve MCP action: write markdown report"}),a.jsx(rs,{children:ae?"Write a custom markdown report and save it to the workspace.":a.jsxs(a.Fragment,{children:["This will call ",a.jsx("code",{children:"mcplab_write_markdown_report"})," via the local MCPLab MCP server."]})})]}),a.jsxs("div",{className:"space-y-3",children:[!ae&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Output path"}),a.jsx(_t,{value:O,onChange:ne=>Q(ne.target.value),placeholder:"mcplab/reports/result-assistant/my-report.md",disabled:V})]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(br,{checked:B,onCheckedChange:ne=>z(ne===!0),disabled:V}),a.jsx("span",{children:"Overwrite if file exists"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:ae?"Markdown content":"Markdown preview (to be written)"}),a.jsx(Ts,{value:q,onChange:ne=>G(ne.target.value),rows:10,className:"font-mono text-xs",disabled:V})]})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:V,children:"Cancel"}),a.jsx(as,{onClick:ne=>{ne.preventDefault(),rt()},disabled:V,children:V?"Writing...":ae?"Save Report":"Approve & Write"})]})]})}),a.jsx(Os,{open:Ge,onOpenChange:Ee,children:a.jsxs(Za,{children:[a.jsxs(es,{children:[a.jsx(ns,{children:"Delete run?"}),a.jsxs(rs,{children:["This will permanently remove run ",a.jsx("span",{className:"font-mono",children:c?.id}),". This action cannot be undone."]})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:Re,children:"Cancel"}),a.jsx(as,{disabled:Re||!c?.id,onClick:ne=>{ne.preventDefault(),Lt()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Re?"Deleting...":"Delete"})]})]})})]})]})};function dwe({item:e,fallbackUserPrompt:t}){if(e.kind==="tool_call"){const u=zD(e,"input");return a.jsx(qD,{variant:"call",title:`Tool call · ${e.toolName||"unknown"}${u}`,text:e.text})}if(e.kind==="tool_result"){const u=zD(e,"output"),f=e.ok?a.jsx(Va,{className:"h-3.5 w-3.5 text-emerald-700 dark:text-emerald-300"}):a.jsx(ll,{className:"h-3.5 w-3.5 text-rose-700 dark:text-rose-300"});return a.jsx(qD,{variant:e.ok?"result_ok":"result_error",title:`Tool result · ${e.toolName||"unknown"} · ${e.ok?"ok":"error"}${typeof e.durationMs=="number"?` · ${e.durationMs}ms`:""}${u}`,text:e.text,icon:f})}const n=e.kind==="user_prompt",r=BD(e.text,e.kind),s=t?BD(t,"user_prompt"):"",o=n&&!r&&s?s:r,i=n?"User prompt":e.kind==="assistant_final"?"Agent final":"Agent",c=n?Kc:Wr;return a.jsxs("div",{className:`flex items-start gap-2 text-xs ${n?"justify-end":"justify-start"}`,children:[!n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",children:a.jsx(c,{className:"h-3 w-3"})}),a.jsxs("div",{className:`max-w-[90%] rounded-md p-2 ${n?"bg-primary/10":"bg-muted/50"}`,children:[a.jsx("p",{className:`mb-1 text-[11px] font-semibold text-muted-foreground ${n?"text-right":""}`,children:i}),n?a.jsx(oC,{text:o,maxLength:280,className:"text-xs"}):a.jsx(oC,{text:o,maxLength:500,className:"text-xs"})]}),n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(c,{className:"h-3 w-3"})})]})}function zD(e,t){const n=t==="input"?e.estimatedTokens?.inputTokens:e.estimatedTokens?.outputTokens;return typeof n!="number"?"":` · ${ta(n)} tokens`}function BD(e,t){const r=String(e??"").replace(/^\s+/,"");return t==="user_prompt"?r.replace(/^user:\s*/i,""):t==="assistant_final"||t==="assistant_thought"?r.replace(/^assistant:\s*/i,""):r}function fwe(e,t){if(!t)return!1;const n=String(e??"").toLowerCase();if(!n.trim())return!1;const r=["check","checks","rule","rules","regex","pattern","value capture","extract rule","update","change","replace","modify","adjust","use ","set "],s=["change ","replace ","update ","use ","set the","suggested","you should","try ","text match failed","text must match pattern"];if(["i can only read","i don't have write access","i cannot directly edit","what happened","summary"].some(m=>n.includes(m))&&!s.some(m=>n.includes(m)))return!1;const i=r.some(m=>n.includes(m)),c=s.some(m=>n.includes(m)),u=/(^|\n)\s*[-*]\s+/.test(e)||/(^|\n)\s*\d+\.\s+/.test(e),f=/["'`][^"'`\n]{2,}["'`]/.test(e);return i&&(c||u||f)}function qD({variant:e,title:t,text:n,icon:r}){const[s,o]=h.useState(!1),i={call:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",result_ok:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",result_error:"border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-300"};return a.jsx(Ss,{open:s,onOpenChange:o,children:a.jsxs("div",{className:`rounded-md border p-2 text-xs ${i[e]}`,children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[11px]",children:[r??a.jsx(Ua,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:t})]}),a.jsx("span",{className:"text-[11px] font-semibold",children:s?"Hide content":"Show content"})]})}),a.jsx(Ns,{children:a.jsx("p",{className:"mt-2 font-mono whitespace-pre-wrap text-foreground",children:n})})]})})}function oC({text:e,maxLength:t,className:n}){const[r,s]=h.useState(!1),o=e.length>t,i=r||!o?e:`${e.slice(0,t)}...`;return a.jsxs("div",{children:[a.jsx(Ga,{text:i,className:n}),o&&a.jsx("button",{type:"button",className:"mt-1 text-[11px] font-medium text-primary hover:underline",onClick:()=>s(c=>!c),children:r?"Show less":"Show all"})]})}function pwe(e,t,n,r){return nq({evalRules:e,failureReasons:t,runError:n,checkResults:r})}function UD(e){const t=String(e??"").trim(),n=t.match(/^Regex assertion failed:\s*(.+)$/i);return n?`Text match failed: ${n[1]}`:t}const qS=["hsl(38, 92%, 50%)","hsl(200, 80%, 50%)","hsl(152, 69%, 40%)","hsl(280, 60%, 50%)","hsl(0, 72%, 51%)"],hwe=9,WD="mcplab.compare.showDaySeparators";function pl(e){if(!e.trim())return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function nm(e){const t=pl(e);return t?t.toLocaleString():""}function mwe(e){const t=pl(e);if(!t)return e;const n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0");return`${n}-${r}-${s}`}function gwe(e){const t=pl(e);return t?t.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):"Unknown day"}function iC({counts:e}){return!e||e.total===0?a.jsx(a.Fragment,{children:"—"}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"text-success",children:[e.passed," ✓"]}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{className:"text-destructive",children:[e.failed," ✕"]})]})}function vwe(e){const t=e.configName?.trim();return t||bB(e).slice(0,2).join(", ")||"n/a"}function xwe(e){return e.configPath?.trim()||void 0}function US({run:e,className:t}){const n=vwe(e),r=xwe(e);return a.jsx("div",{className:t,title:r,children:n})}function ywe(e){const t=e.checkCounts;if(!t||t.total===0)return"—";const n=t.passed+t.failed;return n===0?"—":a.jsxs(a.Fragment,{children:[a.jsx(iC,{counts:t}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{children:[Math.round(t.passed/n*100),"%"]})]})}function bwe(e,t){return e.length!==t.length?!1:e.every((n,r)=>n===t[r])}function wwe(e){const t=e.find(n=>n.provider&&n.model)??e.find(n=>n.provider||n.model);return{provider:t?.provider,model:t?.model}}const jwe=()=>{const{source:e}=$n(),[t,n]=zo(),r=aC(t),s=t.get("mode")==="within-run"?"within-run":"runs",[o,i]=h.useState([]),[c,u]=h.useState({}),[f,m]=h.useState(!1),[p,v]=h.useState(new Set),[x,j]=h.useState("timestamp"),[y,b]=h.useState("desc"),[S,N]=h.useState("all"),[C,k]=h.useState(!1),[A,E]=h.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(WD)==="1"}catch{return!1}}),[P,T]=h.useState(r.mode),[$,Y]=h.useState(r.preset),[H,F]=h.useState(r.start),[X,L]=h.useState(r.end),[I,M]=h.useState(!1),q=100,G=hx(q),{offset:O,hasMore:Q,totalCount:B}=G,z=t.get("runId")??"",V=(t.get("agents")??"").split(",").map(U=>U.trim()).filter(Boolean),ee=t.get("scenario")??"all",[ae,ue]=h.useState(z),[se,xe]=h.useState(V),[oe,de]=h.useState(ee),[De,me]=h.useState(!1),ge=h.useRef(0),we=h.useMemo(()=>{if(P==="all")return{};if(P==="last"){const W=qa.find(ve=>ve.value===$)??qa[0],ye=new Date;return{since:new Date(ye.getTime()-W.durationMs).toISOString(),until:ye.toISOString()}}const U=pl(H)?.toISOString(),le=pl(X)?.toISOString();return{since:U,until:le}},[X,P,$,H]),at=async()=>{const U=ge.current+1;ge.current=U,m(!0);try{if(e.listRunSummariesPage){const le={limit:q,offset:O};S!=="all"&&(le.scenario=S),we.since&&(le.since=we.since),we.until&&(le.until=we.until);const W=await e.listRunSummariesPage(le);if(ge.current!==U)return;G.updateMeta(W),i(W.data.map(vi))}else{const le=await e.listResults();if(ge.current!==U)return;i(le)}}catch(le){$e({title:"Could not load results",description:le instanceof Error?le.message:String(le),variant:"destructive"})}finally{ge.current===U&&m(!1)}};h.useEffect(()=>{let U=!0;return ge.current+=1,m(!0),(e.listRunSummariesPage?e.listRunSummariesPage({limit:q,offset:O,scenario:S==="all"?void 0:S,since:we.since,until:we.until}).then(W=>(U&&G.updateMeta(W),W.data.map(vi))):e.listResults()).then(W=>{U&&i(W)}).catch(W=>{U&&$e({title:"Could not load results",description:W instanceof Error?W.message:String(W),variant:"destructive"})}).finally(()=>{U&&m(!1)}),()=>{U=!1}},[O,S,e,we]);const tt=U=>{if(x===U){b(le=>le==="asc"?"desc":"asc");return}j(U),b(U==="timestamp"?"desc":"asc")},it=U=>{v(le=>{const W=new Set(le);return W.has(U)?W.delete(U):W.add(U),W})},At=h.useMemo(()=>{const U=new Set;return o.forEach(le=>{le.scenarios.forEach(W=>{const ye=String(W.scenarioName??"").trim(),ve=String(W.scenarioId??"").trim(),Ce=ye||ve;Ce&&U.add(Ce)})}),Array.from(U).sort((le,W)=>le.localeCompare(W))},[o]),Ge=h.useMemo(()=>{const U=S==="all"?o:o.filter(_e=>_e.scenarios.some(K=>{const pe=String(K.scenarioName??"").trim(),Ae=String(K.scenarioId??"").trim();return(pe||Ae)===S}));if(s!=="runs"||P==="all")return U;const le=Date.now();if(P==="last"){const _e=qa.find(pe=>pe.value===$)??qa[0],K=le-_e.durationMs;return U.filter(pe=>{const Ae=new Date(pe.timestamp).getTime();return Ae>=K&&Ae<=le})}const W=pl(H)?.getTime()??null,ye=pl(X)?.getTime()??null,ve=W!==null&&ye!==null?Math.min(W,ye):W??null,Ce=W!==null&&ye!==null?Math.max(W,ye):ye??null;return U.filter(_e=>{const K=new Date(_e.timestamp).getTime();return!(Number.isNaN(K)||ve!==null&&K<ve||Ce!==null&&K>Ce)})},[s,o,S,X,P,$,H]),Ee=h.useMemo(()=>[...Ge].sort((U,le)=>{let W=0;return x==="id"&&(W=U.id.localeCompare(le.id)),x==="timestamp"&&(W=new Date(U.timestamp).getTime()-new Date(le.timestamp).getTime()),x==="passRate"&&(W=U.overallPassRate-le.overallPassRate),x==="scenarios"&&(W=U.totalScenarios-le.totalScenarios),y==="asc"?W:-W}),[Ge,x,y]),Re=h.useMemo(()=>Ee.filter(U=>p.has(U.id)).map(U=>c[U.id]??U),[c,Ee,p]),Ze=h.useMemo(()=>{if(!A)return Ee.map(W=>({type:"run",run:W}));const U=[];let le=null;for(const W of Ee){const ye=mwe(W.timestamp);ye!==le&&(U.push({type:"day-separator",dayKey:ye,dayLabel:gwe(W.timestamp)}),le=ye),U.push({type:"run",run:W})}return U},[A,Ee]);h.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(WD,A?"1":"0")}catch{}},[A]);const ht=U=>x!==U?a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"}):y==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}),Ft=h.useMemo(()=>{const U=new Map;for(const le of Ee)U.set(le.id,G_(le));return U},[Ee]),zt=U=>{const le=Array.from(new Set(U.scenarios.map(W=>W.agentId).filter(Boolean)));return le.slice(0,Math.min(2,le.length))},jt=U=>{const le=zt(U);ue(U.id),xe(le),de("all");const W=new URLSearchParams(t);W.set("mode","within-run"),W.set("runId",U.id),le.length>0?W.set("agents",le.join(",")):W.delete("agents"),W.delete("scenario"),n(W,{replace:!0})},rn=h.useMemo(()=>[...new Set(Re.flatMap(U=>U.scenarios.map(le=>le.scenarioId)))],[Re]),an=h.useMemo(()=>{const U=new Map;for(const le of Re)for(const W of le.scenarios){const ye=String(W.scenarioId??"").trim();if(!ye)continue;const ve=String(W.scenarioName??"").trim();U.set(ye,ve||ye)}return U},[Re]),qt=h.useMemo(()=>c[ae]??o.find(U=>U.id===ae),[c,o,ae]);h.useEffect(()=>{if(typeof e.getResult!="function"||p.size===0&&!ae)return;const U=new Set([...p]);ae&&U.add(ae);for(const le of U)c[le]||e.getResult(le).then(W=>{W&&u(ye=>ye[le]?ye:{...ye,[le]:W})})},[c,p,e,ae]),h.useEffect(()=>{G.reset()},[G.reset,S,P,$,H,X]);const Zt=h.useMemo(()=>{if(!qt)return[];const U=new Map;for(const le of qt.scenarios)U.set(le.agentId,le.agentName||le.agentId);return Array.from(U.entries()).map(([le,W])=>({id:le,name:W})).sort((le,W)=>le.name.localeCompare(W.name))},[qt]),sn=h.useMemo(()=>{if(!qt)return[];const U=new Set;for(const le of qt.scenarios){const W=String(le.scenarioName??"").trim(),ye=String(le.scenarioId??"").trim(),ve=W||ye;ve&&U.add(ve)}return Array.from(U).sort((le,W)=>le.localeCompare(W))},[qt]),ln=h.useMemo(()=>se.join(","),[se]);h.useEffect(()=>{if(s==="within-run"){const U=t.get("runId")??"",le=(t.get("agents")??"").split(",").map(ye=>ye.trim()).filter(Boolean),W=t.get("scenario")??"all";ue(ye=>ye===U?ye:U),xe(ye=>bwe(ye,le)?ye:le),de(ye=>ye===W?ye:W)}},[s,t]),h.useEffect(()=>{if(s!=="within-run"||o.length===0)return;let U=ae;(!U||!o.some(K=>K.id===U))&&(U=o[0].id);const le=o.find(K=>K.id===U),W=(()=>{if(!le)return[];const K=new Map;for(const pe of le.scenarios)K.set(pe.agentId,pe.agentName||pe.agentId);return Array.from(K.keys())})(),ye=new Set(W);let ve=ln.split(",").map(K=>K.trim()).filter(K=>!!K).filter(K=>ye.has(K));ve.length===0&&W.length>0&&(ve=W.slice(0,Math.min(2,W.length)));const Ce=(()=>{if(!le)return new Set;const K=new Set;for(const pe of le.scenarios){const Ae=String(pe.scenarioName??"").trim(),Ke=String(pe.scenarioId??"").trim(),te=Ae||Ke;te&&K.add(te)}return new Set(K)})(),_e=oe!=="all"&&!Ce.has(oe)?"all":oe;U!==ae&&ue(U),ve.join(",")!==ln&&xe(ve),_e!==oe&&de(_e)},[s,o,ae,ln,oe]),h.useEffect(()=>{const U=new URLSearchParams(t);s==="within-run"?(U.set("mode","within-run"),ae?U.set("runId",ae):U.delete("runId"),se.length>0?U.set("agents",se.join(",")):U.delete("agents"),oe!=="all"?U.set("scenario",oe):U.delete("scenario"),U.delete("time_filter"),U.delete("time_preset"),U.delete("time_start"),U.delete("time_end")):(U.delete("mode"),U.delete("runId"),U.delete("agents"),U.delete("scenario"),P==="all"?(U.delete("time_filter"),U.delete("time_preset"),U.delete("time_start"),U.delete("time_end")):P==="last"?(U.set("time_filter","last"),U.set("time_preset",$),U.delete("time_start"),U.delete("time_end")):(U.set("time_filter","custom"),U.delete("time_preset"),H.trim()?U.set("time_start",H.trim()):U.delete("time_start"),X.trim()?U.set("time_end",X.trim()):U.delete("time_end")));const le=t.toString(),W=U.toString();le!==W&&n(U,{replace:!0})},[s,X,P,$,H,ae,se,oe,t,n]);const ke=h.useMemo(()=>{if(P==="all")return"All time";if(P==="last")return qa.find(W=>W.value===$)?.label??"Last range";const U=!!H.trim(),le=!!X.trim();return!U&&!le?"Custom range":U&&le?`${nm(H)} - ${nm(X)}`:U?`From ${nm(H)}`:`Until ${nm(X)}`},[X,P,$,H]),ze=()=>{T("all"),Y("15min"),F(""),L("")},Xe=h.useMemo(()=>{if(!qt)return[];const U=new Map;for(const W of qt.scenarios){const ye=String(W.scenarioId??"").trim(),ve=String(W.scenarioName??"").trim(),Ce=ve||ye;if(!ye&&!Ce)continue;const _e=ye||Ce,K=U.get(_e);if(K){K.byAgent[W.agentId]=W;continue}U.set(_e,{scenarioId:ye||Ce,scenarioName:ve,displayLabel:Ce||ye,byAgent:{[W.agentId]:W}})}const le=Array.from(U.values()).sort((W,ye)=>{const ve=(W.displayLabel||W.scenarioId).toLowerCase(),Ce=(ye.displayLabel||ye.scenarioId).toLowerCase();return ve.localeCompare(Ce)});return oe==="all"?le:le.filter(W=>W.displayLabel===oe)},[qt,oe]),kt=h.useMemo(()=>{const U=new Map(Zt.map(le=>[le.id,le]));return se.map(le=>U.get(le)).filter(le=>!!le)},[se,Zt]),vt=h.useMemo(()=>{if(!qt||kt.length!==2)return null;const[U,le]=kt;return{left:U,right:le,link:`/compare/results?left=${encodeURIComponent(qt.id)}&right=${encodeURIComponent(qt.id)}&leftConfig=${encodeURIComponent(qt.configId)}&rightConfig=${encodeURIComponent(qt.configId)}&leftAgent=${encodeURIComponent(U.id)}&rightAgent=${encodeURIComponent(le.id)}`}},[qt,kt]),fe=h.useMemo(()=>!qt||kt.length===0?[]:kt.map(U=>{const le=Xe.map(Ae=>Ae.byAgent[U.id]).filter(Ae=>!!Ae),W=le.flatMap(Ae=>Ae.runs),ye=W.length,ve=W.filter(Ae=>Ae.passed).length,Ce=W.reduce((Ae,Ke)=>Ae+Ke.toolCalls.length,0),_e=W.reduce((Ae,Ke)=>Ae+Ke.duration,0),{provider:K,model:pe}=wwe(le);return{agentId:U.id,agentName:U.name,provider:K,model:pe,passRate:ye===0?0:ve/ye,totalRuns:ye,avgToolCalls:ye===0?0:Ce/ye,avgLatency:ye===0?0:_e/ye}}),[qt,kt,Xe]),Oe=U=>{xe(le=>le.includes(U)?le.filter(W=>W!==U):[...le,U])},Ve=U=>a.jsxs("div",{className:"min-w-0 rounded border bg-muted/20 px-2 py-1.5",children:[a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"font-mono",children:["#",U.runIndex+1]})," ",a.jsx("span",{className:U.passed?"text-emerald-700":"text-destructive",children:U.passed?"PASS":"FAIL"})," ","· tools: ",U.toolCalls.length," · ",U.duration,"ms"]}),!U.passed&&U.failureReasons.length>0&&a.jsx("div",{className:"mt-1 max-h-16 overflow-y-auto whitespace-pre-wrap break-all pr-1 text-[11px] text-muted-foreground",children:U.failureReasons.join("; ")})]},U.runIndex);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(C5,{className:"h-6 w-6"}),"Compare Runs"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:s==="runs"?"Select 2–5 runs to compare":"Compare agents side-by-side within one run"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s==="within-run"&&a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{const U=new URLSearchParams(t);U.delete("mode"),U.delete("runId"),U.delete("agents"),U.delete("scenario"),n(U,{replace:!0})},children:[a.jsx(b5,{className:"mr-1.5 h-4 w-4"}),"Back to Compare"]}),s==="runs"&&a.jsxs(a.Fragment,{children:[a.jsxs(wi,{open:C,onOpenChange:k,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":C,"aria-controls":"compare-scenario-command-list",className:`w-[260px] justify-between font-normal ${S!=="all"?"border-primary/40":""}`,children:[a.jsx("span",{className:"truncate text-left",children:S==="all"?"All scenarios":S}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(Ro,{className:"w-[260px] p-0",align:"start",children:a.jsxs(Tl,{children:[a.jsx(Ol,{placeholder:"Search scenarios..."}),a.jsxs(Ml,{id:"compare-scenario-command-list",children:[a.jsx(Il,{children:"No scenarios found."}),a.jsxs($l,{children:[a.jsx(Na,{value:"all scenarios",onSelect:()=>{N("all"),k(!1)},children:"All scenarios"}),At.map(U=>a.jsx(Na,{value:U,onSelect:()=>{N(U),k(!1)},children:U},U))]})]})]})})]}),a.jsxs(wi,{open:I,onOpenChange:M,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":I,"aria-controls":"compare-time-command-list",className:`w-[320px] justify-between font-normal ${P!=="all"?"border-primary/40":""}`,children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate text-left",children:[a.jsx(w5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:ke})]}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(Ro,{className:"w-[360px] p-0",align:"start",children:[a.jsxs("div",{className:"border-b px-3 py-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Date and time filter"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Filter runs by timestamp."})]}),a.jsxs("div",{id:"compare-time-command-list",className:"grid gap-1 p-2",children:[a.jsx(Z,{type:"button",variant:P==="all"?"secondary":"ghost",className:"justify-start",onClick:()=>{ze(),M(!1)},children:"All time"}),qa.map(U=>a.jsx(Z,{type:"button",variant:P==="last"&&$===U.value?"secondary":"ghost",className:"justify-start",onClick:()=>{T("last"),Y(U.value),M(!1)},children:U.label},U.value)),a.jsx(Z,{type:"button",variant:P==="custom"?"secondary":"ghost",className:"justify-start",onClick:()=>T("custom"),children:"Custom date time range"})]}),P==="custom"&&a.jsxs("div",{className:"space-y-3 border-t p-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{htmlFor:"compare-time-filter-start",children:"Start"}),a.jsx(_t,{id:"compare-time-filter-start",type:"datetime-local",value:H,onChange:U=>F(U.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{htmlFor:"compare-time-filter-end",children:"End"}),a.jsx(_t,{id:"compare-time-filter-end",type:"datetime-local",value:X,onChange:U=>L(U.target.value)})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"px-2",onClick:ze,children:[a.jsx(ca,{className:"mr-1.5 h-3.5 w-3.5"}),"Clear"]}),a.jsx(Z,{type:"button",size:"sm",onClick:()=>M(!1),children:"Done"})]})]})]})]})]}),a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-md border px-3 py-2",children:[a.jsx(We,{htmlFor:"compare-day-separators-switch",className:"text-sm font-medium",children:"Group by day"}),a.jsx(Mg,{id:"compare-day-separators-switch",checked:A,onCheckedChange:E,"aria-label":"Group by day"})]}),a.jsx(Z,{variant:"outline",onClick:()=>{at()},disabled:f,children:f?"Refreshing...":"Refresh"}),a.jsx(Z,{variant:"outline",onClick:G.prev,disabled:f||O===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:G.next,disabled:f||!Q,children:"Next"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:G.rangeLabel(o.length)}),s==="within-run"&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Within One Run Controls"})}),a.jsxs(Je,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Run"}),a.jsxs(Mn,{value:ae,onValueChange:ue,children:[a.jsx(_n,{children:a.jsx(In,{placeholder:"Select run"})}),a.jsx(kn,{children:o.map(U=>a.jsx(ut,{value:U.id,children:U.id},U.id))})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Scenario filter"}),a.jsxs(wi,{open:De,onOpenChange:me,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":De,"aria-controls":"compare-within-run-scenario-command-list",className:"w-full justify-between font-normal",children:[a.jsx("span",{className:"truncate text-left",children:oe==="all"?"All scenarios":oe}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(Ro,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:a.jsxs(Tl,{children:[a.jsx(Ol,{placeholder:"Search scenarios..."}),a.jsxs(Ml,{id:"compare-within-run-scenario-command-list",children:[a.jsx(Il,{children:"No scenarios found."}),a.jsxs($l,{children:[a.jsx(Na,{value:"all scenarios",onSelect:()=>{de("all"),me(!1)},children:"All scenarios"}),sn.map(U=>a.jsx(Na,{value:U,onSelect:()=>{de(U),me(!1)},children:U},U))]})]})]})})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Agents (select 2+)"}),a.jsxs("div",{className:"flex flex-wrap gap-3 rounded-md border p-3",children:[Zt.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents available for selected run."}),Zt.map(U=>a.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[a.jsx(br,{checked:se.includes(U.id),onCheckedChange:()=>Oe(U.id)}),a.jsx("span",{children:U.name})]},U.id))]})]})]})]}),s==="runs"&&a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(oa,{containerClassName:"max-h-[36rem] overflow-auto",children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-10"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>tt("id"),children:["Run ID",ht("id")]})}),a.jsx(ct,{children:"Evaluated"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>tt("timestamp"),children:["Timestamp",ht("timestamp")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-end gap-1 hover:text-foreground",onClick:()=>tt("passRate"),children:["Pass Rate",ht("passRate")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>tt("scenarios"),children:["Scenarios",ht("scenarios")]})}),a.jsx(ct,{className:"text-right",children:"Tool Tokens"}),a.jsx(ct,{className:"text-right",children:"Agents"}),a.jsx(ct,{className:"w-[140px] text-right",children:"Action"})]})}),a.jsx(la,{children:Ze.map((U,le)=>U.type==="day-separator"?a.jsx(Wt,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(qe,{colSpan:hwe,className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border/70"}),a.jsx("span",{className:"shrink-0 rounded-full border border-border bg-background px-2.5 py-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:U.dayLabel}),a.jsx("div",{className:"h-px flex-1 bg-border/70"})]})})},`day-${U.dayKey}-${le}`):a.jsxs(Wt,{children:[a.jsx(qe,{children:a.jsx(br,{checked:p.has(U.run.id),onCheckedChange:()=>it(U.run.id),disabled:!p.has(U.run.id)&&p.size>=5})}),a.jsx(qe,{className:"font-mono text-xs",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{children:U.run.id}),a.jsx(US,{run:U.run,className:"truncate font-sans text-xs text-foreground/80"})]})}),a.jsx(qe,{className:"text-[11px] text-muted-foreground",children:(()=>{const W=Ft.get(U.run.id)??{scenarioCount:0,agentCount:0,modelSummary:""};return a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Evaluated: ",W.scenarioCount," scenario",W.scenarioCount===1?"":"s"," · ",W.agentCount," agent",W.agentCount===1?"":"s",W.modelSummary?` · ${W.modelSummary}`:""]}),a.jsx(Su,{versions:U.run.mcpServerVersions,showPrefix:!1})]})})()}),a.jsx(qe,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(U.run.timestamp).toLocaleString()]}),(()=>{const W=Ig(U.run);return W===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Total time: ",aa(W)]})})()]})}),a.jsx(qe,{className:"text-right",children:a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Ws,{rate:U.run.overallPassRate}),U.run.checkCounts&&U.run.checkCounts.total>0?a.jsx("span",{className:"font-mono text-[11px] leading-none","aria-label":`${U.run.checkCounts.passed} checks passed, ${U.run.checkCounts.failed} checks failed`,title:`${U.run.checkCounts.passed} passed · ${U.run.checkCounts.failed} failed`,children:a.jsx(iC,{counts:U.run.checkCounts})}):null]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:U.run.totalScenarios}),a.jsx(qe,{className:"text-right",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"font-mono text-sm",children:ta(U.run.toolTokenUsage?.totalTokens)}),(()=>{const W=$g(U.run);return W===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Tool time: ",aa(W)]})})()]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:Ft.get(U.run.id)?.agentCount??0}),a.jsx(qe,{className:"text-right",children:(Ft.get(U.run.id)?.agentCount??0)>1?a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>jt(U.run),children:"Compare agents"}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})})]},U.run.id))})]})})}),s==="runs"&&Re.length<2&&a.jsx(Qe,{children:a.jsxs(Je,{className:"py-12 text-center",children:[a.jsx("p",{className:"text-sm font-medium",children:"No runs selected"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Select 2–5 runs from the table above to start a comparison."})]})}),s==="runs"&&Re.length>=2&&a.jsxs(a.Fragment,{children:[Re.length===2&&a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Need a deeper comparison?"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Open the two selected runs in a dedicated side-by-side full result compare view."})]}),a.jsx(Z,{asChild:!0,size:"sm",children:a.jsx(Et,{to:`/compare/results?left=${encodeURIComponent(Re[0].id)}&right=${encodeURIComponent(Re[1].id)}&leftConfig=${encodeURIComponent(Re[0].configId)}&rightConfig=${encodeURIComponent(Re[1].configId)}`,children:"Compare full results"})})]})})}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Summary Comparison"})}),a.jsx(Je,{className:"max-h-[24rem] overflow-auto p-0",children:a.jsxs(oa,{className:"table-fixed",children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-[220px]",children:"Metric"}),Re.map((U,le)=>a.jsxs(ct,{style:{color:qS[le]},className:"font-mono text-xs",children:[a.jsx("div",{children:U.id}),a.jsx(US,{run:U,className:"mt-0.5 truncate text-[10px] font-normal text-muted-foreground"})]},U.id))]})}),a.jsxs(la,{children:[a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Pass Rate"}),Re.map(U=>a.jsx(qe,{children:a.jsx(Ws,{rate:U.overallPassRate})},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Checks Pass Rate"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:ywe(U)},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Total Runs"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:U.totalRuns},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Tool Calls"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:U.avgToolCalls.toFixed(1)},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Avg Latency"}),Re.map(U=>a.jsxs(qe,{className:"font-mono",children:[U.avgLatency,"ms"]},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Total Time"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:(()=>{const le=Ig(U);return le===null?"—":aa(le)})()},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Tool Time"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:(()=>{const le=$g(U);return le===null?"—":aa(le)})()},U.id))]})]})]})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Scenario Breakdown"})}),a.jsx(Je,{className:"max-h-[26rem] overflow-auto p-0",children:a.jsxs(oa,{className:"table-fixed",children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-[220px]",children:"Scenario"}),Re.map((U,le)=>a.jsxs(ct,{style:{color:qS[le]},className:"font-mono text-xs",children:[a.jsx("div",{children:U.id}),a.jsx(US,{run:U,className:"mt-0.5 truncate text-[10px] font-normal text-muted-foreground"}),a.jsx(Su,{versions:U.mcpServerVersions,className:"mt-0.5 max-w-full border-0 bg-transparent p-0 text-[10px] font-normal"})]},U.id))]})}),a.jsx(la,{children:rn.map(U=>a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium text-sm",children:an.get(U)??U}),Re.map(le=>{const W=le.scenarios.find(ye=>ye.scenarioId===U);return a.jsx(qe,{children:W?a.jsxs("div",{className:"flex items-center justify-start gap-2",children:[a.jsx(Ws,{rate:W.passRate}),W.checkCounts?.total?a.jsx("span",{className:"font-mono text-[11px] leading-none",children:a.jsx(iC,{counts:W.checkCounts})}):null]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})},le.id)})]},U))})]})})]})]}),s==="runs"&&Re.length>=2&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Pass Rate Trend"})}),a.jsx(Je,{className:"h-72",children:a.jsx(hf,{width:"100%",height:"100%",children:a.jsxs($N,{data:Re.map((U,le)=>({idx:le+1,runId:U.id,passRate:Number((U.overallPassRate*100).toFixed(1))})),children:[a.jsx(_i,{dataKey:"idx",tickFormatter:U=>String(U)}),a.jsx(ki,{unit:"%",domain:[0,100]}),a.jsx(ra,{formatter:U=>[`${U}%`,"Pass Rate"],labelFormatter:U=>`Run ${U}`}),a.jsx(hl,{}),a.jsx(Al,{type:"monotone",dataKey:"passRate",stroke:qS[0],strokeWidth:2.5,dot:!0})]})})})]}),s==="within-run"&&qt&&kt.length<2&&a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6 text-sm text-muted-foreground",children:"Select at least 2 agents to compare side-by-side within this run."})}),s==="within-run"&&qt&&kt.length>=2&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Need full result details?"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:vt?"Open a side-by-side full result view filtered by the selected agents.":"Open the complete run result page for all details and trace navigation."})]}),a.jsx(Z,{asChild:!0,size:"sm",children:vt?a.jsx(Et,{to:vt.link,children:"Compare full results"}):a.jsx(Et,{to:`/results/${encodeURIComponent(qt.id)}${qt.configId?`?configId=${encodeURIComponent(qt.configId)}`:""}`,children:"Open full result"})})]})})}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Agent Summary"})}),a.jsx(Je,{className:"max-h-[24rem] overflow-auto p-0",children:a.jsxs(oa,{children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{children:"Metric"}),fe.map(U=>a.jsxs(ct,{children:[a.jsx("div",{className:"font-medium text-sm",children:U.agentName}),(U.provider||U.model)&&a.jsx("div",{className:"font-mono text-xs font-normal text-muted-foreground",children:[U.provider?Yf(U.provider):null,U.model].filter(Boolean).join(" · ")})]},U.agentId))]})}),a.jsxs(la,{children:[a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Pass Rate"}),fe.map(U=>a.jsx(qe,{children:a.jsx(Ws,{rate:U.passRate})},U.agentId))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Total Runs"}),fe.map(U=>a.jsx(qe,{className:"font-mono",children:U.totalRuns},U.agentId))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Avg Tool Calls"}),fe.map(U=>a.jsx(qe,{className:"font-mono",children:U.avgToolCalls.toFixed(1)},U.agentId))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Avg Latency"}),fe.map(U=>a.jsxs(qe,{className:"font-mono",children:[Math.round(U.avgLatency),"ms"]},U.agentId))]})]})]})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Scenario × Agent Matrix"})}),a.jsx(Je,{className:"max-h-[34rem] overflow-auto p-0",children:a.jsxs(oa,{className:"table-fixed",children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-[260px]",children:"Scenario"}),kt.map(U=>{const le=fe.find(W=>W.agentId===U.id);return a.jsxs(ct,{children:[a.jsx("div",{className:"font-medium text-sm",children:U.name}),(le?.provider||le?.model)&&a.jsx("div",{className:"font-mono text-xs font-normal text-muted-foreground",children:[le.provider?Yf(le.provider):null,le.model].filter(Boolean).join(" · ")})]},U.id)})]})}),a.jsx(la,{children:Xe.map(U=>a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium text-sm",children:U.displayLabel}),kt.map(le=>{const W=U.byAgent[le.id];return W?a.jsx(qe,{className:"min-w-0 align-top",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"text-xs text-muted-foreground",children:[a.jsx(Ws,{rate:W.passRate})," ",a.jsxs("span",{className:"ml-2",children:["runs: ",W.runs.length]})," · calls:"," ",W.avgToolCalls.toFixed(1)," · latency:"," ",Math.round(W.avgDuration),"ms"]}),W.runs.length>0?a.jsx("div",{className:"space-y-1.5",children:W.runs.map(ye=>Ve(ye))}):a.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs captured."})]})},le.id):a.jsx(qe,{children:a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})},le.id)})]},U.scenarioId))})]})})]})]})]})},HD=(e,t,n)=>{const r=new URLSearchParams;return t&&r.set("configId",t),n&&r.set("agent",n),r.set("embed","1"),`/results/${encodeURIComponent(e)}?${r.toString()}`},VD=(e,t,n)=>{const r=new URLSearchParams;t&&r.set("configId",t),n&&r.set("agent",n);const s=r.toString();return`/results/${encodeURIComponent(e)}${s?`?${s}`:""}`},Swe=()=>{const{source:e}=$n(),[t]=zo(),n=t.get("left")??"",r=t.get("right")??"",s=t.get("leftConfig"),o=t.get("rightConfig"),i=t.get("leftAgent"),c=t.get("rightAgent"),u=i?`${n} · ${i}`:n,f=c?`${r} · ${c}`:r,[m,p]=h.useState(null),[v,x]=h.useState(null);return h.useEffect(()=>{if(!n||typeof e.getResult!="function"){p(null);return}let j=!0;return e.getResult(n).then(y=>{j&&p(y??null)}),()=>{j=!1}},[n,e]),h.useEffect(()=>{if(!r||typeof e.getResult!="function"){x(null);return}let j=!0;return e.getResult(r).then(y=>{j&&x(y??null)}),()=>{j=!1}},[r,e]),!n||!r?a.jsxs(Qe,{children:[a.jsx($t,{children:a.jsx(Dt,{className:"text-base",children:"Full Result Compare"})}),a.jsxs(Je,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Select exactly two runs in Compare and use the “Compare full results” action."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:"/compare",children:"Back to Compare"})})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Full Result Compare"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:i||c?"Side-by-side Result Detail views for deep inspection, filtered by selected agents.":"Side-by-side Result Detail views for deep inspection."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Z,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs(Et,{to:"/compare",children:[a.jsx(b5,{className:"mr-1.5 h-4 w-4"}),"Back to Compare"]})}),a.jsx(Z,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:VD(n,s,i),target:"_blank",rel:"noreferrer",children:["Open Left",a.jsx(Vc,{className:"ml-1.5 h-3.5 w-3.5"})]})}),a.jsx(Z,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:VD(r,o,c),target:"_blank",rel:"noreferrer",children:["Open Right",a.jsx(Vc,{className:"ml-1.5 h-3.5 w-3.5"})]})})]})]}),a.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[a.jsxs(Qe,{className:"overflow-hidden",children:[a.jsx($t,{className:"py-3",children:a.jsx(Dt,{className:"text-sm font-mono",children:u})}),a.jsx(Je,{className:"p-0",children:a.jsx("iframe",{title:`Result ${u}`,src:HD(n,s,i),className:"h-[calc(100vh-12rem)] w-full border-0"})})]}),a.jsxs(Qe,{className:"overflow-hidden",children:[a.jsx($t,{className:"py-3",children:a.jsx(Dt,{className:"text-sm font-mono",children:f})}),a.jsx(Je,{className:"p-0",children:a.jsx("iframe",{title:`Result ${f}`,src:HD(r,o,c),className:"h-[calc(100vh-12rem)] w-full border-0"})})]})]})]})};function Nwe(e){return e.match(/(?:^|\/)(?:result-assistant|results?)\/([0-9]{8}-[0-9]{6})(?:-|\/)/i)?.[1]??null}function Cwe(){const{source:e}=$n(),[t,n]=h.useState([]),[r,s]=h.useState(!0),[o,i]=h.useState(null),[c,u]=h.useState(!1),f=100,m=hx(f),{offset:p,hasMore:v}=m,x=async()=>{s(!0);try{if(e.listMarkdownReportsPage){const S=await e.listMarkdownReportsPage({limit:f,offset:p});n(S.data),m.updateMeta(S)}else n(await e.listMarkdownReports({limit:f,offset:p}))}catch(S){$e({title:"Could not load markdown reports",description:S instanceof Error?S.message:String(S),variant:"destructive"})}finally{s(!1)}};h.useEffect(()=>{x()},[p]);const j=h.useMemo(()=>t[0],[t]),y=h.useMemo(()=>t.find(S=>S.relativePath===o)??null,[t,o]),b=async()=>{if(o){u(!0);try{await e.deleteMarkdownReport(o),n(S=>S.filter(N=>N.relativePath!==o)),$e({title:"Markdown report deleted"}),i(null)}catch(S){$e({title:"Could not delete markdown report",description:S instanceof Error?S.message:String(S),variant:"destructive"})}finally{u(!1)}}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Rc,{className:"h-6 w-6"}),"Markdown Reports"]}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Browse Markdown files under ",a.jsx("code",{children:"mcplab/reports"}),"."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{variant:"outline",onClick:()=>{x()},children:"Refresh"}),j?a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:`/markdown-reports/view?id=${encodeURIComponent(j.reportId)}`,children:"Open latest"})}):null,a.jsx(Z,{variant:"outline",onClick:m.prev,disabled:r||p===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:m.next,disabled:r||!v,children:"Next"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:m.rangeLabel(t.length)}),a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:r?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Loading markdown reports..."}):t.length===0?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"No markdown reports found yet."}):a.jsxs(oa,{children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{children:"Report"}),a.jsx(ct,{children:"Result"}),a.jsx(ct,{children:"Folder"}),a.jsx(ct,{children:"Timestamp"}),a.jsx(ct,{className:"w-10"})]})}),a.jsx(la,{children:t.map(S=>a.jsxs(Wt,{children:[a.jsx(qe,{children:a.jsxs("div",{className:"space-y-1",children:[a.jsx(Et,{to:`/markdown-reports/view?id=${encodeURIComponent(S.reportId)}`,className:"font-mono text-xs text-primary hover:underline",children:S.name}),a.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:S.relativePath})]})}),a.jsx(qe,{className:"text-xs text-muted-foreground font-mono",children:(()=>{const N=Nwe(S.relativePath);return N?a.jsx(Et,{to:`/results/${encodeURIComponent(N)}`,className:"text-primary hover:underline",children:N}):a.jsx("span",{className:"text-muted-foreground",children:"—"})})()}),a.jsx(qe,{className:"text-xs text-muted-foreground font-mono",children:S.relativePath.includes("/")?S.relativePath.slice(0,S.relativePath.lastIndexOf("/")):"."}),a.jsx(qe,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(S.mtime).toLocaleString()]})}),a.jsx(qe,{children:a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Bg,{className:"h-4 w-4"})})}),a.jsxs(Bu,{align:"end",children:[a.jsx(Mr,{asChild:!0,children:a.jsx(Et,{to:`/markdown-reports/view?id=${encodeURIComponent(S.reportId)}`,children:"View"})}),a.jsxs(Mr,{className:"text-destructive",onSelect:N=>{N.preventDefault(),i(S.relativePath)},children:[a.jsx(Xa,{className:"mr-2 h-3.5 w-3.5"})," Delete"]})]})]})})]},S.path))})]})})}),a.jsx(Os,{open:!!o,onOpenChange:S=>!S&&i(null),children:a.jsxs(Za,{children:[a.jsxs(es,{children:[a.jsx(ns,{children:"Delete markdown report?"}),a.jsx(rs,{children:y?`Delete '${y.name}' from disk? This cannot be undone.`:"Delete this report from disk? This cannot be undone."})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:c,children:"Cancel"}),a.jsx(as,{onClick:S=>{S.preventDefault(),b()},disabled:c,children:c?"Deleting...":"Delete"})]})]})})]})}function _we(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function kwe(e){const t=e.relativePath.match(/(?:^|\/)(?:result-assistant|results?)\/([0-9]{8}-[0-9]{6})(?:-|\/)/i);return t?.[1]?t[1]:(e.content.match(/(?:^|\n)\s*\*\*Run:\*\*\s*`([^`]+)`/i)??e.content.match(/(?:^|\n)\s*Run ID:\s*([^\s]+)/i))?.[1]?.trim()||null}function Awe(){const{source:e}=$n(),[t]=zo(),n=(t.get("id")??"").trim(),r=(t.get("path")??"").trim(),[s,o]=h.useState(null),[i,c]=h.useState(!0),[u,f]=h.useState(!1),[m,p]=h.useState(!1);if(h.useEffect(()=>{let x=!0;if(o(null),f(!1),!n&&!r){c(!1);return}return c(!0),(n&&e.getMarkdownReportById?e.getMarkdownReportById(n):e.getMarkdownReport(r)).then(y=>{x&&o(y)}).catch(y=>{if(!x)return;const b=y instanceof Error?y.message:String(y);if(b.includes("(404)")){f(!0);return}$e({title:"Could not load markdown report",description:b,variant:"destructive"})}).finally(()=>{x&&c(!1)}),()=>{x=!1}},[r,n,e]),!n&&!r)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Markdown Report"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Missing report identifier."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:"/markdown-reports",children:"Back to Markdown Reports"})})]});if(i)return a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading markdown report..."});if(u||!s)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Markdown Report"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Report not found."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:"/markdown-reports",children:"Back to Markdown Reports"})})]});const v=kwe(s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"font-mono text-xl font-semibold",children:s.name}),a.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-mono",children:s.relativePath}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[a.jsx(Ea,{className:"h-3 w-3 shrink-0"}),new Date(s.mtime).toLocaleString()]}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx("span",{children:_we(s.sizeBytes)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[v?a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>p(!0),children:"Open Result Panel"}),a.jsx(Z,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(Et,{to:`/results/${encodeURIComponent(v)}`,children:"Open Result"})})]}):null,a.jsx(Z,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(Et,{to:"/markdown-reports",children:"Back to reports"})})]})]}),a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6",children:a.jsx(Ga,{text:s.content,variant:"assistant"})})}),v?a.jsx(bL,{open:m,onOpenChange:p,children:a.jsxs(VC,{side:"right",className:"w-[96vw] max-w-none p-0 sm:max-w-5xl",children:[a.jsx(jL,{className:"border-b px-4 py-3 pr-12",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(SL,{className:"text-base",children:["Result ",v]}),a.jsx(Z,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(Et,{to:`/results/${encodeURIComponent(v)}`,target:"_blank",rel:"noreferrer",children:"Open full page"})})]})}),a.jsx("div",{className:"h-[calc(100vh-64px)]",children:a.jsx("iframe",{title:`Result ${v}`,src:`/results/${encodeURIComponent(v)}?embed=1`,className:"h-full w-full border-0"})})]})}):null]})}const Ewe=()=>{const e=Kr();return h.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),a.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),a.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},Pwe=new vG;function Rwe(){const{scenarioId:e}=Bl();return a.jsx(z3,{to:e?`/libraries/test-cases/${encodeURIComponent(e)}`:"/libraries/test-cases",replace:!0})}function Twe(){return a.jsxs(bY,{children:[a.jsxs(xn,{element:a.jsx(AJ,{}),children:[a.jsx(xn,{path:"/",element:a.jsx(lge,{})}),a.jsx(xn,{path:"/mcp-evaluations",element:a.jsx(Axe,{})}),a.jsx(xn,{path:"/mcp-evaluations/:id",element:a.jsx(mD,{})}),a.jsx(xn,{path:"/mcp-evaluations/:id/:tab",element:a.jsx(mD,{})}),a.jsx(xn,{path:"/tool-analysis",element:a.jsx(O0e,{})}),a.jsx(xn,{path:"/tool-analysis-results",element:a.jsx(M0e,{})}),a.jsx(xn,{path:"/tool-analysis-results/:id",element:a.jsx(I0e,{})}),a.jsx(xn,{path:"/oauth-debugger",element:a.jsx(B0e,{})}),a.jsx(xn,{path:"/libraries/servers",element:a.jsx(Kye,{})}),a.jsx(xn,{path:"/libraries/servers/:serverId",element:a.jsx(Gye,{})}),a.jsx(xn,{path:"/libraries/agents",element:a.jsx(Yye,{})}),a.jsx(xn,{path:"/libraries/agents/:agentName",element:a.jsx(a0e,{})}),a.jsx(xn,{path:"/libraries/test-cases",element:a.jsx(CD,{})}),a.jsx(xn,{path:"/libraries/test-cases/:testCaseId",element:a.jsx(CD,{})}),a.jsx(xn,{path:"/libraries/scenarios",element:a.jsx(z3,{to:"/libraries/test-cases",replace:!0})}),a.jsx(xn,{path:"/libraries/scenarios/:scenarioId",element:a.jsx(Rwe,{})}),a.jsx(xn,{path:"/settings",element:a.jsx(s0e,{})}),a.jsx(xn,{path:"/settings/mcp",element:a.jsx(f0e,{})}),a.jsx(xn,{path:"/run",element:a.jsx(J0e,{})}),a.jsx(xn,{path:"/results",element:a.jsx(owe,{})}),a.jsx(xn,{path:"/results/:id",element:a.jsx(uwe,{})}),a.jsx(xn,{path:"/markdown-reports",element:a.jsx(Cwe,{})}),a.jsx(xn,{path:"/markdown-reports/view",element:a.jsx(Awe,{})}),a.jsx(xn,{path:"/compare",element:a.jsx(jwe,{})}),a.jsx(xn,{path:"/compare/results",element:a.jsx(Swe,{})})]}),a.jsx(xn,{path:"*",element:a.jsx(Ewe,{})})]})}const Owe=()=>a.jsx(yG,{client:Pwe,children:a.jsx(Js,{children:a.jsx(SJ,{children:a.jsx(PJ,{children:a.jsxs(EJ,{children:[a.jsx(wH,{}),a.jsx(ZH,{}),a.jsx(HY,{children:a.jsx(Twe,{})})]})})})})});x9.createRoot(document.getElementById("root")).render(a.jsx(Owe,{}));
257
+ </html>`}function al(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const lwe="mcplab.resultAssistantScenarioHandoff",cwe=[{label:"Summarize Run Results",description:"Highlight failures first, then notable tool usage and extracted values.",prompt:"Summarize the scenario results in this run. Highlight failed scenarios/checks first, then mention notable tool usage and extracted values."},{label:"Compare Agent Answer Quality",description:"Rank agents by completeness, depth, and recommendation quality.",prompt:"Compare the answer quality across all agents for this run. Rank them by completeness, analytical depth, and usefulness of recommendations. Highlight concrete differences in tool usage."},{label:"Explain Key Failures",description:"Use traces and tool outputs to identify likely root causes.",prompt:"Identify the most important failures in this run and explain likely root causes using the trace and tool outputs."},{label:"Compare With Previous Run",description:"Summarize changes in outcomes, tool usage, and extracted values.",prompt:"Compare this run with the previous run and summarize changes in outcomes, tool usage, and extracted values."}];function LD(e){const t=new Date().toISOString().replace(/[:]/g,"-").replace(/\..+/,"");return`mcplab/reports/result-assistant/${e}-${t}.md`}function FD(e){const t=e.toFixed(1);return t.endsWith(".0")?t.slice(0,-2):t}const uwe=()=>{const{id:e}=Bl(),t=is(),[n]=zo(),{source:r}=$n(),s=n.get("embed")==="1",{configs:o}=up(),{scenarios:i}=Is(),[c,u]=h.useState(void 0),[f,m]=h.useState(!0),[p,v]=h.useState(!1),[x,j]=h.useState(""),[y,b]=h.useState(!1),[S,N]=h.useState(new Set),[C,k]=h.useState(new Set),[A,E]=h.useState(""),[P,T]=h.useState(!1),[$,Y]=h.useState(!1),[H,F]=h.useState("assistant"),[X,L]=h.useState(null),[I,M]=h.useState(!1),[q,G]=h.useState(""),[O,Q]=h.useState(""),[B,z]=h.useState(!1),[V,ee]=h.useState(!1),[ae,ue]=h.useState(!1),[se,xe]=h.useState([]),[oe,de]=h.useState(!1),[De,me]=h.useState(""),[ge,we]=h.useState(null),[at,tt]=h.useState(!1),[it,At]=h.useState(null),[Ge,Ee]=h.useState(!1),[Re,Ze]=h.useState(!1),[ht,Ft]=h.useState(!1),zt=h.useRef(null),[jt,rn]=h.useState(!1),{assistantMessages:an,assistantPendingToolCalls:qt,assistantInput:Zt,assistantLoading:sn,assistantTurnCancelable:ln,cancelAssistantTurn:_e,assistantChatEndRef:ze,assistantInputRef:Xe,setAssistantInput:kt,askAssistant:vt,approveResultAssistantToolCall:fe,denyResultAssistantToolCall:Oe,applyResultAssistantSnippet:Ve,ensureIntroMessage:U,resetAssistantSession:le}=kU({source:r,open:P,scope:"run",runId:e,onSessionSync:void 0}),W=h.useCallback(async(ne,Ne)=>{de(!0);try{const Nt=(await r.listMarkdownReports()).filter(jn=>{const bn=String(jn.relativePath??""),mn=String(jn.name??"");return bn.includes(ne)||mn.includes(ne)});if(xe(Nt),Ne&&Nt.length>0){const jn=Nt.find(bn=>bn.relativePath===Ne||bn.path===Ne||bn.relativePath.endsWith(Ne)||bn.path.endsWith(Ne));jn&&me(jn.relativePath)}return Nt}catch{return xe([]),[]}finally{de(!1)}},[r]);h.useEffect(()=>{if(!e)return;let ne=!0;return le(),m(!0),r.getResult(e).then(Ne=>{ne&&(u(Ne),j(Ne?.runNote??""),v(!1),m(!1))}),()=>{ne=!1}},[e,r,le]),h.useEffect(()=>{const ne=zt.current;if(!ne)return;const Ne=()=>{rn(ne.clientWidth<800)};if(Ne(),typeof ResizeObserver<"u"){const pt=new ResizeObserver(()=>Ne());return pt.observe(ne),()=>pt.disconnect()}return window.addEventListener("resize",Ne),()=>window.removeEventListener("resize",Ne)},[f]),h.useEffect(()=>{if(!c?.id){xe([]);return}let ne=!0;return(async()=>{const Ne=await W(c.id)})(),()=>{ne=!1}},[c?.id,W]),h.useEffect(()=>{if(se.length===0){me(""),we(null),At(null);return}(!De||!se.some(ne=>ne.relativePath===De))&&me(se[0].relativePath)},[se,De]),h.useEffect(()=>{if(!P||H!=="reports")return;if(!De){we(null),At(null);return}let ne=!0;return tt(!0),At(null),r.getMarkdownReport(De).then(Ne=>{ne&&we(Ne)}).catch(Ne=>{ne&&(we(null),At(Ne instanceof Error?Ne.message:String(Ne)))}).finally(()=>{ne&&tt(!1)}),()=>{ne=!1}},[P,H,De,r]);const ye=n.get("configId")??"",ve=(n.get("agent")??"").trim(),ke=h.useMemo(()=>{const ne=ye?o.find(nn=>nn.id===ye):void 0;if(ne)return ne;if(!c)return;const Ne=c.configPath?.trim(),pt=c.configName?.trim(),Nt=o.find(nn=>nn.id===c.configId);if(Nt)return Nt;const jn=nn=>[nn.relativePath,nn.sourcePath,nn.suitePath],bn=Ne?o.find(nn=>jn(nn).some(sr=>sr?.trim()===Ne)):void 0;if(bn)return bn;const mn=Ne?o.find(nn=>jn(nn).some(sr=>sr?.endsWith(`/${Ne}`)===!0)):void 0;return mn||o.find(nn=>pt?nn.name===pt||nn.configName===pt:!1)},[o,ye,c]),Ce=h.useMemo(()=>{const ne=c?.configName?.trim();if(ne)return ne;const Ne=c?.configPath?.trim();if(Ne)return Ne;const pt=ke?.relativePath?.trim()||ke?.name?.trim();return pt||c?.configId?.trim()||""},[c,ke]),K=h.useMemo(()=>{const ne=c?.configName?.trim();return ne||ke?.name?.trim()||""},[c,ke]),pe=h.useMemo(()=>{const ne=c?.configPath?.trim();return ne||ke?.relativePath?.trim()||""},[c,ke]),Ae=h.useMemo(()=>{const ne=new Map;if(ke){for(const Ne of ke.scenarios)ne.set(Ne.id,Ne),Ne.name&&!ne.has(Ne.name)&&ne.set(Ne.name,Ne);for(const Ne of ke.scenarioEntries??[]){if(Ne.kind!=="referenced")continue;const pt=i.find(Nt=>Nt.id===Ne.ref);pt&&(ne.set(pt.id,pt),pt.name&&ne.set(pt.name,pt),ne.has(Ne.ref)||ne.set(Ne.ref,pt))}}for(const Ne of i)ne.has(Ne.id)||ne.set(Ne.id,Ne),Ne.name&&!ne.has(Ne.name)&&ne.set(Ne.name,Ne);return ne},[ke,i]),Ke=h.useMemo(()=>"",[]);h.useEffect(()=>{if(ye&&o.some(ne=>ne.id===ye)){E(ye);return}Ke&&E(ne=>ne||Ke)},[ye,o,Ke]);const{filteredScenarios:te,filteredTotalRuns:Le,filteredPassCount:ot,displayPassRate:Ut,displayAvgToolCalls:Te,displayAvgLatency:Qt,displayDurationMs:St,displayToolTimeMs:Gt,displayToolTokenUsage:Xn}=h.useMemo(()=>{if(!c)return{filteredScenarios:[],filteredTotalRuns:0,filteredPassCount:0,displayPassRate:0,displayAvgToolCalls:0,displayAvgLatency:0,displayDurationMs:null,displayToolTimeMs:null,displayToolTokenUsage:null};const ne=ve?c.scenarios.filter(mn=>mn.agentId===ve||mn.agentName===ve):c.scenarios,Ne=ne.reduce((mn,nn)=>mn+nn.runs.length,0),pt=ne.reduce((mn,nn)=>mn+nn.runs.filter(sr=>sr.passed).length,0),Nt=ne.reduce((mn,nn)=>mn+nn.runs.reduce((sr,Ct)=>sr+Ct.toolCalls.length,0),0),jn=Ig({...c,scenarios:ne}),bn=$g({...c,scenarios:ne});return{filteredScenarios:ne,filteredTotalRuns:Ne,filteredPassCount:pt,displayPassRate:Ne===0?0:pt/Ne,displayAvgToolCalls:Ne===0?0:Nt/Ne,displayAvgLatency:Ne===0||jn===null?0:Math.round(jn/Ne),displayDurationMs:jn,displayToolTimeMs:bn,displayToolTokenUsage:HQ(ne.map(mn=>mn.toolTokenUsage))}},[c,ve]),zn=h.useMemo(()=>{const ne={};return te.forEach(Ne=>Ne.runs.forEach(pt=>pt.toolCalls.forEach(Nt=>{ne[Nt.name]=(ne[Nt.name]||0)+1}))),Object.entries(ne).map(([Ne,pt])=>({name:Ne,count:pt})).sort((Ne,pt)=>pt.count-Ne.count)},[te]);if(f)return a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Loading result..."});if(!c)return a.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Result not found"});const Ra=h1(te.flatMap(ne=>ne.runs.flatMap(Ne=>Ne.checkResults??[]))),Xl=ne=>{N(Ne=>{const pt=new Set(Ne);return pt.has(ne)?pt.delete(ne):pt.add(ne),pt})},Bn=(ne,Ne,pt,Nt)=>`${ne}:${Ne}:${pt}:${Nt}`,Li=(ne,Ne)=>`${ne}::${Ne}`,pa=ne=>{k(Ne=>{const pt=new Set(Ne);return pt.has(ne)?pt.delete(ne):pt.add(ne),pt})},jr=ne=>{const Ne=!ne.endsWith(":conversation");return C.has(ne)?!Ne:Ne},io=(ne,Ne)=>{F("assistant"),T(!0),L(Ne?.scenarioId??null),U("Ask me to explain failures, tool usage, or suggest what to inspect next in this result."),ne&&kt(ne)},Fi=qt.filter(ne=>ne.status==="pending"&&!an.some(Ne=>Ne.pendingToolCallId===ne.id)),Wu=ne=>{F("reports"),T(!0)},En=()=>{F("note"),T(!0)},Hu=ne=>{if(!c)return;if(!X){$e({title:"No scenario context",description:"Ask about a specific scenario or run first, then send the suggestion.",variant:"destructive"});return}const Ne=i.find(Nt=>Nt.id===X)??i.find(Nt=>Nt.name===X);if(!Ne){$e({title:"Scenario not found in library",description:`Could not find library scenario '${X}' to open in Scenario Assistant.`,variant:"destructive"});return}const pt=[`I am sending a suggestion from the Result Assistant for scenario '${X}' based on run '${c.id}'.`,"Please review the suggestion, check it against the current scenario configuration, and propose concrete updates to the Checks and/or Value Capture Rules if appropriate.","","Result Assistant suggestion:",ne].join(`
258
+ `);try{window.sessionStorage.setItem(lwe,JSON.stringify({type:"result-assistant-handoff-v1",runId:c.id,configId:ye||c.configId||"",scenarioId:Ne.id,prompt:pt,sourceReply:ne})),t(`/libraries/test-cases/${encodeURIComponent(Ne.id)}?assistantHandoff=1`)}catch(Nt){$e({title:"Could not create handoff",description:Nt instanceof Error?Nt.message:String(Nt),variant:"destructive"})}},Vo=ne=>{c&&(ue(!1),G(ne),Q(LD(c.id)),z(!1),M(!0))},ie=()=>{c&&(ue(!0),G(""),Q(LD(c.id)),z(!1),M(!0))},rt=async()=>{if(!c)return;if(!q.trim()){$e({title:"No markdown to write",description:"The selected assistant response is empty.",variant:"destructive"});return}ee(!0);try{const Ne=await r.applyResultAssistantReport({runId:c.id,markdown:q,outputPath:O.trim()||void 0,overwrite:B});$e({title:"Markdown report written",description:typeof Ne.path=="string"&&Ne.path?Ne.path:Ne.outputPath}),await W(c.id,typeof Ne.path=="string"&&Ne.path||Ne.outputPath||void 0),P&&F("reports"),M(!1)}catch(Ne){$e({title:"Could not write markdown report",description:Ne instanceof Error?Ne.message:String(Ne),variant:"destructive"})}finally{ee(!1)}},Yt=async ne=>{try{await navigator.clipboard.writeText(ne),$e({title:"Copied"})}catch(Ne){$e({title:"Could not copy",description:Ne instanceof Error?Ne.message:String(Ne),variant:"destructive"})}},Pt=async()=>{if(c){b(!0);try{const ne=x.trim();await r.updateRunNote(c.id,ne||void 0),u(Ne=>Ne&&{...Ne,runNote:ne||void 0}),j(ne),v(!1),$e({title:"Run note saved"})}catch(ne){$e({title:"Could not save run note",description:ne instanceof Error?ne.message:String(ne),variant:"destructive"})}finally{b(!1)}}},Lt=async()=>{if(c?.id){Ze(!0);try{await r.deleteResult(c.id),$e({title:"Run deleted",description:c.id}),t("/results")}catch(ne){$e({title:"Could not delete run",description:ne instanceof Error?ne.message:String(ne),variant:"destructive"})}finally{Ze(!1),Ee(!1)}}},tn=async()=>{if(!c?.id)return;if(!pe.trim()){$e({title:"Cannot rerun",description:"This run has no config path in metadata.",variant:"destructive"});return}Ft(!0);try{await AU(r,c),$e({title:"Rerun queued",description:`${c.id} queued with previous run settings.`})}catch(Ne){$e({title:"Could not rerun",description:Ne instanceof Error?Ne.message:String(Ne),variant:"destructive"})}finally{Ft(!1)}};return a.jsxs("div",{className:`${P?"xl:flex xl:h-[calc(100vh-2rem-48px)] xl:min-h-0 xl:flex-col xl:overflow-hidden":""}`,children:[a.jsx("div",{className:`${P?"xl:shrink-0 xl:pb-6":"mb-6"}`,children:a.jsxs("div",{ref:zt,className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[!s&&a.jsx(Z,{variant:"ghost",size:"icon",asChild:!0,children:a.jsx(Et,{to:"/results",children:a.jsx(Si,{className:"h-4 w-4"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"text-2xl font-bold font-mono",children:c.id}),a.jsx(Ws,{rate:Ut})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[a.jsx(oP,{className:"h-3 w-3 shrink-0"}),new Date(c.timestamp).toLocaleString()]}),a.jsx("span",{className:"mx-1",children:"·"}),ve?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Agent: ",ve]}),a.jsx("span",{className:"mx-1",children:"·"})]}):null,K?a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Eval: ",a.jsx("span",{className:"ml-1 font-medium",children:K})]}):null,K&&pe?a.jsx("span",{className:"mx-1",children:"·"}):null,pe?a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Path: ",a.jsx("span",{className:"ml-1 font-mono",children:pe})]}):null,!K&&!pe&&Ce?a.jsxs("span",{className:"inline-flex items-center align-middle",children:["Config: ",a.jsx("span",{className:"ml-1 font-mono",children:Ce})]}):null]})]})]}),a.jsxs("div",{className:"flex w-full min-w-0 items-center justify-between gap-2 sm:ml-auto sm:w-auto",children:[a.jsx(Su,{versions:c.mcpServerVersions}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:[Object.entries(c.langsmithTraceUrls??{}).map(([ne,Ne])=>a.jsxs("a",{href:Ne,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-center gap-1.5 rounded-md border border-input bg-background px-3 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground","aria-label":"LangSmith trace",title:"Open LangSmith trace",children:[a.jsx(Vc,{className:"h-3.5 w-3.5"}),!s&&"LangSmith trace"]},ne)),a.jsxs(Z,{variant:"outline",size:"sm",className:`max-w-full gap-1.5 ${s?"px-2":""}`,onClick:()=>{const ne=iwe(c),Ne=new Blob([ne],{type:"text/html"}),pt=URL.createObjectURL(Ne),Nt=document.createElement("a");Nt.href=pt,Nt.download=`mcplab-report-${c.id}.html`,Nt.click(),URL.revokeObjectURL(pt)},"aria-label":"Download Report",title:"Download Report",children:[a.jsx(zr,{className:"h-3.5 w-3.5"}),!s&&"Download Report"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5",onClick:()=>Wu(),disabled:oe,children:[a.jsx(Rc,{className:"h-3.5 w-3.5"}),oe?"Reports...":`Reports${se.length?` (${se.length})`:""}`]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5","aria-label":"Run Note",onClick:()=>En(),children:[a.jsx(Rc,{className:"h-3.5 w-3.5"}),jt?"Note":"Run Note"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5","aria-label":"MCP Lab Assistant",onClick:()=>io(),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),jt?"Assistant":"MCP Lab Assistant"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5",onClick:()=>{tn()},disabled:ht||!pe.trim(),children:[a.jsx(ks,{className:"h-3.5 w-3.5"}),ht?"Queueing...":"Rerun"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"max-w-full gap-1.5 text-destructive",onClick:()=>Ee(!0),disabled:Re,"aria-label":Re?"Deleting run":"Delete run",children:[Re?a.jsx(_r,{className:"h-4 w-4 animate-spin"}):a.jsx(ll,{className:"h-4 w-4"}),jt?null:Re?"Deleting...":"Delete"]})]})]})]})}),a.jsxs("div",{className:`grid gap-6 items-start ${P?$?"xl:grid-cols-[minmax(0,1fr)_52rem] xl:flex-1 xl:min-h-0 xl:overflow-hidden":"xl:grid-cols-[minmax(0,1fr)_28rem] xl:flex-1 xl:min-h-0 xl:overflow-hidden":"grid-cols-1"}`,children:[a.jsxs("div",{className:`min-w-0 space-y-6 ${P?"xl:h-full xl:min-h-0 xl:overflow-y-auto xl:pr-2":""}`,children:[a.jsxs("div",{className:`grid gap-4 ${P?"grid-cols-3":"sm:grid-cols-2 lg:grid-cols-8"}`,children:[a.jsx(nr,{title:"Scenarios",value:te.length,icon:gm}),a.jsx(nr,{title:"Total Runs",value:Le,icon:hC}),a.jsx(nr,{title:"Pass Rate",value:`${Math.round(Ut*100)}%`,icon:bl}),a.jsx(nr,{title:"Avg Tool Calls",value:FD(Te),icon:Va}),a.jsx(nr,{title:"Avg Latency",value:`${Qt}ms`,icon:bC}),St!==null?a.jsx(nr,{title:"Total Time",value:aa(St),icon:Ea}):null,Gt!==null?a.jsx(nr,{title:"Tool Duration",value:aa(Gt),icon:Ea}):null,a.jsx(nr,{title:"Tool Tokens",value:ta(Xn?.totalTokens),icon:Ua})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-4",children:[a.jsx(Dg,{title:"Runs Pass / Fail",passed:ot,failed:Math.max(0,Le-ot)}),a.jsx(Dg,{title:"Checks Pass / Fail",passed:Ra.passed,failed:Ra.failed,notEvaluated:Ra.not_evaluated}),a.jsxs(Qe,{className:"lg:col-span-2",children:[a.jsx($t,{className:"p-2.5 pb-0",children:a.jsx(Dt,{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Tool Usage"})}),a.jsx(Je,{children:a.jsx(hf,{width:"100%",height:120,children:a.jsxs(oge,{data:zn,layout:"vertical",children:[a.jsx(_i,{type:"number",tick:{fontSize:11}}),a.jsx(ki,{type:"category",dataKey:"name",tick:{fontSize:11},width:120}),a.jsx(ra,{}),a.jsx(Kl,{dataKey:"count",fill:"hsl(38, 92%, 50%)",radius:[0,4,4,0]})]})})})]})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(Dt,{className:"text-base",children:"Scenarios"}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1.5 px-2 text-xs",onClick:()=>io("Summarize the scenario results in this run. Highlight failed scenarios/checks first, then mention notable tool usage and extracted values."),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"Ask Assistant"]})]})}),a.jsx(Je,{className:"p-0",children:a.jsxs(oa,{children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-8"}),a.jsx(ct,{children:"Scenario"}),a.jsx(ct,{children:"Agent"}),a.jsx(ct,{children:"Runs"}),a.jsx(ct,{children:"Pass Rate"}),a.jsx(ct,{children:"Checks"}),a.jsx(ct,{className:"text-right",children:"Total Time"}),a.jsx(ct,{className:"text-right",children:"Tool Calls"}),a.jsx(ct,{className:"text-right",children:"Tool Tokens"}),a.jsx(ct,{className:"text-right",children:"Tool Duration"})]})}),a.jsx(la,{children:te.map(ne=>{const Ne=Li(ne.scenarioId,ne.agentName),pt=ne.scenarioName||ne.scenarioId,Nt=h1(ne.runs.flatMap(Ct=>Ct.checkResults??[])),jn=ne.runs.some(Ct=>(Ct.checkResults?.length??0)>0),bn=ke?.id||c?.configId?.trim(),mn=bn?`/mcp-evaluations/${encodeURIComponent(bn)}/scenarios`:null,nn=i.find(Ct=>Ct.id===ne.scenarioId),sr=nn?`/libraries/test-cases/${encodeURIComponent(nn.id)}?returnTo=${encodeURIComponent(`/results/${c?.id??e}`)}`:null;return a.jsx(Ss,{open:S.has(Ne),onOpenChange:()=>Xl(Ne),asChild:!0,children:a.jsxs(a.Fragment,{children:[a.jsx(Ba,{asChild:!0,children:a.jsxs(Wt,{className:"cursor-pointer hover:bg-muted/50",children:[a.jsx(qe,{children:a.jsx(Jt,{className:`h-4 w-4 transition-transform ${S.has(Ne)?"rotate-180":""}`})}),a.jsx(qe,{className:"font-medium text-sm",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{children:ne.scenarioName}),mn?a.jsx(Et,{to:mn,"aria-label":"Edit scenario",title:"Edit scenario",className:"inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",onClick:Ct=>Ct.stopPropagation(),children:a.jsx(Zf,{className:"h-3.5 w-3.5"})}):null]})}),a.jsxs(qe,{className:"text-sm",children:[a.jsx("div",{children:ne.agentName}),ne.provider||ne.model?a.jsx("div",{className:"text-xs text-muted-foreground",children:[ne.provider?Yf(ne.provider):null,ne.model].filter(Boolean).join(" · ")}):null]}),a.jsx(qe,{className:"font-mono text-sm",children:ne.runs.length}),a.jsx(qe,{children:a.jsx(Ws,{rate:ne.passRate})}),a.jsx(qe,{className:"font-mono text-sm",children:jn?a.jsxs("span",{title:`${Nt.passed} passed · ${Nt.failed} failed${Nt.not_evaluated?` · ${Nt.not_evaluated} not evaluated`:""}`,"aria-label":`${Nt.passed} checks passed, ${Nt.failed} checks failed${Nt.not_evaluated?`, ${Nt.not_evaluated} not evaluated`:""}`,children:[a.jsxs("span",{className:"text-success",children:[Nt.passed," ✓"]}),a.jsx("span",{className:"text-muted-foreground",children:" "}),a.jsxs("span",{className:"text-destructive",children:[Nt.failed," ✕"]}),Nt.not_evaluated>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground",children:" "}),a.jsxs("span",{children:[Nt.not_evaluated," ?"]})]})]}):"—"}),a.jsx(qe,{className:"text-right font-mono text-sm",children:aa(nC(ne),{preciseUnderTenSeconds:!0})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:FD(ne.avgToolCalls)}),a.jsx(qe,{className:"text-right font-mono text-sm",children:ta(ne.toolTokenUsage?.totalTokens)}),a.jsx(qe,{className:"text-right font-mono text-sm",children:aa(rC(ne),{preciseUnderTenSeconds:!0})})]})}),a.jsx(Ns,{asChild:!0,children:a.jsx("tr",{children:a.jsx("td",{colSpan:10,className:"p-0",children:a.jsxs("div",{className:"bg-muted/30 p-4 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border bg-card px-3 py-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs font-semibold",children:"Scenario details"}),a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[pt," · ",ne.agentName," ·"," ",Math.round(ne.passRate*100),"% pass rate ·"," ",jn?`Checks ${Nt.passed} ✓ · ${Nt.failed} ✕ · `:"",ta(ne.toolTokenUsage?.totalTokens)," tool tokens ·"," ",aa(nC(ne),{preciseUnderTenSeconds:!0})," ","total time ·"," ",aa(rC(ne),{preciseUnderTenSeconds:!0})," ","tool time"]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[sr?a.jsx(Z,{asChild:!0,type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs text-muted-foreground",children:a.jsxs(Et,{to:sr,"aria-label":"Edit test case",children:[a.jsx(mC,{className:"h-3.5 w-3.5"}),"Edit test case"]})}):null,a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>io(`Explain why scenario '${pt}' failed (agent: ${ne.agentName}). Summarize the likely cause from the result details and suggest what to inspect next.`,{scenarioId:ne.scenarioId}),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"Ask Assistant"]})]})]}),ne.runs.map(Ct=>a.jsxs("div",{className:"flex items-start gap-3 rounded-md border bg-card p-3 text-sm",children:[a.jsx("div",{className:"mt-0.5",children:Ct.passed?a.jsx(Va,{className:"h-4 w-4 text-success"}):a.jsx(ll,{className:"h-4 w-4 text-destructive"})}),a.jsxs("div",{className:"flex-1 space-y-1",children:[(()=>{const Zn=Ae.get(ne.scenarioId),Vn=Zn?pwe(Zn.evalRules,Ct.failureReasons,Ct.error,Ct.checkResults):[],Ir=Vn.filter(qn=>qn.status==="failed"),Ds=Vn.filter(qn=>qn.status==="passed"),us=Vn.filter(qn=>qn.status==="not_evaluated");return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["Run #",Ct.runIndex+1]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ct.duration,"ms"]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[ta(Ct.toolTokenUsage?.totalTokens)," ","tool tokens"]}),!Ct.passed&&a.jsx(et,{variant:"outline",className:"h-5 border-destructive/30 bg-destructive/10 text-destructive text-[10px]",children:"Failed"})]}),Ct.failureReasons.length>0&&a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-2",children:[a.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-destructive",children:[a.jsx(ll,{className:"h-3.5 w-3.5"}),"Failure reasons"]}),a.jsx("ul",{className:"space-y-1 text-xs text-destructive",children:Ct.failureReasons.map((qn,zi)=>a.jsxs("li",{children:["• ",UD(qn)]},zi))})]}),Vn.length>0&&a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"checks")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"checks")),children:a.jsxs("div",{className:"rounded-md border bg-muted/20 p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full flex-wrap items-center gap-2 text-left",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"checks"))?"rotate-180":""}`}),a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Checks"}),a.jsxs(et,{variant:"outline",className:"h-5 border-success/30 bg-success/10 text-success text-[10px]",children:[Ds.length," passed"]}),a.jsxs(et,{variant:"outline",className:`h-5 text-[10px] ${Ir.length>0?"border-destructive/30 bg-destructive/10 text-destructive":""}`,children:[Ir.length," failed"]}),us.length>0&&a.jsxs(et,{variant:"outline",className:"h-5 border-muted-foreground/30 bg-muted text-[10px] text-muted-foreground",children:[us.length," not evaluated"]})]})}),a.jsxs(Ns,{children:[us.length>0&&a.jsx("p",{className:"mb-2 text-[11px] text-muted-foreground",children:"Checks were not evaluated because this run failed before evaluation."}),a.jsx("div",{className:"space-y-1",children:Vn.map((qn,zi)=>a.jsxs("div",{className:`flex items-start justify-between gap-2 rounded-md border px-2 py-1.5 text-xs ${qn.status==="failed"?"border-destructive/20 bg-destructive/5":qn.status==="not_evaluated"?"border-muted-foreground/20 bg-muted/40":"border-success/20 bg-success/5"}`,children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[qn.status==="failed"?a.jsx(ll,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):qn.status==="not_evaluated"?a.jsx(oP,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):a.jsx(Va,{className:"h-3.5 w-3.5 shrink-0 text-success"}),a.jsx("span",{className:"font-medium",children:cx(qn.rule)})]}),qn.failureReason&&a.jsx("p",{className:"mt-1 pl-5 text-[11px] text-muted-foreground",children:UD(qn.failureReason)})]}),a.jsx(et,{variant:"outline",className:`shrink-0 text-[10px] ${qn.status==="failed"?"border-destructive/30 text-destructive":qn.status==="not_evaluated"?"border-muted-foreground/30 text-muted-foreground":"border-success/30 text-success"}`,children:qn.status})]},`${qn.rule.type}-${qn.rule.value??qn.rule.path??""}-${zi}`))})]})]})})]})})(),a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"extracts")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"extracts")),children:a.jsxs("div",{className:"rounded-md border border-violet-500/20 bg-violet-500/5 p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full flex-wrap items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"extracts"))?"rotate-180":""}`}),a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(gm,{className:"h-3.5 w-3.5 text-violet-600"}),"Extracted values"]})]}),a.jsxs(et,{variant:"outline",className:"h-5 text-[10px]",children:[Object.keys(Ct.extractedValues??{}).length," ","total"]})]})}),a.jsx(Ns,{children:Object.keys(Ct.extractedValues??{}).length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No extracted values captured for this run."}):a.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:Object.entries(Ct.extractedValues??{}).map(([Zn,Vn])=>a.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5 text-xs",children:[a.jsx("div",{className:"mb-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:Zn}),a.jsx("div",{className:"font-mono break-all text-foreground",children:Vn===null?"null":String(Vn)})]},Zn))})})]})}),a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"tools")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"tools")),children:a.jsxs("div",{className:"rounded-md border border-sky-500/20 bg-sky-500/5 p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full flex-wrap items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"tools"))?"rotate-180":""}`}),a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(Ua,{className:"h-3.5 w-3.5 text-sky-600"}),"Tool call sequence"]})]}),a.jsxs(et,{variant:"outline",className:"h-5 text-[10px]",children:[Ct.toolCalls.length," total"]})]})}),a.jsx(Ns,{children:Ct.toolCalls.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No tool calls captured for this run."}):a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"flex flex-wrap gap-1",children:a.jsx(Js,{delayDuration:0,children:Ct.toolCalls.map((Zn,Vn)=>{const Ir=Ct.conversation.filter(us=>us.kind==="tool_call")[Vn]?.estimatedTokens,Ds=typeof Ir?.totalTokens=="number";return a.jsxs(Zs,{children:[a.jsx(eo,{asChild:!0,children:a.jsxs(et,{variant:"outline",className:"font-mono text-xs bg-background",children:[a.jsxs("span",{className:"mr-1 text-muted-foreground",children:["#",Vn+1]}),Zn.name,a.jsxs("span",{className:"ml-1 text-muted-foreground",children:[Zn.duration,"ms"]}),Ds&&a.jsxs("span",{className:"ml-1 text-muted-foreground",children:["·"," ",ta(Ir?.totalTokens),"tok"]})]})}),Ds&&a.jsx(Rs,{className:"text-xs",children:`${Zn.name} · tokens total: ${ta(Ir?.totalTokens)} · in: ${ta(Ir?.inputTokens)} · out: ${ta(Ir?.outputTokens)}`})]},Vn)})})}),a.jsxs("div",{className:"rounded-md border bg-background p-2",children:[a.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Tool token estimate"}),a.jsx(et,{variant:"outline",className:"h-5 text-[10px]",children:"estimated"})]}),Object.keys(Ct.toolTokenUsageByTool??{}).length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"n/a"}):a.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:Object.entries(Ct.toolTokenUsageByTool??{}).map(([Zn,Vn])=>a.jsxs("div",{className:"rounded border bg-muted/30 px-2 py-1.5 text-xs",children:[a.jsx("div",{className:"font-mono text-[11px]",children:Zn}),a.jsxs("div",{className:"text-muted-foreground",children:["total:"," ",ta(Vn.totalTokens)," ","· in:"," ",ta(Vn.inputTokens)," ","· out:"," ",ta(Vn.outputTokens)]})]},Zn))})]})]})})]})}),a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"final")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"final")),children:a.jsxs("div",{className:"rounded-md border border-muted-foreground/20 bg-card p-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"mb-2 flex w-full items-center gap-2 text-left",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"final"))?"rotate-180":""}`}),a.jsxs("p",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(Wr,{className:"h-3.5 w-3.5"}),"Final answer"]})]})}),a.jsx(Ns,{children:a.jsx(oC,{text:Ct.finalAnswer||"No final answer captured.",maxLength:1200,className:"text-xs text-foreground"})})]})}),a.jsx(Ss,{open:jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation")),onOpenChange:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation")),children:a.jsxs("div",{className:"rounded-md border bg-muted/10 p-2",children:[a.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left",children:[a.jsx(Jt,{className:`h-3.5 w-3.5 shrink-0 transition-transform ${jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation"))?"rotate-180":""}`}),a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Conversation trace"})]})}),a.jsx("div",{className:"flex flex-wrap gap-2",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>io(`Explain Run #${Ct.runIndex+1} for scenario '${pt}'. It ${Ct.passed?"passed":"failed"} in ${Ct.duration}ms. Focus on the tool sequence and ${Ct.passed?"why it passed":"what caused the failure"}.`,{scenarioId:ne.scenarioId}),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"Ask Assistant"]})})]}),a.jsx(Ns,{children:a.jsx("div",{className:"space-y-2 rounded-md border bg-muted/20 p-2",children:Ct.conversation.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No conversation trace captured."}):Ct.conversation.map(Zn=>a.jsx(dwe,{item:Zn,fallbackUserPrompt:Ae.get(ne.scenarioId)?.prompt},Zn.id))})}),!jr(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation"))&&a.jsx("button",{type:"button",className:"text-xs text-muted-foreground underline decoration-dotted underline-offset-2 hover:text-foreground",onClick:()=>pa(Bn(ne.scenarioId,ne.agentName,Ct.runIndex,"conversation")),children:"Expand to inspect user/assistant/tool messages for this run."})]})})]})]},Ct.runIndex))]})})})})]})},Ne)})})]})})]})]}),P&&a.jsxs("div",{className:"min-w-0 space-y-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx(ax,{value:H,onValueChange:ne=>F(ne),className:"min-w-0 -mb-px px-3 pt-1",children:a.jsxs(Cp,{className:"h-auto w-full justify-start rounded-none border-b bg-transparent p-0",children:[a.jsx(Xs,{value:"assistant",className:"-mb-px h-9 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-3 text-xs text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Assistant"}),a.jsx(Xs,{value:"reports",className:"-mb-px h-9 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-3 text-xs text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Reports"}),a.jsx(Xs,{value:"note",className:"-mb-px h-9 rounded-none rounded-t border border-border border-b-border bg-muted/20 px-3 text-xs text-muted-foreground data-[state=active]:z-10 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:border-border data-[state=active]:border-b-card data-[state=active]:shadow-none",children:"Note"})]})}),H==="assistant"?a.jsx(_U,{title:"MCP Lab Assistant",description:"Ask questions about this run result, failures, and tool usage.",expanded:$,onToggleExpanded:()=>Y(ne=>!ne),onHide:()=>T(!1),messages:an,pendingToolCalls:qt,loading:sn,onCancel:ln?_e:void 0,input:Zt,onInputChange:kt,onSend:()=>{vt()},inputPlaceholder:"Ask about this result...",snippets:cwe,onSnippetSelect:Ve,onApproveToolCall:ne=>{fe(ne)},onDenyToolCall:ne=>{Oe(ne)},chatEndRef:ze,inputRef:Xe,className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",renderMessage:({message:ne,index:Ne,linkedPendingToolCall:pt,isUser:Nt,isAssistant:jn,isSystem:bn,isTool:mn})=>{const nn=jn&&!!ne.pendingToolCallId;if(mn&&/^(Approved|Denied) tool call\\b/i.test(String(ne.text??"").trim()))return null;const sr=pt?.tool??ne.toolRequestName,Ct=pt?.publicToolName??ne.toolRequestPublicName,Zn=jn&&!nn&&fwe(ne.text,!!X);if(nn){const Ir=pt?.status==="pending",Ds=mm(sr??Ct??"unknown_tool");return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("details",{open:!!pt,className:"group min-w-0 w-full max-w-[92%] overflow-hidden rounded-md border border-border/60 bg-background",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ua,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:`Tool call ${Ds}`}),a.jsx("span",{className:`shrink-0 whitespace-nowrap rounded px-1.5 py-0.5 text-[10px] font-semibold ${Ir?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"}`,children:Ir?"Needs approval":"Completed"})]})}),a.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsxs("div",{className:"min-w-0 space-y-2 border-t border-border/50 px-3 py-2",children:[a.jsx(Ga,{text:ne.text,className:"text-sm"}),Ir&&pt&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"max-h-40 min-w-0 w-full max-w-full overflow-x-auto overflow-y-auto whitespace-pre-wrap break-words rounded border bg-muted/50 p-2 text-xs",children:a.jsx("code",{className:"break-words",children:JSON.stringify(pt.arguments??{},null,2)})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:sn,onClick:()=>{Oe(pt.id)},children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:sn,onClick:()=>{fe(pt.id)},children:"Approve"})]})]})]})]})]},`${ne.id??`${ne.role}-${Ne}`}:${pt?"pending":"completed"}`)}const Vn=Nt||jn&&!mn&&!bn;return a.jsxs("div",{className:`flex items-start gap-2 ${Nt?"justify-end":"justify-start"}`,children:[!Nt&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700",children:bn?a.jsx(vC,{className:"h-3 w-3"}):a.jsx(Wr,{className:"h-3 w-3"})}),a.jsxs("div",{className:"relative max-w-[92%]",children:[a.jsxs("div",{className:`max-w-full rounded-md border p-3 text-sm ${Nt?"border-primary/20 bg-primary/10":bn?"border-amber-400/30 bg-amber-50/70":mn?"border-blue-300/30 bg-blue-50/50":"border-border/80 bg-background shadow-sm"}`,children:[!(Nt||bn)&&a.jsx("p",{className:`mb-2 text-[11px] font-semibold text-muted-foreground ${Nt?"text-right":""}`,children:mn?"Tool":"Assistant"}),Nt?a.jsx("p",{className:"whitespace-pre-wrap",children:ne.text}):a.jsx(Ga,{text:ne.text,className:"text-sm"}),Zn&&a.jsxs("div",{className:"mt-3 flex max-w-full flex-wrap justify-end gap-2 overflow-x-auto pb-1",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>Hu(ne.text),children:[a.jsx(sa,{className:"h-4 w-4 text-amber-500"}),"Send to Scenario Assistant"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>Vo(ne.text),children:[a.jsx(Ua,{className:"h-3.5 w-3.5"}),"Apply: Write Markdown Report"]})]}),!Zn&&jn&&!nn&&a.jsx("div",{className:"mt-3 flex max-w-full justify-end overflow-x-auto pb-1",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>Vo(ne.text),children:[a.jsx(Ua,{className:"h-3.5 w-3.5"}),"Apply: Write Markdown Report"]})})]}),Vn&&a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"absolute -right-8 bottom-1 h-6 w-6 text-muted-foreground",onClick:()=>{Yt(ne.text)},"aria-label":"Copy message",title:"Copy message",children:a.jsx(Hr,{className:"h-3.5 w-3.5"})})]}),Nt&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(Kc,{className:"h-3 w-3"})})]},ne.id??`${ne.role}-${Ne}`)},renderMessageExtras:Fi.length>0?a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Pending actions (approve/deny)"}),Fi.map(ne=>a.jsxs("details",{open:!0,className:"group min-w-0 rounded-md border bg-background",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-2 p-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"break-all font-mono text-xs font-semibold",children:mm(ne.publicToolName)}),a.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:[ne.server,"::",mm(ne.tool)]})]}),a.jsx(Jt,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180"})]}),a.jsxs("div",{className:"border-t px-3 pb-3 pt-2",children:[a.jsx("pre",{className:"max-h-48 min-w-0 w-full max-w-full overflow-x-auto overflow-y-auto whitespace-pre-wrap break-words rounded border bg-muted/50 p-2 text-xs",children:a.jsx("code",{className:"break-words",children:JSON.stringify(ne.arguments??{},null,2)})}),a.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-7 px-2 text-xs",disabled:sn,onClick:()=>{Oe(ne.id)},children:"Deny"}),a.jsx(Z,{type:"button",size:"sm",className:"h-7 px-2 text-xs",disabled:sn,onClick:()=>{fe(ne.id)},children:"Approve"})]})]})]},ne.id))]}):null}):H==="reports"?a.jsxs(Qe,{className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx($t,{className:"border-b px-4 py-3",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx(Rc,{className:"h-4 w-4 text-muted-foreground"}),"Reports"]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>Y(ne=>!ne),children:[$?a.jsx(XS,{className:"h-3.5 w-3.5"}):a.jsx(QS,{className:"h-3.5 w-3.5"}),$?"Compact":"Expand"]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>T(!1),children:"Hide"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Review markdown reports for this run while keeping the result visible."})]})}),a.jsxs(Je,{className:"flex h-[70vh] min-h-[520px] flex-col p-0 xl:h-auto xl:min-h-0 xl:flex-1",children:[(oe||se.length===0||se.length>1)&&a.jsx("div",{className:"border-b px-4 py-3",children:oe?a.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading reference reports..."}):se.length===0?a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No reference reports for this run yet."}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"shrink-0 gap-1.5",onClick:()=>ie(),children:[a.jsx(To,{className:"h-3.5 w-3.5"}),"New Report"]})]}):a.jsx("div",{className:"space-y-2",children:se.length>1?a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Selected report"}),a.jsxs(Mn,{value:De,onValueChange:me,children:[a.jsx(_n,{className:"h-8",children:a.jsx(In,{placeholder:"Select a report"})}),a.jsx(kn,{children:se.map(ne=>a.jsx(ut,{value:ne.relativePath,children:ne.name},ne.path))})]})]}):null})}),a.jsx(hk,{className:"min-h-0 flex-1 bg-muted/15 px-4 py-4",children:se.length===0?a.jsx("div",{className:"text-sm text-muted-foreground",children:"No report selected."}):at?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(_r,{className:"h-4 w-4 animate-spin"}),"Loading report..."]}):it?a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive",children:["Could not load report: ",it]}):ge?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"rounded-md border bg-background p-3",children:[a.jsx("p",{className:"font-mono text-xs font-semibold",children:ge.name}),a.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:ge.relativePath}),a.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:new Date(ge.mtime).toLocaleString()})]}),a.jsx("div",{className:"rounded-md border bg-background p-3",children:a.jsx(Ga,{text:ge.content,className:"text-sm"})})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"Select a report to preview."})})]})]}):a.jsxs(Qe,{className:"min-w-0 overflow-hidden rounded-t-none xl:flex xl:h-full xl:min-h-0 xl:flex-col",children:[a.jsx($t,{className:"border-b px-4 py-3",children:a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Dt,{className:"flex items-center gap-2 text-base",children:[a.jsx(Rc,{className:"h-4 w-4 text-muted-foreground"}),"Run Note"]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:()=>Y(ne=>!ne),children:[$?a.jsx(XS,{className:"h-3.5 w-3.5"}):a.jsx(QS,{className:"h-3.5 w-3.5"}),$?"Compact":"Expand"]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>T(!1),children:"Hide"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Add context for this run, such as server version or environment details."})]})}),a.jsx(Je,{className:"flex h-[70vh] min-h-[520px] flex-col p-4 xl:h-auto xl:min-h-0 xl:flex-1",children:p?a.jsxs("div",{className:"w-full max-w-xl space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-xs font-medium",children:"Run note"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.length,"/500"]})]}),a.jsx(Ts,{value:x,onChange:ne=>j(ne.target.value.slice(0,500)),placeholder:"Optional context for this run",rows:3,className:"min-h-20 resize"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{size:"sm",onClick:()=>{Pt()},disabled:y,children:y?"Saving...":"Save note"}),a.jsx(Z,{size:"sm",variant:"outline",onClick:()=>{j(c.runNote??""),v(!1)},disabled:y,children:"Cancel"})]})]}):a.jsxs("div",{className:"flex w-full max-w-3xl items-center gap-2 rounded-md border bg-muted/20 px-2 py-1 text-xs",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[a.jsx("span",{className:"text-muted-foreground",children:"Run note:"}),a.jsx("span",{className:`break-words ${c.runNote?"text-foreground":"text-muted-foreground"}`,children:c.runNote||"none"})]}),a.jsx(Z,{size:"sm",variant:"ghost",className:"ml-auto h-6 px-2 text-xs",onClick:()=>v(!0),children:c.runNote?"Edit":"Add note"})]})})]})]}),a.jsx(Os,{open:I,onOpenChange:ne=>!V&&M(ne),children:a.jsxs(Za,{className:"max-w-2xl",children:[a.jsxs(es,{children:[a.jsx(ns,{children:ae?"Create markdown report":"Approve MCP action: write markdown report"}),a.jsx(rs,{children:ae?"Write a custom markdown report and save it to the workspace.":a.jsxs(a.Fragment,{children:["This will call ",a.jsx("code",{children:"mcplab_write_markdown_report"})," via the local MCPLab MCP server."]})})]}),a.jsxs("div",{className:"space-y-3",children:[!ae&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Output path"}),a.jsx(_t,{value:O,onChange:ne=>Q(ne.target.value),placeholder:"mcplab/reports/result-assistant/my-report.md",disabled:V})]}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx(br,{checked:B,onCheckedChange:ne=>z(ne===!0),disabled:V}),a.jsx("span",{children:"Overwrite if file exists"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:ae?"Markdown content":"Markdown preview (to be written)"}),a.jsx(Ts,{value:q,onChange:ne=>G(ne.target.value),rows:10,className:"font-mono text-xs",disabled:V})]})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:V,children:"Cancel"}),a.jsx(as,{onClick:ne=>{ne.preventDefault(),rt()},disabled:V,children:V?"Writing...":ae?"Save Report":"Approve & Write"})]})]})}),a.jsx(Os,{open:Ge,onOpenChange:Ee,children:a.jsxs(Za,{children:[a.jsxs(es,{children:[a.jsx(ns,{children:"Delete run?"}),a.jsxs(rs,{children:["This will permanently remove run ",a.jsx("span",{className:"font-mono",children:c?.id}),". This action cannot be undone."]})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:Re,children:"Cancel"}),a.jsx(as,{disabled:Re||!c?.id,onClick:ne=>{ne.preventDefault(),Lt()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Re?"Deleting...":"Delete"})]})]})})]})]})};function dwe({item:e,fallbackUserPrompt:t}){if(e.kind==="tool_call"){const u=zD(e,"input");return a.jsx(qD,{variant:"call",title:`Tool call · ${e.toolName||"unknown"}${u}`,text:e.text})}if(e.kind==="tool_result"){const u=zD(e,"output"),f=e.ok?a.jsx(Va,{className:"h-3.5 w-3.5 text-emerald-700 dark:text-emerald-300"}):a.jsx(ll,{className:"h-3.5 w-3.5 text-rose-700 dark:text-rose-300"});return a.jsx(qD,{variant:e.ok?"result_ok":"result_error",title:`Tool result · ${e.toolName||"unknown"} · ${e.ok?"ok":"error"}${typeof e.durationMs=="number"?` · ${e.durationMs}ms`:""}${u}`,text:e.text,icon:f})}const n=e.kind==="user_prompt",r=BD(e.text,e.kind),s=t?BD(t,"user_prompt"):"",o=n&&!r&&s?s:r,i=n?"User prompt":e.kind==="assistant_final"?"Agent final":"Agent",c=n?Kc:Wr;return a.jsxs("div",{className:`flex items-start gap-2 text-xs ${n?"justify-end":"justify-start"}`,children:[!n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",children:a.jsx(c,{className:"h-3 w-3"})}),a.jsxs("div",{className:`max-w-[90%] rounded-md p-2 ${n?"bg-primary/10":"bg-muted/50"}`,children:[a.jsx("p",{className:`mb-1 text-[11px] font-semibold text-muted-foreground ${n?"text-right":""}`,children:i}),n?a.jsx(oC,{text:o,maxLength:280,className:"text-xs"}):a.jsx(oC,{text:o,maxLength:500,className:"text-xs"})]}),n&&a.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary/30 bg-primary/15 text-primary",children:a.jsx(c,{className:"h-3 w-3"})})]})}function zD(e,t){const n=t==="input"?e.estimatedTokens?.inputTokens:e.estimatedTokens?.outputTokens;return typeof n!="number"?"":` · ${ta(n)} tokens`}function BD(e,t){const r=String(e??"").replace(/^\s+/,"");return t==="user_prompt"?r.replace(/^user:\s*/i,""):t==="assistant_final"||t==="assistant_thought"?r.replace(/^assistant:\s*/i,""):r}function fwe(e,t){if(!t)return!1;const n=String(e??"").toLowerCase();if(!n.trim())return!1;const r=["check","checks","rule","rules","regex","pattern","value capture","extract rule","update","change","replace","modify","adjust","use ","set "],s=["change ","replace ","update ","use ","set the","suggested","you should","try ","text match failed","text must match pattern"];if(["i can only read","i don't have write access","i cannot directly edit","what happened","summary"].some(m=>n.includes(m))&&!s.some(m=>n.includes(m)))return!1;const i=r.some(m=>n.includes(m)),c=s.some(m=>n.includes(m)),u=/(^|\n)\s*[-*]\s+/.test(e)||/(^|\n)\s*\d+\.\s+/.test(e),f=/["'`][^"'`\n]{2,}["'`]/.test(e);return i&&(c||u||f)}function qD({variant:e,title:t,text:n,icon:r}){const[s,o]=h.useState(!1),i={call:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",result_ok:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",result_error:"border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-300"};return a.jsx(Ss,{open:s,onOpenChange:o,children:a.jsxs("div",{className:`rounded-md border p-2 text-xs ${i[e]}`,children:[a.jsx(Ba,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 text-left",children:[a.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[11px]",children:[r??a.jsx(Ua,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:t})]}),a.jsx("span",{className:"text-[11px] font-semibold",children:s?"Hide content":"Show content"})]})}),a.jsx(Ns,{children:a.jsx("p",{className:"mt-2 font-mono whitespace-pre-wrap text-foreground",children:n})})]})})}function oC({text:e,maxLength:t,className:n}){const[r,s]=h.useState(!1),o=e.length>t,i=r||!o?e:`${e.slice(0,t)}...`;return a.jsxs("div",{children:[a.jsx(Ga,{text:i,className:n}),o&&a.jsx("button",{type:"button",className:"mt-1 text-[11px] font-medium text-primary hover:underline",onClick:()=>s(c=>!c),children:r?"Show less":"Show all"})]})}function pwe(e,t,n,r){return nq({evalRules:e,failureReasons:t,runError:n,checkResults:r})}function UD(e){const t=String(e??"").trim(),n=t.match(/^Regex assertion failed:\s*(.+)$/i);return n?`Text match failed: ${n[1]}`:t}const qS=["hsl(38, 92%, 50%)","hsl(200, 80%, 50%)","hsl(152, 69%, 40%)","hsl(280, 60%, 50%)","hsl(0, 72%, 51%)"],hwe=9,WD="mcplab.compare.showDaySeparators";function pl(e){if(!e.trim())return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function nm(e){const t=pl(e);return t?t.toLocaleString():""}function mwe(e){const t=pl(e);if(!t)return e;const n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0");return`${n}-${r}-${s}`}function gwe(e){const t=pl(e);return t?t.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}):"Unknown day"}function iC({counts:e}){return!e||e.total===0?a.jsx(a.Fragment,{children:"—"}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"text-success",children:[e.passed," ✓"]}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{className:"text-destructive",children:[e.failed," ✕"]})]})}function vwe(e){const t=e.configName?.trim();return t||bB(e).slice(0,2).join(", ")||"n/a"}function xwe(e){return e.configPath?.trim()||void 0}function US({run:e,className:t}){const n=vwe(e),r=xwe(e);return a.jsx("div",{className:t,title:r,children:n})}function ywe(e){const t=e.checkCounts;if(!t||t.total===0)return"—";const n=t.passed+t.failed;return n===0?"—":a.jsxs(a.Fragment,{children:[a.jsx(iC,{counts:t}),a.jsx("span",{className:"text-muted-foreground",children:" · "}),a.jsxs("span",{children:[Math.round(t.passed/n*100),"%"]})]})}function bwe(e,t){return e.length!==t.length?!1:e.every((n,r)=>n===t[r])}function wwe(e){const t=e.find(n=>n.provider&&n.model)??e.find(n=>n.provider||n.model);return{provider:t?.provider,model:t?.model}}const jwe=()=>{const{source:e}=$n(),[t,n]=zo(),r=aC(t),s=t.get("mode")==="within-run"?"within-run":"runs",[o,i]=h.useState([]),[c,u]=h.useState({}),[f,m]=h.useState(!1),[p,v]=h.useState(new Set),[x,j]=h.useState("timestamp"),[y,b]=h.useState("desc"),[S,N]=h.useState("all"),[C,k]=h.useState(!1),[A,E]=h.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(WD)==="1"}catch{return!1}}),[P,T]=h.useState(r.mode),[$,Y]=h.useState(r.preset),[H,F]=h.useState(r.start),[X,L]=h.useState(r.end),[I,M]=h.useState(!1),q=100,G=hx(q),{offset:O,hasMore:Q,totalCount:B}=G,z=t.get("runId")??"",V=(t.get("agents")??"").split(",").map(U=>U.trim()).filter(Boolean),ee=t.get("scenario")??"all",[ae,ue]=h.useState(z),[se,xe]=h.useState(V),[oe,de]=h.useState(ee),[De,me]=h.useState(!1),ge=h.useRef(0),we=h.useMemo(()=>{if(P==="all")return{};if(P==="last"){const W=qa.find(ve=>ve.value===$)??qa[0],ye=new Date;return{since:new Date(ye.getTime()-W.durationMs).toISOString(),until:ye.toISOString()}}const U=pl(H)?.toISOString(),le=pl(X)?.toISOString();return{since:U,until:le}},[X,P,$,H]),at=async()=>{const U=ge.current+1;ge.current=U,m(!0);try{if(e.listRunSummariesPage){const le={limit:q,offset:O};S!=="all"&&(le.scenario=S),we.since&&(le.since=we.since),we.until&&(le.until=we.until);const W=await e.listRunSummariesPage(le);if(ge.current!==U)return;G.updateMeta(W),i(W.data.map(vi))}else{const le=await e.listResults();if(ge.current!==U)return;i(le)}}catch(le){$e({title:"Could not load results",description:le instanceof Error?le.message:String(le),variant:"destructive"})}finally{ge.current===U&&m(!1)}};h.useEffect(()=>{let U=!0;return ge.current+=1,m(!0),(e.listRunSummariesPage?e.listRunSummariesPage({limit:q,offset:O,scenario:S==="all"?void 0:S,since:we.since,until:we.until}).then(W=>(U&&G.updateMeta(W),W.data.map(vi))):e.listResults()).then(W=>{U&&i(W)}).catch(W=>{U&&$e({title:"Could not load results",description:W instanceof Error?W.message:String(W),variant:"destructive"})}).finally(()=>{U&&m(!1)}),()=>{U=!1}},[O,S,e,we]);const tt=U=>{if(x===U){b(le=>le==="asc"?"desc":"asc");return}j(U),b(U==="timestamp"?"desc":"asc")},it=U=>{v(le=>{const W=new Set(le);return W.has(U)?W.delete(U):W.add(U),W})},At=h.useMemo(()=>{const U=new Set;return o.forEach(le=>{le.scenarios.forEach(W=>{const ye=String(W.scenarioName??"").trim(),ve=String(W.scenarioId??"").trim(),ke=ye||ve;ke&&U.add(ke)})}),Array.from(U).sort((le,W)=>le.localeCompare(W))},[o]),Ge=h.useMemo(()=>{const U=S==="all"?o:o.filter(Ce=>Ce.scenarios.some(K=>{const pe=String(K.scenarioName??"").trim(),Ae=String(K.scenarioId??"").trim();return(pe||Ae)===S}));if(s!=="runs"||P==="all")return U;const le=Date.now();if(P==="last"){const Ce=qa.find(pe=>pe.value===$)??qa[0],K=le-Ce.durationMs;return U.filter(pe=>{const Ae=new Date(pe.timestamp).getTime();return Ae>=K&&Ae<=le})}const W=pl(H)?.getTime()??null,ye=pl(X)?.getTime()??null,ve=W!==null&&ye!==null?Math.min(W,ye):W??null,ke=W!==null&&ye!==null?Math.max(W,ye):ye??null;return U.filter(Ce=>{const K=new Date(Ce.timestamp).getTime();return!(Number.isNaN(K)||ve!==null&&K<ve||ke!==null&&K>ke)})},[s,o,S,X,P,$,H]),Ee=h.useMemo(()=>[...Ge].sort((U,le)=>{let W=0;return x==="id"&&(W=U.id.localeCompare(le.id)),x==="timestamp"&&(W=new Date(U.timestamp).getTime()-new Date(le.timestamp).getTime()),x==="passRate"&&(W=U.overallPassRate-le.overallPassRate),x==="scenarios"&&(W=U.totalScenarios-le.totalScenarios),y==="asc"?W:-W}),[Ge,x,y]),Re=h.useMemo(()=>Ee.filter(U=>p.has(U.id)).map(U=>c[U.id]??U),[c,Ee,p]),Ze=h.useMemo(()=>{if(!A)return Ee.map(W=>({type:"run",run:W}));const U=[];let le=null;for(const W of Ee){const ye=mwe(W.timestamp);ye!==le&&(U.push({type:"day-separator",dayKey:ye,dayLabel:gwe(W.timestamp)}),le=ye),U.push({type:"run",run:W})}return U},[A,Ee]);h.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(WD,A?"1":"0")}catch{}},[A]);const ht=U=>x!==U?a.jsx(Dc,{className:"h-3.5 w-3.5 text-muted-foreground"}):y==="asc"?a.jsx(_s,{className:"h-3.5 w-3.5"}):a.jsx(Jt,{className:"h-3.5 w-3.5"}),Ft=h.useMemo(()=>{const U=new Map;for(const le of Ee)U.set(le.id,G_(le));return U},[Ee]),zt=U=>{const le=Array.from(new Set(U.scenarios.map(W=>W.agentId).filter(Boolean)));return le.slice(0,Math.min(2,le.length))},jt=U=>{const le=zt(U);ue(U.id),xe(le),de("all");const W=new URLSearchParams(t);W.set("mode","within-run"),W.set("runId",U.id),le.length>0?W.set("agents",le.join(",")):W.delete("agents"),W.delete("scenario"),n(W,{replace:!0})},rn=h.useMemo(()=>[...new Set(Re.flatMap(U=>U.scenarios.map(le=>le.scenarioId)))],[Re]),an=h.useMemo(()=>{const U=new Map;for(const le of Re)for(const W of le.scenarios){const ye=String(W.scenarioId??"").trim();if(!ye)continue;const ve=String(W.scenarioName??"").trim();U.set(ye,ve||ye)}return U},[Re]),qt=h.useMemo(()=>c[ae]??o.find(U=>U.id===ae),[c,o,ae]);h.useEffect(()=>{if(typeof e.getResult!="function"||p.size===0&&!ae)return;const U=new Set([...p]);ae&&U.add(ae);for(const le of U)c[le]||e.getResult(le).then(W=>{W&&u(ye=>ye[le]?ye:{...ye,[le]:W})})},[c,p,e,ae]),h.useEffect(()=>{G.reset()},[G.reset,S,P,$,H,X]);const Zt=h.useMemo(()=>{if(!qt)return[];const U=new Map;for(const le of qt.scenarios)U.set(le.agentId,le.agentName||le.agentId);return Array.from(U.entries()).map(([le,W])=>({id:le,name:W})).sort((le,W)=>le.name.localeCompare(W.name))},[qt]),sn=h.useMemo(()=>{if(!qt)return[];const U=new Set;for(const le of qt.scenarios){const W=String(le.scenarioName??"").trim(),ye=String(le.scenarioId??"").trim(),ve=W||ye;ve&&U.add(ve)}return Array.from(U).sort((le,W)=>le.localeCompare(W))},[qt]),ln=h.useMemo(()=>se.join(","),[se]);h.useEffect(()=>{if(s==="within-run"){const U=t.get("runId")??"",le=(t.get("agents")??"").split(",").map(ye=>ye.trim()).filter(Boolean),W=t.get("scenario")??"all";ue(ye=>ye===U?ye:U),xe(ye=>bwe(ye,le)?ye:le),de(ye=>ye===W?ye:W)}},[s,t]),h.useEffect(()=>{if(s!=="within-run"||o.length===0)return;let U=ae;(!U||!o.some(K=>K.id===U))&&(U=o[0].id);const le=o.find(K=>K.id===U),W=(()=>{if(!le)return[];const K=new Map;for(const pe of le.scenarios)K.set(pe.agentId,pe.agentName||pe.agentId);return Array.from(K.keys())})(),ye=new Set(W);let ve=ln.split(",").map(K=>K.trim()).filter(K=>!!K).filter(K=>ye.has(K));ve.length===0&&W.length>0&&(ve=W.slice(0,Math.min(2,W.length)));const ke=(()=>{if(!le)return new Set;const K=new Set;for(const pe of le.scenarios){const Ae=String(pe.scenarioName??"").trim(),Ke=String(pe.scenarioId??"").trim(),te=Ae||Ke;te&&K.add(te)}return new Set(K)})(),Ce=oe!=="all"&&!ke.has(oe)?"all":oe;U!==ae&&ue(U),ve.join(",")!==ln&&xe(ve),Ce!==oe&&de(Ce)},[s,o,ae,ln,oe]),h.useEffect(()=>{const U=new URLSearchParams(t);s==="within-run"?(U.set("mode","within-run"),ae?U.set("runId",ae):U.delete("runId"),se.length>0?U.set("agents",se.join(",")):U.delete("agents"),oe!=="all"?U.set("scenario",oe):U.delete("scenario"),U.delete("time_filter"),U.delete("time_preset"),U.delete("time_start"),U.delete("time_end")):(U.delete("mode"),U.delete("runId"),U.delete("agents"),U.delete("scenario"),P==="all"?(U.delete("time_filter"),U.delete("time_preset"),U.delete("time_start"),U.delete("time_end")):P==="last"?(U.set("time_filter","last"),U.set("time_preset",$),U.delete("time_start"),U.delete("time_end")):(U.set("time_filter","custom"),U.delete("time_preset"),H.trim()?U.set("time_start",H.trim()):U.delete("time_start"),X.trim()?U.set("time_end",X.trim()):U.delete("time_end")));const le=t.toString(),W=U.toString();le!==W&&n(U,{replace:!0})},[s,X,P,$,H,ae,se,oe,t,n]);const _e=h.useMemo(()=>{if(P==="all")return"All time";if(P==="last")return qa.find(W=>W.value===$)?.label??"Last range";const U=!!H.trim(),le=!!X.trim();return!U&&!le?"Custom range":U&&le?`${nm(H)} - ${nm(X)}`:U?`From ${nm(H)}`:`Until ${nm(X)}`},[X,P,$,H]),ze=()=>{T("all"),Y("15min"),F(""),L("")},Xe=h.useMemo(()=>{if(!qt)return[];const U=new Map;for(const W of qt.scenarios){const ye=String(W.scenarioId??"").trim(),ve=String(W.scenarioName??"").trim(),ke=ve||ye;if(!ye&&!ke)continue;const Ce=ye||ke,K=U.get(Ce);if(K){K.byAgent[W.agentId]=W;continue}U.set(Ce,{scenarioId:ye||ke,scenarioName:ve,displayLabel:ke||ye,byAgent:{[W.agentId]:W}})}const le=Array.from(U.values()).sort((W,ye)=>{const ve=(W.displayLabel||W.scenarioId).toLowerCase(),ke=(ye.displayLabel||ye.scenarioId).toLowerCase();return ve.localeCompare(ke)});return oe==="all"?le:le.filter(W=>W.displayLabel===oe)},[qt,oe]),kt=h.useMemo(()=>{const U=new Map(Zt.map(le=>[le.id,le]));return se.map(le=>U.get(le)).filter(le=>!!le)},[se,Zt]),vt=h.useMemo(()=>{if(!qt||kt.length!==2)return null;const[U,le]=kt;return{left:U,right:le,link:`/compare/results?left=${encodeURIComponent(qt.id)}&right=${encodeURIComponent(qt.id)}&leftConfig=${encodeURIComponent(qt.configId)}&rightConfig=${encodeURIComponent(qt.configId)}&leftAgent=${encodeURIComponent(U.id)}&rightAgent=${encodeURIComponent(le.id)}`}},[qt,kt]),fe=h.useMemo(()=>!qt||kt.length===0?[]:kt.map(U=>{const le=Xe.map(Ae=>Ae.byAgent[U.id]).filter(Ae=>!!Ae),W=le.flatMap(Ae=>Ae.runs),ye=W.length,ve=W.filter(Ae=>Ae.passed).length,ke=W.reduce((Ae,Ke)=>Ae+Ke.toolCalls.length,0),Ce=W.reduce((Ae,Ke)=>Ae+Ke.duration,0),{provider:K,model:pe}=wwe(le);return{agentId:U.id,agentName:U.name,provider:K,model:pe,passRate:ye===0?0:ve/ye,totalRuns:ye,avgToolCalls:ye===0?0:ke/ye,avgLatency:ye===0?0:Ce/ye}}),[qt,kt,Xe]),Oe=U=>{xe(le=>le.includes(U)?le.filter(W=>W!==U):[...le,U])},Ve=U=>a.jsxs("div",{className:"min-w-0 rounded border bg-muted/20 px-2 py-1.5",children:[a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"font-mono",children:["#",U.runIndex+1]})," ",a.jsx("span",{className:U.passed?"text-emerald-700":"text-destructive",children:U.passed?"PASS":"FAIL"})," ","· tools: ",U.toolCalls.length," · ",U.duration,"ms"]}),!U.passed&&U.failureReasons.length>0&&a.jsx("div",{className:"mt-1 max-h-16 overflow-y-auto whitespace-pre-wrap break-all pr-1 text-[11px] text-muted-foreground",children:U.failureReasons.join("; ")})]},U.runIndex);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(C5,{className:"h-6 w-6"}),"Compare Runs"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:s==="runs"?"Select 2–5 runs to compare":"Compare agents side-by-side within one run"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s==="within-run"&&a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{const U=new URLSearchParams(t);U.delete("mode"),U.delete("runId"),U.delete("agents"),U.delete("scenario"),n(U,{replace:!0})},children:[a.jsx(b5,{className:"mr-1.5 h-4 w-4"}),"Back to Compare"]}),s==="runs"&&a.jsxs(a.Fragment,{children:[a.jsxs(wi,{open:C,onOpenChange:k,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":C,"aria-controls":"compare-scenario-command-list",className:`w-[260px] justify-between font-normal ${S!=="all"?"border-primary/40":""}`,children:[a.jsx("span",{className:"truncate text-left",children:S==="all"?"All scenarios":S}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(Ro,{className:"w-[260px] p-0",align:"start",children:a.jsxs(Tl,{children:[a.jsx(Ol,{placeholder:"Search scenarios..."}),a.jsxs(Ml,{id:"compare-scenario-command-list",children:[a.jsx(Il,{children:"No scenarios found."}),a.jsxs($l,{children:[a.jsx(Na,{value:"all scenarios",onSelect:()=>{N("all"),k(!1)},children:"All scenarios"}),At.map(U=>a.jsx(Na,{value:U,onSelect:()=>{N(U),k(!1)},children:U},U))]})]})]})})]}),a.jsxs(wi,{open:I,onOpenChange:M,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":I,"aria-controls":"compare-time-command-list",className:`w-[320px] justify-between font-normal ${P!=="all"?"border-primary/40":""}`,children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate text-left",children:[a.jsx(w5,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:_e})]}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsxs(Ro,{className:"w-[360px] p-0",align:"start",children:[a.jsxs("div",{className:"border-b px-3 py-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Date and time filter"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Filter runs by timestamp."})]}),a.jsxs("div",{id:"compare-time-command-list",className:"grid gap-1 p-2",children:[a.jsx(Z,{type:"button",variant:P==="all"?"secondary":"ghost",className:"justify-start",onClick:()=>{ze(),M(!1)},children:"All time"}),qa.map(U=>a.jsx(Z,{type:"button",variant:P==="last"&&$===U.value?"secondary":"ghost",className:"justify-start",onClick:()=>{T("last"),Y(U.value),M(!1)},children:U.label},U.value)),a.jsx(Z,{type:"button",variant:P==="custom"?"secondary":"ghost",className:"justify-start",onClick:()=>T("custom"),children:"Custom date time range"})]}),P==="custom"&&a.jsxs("div",{className:"space-y-3 border-t p-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{htmlFor:"compare-time-filter-start",children:"Start"}),a.jsx(_t,{id:"compare-time-filter-start",type:"datetime-local",value:H,onChange:U=>F(U.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(We,{htmlFor:"compare-time-filter-end",children:"End"}),a.jsx(_t,{id:"compare-time-filter-end",type:"datetime-local",value:X,onChange:U=>L(U.target.value)})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"px-2",onClick:ze,children:[a.jsx(ca,{className:"mr-1.5 h-3.5 w-3.5"}),"Clear"]}),a.jsx(Z,{type:"button",size:"sm",onClick:()=>M(!1),children:"Done"})]})]})]})]})]}),a.jsxs("div",{className:"inline-flex items-center gap-2 rounded-md border px-3 py-2",children:[a.jsx(We,{htmlFor:"compare-day-separators-switch",className:"text-sm font-medium",children:"Group by day"}),a.jsx(Mg,{id:"compare-day-separators-switch",checked:A,onCheckedChange:E,"aria-label":"Group by day"})]}),a.jsx(Z,{variant:"outline",onClick:()=>{at()},disabled:f,children:f?"Refreshing...":"Refresh"}),a.jsx(Z,{variant:"outline",onClick:G.prev,disabled:f||O===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:G.next,disabled:f||!Q,children:"Next"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:G.rangeLabel(o.length)}),s==="within-run"&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Within One Run Controls"})}),a.jsxs(Je,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Run"}),a.jsxs(Mn,{value:ae,onValueChange:ue,children:[a.jsx(_n,{children:a.jsx(In,{placeholder:"Select run"})}),a.jsx(kn,{children:o.map(U=>a.jsx(ut,{value:U.id,children:U.id},U.id))})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Scenario filter"}),a.jsxs(wi,{open:De,onOpenChange:me,children:[a.jsx(ji,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",role:"combobox","aria-expanded":De,"aria-controls":"compare-within-run-scenario-command-list",className:"w-full justify-between font-normal",children:[a.jsx("span",{className:"truncate text-left",children:oe==="all"?"All scenarios":oe}),a.jsx(Jt,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(Ro,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:a.jsxs(Tl,{children:[a.jsx(Ol,{placeholder:"Search scenarios..."}),a.jsxs(Ml,{id:"compare-within-run-scenario-command-list",children:[a.jsx(Il,{children:"No scenarios found."}),a.jsxs($l,{children:[a.jsx(Na,{value:"all scenarios",onSelect:()=>{de("all"),me(!1)},children:"All scenarios"}),sn.map(U=>a.jsx(Na,{value:U,onSelect:()=>{de(U),me(!1)},children:U},U))]})]})]})})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Agents (select 2+)"}),a.jsxs("div",{className:"flex flex-wrap gap-3 rounded-md border p-3",children:[Zt.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No agents available for selected run."}),Zt.map(U=>a.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[a.jsx(br,{checked:se.includes(U.id),onCheckedChange:()=>Oe(U.id)}),a.jsx("span",{children:U.name})]},U.id))]})]})]})]}),s==="runs"&&a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:a.jsxs(oa,{containerClassName:"max-h-[36rem] overflow-auto",children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-10"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>tt("id"),children:["Run ID",ht("id")]})}),a.jsx(ct,{children:"Evaluated"}),a.jsx(ct,{children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>tt("timestamp"),children:["Timestamp",ht("timestamp")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-end gap-1 hover:text-foreground",onClick:()=>tt("passRate"),children:["Pass Rate",ht("passRate")]})}),a.jsx(ct,{className:"text-right",children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 hover:text-foreground",onClick:()=>tt("scenarios"),children:["Scenarios",ht("scenarios")]})}),a.jsx(ct,{className:"text-right",children:"Tool Tokens"}),a.jsx(ct,{className:"text-right",children:"Agents"}),a.jsx(ct,{className:"w-[140px] text-right",children:"Action"})]})}),a.jsx(la,{children:Ze.map((U,le)=>U.type==="day-separator"?a.jsx(Wt,{className:"bg-muted/30 hover:bg-muted/30",children:a.jsx(qe,{colSpan:hwe,className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border/70"}),a.jsx("span",{className:"shrink-0 rounded-full border border-border bg-background px-2.5 py-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:U.dayLabel}),a.jsx("div",{className:"h-px flex-1 bg-border/70"})]})})},`day-${U.dayKey}-${le}`):a.jsxs(Wt,{children:[a.jsx(qe,{children:a.jsx(br,{checked:p.has(U.run.id),onCheckedChange:()=>it(U.run.id),disabled:!p.has(U.run.id)&&p.size>=5})}),a.jsx(qe,{className:"font-mono text-xs",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{children:U.run.id}),a.jsx(US,{run:U.run,className:"truncate font-sans text-xs text-foreground/80"})]})}),a.jsx(qe,{className:"text-[11px] text-muted-foreground",children:(()=>{const W=Ft.get(U.run.id)??{scenarioCount:0,agentCount:0,modelSummary:""};return a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{children:["Evaluated: ",W.scenarioCount," scenario",W.scenarioCount===1?"":"s"," · ",W.agentCount," agent",W.agentCount===1?"":"s",W.modelSummary?` · ${W.modelSummary}`:""]}),a.jsx(Su,{versions:U.run.mcpServerVersions,showPrefix:!1})]})})()}),a.jsx(qe,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(U.run.timestamp).toLocaleString()]}),(()=>{const W=Ig(U.run);return W===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Total time: ",aa(W)]})})()]})}),a.jsx(qe,{className:"text-right",children:a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx(Ws,{rate:U.run.overallPassRate}),U.run.checkCounts&&U.run.checkCounts.total>0?a.jsx("span",{className:"font-mono text-[11px] leading-none","aria-label":`${U.run.checkCounts.passed} checks passed, ${U.run.checkCounts.failed} checks failed`,title:`${U.run.checkCounts.passed} passed · ${U.run.checkCounts.failed} failed`,children:a.jsx(iC,{counts:U.run.checkCounts})}):null]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:U.run.totalScenarios}),a.jsx(qe,{className:"text-right",children:a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("div",{className:"font-mono text-sm",children:ta(U.run.toolTokenUsage?.totalTokens)}),(()=>{const W=$g(U.run);return W===null?null:a.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground/90",children:["Tool time: ",aa(W)]})})()]})}),a.jsx(qe,{className:"text-right font-mono text-sm",children:Ft.get(U.run.id)?.agentCount??0}),a.jsx(qe,{className:"text-right",children:(Ft.get(U.run.id)?.agentCount??0)>1?a.jsx(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>jt(U.run),children:"Compare agents"}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})})]},U.run.id))})]})})}),s==="runs"&&Re.length<2&&a.jsx(Qe,{children:a.jsxs(Je,{className:"py-12 text-center",children:[a.jsx("p",{className:"text-sm font-medium",children:"No runs selected"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Select 2–5 runs from the table above to start a comparison."})]})}),s==="runs"&&Re.length>=2&&a.jsxs(a.Fragment,{children:[Re.length===2&&a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Need a deeper comparison?"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Open the two selected runs in a dedicated side-by-side full result compare view."})]}),a.jsx(Z,{asChild:!0,size:"sm",children:a.jsx(Et,{to:`/compare/results?left=${encodeURIComponent(Re[0].id)}&right=${encodeURIComponent(Re[1].id)}&leftConfig=${encodeURIComponent(Re[0].configId)}&rightConfig=${encodeURIComponent(Re[1].configId)}`,children:"Compare full results"})})]})})}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Summary Comparison"})}),a.jsx(Je,{className:"max-h-[24rem] overflow-auto p-0",children:a.jsxs(oa,{className:"table-fixed",children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-[220px]",children:"Metric"}),Re.map((U,le)=>a.jsxs(ct,{style:{color:qS[le]},className:"font-mono text-xs",children:[a.jsx("div",{children:U.id}),a.jsx(US,{run:U,className:"mt-0.5 truncate text-[10px] font-normal text-muted-foreground"})]},U.id))]})}),a.jsxs(la,{children:[a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Pass Rate"}),Re.map(U=>a.jsx(qe,{children:a.jsx(Ws,{rate:U.overallPassRate})},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Checks Pass Rate"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:ywe(U)},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Total Runs"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:U.totalRuns},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Tool Calls"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:U.avgToolCalls.toFixed(1)},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Avg Latency"}),Re.map(U=>a.jsxs(qe,{className:"font-mono",children:[U.avgLatency,"ms"]},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Total Time"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:(()=>{const le=Ig(U);return le===null?"—":aa(le)})()},U.id))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Tool Time"}),Re.map(U=>a.jsx(qe,{className:"font-mono",children:(()=>{const le=$g(U);return le===null?"—":aa(le)})()},U.id))]})]})]})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Scenario Breakdown"})}),a.jsx(Je,{className:"max-h-[26rem] overflow-auto p-0",children:a.jsxs(oa,{className:"table-fixed",children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-[220px]",children:"Scenario"}),Re.map((U,le)=>a.jsxs(ct,{style:{color:qS[le]},className:"font-mono text-xs",children:[a.jsx("div",{children:U.id}),a.jsx(US,{run:U,className:"mt-0.5 truncate text-[10px] font-normal text-muted-foreground"}),a.jsx(Su,{versions:U.mcpServerVersions,className:"mt-0.5 max-w-full border-0 bg-transparent p-0 text-[10px] font-normal"})]},U.id))]})}),a.jsx(la,{children:rn.map(U=>a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium text-sm",children:an.get(U)??U}),Re.map(le=>{const W=le.scenarios.find(ye=>ye.scenarioId===U);return a.jsx(qe,{children:W?a.jsxs("div",{className:"flex items-center justify-start gap-2",children:[a.jsx(Ws,{rate:W.passRate}),W.checkCounts?.total?a.jsx("span",{className:"font-mono text-[11px] leading-none",children:a.jsx(iC,{counts:W.checkCounts})}):null]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})},le.id)})]},U))})]})})]})]}),s==="runs"&&Re.length>=2&&a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Pass Rate Trend"})}),a.jsx(Je,{className:"h-72",children:a.jsx(hf,{width:"100%",height:"100%",children:a.jsxs($N,{data:Re.map((U,le)=>({idx:le+1,runId:U.id,passRate:Number((U.overallPassRate*100).toFixed(1))})),children:[a.jsx(_i,{dataKey:"idx",tickFormatter:U=>String(U)}),a.jsx(ki,{unit:"%",domain:[0,100]}),a.jsx(ra,{formatter:U=>[`${U}%`,"Pass Rate"],labelFormatter:U=>`Run ${U}`}),a.jsx(hl,{}),a.jsx(Al,{type:"monotone",dataKey:"passRate",stroke:qS[0],strokeWidth:2.5,dot:!0})]})})})]}),s==="within-run"&&qt&&kt.length<2&&a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6 text-sm text-muted-foreground",children:"Select at least 2 agents to compare side-by-side within this run."})}),s==="within-run"&&qt&&kt.length>=2&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Need full result details?"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:vt?"Open a side-by-side full result view filtered by the selected agents.":"Open the complete run result page for all details and trace navigation."})]}),a.jsx(Z,{asChild:!0,size:"sm",children:vt?a.jsx(Et,{to:vt.link,children:"Compare full results"}):a.jsx(Et,{to:`/results/${encodeURIComponent(qt.id)}${qt.configId?`?configId=${encodeURIComponent(qt.configId)}`:""}`,children:"Open full result"})})]})})}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Agent Summary"})}),a.jsx(Je,{className:"max-h-[24rem] overflow-auto p-0",children:a.jsxs(oa,{children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{children:"Metric"}),fe.map(U=>a.jsxs(ct,{children:[a.jsx("div",{className:"font-medium text-sm",children:U.agentName}),(U.provider||U.model)&&a.jsx("div",{className:"font-mono text-xs font-normal text-muted-foreground",children:[U.provider?Yf(U.provider):null,U.model].filter(Boolean).join(" · ")})]},U.agentId))]})}),a.jsxs(la,{children:[a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Pass Rate"}),fe.map(U=>a.jsx(qe,{children:a.jsx(Ws,{rate:U.passRate})},U.agentId))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Total Runs"}),fe.map(U=>a.jsx(qe,{className:"font-mono",children:U.totalRuns},U.agentId))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Avg Tool Calls"}),fe.map(U=>a.jsx(qe,{className:"font-mono",children:U.avgToolCalls.toFixed(1)},U.agentId))]}),a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium",children:"Avg Latency"}),fe.map(U=>a.jsxs(qe,{className:"font-mono",children:[Math.round(U.avgLatency),"ms"]},U.agentId))]})]})]})})]}),a.jsxs(Qe,{children:[a.jsx($t,{className:"pb-3",children:a.jsx(Dt,{className:"text-base",children:"Scenario × Agent Matrix"})}),a.jsx(Je,{className:"max-h-[34rem] overflow-auto p-0",children:a.jsxs(oa,{className:"table-fixed",children:[a.jsx(ia,{className:"[&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-background",children:a.jsxs(Wt,{children:[a.jsx(ct,{className:"w-[260px]",children:"Scenario"}),kt.map(U=>{const le=fe.find(W=>W.agentId===U.id);return a.jsxs(ct,{children:[a.jsx("div",{className:"font-medium text-sm",children:U.name}),(le?.provider||le?.model)&&a.jsx("div",{className:"font-mono text-xs font-normal text-muted-foreground",children:[le.provider?Yf(le.provider):null,le.model].filter(Boolean).join(" · ")})]},U.id)})]})}),a.jsx(la,{children:Xe.map(U=>a.jsxs(Wt,{children:[a.jsx(qe,{className:"font-medium text-sm",children:U.displayLabel}),kt.map(le=>{const W=U.byAgent[le.id];return W?a.jsx(qe,{className:"min-w-0 align-top",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"text-xs text-muted-foreground",children:[a.jsx(Ws,{rate:W.passRate})," ",a.jsxs("span",{className:"ml-2",children:["runs: ",W.runs.length]})," · calls:"," ",W.avgToolCalls.toFixed(1)," · latency:"," ",Math.round(W.avgDuration),"ms"]}),W.runs.length>0?a.jsx("div",{className:"space-y-1.5",children:W.runs.map(ye=>Ve(ye))}):a.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs captured."})]})},le.id):a.jsx(qe,{children:a.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})},le.id)})]},U.scenarioId))})]})})]})]})]})},HD=(e,t,n)=>{const r=new URLSearchParams;return t&&r.set("configId",t),n&&r.set("agent",n),r.set("embed","1"),`/results/${encodeURIComponent(e)}?${r.toString()}`},VD=(e,t,n)=>{const r=new URLSearchParams;t&&r.set("configId",t),n&&r.set("agent",n);const s=r.toString();return`/results/${encodeURIComponent(e)}${s?`?${s}`:""}`},Swe=()=>{const{source:e}=$n(),[t]=zo(),n=t.get("left")??"",r=t.get("right")??"",s=t.get("leftConfig"),o=t.get("rightConfig"),i=t.get("leftAgent"),c=t.get("rightAgent"),u=i?`${n} · ${i}`:n,f=c?`${r} · ${c}`:r,[m,p]=h.useState(null),[v,x]=h.useState(null);return h.useEffect(()=>{if(!n||typeof e.getResult!="function"){p(null);return}let j=!0;return e.getResult(n).then(y=>{j&&p(y??null)}),()=>{j=!1}},[n,e]),h.useEffect(()=>{if(!r||typeof e.getResult!="function"){x(null);return}let j=!0;return e.getResult(r).then(y=>{j&&x(y??null)}),()=>{j=!1}},[r,e]),!n||!r?a.jsxs(Qe,{children:[a.jsx($t,{children:a.jsx(Dt,{className:"text-base",children:"Full Result Compare"})}),a.jsxs(Je,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Select exactly two runs in Compare and use the “Compare full results” action."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:"/compare",children:"Back to Compare"})})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Full Result Compare"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:i||c?"Side-by-side Result Detail views for deep inspection, filtered by selected agents.":"Side-by-side Result Detail views for deep inspection."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Z,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs(Et,{to:"/compare",children:[a.jsx(b5,{className:"mr-1.5 h-4 w-4"}),"Back to Compare"]})}),a.jsx(Z,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:VD(n,s,i),target:"_blank",rel:"noreferrer",children:["Open Left",a.jsx(Vc,{className:"ml-1.5 h-3.5 w-3.5"})]})}),a.jsx(Z,{variant:"outline",size:"sm",asChild:!0,children:a.jsxs("a",{href:VD(r,o,c),target:"_blank",rel:"noreferrer",children:["Open Right",a.jsx(Vc,{className:"ml-1.5 h-3.5 w-3.5"})]})})]})]}),a.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[a.jsxs(Qe,{className:"overflow-hidden",children:[a.jsx($t,{className:"py-3",children:a.jsx(Dt,{className:"text-sm font-mono",children:u})}),a.jsx(Je,{className:"p-0",children:a.jsx("iframe",{title:`Result ${u}`,src:HD(n,s,i),className:"h-[calc(100vh-12rem)] w-full border-0"})})]}),a.jsxs(Qe,{className:"overflow-hidden",children:[a.jsx($t,{className:"py-3",children:a.jsx(Dt,{className:"text-sm font-mono",children:f})}),a.jsx(Je,{className:"p-0",children:a.jsx("iframe",{title:`Result ${f}`,src:HD(r,o,c),className:"h-[calc(100vh-12rem)] w-full border-0"})})]})]})]})};function Nwe(e){return e.match(/(?:^|\/)(?:result-assistant|results?)\/([0-9]{8}-[0-9]{6})(?:-|\/)/i)?.[1]??null}function Cwe(){const{source:e}=$n(),[t,n]=h.useState([]),[r,s]=h.useState(!0),[o,i]=h.useState(null),[c,u]=h.useState(!1),f=100,m=hx(f),{offset:p,hasMore:v}=m,x=async()=>{s(!0);try{if(e.listMarkdownReportsPage){const S=await e.listMarkdownReportsPage({limit:f,offset:p});n(S.data),m.updateMeta(S)}else n(await e.listMarkdownReports({limit:f,offset:p}))}catch(S){$e({title:"Could not load markdown reports",description:S instanceof Error?S.message:String(S),variant:"destructive"})}finally{s(!1)}};h.useEffect(()=>{x()},[p]);const j=h.useMemo(()=>t[0],[t]),y=h.useMemo(()=>t.find(S=>S.relativePath===o)??null,[t,o]),b=async()=>{if(o){u(!0);try{await e.deleteMarkdownReport(o),n(S=>S.filter(N=>N.relativePath!==o)),$e({title:"Markdown report deleted"}),i(null)}catch(S){$e({title:"Could not delete markdown report",description:S instanceof Error?S.message:String(S),variant:"destructive"})}finally{u(!1)}}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"inline-flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Rc,{className:"h-6 w-6"}),"Markdown Reports"]}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Browse Markdown files under ",a.jsx("code",{children:"mcplab/reports"}),"."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{variant:"outline",onClick:()=>{x()},children:"Refresh"}),j?a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:`/markdown-reports/view?id=${encodeURIComponent(j.reportId)}`,children:"Open latest"})}):null,a.jsx(Z,{variant:"outline",onClick:m.prev,disabled:r||p===0,children:"Prev"}),a.jsx(Z,{variant:"outline",onClick:m.next,disabled:r||!v,children:"Next"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:m.rangeLabel(t.length)}),a.jsx(Qe,{children:a.jsx(Je,{className:"p-0",children:r?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Loading markdown reports..."}):t.length===0?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"No markdown reports found yet."}):a.jsxs(oa,{children:[a.jsx(ia,{children:a.jsxs(Wt,{children:[a.jsx(ct,{children:"Report"}),a.jsx(ct,{children:"Result"}),a.jsx(ct,{children:"Folder"}),a.jsx(ct,{children:"Timestamp"}),a.jsx(ct,{className:"w-10"})]})}),a.jsx(la,{children:t.map(S=>a.jsxs(Wt,{children:[a.jsx(qe,{children:a.jsxs("div",{className:"space-y-1",children:[a.jsx(Et,{to:`/markdown-reports/view?id=${encodeURIComponent(S.reportId)}`,className:"font-mono text-xs text-primary hover:underline",children:S.name}),a.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:S.relativePath})]})}),a.jsx(qe,{className:"text-xs text-muted-foreground font-mono",children:(()=>{const N=Nwe(S.relativePath);return N?a.jsx(Et,{to:`/results/${encodeURIComponent(N)}`,className:"text-primary hover:underline",children:N}):a.jsx("span",{className:"text-muted-foreground",children:"—"})})()}),a.jsx(qe,{className:"text-xs text-muted-foreground font-mono",children:S.relativePath.includes("/")?S.relativePath.slice(0,S.relativePath.lastIndexOf("/")):"."}),a.jsx(qe,{className:"text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Ea,{className:"h-3 w-3"}),new Date(S.mtime).toLocaleString()]})}),a.jsx(qe,{children:a.jsxs(Sp,{children:[a.jsx(Np,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Bg,{className:"h-4 w-4"})})}),a.jsxs(Bu,{align:"end",children:[a.jsx(Mr,{asChild:!0,children:a.jsx(Et,{to:`/markdown-reports/view?id=${encodeURIComponent(S.reportId)}`,children:"View"})}),a.jsxs(Mr,{className:"text-destructive",onSelect:N=>{N.preventDefault(),i(S.relativePath)},children:[a.jsx(Xa,{className:"mr-2 h-3.5 w-3.5"})," Delete"]})]})]})})]},S.path))})]})})}),a.jsx(Os,{open:!!o,onOpenChange:S=>!S&&i(null),children:a.jsxs(Za,{children:[a.jsxs(es,{children:[a.jsx(ns,{children:"Delete markdown report?"}),a.jsx(rs,{children:y?`Delete '${y.name}' from disk? This cannot be undone.`:"Delete this report from disk? This cannot be undone."})]}),a.jsxs(ts,{children:[a.jsx(ss,{disabled:c,children:"Cancel"}),a.jsx(as,{onClick:S=>{S.preventDefault(),b()},disabled:c,children:c?"Deleting...":"Delete"})]})]})})]})}function _we(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function kwe(e){const t=e.relativePath.match(/(?:^|\/)(?:result-assistant|results?)\/([0-9]{8}-[0-9]{6})(?:-|\/)/i);return t?.[1]?t[1]:(e.content.match(/(?:^|\n)\s*\*\*Run:\*\*\s*`([^`]+)`/i)??e.content.match(/(?:^|\n)\s*Run ID:\s*([^\s]+)/i))?.[1]?.trim()||null}function Awe(){const{source:e}=$n(),[t]=zo(),n=(t.get("id")??"").trim(),r=(t.get("path")??"").trim(),[s,o]=h.useState(null),[i,c]=h.useState(!0),[u,f]=h.useState(!1),[m,p]=h.useState(!1);if(h.useEffect(()=>{let x=!0;if(o(null),f(!1),!n&&!r){c(!1);return}return c(!0),(n&&e.getMarkdownReportById?e.getMarkdownReportById(n):e.getMarkdownReport(r)).then(y=>{x&&o(y)}).catch(y=>{if(!x)return;const b=y instanceof Error?y.message:String(y);if(b.includes("(404)")){f(!0);return}$e({title:"Could not load markdown report",description:b,variant:"destructive"})}).finally(()=>{x&&c(!1)}),()=>{x=!1}},[r,n,e]),!n&&!r)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Markdown Report"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Missing report identifier."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:"/markdown-reports",children:"Back to Markdown Reports"})})]});if(i)return a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading markdown report..."});if(u||!s)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Markdown Report"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Report not found."}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(Et,{to:"/markdown-reports",children:"Back to Markdown Reports"})})]});const v=kwe(s);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"font-mono text-xl font-semibold",children:s.name}),a.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-mono",children:s.relativePath}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[a.jsx(Ea,{className:"h-3 w-3 shrink-0"}),new Date(s.mtime).toLocaleString()]}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx("span",{children:_we(s.sizeBytes)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[v?a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>p(!0),children:"Open Result Panel"}),a.jsx(Z,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(Et,{to:`/results/${encodeURIComponent(v)}`,children:"Open Result"})})]}):null,a.jsx(Z,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(Et,{to:"/markdown-reports",children:"Back to reports"})})]})]}),a.jsx(Qe,{children:a.jsx(Je,{className:"pt-6",children:a.jsx(Ga,{text:s.content,variant:"assistant"})})}),v?a.jsx(bL,{open:m,onOpenChange:p,children:a.jsxs(VC,{side:"right",className:"w-[96vw] max-w-none p-0 sm:max-w-5xl",children:[a.jsx(jL,{className:"border-b px-4 py-3 pr-12",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(SL,{className:"text-base",children:["Result ",v]}),a.jsx(Z,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(Et,{to:`/results/${encodeURIComponent(v)}`,target:"_blank",rel:"noreferrer",children:"Open full page"})})]})}),a.jsx("div",{className:"h-[calc(100vh-64px)]",children:a.jsx("iframe",{title:`Result ${v}`,src:`/results/${encodeURIComponent(v)}?embed=1`,className:"h-full w-full border-0"})})]})}):null]})}const Ewe=()=>{const e=Kr();return h.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),a.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),a.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},Pwe=new vG;function Rwe(){const{scenarioId:e}=Bl();return a.jsx(z3,{to:e?`/libraries/test-cases/${encodeURIComponent(e)}`:"/libraries/test-cases",replace:!0})}function Twe(){return a.jsxs(bY,{children:[a.jsxs(xn,{element:a.jsx(AJ,{}),children:[a.jsx(xn,{path:"/",element:a.jsx(lge,{})}),a.jsx(xn,{path:"/mcp-evaluations",element:a.jsx(Axe,{})}),a.jsx(xn,{path:"/mcp-evaluations/:id",element:a.jsx(mD,{})}),a.jsx(xn,{path:"/mcp-evaluations/:id/:tab",element:a.jsx(mD,{})}),a.jsx(xn,{path:"/tool-analysis",element:a.jsx(O0e,{})}),a.jsx(xn,{path:"/tool-analysis-results",element:a.jsx(M0e,{})}),a.jsx(xn,{path:"/tool-analysis-results/:id",element:a.jsx(I0e,{})}),a.jsx(xn,{path:"/oauth-debugger",element:a.jsx(B0e,{})}),a.jsx(xn,{path:"/libraries/servers",element:a.jsx(Kye,{})}),a.jsx(xn,{path:"/libraries/servers/:serverId",element:a.jsx(Gye,{})}),a.jsx(xn,{path:"/libraries/agents",element:a.jsx(Yye,{})}),a.jsx(xn,{path:"/libraries/agents/:agentName",element:a.jsx(a0e,{})}),a.jsx(xn,{path:"/libraries/test-cases",element:a.jsx(CD,{})}),a.jsx(xn,{path:"/libraries/test-cases/:testCaseId",element:a.jsx(CD,{})}),a.jsx(xn,{path:"/libraries/scenarios",element:a.jsx(z3,{to:"/libraries/test-cases",replace:!0})}),a.jsx(xn,{path:"/libraries/scenarios/:scenarioId",element:a.jsx(Rwe,{})}),a.jsx(xn,{path:"/settings",element:a.jsx(s0e,{})}),a.jsx(xn,{path:"/settings/mcp",element:a.jsx(f0e,{})}),a.jsx(xn,{path:"/run",element:a.jsx(J0e,{})}),a.jsx(xn,{path:"/results",element:a.jsx(owe,{})}),a.jsx(xn,{path:"/results/:id",element:a.jsx(uwe,{})}),a.jsx(xn,{path:"/markdown-reports",element:a.jsx(Cwe,{})}),a.jsx(xn,{path:"/markdown-reports/view",element:a.jsx(Awe,{})}),a.jsx(xn,{path:"/compare",element:a.jsx(jwe,{})}),a.jsx(xn,{path:"/compare/results",element:a.jsx(Swe,{})})]}),a.jsx(xn,{path:"*",element:a.jsx(Ewe,{})})]})}const Owe=()=>a.jsx(yG,{client:Pwe,children:a.jsx(Js,{children:a.jsx(SJ,{children:a.jsx(PJ,{children:a.jsxs(EJ,{children:[a.jsx(wH,{}),a.jsx(ZH,{}),a.jsx(HY,{children:a.jsx(Twe,{})})]})})})})});x9.createRoot(document.getElementById("root")).render(a.jsx(Owe,{}));