vskill 0.2.87 → 0.2.88

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.
@@ -46,24 +46,24 @@
46
46
  `+v[a].replace(" at new "," at ");return e.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",e.displayName)),D}while(1<=a&&0<=n);break}}}finally{$s=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?Ml(l):""}function sm(e,t){switch(e.tag){case 26:case 27:case 5:return Ml(e.type);case 16:return Ml("Lazy");case 13:return e.child!==t&&t!==null?Ml("Suspense Fallback"):Ml("Suspense");case 19:return Ml("SuspenseList");case 0:case 15:return Ws(e.type,!1);case 11:return Ws(e.type.render,!1);case 1:return Ws(e.type,!0);case 31:return Ml("Activity");default:return""}}function _c(e){try{var t="",l=null;do t+=sm(e,l),l=e,e=e.return;while(e);return t}catch(a){return`
47
47
  Error generating stack: `+a.message+`
48
48
  `+a.stack}}var Fs=Object.prototype.hasOwnProperty,Is=c.unstable_scheduleCallback,Ps=c.unstable_cancelCallback,im=c.unstable_shouldYield,rm=c.unstable_requestPaint,ot=c.unstable_now,cm=c.unstable_getCurrentPriorityLevel,zc=c.unstable_ImmediatePriority,kc=c.unstable_UserBlockingPriority,_n=c.unstable_NormalPriority,um=c.unstable_LowPriority,Rc=c.unstable_IdlePriority,om=c.log,dm=c.unstable_setDisableYieldValue,Oa=null,dt=null;function tl(e){if(typeof om=="function"&&dm(e),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode(Oa,e)}catch{}}var ft=Math.clz32?Math.clz32:xm,fm=Math.log,mm=Math.LN2;function xm(e){return e>>>=0,e===0?32:31-(fm(e)/mm|0)|0}var zn=256,kn=262144,Rn=4194304;function _l(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function On(e,t,l){var a=e.pendingLanes;if(a===0)return 0;var n=0,i=e.suspendedLanes,r=e.pingedLanes;e=e.warmLanes;var d=a&134217727;return d!==0?(a=d&~i,a!==0?n=_l(a):(r&=d,r!==0?n=_l(r):l||(l=d&~e,l!==0&&(n=_l(l))))):(d=a&~i,d!==0?n=_l(d):r!==0?n=_l(r):l||(l=a&~e,l!==0&&(n=_l(l)))),n===0?0:t!==0&&t!==n&&(t&i)===0&&(i=n&-n,l=t&-t,i>=l||i===32&&(l&4194048)!==0)?t:n}function Da(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function vm(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Oc(){var e=Rn;return Rn<<=1,(Rn&62914560)===0&&(Rn=4194304),e}function ei(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function wa(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function hm(e,t,l,a,n,i){var r=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var d=e.entanglements,v=e.expirationTimes,A=e.hiddenUpdates;for(l=r&~l;0<l;){var D=31-ft(l),L=1<<D;d[D]=0,v[D]=-1;var M=A[D];if(M!==null)for(A[D]=null,D=0;D<M.length;D++){var _=M[D];_!==null&&(_.lane&=-536870913)}l&=~L}a!==0&&Dc(e,a,0),i!==0&&n===0&&e.tag!==0&&(e.suspendedLanes|=i&~(r&~t))}function Dc(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-ft(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|l&261930}function wc(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var a=31-ft(l),n=1<<a;n&t|e[a]&t&&(e[a]|=t),l&=~n}}function Lc(e,t){var l=t&-t;return l=(l&42)!==0?1:ti(l),(l&(e.suspendedLanes|t))!==0?0:l}function ti(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function li(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Uc(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:Tf(e.type))}function Bc(e,t){var l=Q.p;try{return Q.p=e,t()}finally{Q.p=l}}var ll=Math.random().toString(36).slice(2),Je="__reactFiber$"+ll,at="__reactProps$"+ll,Jl="__reactContainer$"+ll,ai="__reactEvents$"+ll,pm="__reactListeners$"+ll,ym="__reactHandles$"+ll,Hc="__reactResources$"+ll,La="__reactMarker$"+ll;function ni(e){delete e[Je],delete e[at],delete e[ai],delete e[pm],delete e[ym]}function $l(e){var t=e[Je];if(t)return t;for(var l=e.parentNode;l;){if(t=l[Jl]||l[Je]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=cf(e);e!==null;){if(l=e[Je])return l;e=cf(e)}return t}e=l,l=e.parentNode}return null}function Wl(e){if(e=e[Je]||e[Jl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ua(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Fl(e){var t=e[Hc];return t||(t=e[Hc]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ze(e){e[La]=!0}var qc=new Set,Yc={};function zl(e,t){Il(e,t),Il(e+"Capture",t)}function Il(e,t){for(Yc[e]=t,e=0;e<t.length;e++)qc.add(t[e])}var gm=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Gc={},Qc={};function bm(e){return Fs.call(Qc,e)?!0:Fs.call(Gc,e)?!1:gm.test(e)?Qc[e]=!0:(Gc[e]=!0,!1)}function Dn(e,t,l){if(bm(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function wn(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Ut(e,t,l,a){if(a===null)e.removeAttribute(l);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+a)}}function bt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Xc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function jm(e,t,l){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var n=a.get,i=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(r){l=""+r,i.call(this,r)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(r){l=""+r},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function si(e){if(!e._valueTracker){var t=Xc(e)?"checked":"value";e._valueTracker=jm(e,t,""+e[t])}}function Vc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),a="";return e&&(a=Xc(e)?e.checked?"true":"false":e.value),e=a,e!==l?(t.setValue(e),!0):!1}function Ln(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Sm=/[\n"\\]/g;function jt(e){return e.replace(Sm,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ii(e,t,l,a,n,i,r,d){e.name="",r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"?e.type=r:e.removeAttribute("type"),t!=null?r==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+bt(t)):e.value!==""+bt(t)&&(e.value=""+bt(t)):r!=="submit"&&r!=="reset"||e.removeAttribute("value"),t!=null?ri(e,r,bt(t)):l!=null?ri(e,r,bt(l)):a!=null&&e.removeAttribute("value"),n==null&&i!=null&&(e.defaultChecked=!!i),n!=null&&(e.checked=n&&typeof n!="function"&&typeof n!="symbol"),d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?e.name=""+bt(d):e.removeAttribute("name")}function Zc(e,t,l,a,n,i,r,d){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||l!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){si(e);return}l=l!=null?""+bt(l):"",t=t!=null?""+bt(t):l,d||t===e.value||(e.value=t),e.defaultValue=t}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=d?e.checked:!!a,e.defaultChecked=!!a,r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.name=r),si(e)}function ri(e,t,l){t==="number"&&Ln(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Pl(e,t,l,a){if(e=e.options,t){t={};for(var n=0;n<l.length;n++)t["$"+l[n]]=!0;for(l=0;l<e.length;l++)n=t.hasOwnProperty("$"+e[l].value),e[l].selected!==n&&(e[l].selected=n),n&&a&&(e[l].defaultSelected=!0)}else{for(l=""+bt(l),t=null,n=0;n<e.length;n++){if(e[n].value===l){e[n].selected=!0,a&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function Kc(e,t,l){if(t!=null&&(t=""+bt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+bt(l):""}function Jc(e,t,l,a){if(t==null){if(a!=null){if(l!=null)throw Error(o(92));if(ie(a)){if(1<a.length)throw Error(o(93));a=a[0]}l=a}l==null&&(l=""),t=l}l=bt(t),e.defaultValue=l,a=e.textContent,a===l&&a!==""&&a!==null&&(e.value=a),si(e)}function ea(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Nm=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $c(e,t,l){var a=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,l):typeof l!="number"||l===0||Nm.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Wc(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var a in l)!l.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var n in t)a=t[n],t.hasOwnProperty(n)&&l[n]!==a&&$c(e,n,a)}else for(var i in t)t.hasOwnProperty(i)&&$c(e,i,t[i])}function ci(e){if(e.indexOf("-")===-1)return!1;switch(e){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 Tm=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Em=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Un(e){return Em.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Bt(){}var ui=null;function oi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ta=null,la=null;function Fc(e){var t=Wl(e);if(t&&(e=t.stateNode)){var l=e[at]||null;e:switch(e=t.stateNode,t.type){case"input":if(ii(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+jt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var a=l[t];if(a!==e&&a.form===e.form){var n=a[at]||null;if(!n)throw Error(o(90));ii(a,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name)}}for(t=0;t<l.length;t++)a=l[t],a.form===e.form&&Vc(a)}break e;case"textarea":Kc(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Pl(e,!!l.multiple,t,!1)}}}var di=!1;function Ic(e,t,l){if(di)return e(t,l);di=!0;try{var a=e(t);return a}finally{if(di=!1,(ta!==null||la!==null)&&(Ts(),ta&&(t=ta,e=la,la=ta=null,Fc(t),e)))for(t=0;t<e.length;t++)Fc(e[t])}}function Ba(e,t){var l=e.stateNode;if(l===null)return null;var a=l[at]||null;if(a===null)return null;l=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var Ht=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fi=!1;if(Ht)try{var Ha={};Object.defineProperty(Ha,"passive",{get:function(){fi=!0}}),window.addEventListener("test",Ha,Ha),window.removeEventListener("test",Ha,Ha)}catch{fi=!1}var al=null,mi=null,Bn=null;function Pc(){if(Bn)return Bn;var e,t=mi,l=t.length,a,n="value"in al?al.value:al.textContent,i=n.length;for(e=0;e<l&&t[e]===n[e];e++);var r=l-e;for(a=1;a<=r&&t[l-a]===n[i-a];a++);return Bn=n.slice(e,1<a?1-a:void 0)}function Hn(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function qn(){return!0}function eu(){return!1}function nt(e){function t(l,a,n,i,r){this._reactName=l,this._targetInst=n,this.type=a,this.nativeEvent=i,this.target=r,this.currentTarget=null;for(var d in e)e.hasOwnProperty(d)&&(l=e[d],this[d]=l?l(i):i[d]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?qn:eu,this.isPropagationStopped=eu,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=qn)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=qn)},persist:function(){},isPersistent:qn}),t}var kl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yn=nt(kl),qa=h({},kl,{view:0,detail:0}),Cm=nt(qa),xi,vi,Ya,Gn=h({},qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pi,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ya&&(Ya&&e.type==="mousemove"?(xi=e.screenX-Ya.screenX,vi=e.screenY-Ya.screenY):vi=xi=0,Ya=e),xi)},movementY:function(e){return"movementY"in e?e.movementY:vi}}),tu=nt(Gn),Am=h({},Gn,{dataTransfer:0}),Mm=nt(Am),_m=h({},qa,{relatedTarget:0}),hi=nt(_m),zm=h({},kl,{animationName:0,elapsedTime:0,pseudoElement:0}),km=nt(zm),Rm=h({},kl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Om=nt(Rm),Dm=h({},kl,{data:0}),lu=nt(Dm),wm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lm={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"},Um={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Bm(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Um[e])?!!t[e]:!1}function pi(){return Bm}var Hm=h({},qa,{key:function(e){if(e.key){var t=wm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Hn(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Lm[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pi,charCode:function(e){return e.type==="keypress"?Hn(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hn(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qm=nt(Hm),Ym=h({},Gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),au=nt(Ym),Gm=h({},qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pi}),Qm=nt(Gm),Xm=h({},kl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vm=nt(Xm),Zm=h({},Gn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Km=nt(Zm),Jm=h({},kl,{newState:0,oldState:0}),$m=nt(Jm),Wm=[9,13,27,32],yi=Ht&&"CompositionEvent"in window,Ga=null;Ht&&"documentMode"in document&&(Ga=document.documentMode);var Fm=Ht&&"TextEvent"in window&&!Ga,nu=Ht&&(!yi||Ga&&8<Ga&&11>=Ga),su=" ",iu=!1;function ru(e,t){switch(e){case"keyup":return Wm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var aa=!1;function Im(e,t){switch(e){case"compositionend":return cu(t);case"keypress":return t.which!==32?null:(iu=!0,su);case"textInput":return e=t.data,e===su&&iu?null:e;default:return null}}function Pm(e,t){if(aa)return e==="compositionend"||!yi&&ru(e,t)?(e=Pc(),Bn=mi=al=null,aa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return nu&&t.locale!=="ko"?null:t.data;default:return null}}var ex={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 uu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ex[e.type]:t==="textarea"}function ou(e,t,l,a){ta?la?la.push(a):la=[a]:ta=a,t=ks(t,"onChange"),0<t.length&&(l=new Yn("onChange","change",null,l,a),e.push({event:l,listeners:t}))}var Qa=null,Xa=null;function tx(e){Kd(e,0)}function Qn(e){var t=Ua(e);if(Vc(t))return e}function du(e,t){if(e==="change")return t}var fu=!1;if(Ht){var gi;if(Ht){var bi="oninput"in document;if(!bi){var mu=document.createElement("div");mu.setAttribute("oninput","return;"),bi=typeof mu.oninput=="function"}gi=bi}else gi=!1;fu=gi&&(!document.documentMode||9<document.documentMode)}function xu(){Qa&&(Qa.detachEvent("onpropertychange",vu),Xa=Qa=null)}function vu(e){if(e.propertyName==="value"&&Qn(Xa)){var t=[];ou(t,Xa,e,oi(e)),Ic(tx,t)}}function lx(e,t,l){e==="focusin"?(xu(),Qa=t,Xa=l,Qa.attachEvent("onpropertychange",vu)):e==="focusout"&&xu()}function ax(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qn(Xa)}function nx(e,t){if(e==="click")return Qn(t)}function sx(e,t){if(e==="input"||e==="change")return Qn(t)}function ix(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var mt=typeof Object.is=="function"?Object.is:ix;function Va(e,t){if(mt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),a=Object.keys(t);if(l.length!==a.length)return!1;for(a=0;a<l.length;a++){var n=l[a];if(!Fs.call(t,n)||!mt(e[n],t[n]))return!1}return!0}function hu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function pu(e,t){var l=hu(e);e=0;for(var a;l;){if(l.nodeType===3){if(a=e+l.textContent.length,e<=t&&a>=t)return{node:l,offset:t-e};e=a}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=hu(l)}}function yu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function gu(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ln(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Ln(e.document)}return t}function ji(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var rx=Ht&&"documentMode"in document&&11>=document.documentMode,na=null,Si=null,Za=null,Ni=!1;function bu(e,t,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ni||na==null||na!==Ln(a)||(a=na,"selectionStart"in a&&ji(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Za&&Va(Za,a)||(Za=a,a=ks(Si,"onSelect"),0<a.length&&(t=new Yn("onSelect","select",null,t,l),e.push({event:t,listeners:a}),t.target=na)))}function Rl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var sa={animationend:Rl("Animation","AnimationEnd"),animationiteration:Rl("Animation","AnimationIteration"),animationstart:Rl("Animation","AnimationStart"),transitionrun:Rl("Transition","TransitionRun"),transitionstart:Rl("Transition","TransitionStart"),transitioncancel:Rl("Transition","TransitionCancel"),transitionend:Rl("Transition","TransitionEnd")},Ti={},ju={};Ht&&(ju=document.createElement("div").style,"AnimationEvent"in window||(delete sa.animationend.animation,delete sa.animationiteration.animation,delete sa.animationstart.animation),"TransitionEvent"in window||delete sa.transitionend.transition);function Ol(e){if(Ti[e])return Ti[e];if(!sa[e])return e;var t=sa[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in ju)return Ti[e]=t[l];return e}var Su=Ol("animationend"),Nu=Ol("animationiteration"),Tu=Ol("animationstart"),cx=Ol("transitionrun"),ux=Ol("transitionstart"),ox=Ol("transitioncancel"),Eu=Ol("transitionend"),Cu=new Map,Ei="abort auxClick beforeToggle 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(" ");Ei.push("scrollEnd");function zt(e,t){Cu.set(e,t),zl(t,[e])}var Xn=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},St=[],ia=0,Ci=0;function Vn(){for(var e=ia,t=Ci=ia=0;t<e;){var l=St[t];St[t++]=null;var a=St[t];St[t++]=null;var n=St[t];St[t++]=null;var i=St[t];if(St[t++]=null,a!==null&&n!==null){var r=a.pending;r===null?n.next=n:(n.next=r.next,r.next=n),a.pending=n}i!==0&&Au(l,n,i)}}function Zn(e,t,l,a){St[ia++]=e,St[ia++]=t,St[ia++]=l,St[ia++]=a,Ci|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Ai(e,t,l,a){return Zn(e,t,l,a),Kn(e)}function Dl(e,t){return Zn(e,null,null,t),Kn(e)}function Au(e,t,l){e.lanes|=l;var a=e.alternate;a!==null&&(a.lanes|=l);for(var n=!1,i=e.return;i!==null;)i.childLanes|=l,a=i.alternate,a!==null&&(a.childLanes|=l),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(n=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,n&&t!==null&&(n=31-ft(l),e=i.hiddenUpdates,a=e[n],a===null?e[n]=[t]:a.push(t),t.lane=l|536870912),i):null}function Kn(e){if(50<vn)throw vn=0,Lr=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ra={};function dx(e,t,l,a){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xt(e,t,l,a){return new dx(e,t,l,a)}function Mi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qt(e,t){var l=e.alternate;return l===null?(l=xt(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Mu(e,t){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Jn(e,t,l,a,n,i){var r=0;if(a=e,typeof e=="function")Mi(e)&&(r=1);else if(typeof e=="string")r=hv(e,l,F.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Se:return e=xt(31,l,t,n),e.elementType=Se,e.lanes=i,e;case B:return wl(l.children,n,i,t);case Y:r=8,n|=24;break;case V:return e=xt(12,l,t,n|2),e.elementType=V,e.lanes=i,e;case se:return e=xt(13,l,t,n),e.elementType=se,e.lanes=i,e;case re:return e=xt(19,l,t,n),e.elementType=re,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case P:r=10;break e;case G:r=9;break e;case K:r=11;break e;case ee:r=14;break e;case fe:r=16,a=null;break e}r=29,l=Error(o(130,e===null?"null":typeof e,"")),a=null}return t=xt(r,l,t,n),t.elementType=e,t.type=a,t.lanes=i,t}function wl(e,t,l,a){return e=xt(7,e,a,t),e.lanes=l,e}function _i(e,t,l){return e=xt(6,e,null,t),e.lanes=l,e}function _u(e){var t=xt(18,null,null,0);return t.stateNode=e,t}function zi(e,t,l){return t=xt(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var zu=new WeakMap;function Nt(e,t){if(typeof e=="object"&&e!==null){var l=zu.get(e);return l!==void 0?l:(t={value:e,source:t,stack:_c(t)},zu.set(e,t),t)}return{value:e,source:t,stack:_c(t)}}var ca=[],ua=0,$n=null,Ka=0,Tt=[],Et=0,nl=null,Ot=1,Dt="";function Yt(e,t){ca[ua++]=Ka,ca[ua++]=$n,$n=e,Ka=t}function ku(e,t,l){Tt[Et++]=Ot,Tt[Et++]=Dt,Tt[Et++]=nl,nl=e;var a=Ot;e=Dt;var n=32-ft(a)-1;a&=~(1<<n),l+=1;var i=32-ft(t)+n;if(30<i){var r=n-n%5;i=(a&(1<<r)-1).toString(32),a>>=r,n-=r,Ot=1<<32-ft(t)+n|l<<n|a,Dt=i+e}else Ot=1<<i|l<<n|a,Dt=e}function ki(e){e.return!==null&&(Yt(e,1),ku(e,1,0))}function Ri(e){for(;e===$n;)$n=ca[--ua],ca[ua]=null,Ka=ca[--ua],ca[ua]=null;for(;e===nl;)nl=Tt[--Et],Tt[Et]=null,Dt=Tt[--Et],Tt[Et]=null,Ot=Tt[--Et],Tt[Et]=null}function Ru(e,t){Tt[Et++]=Ot,Tt[Et++]=Dt,Tt[Et++]=nl,Ot=t.id,Dt=t.overflow,nl=e}var $e=null,Re=null,ye=!1,sl=null,Ct=!1,Oi=Error(o(519));function il(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ja(Nt(t,e)),Oi}function Ou(e){var t=e.stateNode,l=e.type,a=e.memoizedProps;switch(t[Je]=e,t[at]=a,l){case"dialog":ve("cancel",t),ve("close",t);break;case"iframe":case"object":case"embed":ve("load",t);break;case"video":case"audio":for(l=0;l<pn.length;l++)ve(pn[l],t);break;case"source":ve("error",t);break;case"img":case"image":case"link":ve("error",t),ve("load",t);break;case"details":ve("toggle",t);break;case"input":ve("invalid",t),Zc(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":ve("invalid",t);break;case"textarea":ve("invalid",t),Jc(t,a.value,a.defaultValue,a.children)}l=a.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||a.suppressHydrationWarning===!0||Fd(t.textContent,l)?(a.popover!=null&&(ve("beforetoggle",t),ve("toggle",t)),a.onScroll!=null&&ve("scroll",t),a.onScrollEnd!=null&&ve("scrollend",t),a.onClick!=null&&(t.onclick=Bt),t=!0):t=!1,t||il(e,!0)}function Du(e){for($e=e.return;$e;)switch($e.tag){case 5:case 31:case 13:Ct=!1;return;case 27:case 3:Ct=!0;return;default:$e=$e.return}}function oa(e){if(e!==$e)return!1;if(!ye)return Du(e),ye=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Fr(e.type,e.memoizedProps)),l=!l),l&&Re&&il(e),Du(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Re=rf(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Re=rf(e)}else t===27?(t=Re,bl(e.type)?(e=lc,lc=null,Re=e):Re=t):Re=$e?Mt(e.stateNode.nextSibling):null;return!0}function Ll(){Re=$e=null,ye=!1}function Di(){var e=sl;return e!==null&&(ct===null?ct=e:ct.push.apply(ct,e),sl=null),e}function Ja(e){sl===null?sl=[e]:sl.push(e)}var wi=g(null),Ul=null,Gt=null;function rl(e,t,l){X(wi,t._currentValue),t._currentValue=l}function Qt(e){e._currentValue=wi.current,U(wi)}function Li(e,t,l){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===l)break;e=e.return}}function Ui(e,t,l,a){var n=e.child;for(n!==null&&(n.return=e);n!==null;){var i=n.dependencies;if(i!==null){var r=n.child;i=i.firstContext;e:for(;i!==null;){var d=i;i=n;for(var v=0;v<t.length;v++)if(d.context===t[v]){i.lanes|=l,d=i.alternate,d!==null&&(d.lanes|=l),Li(i.return,l,e),a||(r=null);break e}i=d.next}}else if(n.tag===18){if(r=n.return,r===null)throw Error(o(341));r.lanes|=l,i=r.alternate,i!==null&&(i.lanes|=l),Li(r,l,e),r=null}else r=n.child;if(r!==null)r.return=n;else for(r=n;r!==null;){if(r===e){r=null;break}if(n=r.sibling,n!==null){n.return=r.return,r=n;break}r=r.return}n=r}}function da(e,t,l,a){e=null;for(var n=t,i=!1;n!==null;){if(!i){if((n.flags&524288)!==0)i=!0;else if((n.flags&262144)!==0)break}if(n.tag===10){var r=n.alternate;if(r===null)throw Error(o(387));if(r=r.memoizedProps,r!==null){var d=n.type;mt(n.pendingProps.value,r.value)||(e!==null?e.push(d):e=[d])}}else if(n===Ee.current){if(r=n.alternate,r===null)throw Error(o(387));r.memoizedState.memoizedState!==n.memoizedState.memoizedState&&(e!==null?e.push(Sn):e=[Sn])}n=n.return}e!==null&&Ui(t,e,l,a),t.flags|=262144}function Wn(e){for(e=e.firstContext;e!==null;){if(!mt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Bl(e){Ul=e,Gt=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function We(e){return wu(Ul,e)}function Fn(e,t){return Ul===null&&Bl(e),wu(e,t)}function wu(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},Gt===null){if(e===null)throw Error(o(308));Gt=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Gt=Gt.next=t;return l}var fx=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},mx=c.unstable_scheduleCallback,xx=c.unstable_NormalPriority,qe={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Bi(){return{controller:new fx,data:new Map,refCount:0}}function $a(e){e.refCount--,e.refCount===0&&mx(xx,function(){e.controller.abort()})}var Wa=null,Hi=0,fa=0,ma=null;function vx(e,t){if(Wa===null){var l=Wa=[];Hi=0,fa=Gr(),ma={status:"pending",value:void 0,then:function(a){l.push(a)}}}return Hi++,t.then(Lu,Lu),t}function Lu(){if(--Hi===0&&Wa!==null){ma!==null&&(ma.status="fulfilled");var e=Wa;Wa=null,fa=0,ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function hx(e,t){var l=[],a={status:"pending",value:null,reason:null,then:function(n){l.push(n)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var n=0;n<l.length;n++)(0,l[n])(t)},function(n){for(a.status="rejected",a.reason=n,n=0;n<l.length;n++)(0,l[n])(void 0)}),a}var Uu=k.S;k.S=function(e,t){jd=ot(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&vx(e,t),Uu!==null&&Uu(e,t)};var Hl=g(null);function qi(){var e=Hl.current;return e!==null?e:ke.pooledCache}function In(e,t){t===null?X(Hl,Hl.current):X(Hl,t.pool)}function Bu(){var e=qi();return e===null?null:{parent:qe._currentValue,pool:e}}var xa=Error(o(460)),Yi=Error(o(474)),Pn=Error(o(542)),es={then:function(){}};function Hu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function qu(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(Bt,Bt),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Gu(e),e;default:if(typeof t.status=="string")t.then(Bt,Bt);else{if(e=ke,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var n=t;n.status="fulfilled",n.value=a}},function(a){if(t.status==="pending"){var n=t;n.status="rejected",n.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Gu(e),e}throw Yl=t,xa}}function ql(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Yl=l,xa):l}}var Yl=null;function Yu(){if(Yl===null)throw Error(o(459));var e=Yl;return Yl=null,e}function Gu(e){if(e===xa||e===Pn)throw Error(o(483))}var va=null,Fa=0;function ts(e){var t=Fa;return Fa+=1,va===null&&(va=[]),qu(va,e,t)}function Ia(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ls(e,t){throw t.$$typeof===O?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Qu(e){function t(S,y){if(e){var C=S.deletions;C===null?(S.deletions=[y],S.flags|=16):C.push(y)}}function l(S,y){if(!e)return null;for(;y!==null;)t(S,y),y=y.sibling;return null}function a(S){for(var y=new Map;S!==null;)S.key!==null?y.set(S.key,S):y.set(S.index,S),S=S.sibling;return y}function n(S,y){return S=qt(S,y),S.index=0,S.sibling=null,S}function i(S,y,C){return S.index=C,e?(C=S.alternate,C!==null?(C=C.index,C<y?(S.flags|=67108866,y):C):(S.flags|=67108866,y)):(S.flags|=1048576,y)}function r(S){return e&&S.alternate===null&&(S.flags|=67108866),S}function d(S,y,C,w){return y===null||y.tag!==6?(y=_i(C,S.mode,w),y.return=S,y):(y=n(y,C),y.return=S,y)}function v(S,y,C,w){var le=C.type;return le===B?D(S,y,C.props.children,w,C.key):y!==null&&(y.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===fe&&ql(le)===y.type)?(y=n(y,C.props),Ia(y,C),y.return=S,y):(y=Jn(C.type,C.key,C.props,null,S.mode,w),Ia(y,C),y.return=S,y)}function A(S,y,C,w){return y===null||y.tag!==4||y.stateNode.containerInfo!==C.containerInfo||y.stateNode.implementation!==C.implementation?(y=zi(C,S.mode,w),y.return=S,y):(y=n(y,C.children||[]),y.return=S,y)}function D(S,y,C,w,le){return y===null||y.tag!==7?(y=wl(C,S.mode,w,le),y.return=S,y):(y=n(y,C),y.return=S,y)}function L(S,y,C){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return y=_i(""+y,S.mode,C),y.return=S,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case q:return C=Jn(y.type,y.key,y.props,null,S.mode,C),Ia(C,y),C.return=S,C;case H:return y=zi(y,S.mode,C),y.return=S,y;case fe:return y=ql(y),L(S,y,C)}if(ie(y)||J(y))return y=wl(y,S.mode,C,null),y.return=S,y;if(typeof y.then=="function")return L(S,ts(y),C);if(y.$$typeof===P)return L(S,Fn(S,y),C);ls(S,y)}return null}function M(S,y,C,w){var le=y!==null?y.key:null;if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return le!==null?null:d(S,y,""+C,w);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case q:return C.key===le?v(S,y,C,w):null;case H:return C.key===le?A(S,y,C,w):null;case fe:return C=ql(C),M(S,y,C,w)}if(ie(C)||J(C))return le!==null?null:D(S,y,C,w,null);if(typeof C.then=="function")return M(S,y,ts(C),w);if(C.$$typeof===P)return M(S,y,Fn(S,C),w);ls(S,C)}return null}function _(S,y,C,w,le){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return S=S.get(C)||null,d(y,S,""+w,le);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case q:return S=S.get(w.key===null?C:w.key)||null,v(y,S,w,le);case H:return S=S.get(w.key===null?C:w.key)||null,A(y,S,w,le);case fe:return w=ql(w),_(S,y,C,w,le)}if(ie(w)||J(w))return S=S.get(C)||null,D(y,S,w,le,null);if(typeof w.then=="function")return _(S,y,C,ts(w),le);if(w.$$typeof===P)return _(S,y,C,Fn(y,w),le);ls(y,w)}return null}function W(S,y,C,w){for(var le=null,be=null,I=y,de=y=0,pe=null;I!==null&&de<C.length;de++){I.index>de?(pe=I,I=null):pe=I.sibling;var je=M(S,I,C[de],w);if(je===null){I===null&&(I=pe);break}e&&I&&je.alternate===null&&t(S,I),y=i(je,y,de),be===null?le=je:be.sibling=je,be=je,I=pe}if(de===C.length)return l(S,I),ye&&Yt(S,de),le;if(I===null){for(;de<C.length;de++)I=L(S,C[de],w),I!==null&&(y=i(I,y,de),be===null?le=I:be.sibling=I,be=I);return ye&&Yt(S,de),le}for(I=a(I);de<C.length;de++)pe=_(I,S,de,C[de],w),pe!==null&&(e&&pe.alternate!==null&&I.delete(pe.key===null?de:pe.key),y=i(pe,y,de),be===null?le=pe:be.sibling=pe,be=pe);return e&&I.forEach(function(El){return t(S,El)}),ye&&Yt(S,de),le}function ne(S,y,C,w){if(C==null)throw Error(o(151));for(var le=null,be=null,I=y,de=y=0,pe=null,je=C.next();I!==null&&!je.done;de++,je=C.next()){I.index>de?(pe=I,I=null):pe=I.sibling;var El=M(S,I,je.value,w);if(El===null){I===null&&(I=pe);break}e&&I&&El.alternate===null&&t(S,I),y=i(El,y,de),be===null?le=El:be.sibling=El,be=El,I=pe}if(je.done)return l(S,I),ye&&Yt(S,de),le;if(I===null){for(;!je.done;de++,je=C.next())je=L(S,je.value,w),je!==null&&(y=i(je,y,de),be===null?le=je:be.sibling=je,be=je);return ye&&Yt(S,de),le}for(I=a(I);!je.done;de++,je=C.next())je=_(I,S,de,je.value,w),je!==null&&(e&&je.alternate!==null&&I.delete(je.key===null?de:je.key),y=i(je,y,de),be===null?le=je:be.sibling=je,be=je);return e&&I.forEach(function(Av){return t(S,Av)}),ye&&Yt(S,de),le}function ze(S,y,C,w){if(typeof C=="object"&&C!==null&&C.type===B&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case q:e:{for(var le=C.key;y!==null;){if(y.key===le){if(le=C.type,le===B){if(y.tag===7){l(S,y.sibling),w=n(y,C.props.children),w.return=S,S=w;break e}}else if(y.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===fe&&ql(le)===y.type){l(S,y.sibling),w=n(y,C.props),Ia(w,C),w.return=S,S=w;break e}l(S,y);break}else t(S,y);y=y.sibling}C.type===B?(w=wl(C.props.children,S.mode,w,C.key),w.return=S,S=w):(w=Jn(C.type,C.key,C.props,null,S.mode,w),Ia(w,C),w.return=S,S=w)}return r(S);case H:e:{for(le=C.key;y!==null;){if(y.key===le)if(y.tag===4&&y.stateNode.containerInfo===C.containerInfo&&y.stateNode.implementation===C.implementation){l(S,y.sibling),w=n(y,C.children||[]),w.return=S,S=w;break e}else{l(S,y);break}else t(S,y);y=y.sibling}w=zi(C,S.mode,w),w.return=S,S=w}return r(S);case fe:return C=ql(C),ze(S,y,C,w)}if(ie(C))return W(S,y,C,w);if(J(C)){if(le=J(C),typeof le!="function")throw Error(o(150));return C=le.call(C),ne(S,y,C,w)}if(typeof C.then=="function")return ze(S,y,ts(C),w);if(C.$$typeof===P)return ze(S,y,Fn(S,C),w);ls(S,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,y!==null&&y.tag===6?(l(S,y.sibling),w=n(y,C),w.return=S,S=w):(l(S,y),w=_i(C,S.mode,w),w.return=S,S=w),r(S)):l(S,y)}return function(S,y,C,w){try{Fa=0;var le=ze(S,y,C,w);return va=null,le}catch(I){if(I===xa||I===Pn)throw I;var be=xt(29,I,null,S.mode);return be.lanes=w,be.return=S,be}finally{}}}var Gl=Qu(!0),Xu=Qu(!1),cl=!1;function Gi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qi(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ul(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ol(e,t,l){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ne&2)!==0){var n=a.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),a.pending=t,t=Kn(e),Au(e,null,l),t}return Zn(e,a,t,l),Kn(e)}function Pa(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,wc(e,l)}}function Xi(e,t){var l=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var n=null,i=null;if(l=l.firstBaseUpdate,l!==null){do{var r={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};i===null?n=i=r:i=i.next=r,l=l.next}while(l!==null);i===null?n=i=t:i=i.next=t}else n=i=t;l={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:i,shared:a.shared,callbacks:a.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Vi=!1;function en(){if(Vi){var e=ma;if(e!==null)throw e}}function tn(e,t,l,a){Vi=!1;var n=e.updateQueue;cl=!1;var i=n.firstBaseUpdate,r=n.lastBaseUpdate,d=n.shared.pending;if(d!==null){n.shared.pending=null;var v=d,A=v.next;v.next=null,r===null?i=A:r.next=A,r=v;var D=e.alternate;D!==null&&(D=D.updateQueue,d=D.lastBaseUpdate,d!==r&&(d===null?D.firstBaseUpdate=A:d.next=A,D.lastBaseUpdate=v))}if(i!==null){var L=n.baseState;r=0,D=A=v=null,d=i;do{var M=d.lane&-536870913,_=M!==d.lane;if(_?(he&M)===M:(a&M)===M){M!==0&&M===fa&&(Vi=!0),D!==null&&(D=D.next={lane:0,tag:d.tag,payload:d.payload,callback:null,next:null});e:{var W=e,ne=d;M=t;var ze=l;switch(ne.tag){case 1:if(W=ne.payload,typeof W=="function"){L=W.call(ze,L,M);break e}L=W;break e;case 3:W.flags=W.flags&-65537|128;case 0:if(W=ne.payload,M=typeof W=="function"?W.call(ze,L,M):W,M==null)break e;L=h({},L,M);break e;case 2:cl=!0}}M=d.callback,M!==null&&(e.flags|=64,_&&(e.flags|=8192),_=n.callbacks,_===null?n.callbacks=[M]:_.push(M))}else _={lane:M,tag:d.tag,payload:d.payload,callback:d.callback,next:null},D===null?(A=D=_,v=L):D=D.next=_,r|=M;if(d=d.next,d===null){if(d=n.shared.pending,d===null)break;_=d,d=_.next,_.next=null,n.lastBaseUpdate=_,n.shared.pending=null}}while(!0);D===null&&(v=L),n.baseState=v,n.firstBaseUpdate=A,n.lastBaseUpdate=D,i===null&&(n.shared.lanes=0),vl|=r,e.lanes=r,e.memoizedState=L}}function Vu(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Zu(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Vu(l[e],t)}var ha=g(null),as=g(0);function Ku(e,t){e=It,X(as,e),X(ha,t),It=e|t.baseLanes}function Zi(){X(as,It),X(ha,ha.current)}function Ki(){It=as.current,U(ha),U(as)}var vt=g(null),At=null;function dl(e){var t=e.alternate;X(Be,Be.current&1),X(vt,e),At===null&&(t===null||ha.current!==null||t.memoizedState!==null)&&(At=e)}function Ji(e){X(Be,Be.current),X(vt,e),At===null&&(At=e)}function Ju(e){e.tag===22?(X(Be,Be.current),X(vt,e),At===null&&(At=e)):fl()}function fl(){X(Be,Be.current),X(vt,vt.current)}function ht(e){U(vt),At===e&&(At=null),U(Be)}var Be=g(0);function ns(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||ec(l)||tc(l)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Xt=0,oe=null,Me=null,Ye=null,ss=!1,pa=!1,Ql=!1,is=0,ln=0,ya=null,px=0;function we(){throw Error(o(321))}function $i(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!mt(e[l],t[l]))return!1;return!0}function Wi(e,t,l,a,n,i){return Xt=i,oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?Ro:dr,Ql=!1,i=l(a,n),Ql=!1,pa&&(i=Wu(t,l,a,n)),$u(e),i}function $u(e){k.H=sn;var t=Me!==null&&Me.next!==null;if(Xt=0,Ye=Me=oe=null,ss=!1,ln=0,ya=null,t)throw Error(o(300));e===null||Ge||(e=e.dependencies,e!==null&&Wn(e)&&(Ge=!0))}function Wu(e,t,l,a){oe=e;var n=0;do{if(pa&&(ya=null),ln=0,pa=!1,25<=n)throw Error(o(301));if(n+=1,Ye=Me=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}k.H=Oo,i=t(l,a)}while(pa);return i}function yx(){var e=k.H,t=e.useState()[0];return t=typeof t.then=="function"?an(t):t,e=e.useState()[0],(Me!==null?Me.memoizedState:null)!==e&&(oe.flags|=1024),t}function Fi(){var e=is!==0;return is=0,e}function Ii(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Pi(e){if(ss){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ss=!1}Xt=0,Ye=Me=oe=null,pa=!1,ln=is=0,ya=null}function tt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ye===null?oe.memoizedState=Ye=e:Ye=Ye.next=e,Ye}function He(){if(Me===null){var e=oe.alternate;e=e!==null?e.memoizedState:null}else e=Me.next;var t=Ye===null?oe.memoizedState:Ye.next;if(t!==null)Ye=t,Me=e;else{if(e===null)throw oe.alternate===null?Error(o(467)):Error(o(310));Me=e,e={memoizedState:Me.memoizedState,baseState:Me.baseState,baseQueue:Me.baseQueue,queue:Me.queue,next:null},Ye===null?oe.memoizedState=Ye=e:Ye=Ye.next=e}return Ye}function rs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function an(e){var t=ln;return ln+=1,ya===null&&(ya=[]),e=qu(ya,e,t),t=oe,(Ye===null?t.memoizedState:Ye.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?Ro:dr),e}function cs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return an(e);if(e.$$typeof===P)return We(e)}throw Error(o(438,String(e)))}function er(e){var t=null,l=oe.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var a=oe.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(n){return n.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=rs(),oe.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),a=0;a<e;a++)l[a]=te;return t.index++,l}function Vt(e,t){return typeof t=="function"?t(e):t}function us(e){var t=He();return tr(t,Me,e)}function tr(e,t,l){var a=e.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=l;var n=e.baseQueue,i=a.pending;if(i!==null){if(n!==null){var r=n.next;n.next=i.next,i.next=r}t.baseQueue=n=i,a.pending=null}if(i=e.baseState,n===null)e.memoizedState=i;else{t=n.next;var d=r=null,v=null,A=t,D=!1;do{var L=A.lane&-536870913;if(L!==A.lane?(he&L)===L:(Xt&L)===L){var M=A.revertLane;if(M===0)v!==null&&(v=v.next={lane:0,revertLane:0,gesture:null,action:A.action,hasEagerState:A.hasEagerState,eagerState:A.eagerState,next:null}),L===fa&&(D=!0);else if((Xt&M)===M){A=A.next,M===fa&&(D=!0);continue}else L={lane:0,revertLane:A.revertLane,gesture:null,action:A.action,hasEagerState:A.hasEagerState,eagerState:A.eagerState,next:null},v===null?(d=v=L,r=i):v=v.next=L,oe.lanes|=M,vl|=M;L=A.action,Ql&&l(i,L),i=A.hasEagerState?A.eagerState:l(i,L)}else M={lane:L,revertLane:A.revertLane,gesture:A.gesture,action:A.action,hasEagerState:A.hasEagerState,eagerState:A.eagerState,next:null},v===null?(d=v=M,r=i):v=v.next=M,oe.lanes|=L,vl|=L;A=A.next}while(A!==null&&A!==t);if(v===null?r=i:v.next=d,!mt(i,e.memoizedState)&&(Ge=!0,D&&(l=ma,l!==null)))throw l;e.memoizedState=i,e.baseState=r,e.baseQueue=v,a.lastRenderedState=i}return n===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function lr(e){var t=He(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var a=l.dispatch,n=l.pending,i=t.memoizedState;if(n!==null){l.pending=null;var r=n=n.next;do i=e(i,r.action),r=r.next;while(r!==n);mt(i,t.memoizedState)||(Ge=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),l.lastRenderedState=i}return[i,a]}function Fu(e,t,l){var a=oe,n=He(),i=ye;if(i){if(l===void 0)throw Error(o(407));l=l()}else l=t();var r=!mt((Me||n).memoizedState,l);if(r&&(n.memoizedState=l,Ge=!0),n=n.queue,sr(eo.bind(null,a,n,e),[e]),n.getSnapshot!==t||r||Ye!==null&&Ye.memoizedState.tag&1){if(a.flags|=2048,ga(9,{destroy:void 0},Pu.bind(null,a,n,l,t),null),ke===null)throw Error(o(349));i||(Xt&127)!==0||Iu(a,t,l)}return l}function Iu(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=oe.updateQueue,t===null?(t=rs(),oe.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function Pu(e,t,l,a){t.value=l,t.getSnapshot=a,to(t)&&lo(e)}function eo(e,t,l){return l(function(){to(t)&&lo(e)})}function to(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!mt(e,l)}catch{return!0}}function lo(e){var t=Dl(e,2);t!==null&&ut(t,e,2)}function ar(e){var t=tt();if(typeof e=="function"){var l=e;if(e=l(),Ql){tl(!0);try{l()}finally{tl(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vt,lastRenderedState:e},t}function ao(e,t,l,a){return e.baseState=l,tr(e,Me,typeof a=="function"?a:Vt)}function gx(e,t,l,a,n){if(fs(e))throw Error(o(485));if(e=t.action,e!==null){var i={payload:n,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(r){i.listeners.push(r)}};k.T!==null?l(!0):i.isTransition=!1,a(i),l=t.pending,l===null?(i.next=t.pending=i,no(t,i)):(i.next=l.next,t.pending=l.next=i)}}function no(e,t){var l=t.action,a=t.payload,n=e.state;if(t.isTransition){var i=k.T,r={};k.T=r;try{var d=l(n,a),v=k.S;v!==null&&v(r,d),so(e,t,d)}catch(A){nr(e,t,A)}finally{i!==null&&r.types!==null&&(i.types=r.types),k.T=i}}else try{i=l(n,a),so(e,t,i)}catch(A){nr(e,t,A)}}function so(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(a){io(e,t,a)},function(a){return nr(e,t,a)}):io(e,t,l)}function io(e,t,l){t.status="fulfilled",t.value=l,ro(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,no(e,l)))}function nr(e,t,l){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=l,ro(t),t=t.next;while(t!==a)}e.action=null}function ro(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function co(e,t){return t}function uo(e,t){if(ye){var l=ke.formState;if(l!==null){e:{var a=oe;if(ye){if(Re){t:{for(var n=Re,i=Ct;n.nodeType!==8;){if(!i){n=null;break t}if(n=Mt(n.nextSibling),n===null){n=null;break t}}i=n.data,n=i==="F!"||i==="F"?n:null}if(n){Re=Mt(n.nextSibling),a=n.data==="F!";break e}}il(a)}a=!1}a&&(t=l[0])}}return l=tt(),l.memoizedState=l.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:co,lastRenderedState:t},l.queue=a,l=_o.bind(null,oe,a),a.dispatch=l,a=ar(!1),i=or.bind(null,oe,!1,a.queue),a=tt(),n={state:t,dispatch:null,action:e,pending:null},a.queue=n,l=gx.bind(null,oe,n,i,l),n.dispatch=l,a.memoizedState=e,[t,l,!1]}function oo(e){var t=He();return fo(t,Me,e)}function fo(e,t,l){if(t=tr(e,t,co)[0],e=us(Vt)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=an(t)}catch(r){throw r===xa?Pn:r}else a=t;t=He();var n=t.queue,i=n.dispatch;return l!==t.memoizedState&&(oe.flags|=2048,ga(9,{destroy:void 0},bx.bind(null,n,l),null)),[a,i,e]}function bx(e,t){e.action=t}function mo(e){var t=He(),l=Me;if(l!==null)return fo(t,l,e);He(),t=t.memoizedState,l=He();var a=l.queue.dispatch;return l.memoizedState=e,[t,a,!1]}function ga(e,t,l,a){return e={tag:e,create:l,deps:a,inst:t,next:null},t=oe.updateQueue,t===null&&(t=rs(),oe.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(a=l.next,l.next=e,e.next=a,t.lastEffect=e),e}function xo(){return He().memoizedState}function os(e,t,l,a){var n=tt();oe.flags|=e,n.memoizedState=ga(1|t,{destroy:void 0},l,a===void 0?null:a)}function ds(e,t,l,a){var n=He();a=a===void 0?null:a;var i=n.memoizedState.inst;Me!==null&&a!==null&&$i(a,Me.memoizedState.deps)?n.memoizedState=ga(t,i,l,a):(oe.flags|=e,n.memoizedState=ga(1|t,i,l,a))}function vo(e,t){os(8390656,8,e,t)}function sr(e,t){ds(2048,8,e,t)}function jx(e){oe.flags|=4;var t=oe.updateQueue;if(t===null)t=rs(),oe.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function ho(e){var t=He().memoizedState;return jx({ref:t,nextImpl:e}),function(){if((Ne&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function po(e,t){return ds(4,2,e,t)}function yo(e,t){return ds(4,4,e,t)}function go(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function bo(e,t,l){l=l!=null?l.concat([e]):null,ds(4,4,go.bind(null,t,e),l)}function ir(){}function jo(e,t){var l=He();t=t===void 0?null:t;var a=l.memoizedState;return t!==null&&$i(t,a[1])?a[0]:(l.memoizedState=[e,t],e)}function So(e,t){var l=He();t=t===void 0?null:t;var a=l.memoizedState;if(t!==null&&$i(t,a[1]))return a[0];if(a=e(),Ql){tl(!0);try{e()}finally{tl(!1)}}return l.memoizedState=[a,t],a}function rr(e,t,l){return l===void 0||(Xt&1073741824)!==0&&(he&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Nd(),oe.lanes|=e,vl|=e,l)}function No(e,t,l,a){return mt(l,t)?l:ha.current!==null?(e=rr(e,l,a),mt(e,t)||(Ge=!0),e):(Xt&42)===0||(Xt&1073741824)!==0&&(he&261930)===0?(Ge=!0,e.memoizedState=l):(e=Nd(),oe.lanes|=e,vl|=e,t)}function To(e,t,l,a,n){var i=Q.p;Q.p=i!==0&&8>i?i:8;var r=k.T,d={};k.T=d,or(e,!1,t,l);try{var v=n(),A=k.S;if(A!==null&&A(d,v),v!==null&&typeof v=="object"&&typeof v.then=="function"){var D=hx(v,a);nn(e,t,D,gt(e))}else nn(e,t,a,gt(e))}catch(L){nn(e,t,{then:function(){},status:"rejected",reason:L},gt())}finally{Q.p=i,r!==null&&d.types!==null&&(r.types=d.types),k.T=r}}function Sx(){}function cr(e,t,l,a){if(e.tag!==5)throw Error(o(476));var n=Eo(e).queue;To(e,n,t,ae,l===null?Sx:function(){return Co(e),l(a)})}function Eo(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vt,lastRenderedState:ae},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vt,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Co(e){var t=Eo(e);t.next===null&&(t=e.alternate.memoizedState),nn(e,t.next.queue,{},gt())}function ur(){return We(Sn)}function Ao(){return He().memoizedState}function Mo(){return He().memoizedState}function Nx(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=gt();e=ul(l);var a=ol(t,e,l);a!==null&&(ut(a,t,l),Pa(a,t,l)),t={cache:Bi()},e.payload=t;return}t=t.return}}function Tx(e,t,l){var a=gt();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},fs(e)?zo(t,l):(l=Ai(e,t,l,a),l!==null&&(ut(l,e,a),ko(l,t,a)))}function _o(e,t,l){var a=gt();nn(e,t,l,a)}function nn(e,t,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(fs(e))zo(t,n);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var r=t.lastRenderedState,d=i(r,l);if(n.hasEagerState=!0,n.eagerState=d,mt(d,r))return Zn(e,t,n,0),ke===null&&Vn(),!1}catch{}finally{}if(l=Ai(e,t,n,a),l!==null)return ut(l,e,a),ko(l,t,a),!0}return!1}function or(e,t,l,a){if(a={lane:2,revertLane:Gr(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},fs(e)){if(t)throw Error(o(479))}else t=Ai(e,l,a,2),t!==null&&ut(t,e,2)}function fs(e){var t=e.alternate;return e===oe||t!==null&&t===oe}function zo(e,t){pa=ss=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function ko(e,t,l){if((l&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,wc(e,l)}}var sn={readContext:We,use:cs,useCallback:we,useContext:we,useEffect:we,useImperativeHandle:we,useLayoutEffect:we,useInsertionEffect:we,useMemo:we,useReducer:we,useRef:we,useState:we,useDebugValue:we,useDeferredValue:we,useTransition:we,useSyncExternalStore:we,useId:we,useHostTransitionStatus:we,useFormState:we,useActionState:we,useOptimistic:we,useMemoCache:we,useCacheRefresh:we};sn.useEffectEvent=we;var Ro={readContext:We,use:cs,useCallback:function(e,t){return tt().memoizedState=[e,t===void 0?null:t],e},useContext:We,useEffect:vo,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,os(4194308,4,go.bind(null,t,e),l)},useLayoutEffect:function(e,t){return os(4194308,4,e,t)},useInsertionEffect:function(e,t){os(4,2,e,t)},useMemo:function(e,t){var l=tt();t=t===void 0?null:t;var a=e();if(Ql){tl(!0);try{e()}finally{tl(!1)}}return l.memoizedState=[a,t],a},useReducer:function(e,t,l){var a=tt();if(l!==void 0){var n=l(t);if(Ql){tl(!0);try{l(t)}finally{tl(!1)}}}else n=t;return a.memoizedState=a.baseState=n,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=Tx.bind(null,oe,e),[a.memoizedState,e]},useRef:function(e){var t=tt();return e={current:e},t.memoizedState=e},useState:function(e){e=ar(e);var t=e.queue,l=_o.bind(null,oe,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:ir,useDeferredValue:function(e,t){var l=tt();return rr(l,e,t)},useTransition:function(){var e=ar(!1);return e=To.bind(null,oe,e.queue,!0,!1),tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var a=oe,n=tt();if(ye){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ke===null)throw Error(o(349));(he&127)!==0||Iu(a,t,l)}n.memoizedState=l;var i={value:l,getSnapshot:t};return n.queue=i,vo(eo.bind(null,a,i,e),[e]),a.flags|=2048,ga(9,{destroy:void 0},Pu.bind(null,a,i,l,t),null),l},useId:function(){var e=tt(),t=ke.identifierPrefix;if(ye){var l=Dt,a=Ot;l=(a&~(1<<32-ft(a)-1)).toString(32)+l,t="_"+t+"R_"+l,l=is++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=px++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ur,useFormState:uo,useActionState:uo,useOptimistic:function(e){var t=tt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=or.bind(null,oe,!0,l),l.dispatch=t,[e,t]},useMemoCache:er,useCacheRefresh:function(){return tt().memoizedState=Nx.bind(null,oe)},useEffectEvent:function(e){var t=tt(),l={impl:e};return t.memoizedState=l,function(){if((Ne&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},dr={readContext:We,use:cs,useCallback:jo,useContext:We,useEffect:sr,useImperativeHandle:bo,useInsertionEffect:po,useLayoutEffect:yo,useMemo:So,useReducer:us,useRef:xo,useState:function(){return us(Vt)},useDebugValue:ir,useDeferredValue:function(e,t){var l=He();return No(l,Me.memoizedState,e,t)},useTransition:function(){var e=us(Vt)[0],t=He().memoizedState;return[typeof e=="boolean"?e:an(e),t]},useSyncExternalStore:Fu,useId:Ao,useHostTransitionStatus:ur,useFormState:oo,useActionState:oo,useOptimistic:function(e,t){var l=He();return ao(l,Me,e,t)},useMemoCache:er,useCacheRefresh:Mo};dr.useEffectEvent=ho;var Oo={readContext:We,use:cs,useCallback:jo,useContext:We,useEffect:sr,useImperativeHandle:bo,useInsertionEffect:po,useLayoutEffect:yo,useMemo:So,useReducer:lr,useRef:xo,useState:function(){return lr(Vt)},useDebugValue:ir,useDeferredValue:function(e,t){var l=He();return Me===null?rr(l,e,t):No(l,Me.memoizedState,e,t)},useTransition:function(){var e=lr(Vt)[0],t=He().memoizedState;return[typeof e=="boolean"?e:an(e),t]},useSyncExternalStore:Fu,useId:Ao,useHostTransitionStatus:ur,useFormState:mo,useActionState:mo,useOptimistic:function(e,t){var l=He();return Me!==null?ao(l,Me,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:er,useCacheRefresh:Mo};Oo.useEffectEvent=ho;function fr(e,t,l,a){t=e.memoizedState,l=l(a,t),l=l==null?t:h({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var mr={enqueueSetState:function(e,t,l){e=e._reactInternals;var a=gt(),n=ul(a);n.payload=t,l!=null&&(n.callback=l),t=ol(e,n,a),t!==null&&(ut(t,e,a),Pa(t,e,a))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var a=gt(),n=ul(a);n.tag=1,n.payload=t,l!=null&&(n.callback=l),t=ol(e,n,a),t!==null&&(ut(t,e,a),Pa(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=gt(),a=ul(l);a.tag=2,t!=null&&(a.callback=t),t=ol(e,a,l),t!==null&&(ut(t,e,l),Pa(t,e,l))}};function Do(e,t,l,a,n,i,r){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,i,r):t.prototype&&t.prototype.isPureReactComponent?!Va(l,a)||!Va(n,i):!0}function wo(e,t,l,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,a),t.state!==e&&mr.enqueueReplaceState(t,t.state,null)}function Xl(e,t){var l=t;if("ref"in t){l={};for(var a in t)a!=="ref"&&(l[a]=t[a])}if(e=e.defaultProps){l===t&&(l=h({},l));for(var n in e)l[n]===void 0&&(l[n]=e[n])}return l}function Lo(e){Xn(e)}function Uo(e){console.error(e)}function Bo(e){Xn(e)}function ms(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Ho(e,t,l){try{var a=e.onCaughtError;a(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(n){setTimeout(function(){throw n})}}function xr(e,t,l){return l=ul(l),l.tag=3,l.payload={element:null},l.callback=function(){ms(e,t)},l}function qo(e){return e=ul(e),e.tag=3,e}function Yo(e,t,l,a){var n=l.type.getDerivedStateFromError;if(typeof n=="function"){var i=a.value;e.payload=function(){return n(i)},e.callback=function(){Ho(t,l,a)}}var r=l.stateNode;r!==null&&typeof r.componentDidCatch=="function"&&(e.callback=function(){Ho(t,l,a),typeof n!="function"&&(hl===null?hl=new Set([this]):hl.add(this));var d=a.stack;this.componentDidCatch(a.value,{componentStack:d!==null?d:""})})}function Ex(e,t,l,a,n){if(l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=l.alternate,t!==null&&da(t,l,n,!0),l=vt.current,l!==null){switch(l.tag){case 31:case 13:return At===null?Es():l.alternate===null&&Le===0&&(Le=3),l.flags&=-257,l.flags|=65536,l.lanes=n,a===es?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([a]):t.add(a),Hr(e,a,n)),!1;case 22:return l.flags|=65536,a===es?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([a]):l.add(a)),Hr(e,a,n)),!1}throw Error(o(435,l.tag))}return Hr(e,a,n),Es(),!1}if(ye)return t=vt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=n,a!==Oi&&(e=Error(o(422),{cause:a}),Ja(Nt(e,l)))):(a!==Oi&&(t=Error(o(423),{cause:a}),Ja(Nt(t,l))),e=e.current.alternate,e.flags|=65536,n&=-n,e.lanes|=n,a=Nt(a,l),n=xr(e.stateNode,a,n),Xi(e,n),Le!==4&&(Le=2)),!1;var i=Error(o(520),{cause:a});if(i=Nt(i,l),xn===null?xn=[i]:xn.push(i),Le!==4&&(Le=2),t===null)return!0;a=Nt(a,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=n&-n,l.lanes|=e,e=xr(l.stateNode,a,e),Xi(l,e),!1;case 1:if(t=l.type,i=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(hl===null||!hl.has(i))))return l.flags|=65536,n&=-n,l.lanes|=n,n=qo(n),Yo(n,e,l,a),Xi(l,n),!1}l=l.return}while(l!==null);return!1}var vr=Error(o(461)),Ge=!1;function Fe(e,t,l,a){t.child=e===null?Xu(t,null,l,a):Gl(t,e.child,l,a)}function Go(e,t,l,a,n){l=l.render;var i=t.ref;if("ref"in a){var r={};for(var d in a)d!=="ref"&&(r[d]=a[d])}else r=a;return Bl(t),a=Wi(e,t,l,r,i,n),d=Fi(),e!==null&&!Ge?(Ii(e,t,n),Zt(e,t,n)):(ye&&d&&ki(t),t.flags|=1,Fe(e,t,a,n),t.child)}function Qo(e,t,l,a,n){if(e===null){var i=l.type;return typeof i=="function"&&!Mi(i)&&i.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=i,Xo(e,t,i,a,n)):(e=Jn(l.type,null,a,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!Nr(e,n)){var r=i.memoizedProps;if(l=l.compare,l=l!==null?l:Va,l(r,a)&&e.ref===t.ref)return Zt(e,t,n)}return t.flags|=1,e=qt(i,a),e.ref=t.ref,e.return=t,t.child=e}function Xo(e,t,l,a,n){if(e!==null){var i=e.memoizedProps;if(Va(i,a)&&e.ref===t.ref)if(Ge=!1,t.pendingProps=a=i,Nr(e,n))(e.flags&131072)!==0&&(Ge=!0);else return t.lanes=e.lanes,Zt(e,t,n)}return hr(e,t,l,a,n)}function Vo(e,t,l,a){var n=a.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(i=i!==null?i.baseLanes|l:l,e!==null){for(a=t.child=e.child,n=0;a!==null;)n=n|a.lanes|a.childLanes,a=a.sibling;a=n&~i}else a=0,t.child=null;return Zo(e,t,i,l,a)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&In(t,i!==null?i.cachePool:null),i!==null?Ku(t,i):Zi(),Ju(t);else return a=t.lanes=536870912,Zo(e,t,i!==null?i.baseLanes|l:l,l,a)}else i!==null?(In(t,i.cachePool),Ku(t,i),fl(),t.memoizedState=null):(e!==null&&In(t,null),Zi(),fl());return Fe(e,t,n,l),t.child}function rn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Zo(e,t,l,a,n){var i=qi();return i=i===null?null:{parent:qe._currentValue,pool:i},t.memoizedState={baseLanes:l,cachePool:i},e!==null&&In(t,null),Zi(),Ju(t),e!==null&&da(e,t,a,!0),t.childLanes=n,null}function xs(e,t){return t=hs({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Ko(e,t,l){return Gl(t,e.child,null,l),e=xs(t,t.pendingProps),e.flags|=2,ht(t),t.memoizedState=null,e}function Cx(e,t,l){var a=t.pendingProps,n=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ye){if(a.mode==="hidden")return e=xs(t,a),t.lanes=536870912,rn(null,e);if(Ji(t),(e=Re)?(e=sf(e,Ct),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:nl!==null?{id:Ot,overflow:Dt}:null,retryLane:536870912,hydrationErrors:null},l=_u(e),l.return=t,t.child=l,$e=t,Re=null)):e=null,e===null)throw il(t);return t.lanes=536870912,null}return xs(t,a)}var i=e.memoizedState;if(i!==null){var r=i.dehydrated;if(Ji(t),n)if(t.flags&256)t.flags&=-257,t=Ko(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Ge||da(e,t,l,!1),n=(l&e.childLanes)!==0,Ge||n){if(a=ke,a!==null&&(r=Lc(a,l),r!==0&&r!==i.retryLane))throw i.retryLane=r,Dl(e,r),ut(a,e,r),vr;Es(),t=Ko(e,t,l)}else e=i.treeContext,Re=Mt(r.nextSibling),$e=t,ye=!0,sl=null,Ct=!1,e!==null&&Ru(t,e),t=xs(t,a),t.flags|=4096;return t}return e=qt(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function vs(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function hr(e,t,l,a,n){return Bl(t),l=Wi(e,t,l,a,void 0,n),a=Fi(),e!==null&&!Ge?(Ii(e,t,n),Zt(e,t,n)):(ye&&a&&ki(t),t.flags|=1,Fe(e,t,l,n),t.child)}function Jo(e,t,l,a,n,i){return Bl(t),t.updateQueue=null,l=Wu(t,a,l,n),$u(e),a=Fi(),e!==null&&!Ge?(Ii(e,t,i),Zt(e,t,i)):(ye&&a&&ki(t),t.flags|=1,Fe(e,t,l,i),t.child)}function $o(e,t,l,a,n){if(Bl(t),t.stateNode===null){var i=ra,r=l.contextType;typeof r=="object"&&r!==null&&(i=We(r)),i=new l(a,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=mr,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=a,i.state=t.memoizedState,i.refs={},Gi(t),r=l.contextType,i.context=typeof r=="object"&&r!==null?We(r):ra,i.state=t.memoizedState,r=l.getDerivedStateFromProps,typeof r=="function"&&(fr(t,l,r,a),i.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(r=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),r!==i.state&&mr.enqueueReplaceState(i,i.state,null),tn(t,a,i,n),en(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){i=t.stateNode;var d=t.memoizedProps,v=Xl(l,d);i.props=v;var A=i.context,D=l.contextType;r=ra,typeof D=="object"&&D!==null&&(r=We(D));var L=l.getDerivedStateFromProps;D=typeof L=="function"||typeof i.getSnapshotBeforeUpdate=="function",d=t.pendingProps!==d,D||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(d||A!==r)&&wo(t,i,a,r),cl=!1;var M=t.memoizedState;i.state=M,tn(t,a,i,n),en(),A=t.memoizedState,d||M!==A||cl?(typeof L=="function"&&(fr(t,l,L,a),A=t.memoizedState),(v=cl||Do(t,l,v,a,M,A,r))?(D||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=A),i.props=a,i.state=A,i.context=r,a=v):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{i=t.stateNode,Qi(e,t),r=t.memoizedProps,D=Xl(l,r),i.props=D,L=t.pendingProps,M=i.context,A=l.contextType,v=ra,typeof A=="object"&&A!==null&&(v=We(A)),d=l.getDerivedStateFromProps,(A=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(r!==L||M!==v)&&wo(t,i,a,v),cl=!1,M=t.memoizedState,i.state=M,tn(t,a,i,n),en();var _=t.memoizedState;r!==L||M!==_||cl||e!==null&&e.dependencies!==null&&Wn(e.dependencies)?(typeof d=="function"&&(fr(t,l,d,a),_=t.memoizedState),(D=cl||Do(t,l,D,a,M,_,v)||e!==null&&e.dependencies!==null&&Wn(e.dependencies))?(A||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(a,_,v),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(a,_,v)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||r===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||r===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=_),i.props=a,i.state=_,i.context=v,a=D):(typeof i.componentDidUpdate!="function"||r===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||r===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),a=!1)}return i=a,vs(e,t),a=(t.flags&128)!==0,i||a?(i=t.stateNode,l=a&&typeof l.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&a?(t.child=Gl(t,e.child,null,n),t.child=Gl(t,null,l,n)):Fe(e,t,l,n),t.memoizedState=i.state,e=t.child):e=Zt(e,t,n),e}function Wo(e,t,l,a){return Ll(),t.flags|=256,Fe(e,t,l,a),t.child}var pr={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yr(e){return{baseLanes:e,cachePool:Bu()}}function gr(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=yt),e}function Fo(e,t,l){var a=t.pendingProps,n=!1,i=(t.flags&128)!==0,r;if((r=i)||(r=e!==null&&e.memoizedState===null?!1:(Be.current&2)!==0),r&&(n=!0,t.flags&=-129),r=(t.flags&32)!==0,t.flags&=-33,e===null){if(ye){if(n?dl(t):fl(),(e=Re)?(e=sf(e,Ct),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:nl!==null?{id:Ot,overflow:Dt}:null,retryLane:536870912,hydrationErrors:null},l=_u(e),l.return=t,t.child=l,$e=t,Re=null)):e=null,e===null)throw il(t);return tc(e)?t.lanes=32:t.lanes=536870912,null}var d=a.children;return a=a.fallback,n?(fl(),n=t.mode,d=hs({mode:"hidden",children:d},n),a=wl(a,n,l,null),d.return=t,a.return=t,d.sibling=a,t.child=d,a=t.child,a.memoizedState=yr(l),a.childLanes=gr(e,r,l),t.memoizedState=pr,rn(null,a)):(dl(t),br(t,d))}var v=e.memoizedState;if(v!==null&&(d=v.dehydrated,d!==null)){if(i)t.flags&256?(dl(t),t.flags&=-257,t=jr(e,t,l)):t.memoizedState!==null?(fl(),t.child=e.child,t.flags|=128,t=null):(fl(),d=a.fallback,n=t.mode,a=hs({mode:"visible",children:a.children},n),d=wl(d,n,l,null),d.flags|=2,a.return=t,d.return=t,a.sibling=d,t.child=a,Gl(t,e.child,null,l),a=t.child,a.memoizedState=yr(l),a.childLanes=gr(e,r,l),t.memoizedState=pr,t=rn(null,a));else if(dl(t),tc(d)){if(r=d.nextSibling&&d.nextSibling.dataset,r)var A=r.dgst;r=A,a=Error(o(419)),a.stack="",a.digest=r,Ja({value:a,source:null,stack:null}),t=jr(e,t,l)}else if(Ge||da(e,t,l,!1),r=(l&e.childLanes)!==0,Ge||r){if(r=ke,r!==null&&(a=Lc(r,l),a!==0&&a!==v.retryLane))throw v.retryLane=a,Dl(e,a),ut(r,e,a),vr;ec(d)||Es(),t=jr(e,t,l)}else ec(d)?(t.flags|=192,t.child=e.child,t=null):(e=v.treeContext,Re=Mt(d.nextSibling),$e=t,ye=!0,sl=null,Ct=!1,e!==null&&Ru(t,e),t=br(t,a.children),t.flags|=4096);return t}return n?(fl(),d=a.fallback,n=t.mode,v=e.child,A=v.sibling,a=qt(v,{mode:"hidden",children:a.children}),a.subtreeFlags=v.subtreeFlags&65011712,A!==null?d=qt(A,d):(d=wl(d,n,l,null),d.flags|=2),d.return=t,a.return=t,a.sibling=d,t.child=a,rn(null,a),a=t.child,d=e.child.memoizedState,d===null?d=yr(l):(n=d.cachePool,n!==null?(v=qe._currentValue,n=n.parent!==v?{parent:v,pool:v}:n):n=Bu(),d={baseLanes:d.baseLanes|l,cachePool:n}),a.memoizedState=d,a.childLanes=gr(e,r,l),t.memoizedState=pr,rn(e.child,a)):(dl(t),l=e.child,e=l.sibling,l=qt(l,{mode:"visible",children:a.children}),l.return=t,l.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=l,t.memoizedState=null,l)}function br(e,t){return t=hs({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function hs(e,t){return e=xt(22,e,null,t),e.lanes=0,e}function jr(e,t,l){return Gl(t,e.child,null,l),e=br(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Io(e,t,l){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),Li(e.return,t,l)}function Sr(e,t,l,a,n,i){var r=e.memoizedState;r===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:l,tailMode:n,treeForkCount:i}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=a,r.tail=l,r.tailMode=n,r.treeForkCount=i)}function Po(e,t,l){var a=t.pendingProps,n=a.revealOrder,i=a.tail;a=a.children;var r=Be.current,d=(r&2)!==0;if(d?(r=r&1|2,t.flags|=128):r&=1,X(Be,r),Fe(e,t,a,l),a=ye?Ka:0,!d&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Io(e,l,t);else if(e.tag===19)Io(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(n){case"forwards":for(l=t.child,n=null;l!==null;)e=l.alternate,e!==null&&ns(e)===null&&(n=l),l=l.sibling;l=n,l===null?(n=t.child,t.child=null):(n=l.sibling,l.sibling=null),Sr(t,!1,n,l,i,a);break;case"backwards":case"unstable_legacy-backwards":for(l=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&ns(e)===null){t.child=n;break}e=n.sibling,n.sibling=l,l=n,n=e}Sr(t,!0,l,null,i,a);break;case"together":Sr(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function Zt(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),vl|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(da(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=qt(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=qt(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Nr(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Wn(e)))}function Ax(e,t,l){switch(t.tag){case 3:et(t,t.stateNode.containerInfo),rl(t,qe,e.memoizedState.cache),Ll();break;case 27:case 5:Ra(t);break;case 4:et(t,t.stateNode.containerInfo);break;case 10:rl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ji(t),null;break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(dl(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Fo(e,t,l):(dl(t),e=Zt(e,t,l),e!==null?e.sibling:null);dl(t);break;case 19:var n=(e.flags&128)!==0;if(a=(l&t.childLanes)!==0,a||(da(e,t,l,!1),a=(l&t.childLanes)!==0),n){if(a)return Po(e,t,l);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),X(Be,Be.current),a)break;return null;case 22:return t.lanes=0,Vo(e,t,l,t.pendingProps);case 24:rl(t,qe,e.memoizedState.cache)}return Zt(e,t,l)}function ed(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ge=!0;else{if(!Nr(e,l)&&(t.flags&128)===0)return Ge=!1,Ax(e,t,l);Ge=(e.flags&131072)!==0}else Ge=!1,ye&&(t.flags&1048576)!==0&&ku(t,Ka,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=ql(t.elementType),t.type=e,typeof e=="function")Mi(e)?(a=Xl(e,a),t.tag=1,t=$o(null,t,e,a,l)):(t.tag=0,t=hr(null,t,e,a,l));else{if(e!=null){var n=e.$$typeof;if(n===K){t.tag=11,t=Go(null,t,e,a,l);break e}else if(n===ee){t.tag=14,t=Qo(null,t,e,a,l);break e}}throw t=$(e)||e,Error(o(306,t,""))}}return t;case 0:return hr(e,t,t.type,t.pendingProps,l);case 1:return a=t.type,n=Xl(a,t.pendingProps),$o(e,t,a,n,l);case 3:e:{if(et(t,t.stateNode.containerInfo),e===null)throw Error(o(387));a=t.pendingProps;var i=t.memoizedState;n=i.element,Qi(e,t),tn(t,a,null,l);var r=t.memoizedState;if(a=r.cache,rl(t,qe,a),a!==i.cache&&Ui(t,[qe],l,!0),en(),a=r.element,i.isDehydrated)if(i={element:a,isDehydrated:!1,cache:r.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=Wo(e,t,a,l);break e}else if(a!==n){n=Nt(Error(o(424)),t),Ja(n),t=Wo(e,t,a,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Re=Mt(e.firstChild),$e=t,ye=!0,sl=null,Ct=!0,l=Xu(t,null,a,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Ll(),a===n){t=Zt(e,t,l);break e}Fe(e,t,a,l)}t=t.child}return t;case 26:return vs(e,t),e===null?(l=ff(t.type,null,t.pendingProps,null))?t.memoizedState=l:ye||(l=t.type,e=t.pendingProps,a=Rs(me.current).createElement(l),a[Je]=t,a[at]=e,Ie(a,l,e),Ze(a),t.stateNode=a):t.memoizedState=ff(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ra(t),e===null&&ye&&(a=t.stateNode=uf(t.type,t.pendingProps,me.current),$e=t,Ct=!0,n=Re,bl(t.type)?(lc=n,Re=Mt(a.firstChild)):Re=n),Fe(e,t,t.pendingProps.children,l),vs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ye&&((n=a=Re)&&(a=av(a,t.type,t.pendingProps,Ct),a!==null?(t.stateNode=a,$e=t,Re=Mt(a.firstChild),Ct=!1,n=!0):n=!1),n||il(t)),Ra(t),n=t.type,i=t.pendingProps,r=e!==null?e.memoizedProps:null,a=i.children,Fr(n,i)?a=null:r!==null&&Fr(n,r)&&(t.flags|=32),t.memoizedState!==null&&(n=Wi(e,t,yx,null,null,l),Sn._currentValue=n),vs(e,t),Fe(e,t,a,l),t.child;case 6:return e===null&&ye&&((e=l=Re)&&(l=nv(l,t.pendingProps,Ct),l!==null?(t.stateNode=l,$e=t,Re=null,e=!0):e=!1),e||il(t)),null;case 13:return Fo(e,t,l);case 4:return et(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Gl(t,null,a,l):Fe(e,t,a,l),t.child;case 11:return Go(e,t,t.type,t.pendingProps,l);case 7:return Fe(e,t,t.pendingProps,l),t.child;case 8:return Fe(e,t,t.pendingProps.children,l),t.child;case 12:return Fe(e,t,t.pendingProps.children,l),t.child;case 10:return a=t.pendingProps,rl(t,t.type,a.value),Fe(e,t,a.children,l),t.child;case 9:return n=t.type._context,a=t.pendingProps.children,Bl(t),n=We(n),a=a(n),t.flags|=1,Fe(e,t,a,l),t.child;case 14:return Qo(e,t,t.type,t.pendingProps,l);case 15:return Xo(e,t,t.type,t.pendingProps,l);case 19:return Po(e,t,l);case 31:return Cx(e,t,l);case 22:return Vo(e,t,l,t.pendingProps);case 24:return Bl(t),a=We(qe),e===null?(n=qi(),n===null&&(n=ke,i=Bi(),n.pooledCache=i,i.refCount++,i!==null&&(n.pooledCacheLanes|=l),n=i),t.memoizedState={parent:a,cache:n},Gi(t),rl(t,qe,n)):((e.lanes&l)!==0&&(Qi(e,t),tn(t,null,null,l),en()),n=e.memoizedState,i=t.memoizedState,n.parent!==a?(n={parent:a,cache:a},t.memoizedState=n,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=n),rl(t,qe,a)):(a=i.cache,rl(t,qe,a),a!==n.cache&&Ui(t,[qe],l,!0))),Fe(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Kt(e){e.flags|=4}function Tr(e,t,l,a,n){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(n&335544128)===n)if(e.stateNode.complete)e.flags|=8192;else if(Ad())e.flags|=8192;else throw Yl=es,Yi}else e.flags&=-16777217}function td(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!pf(t))if(Ad())e.flags|=8192;else throw Yl=es,Yi}function ps(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Oc():536870912,e.lanes|=t,Na|=t)}function cn(e,t){if(!ye)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var a=null;l!==null;)l.alternate!==null&&(a=l),l=l.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function Oe(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,a=0;if(t)for(var n=e.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags&65011712,a|=n.flags&65011712,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags,a|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=a,e.childLanes=l,t}function Mx(e,t,l){var a=t.pendingProps;switch(Ri(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Oe(t),null;case 1:return Oe(t),null;case 3:return l=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Qt(qe),Ue(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(oa(t)?Kt(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Di())),Oe(t),null;case 26:var n=t.type,i=t.memoizedState;return e===null?(Kt(t),i!==null?(Oe(t),td(t,i)):(Oe(t),Tr(t,n,null,a,l))):i?i!==e.memoizedState?(Kt(t),Oe(t),td(t,i)):(Oe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&Kt(t),Oe(t),Tr(t,n,e,a,l)),null;case 27:if(Mn(t),l=me.current,n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Kt(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Oe(t),null}e=F.current,oa(t)?Ou(t):(e=uf(n,a,l),t.stateNode=e,Kt(t))}return Oe(t),null;case 5:if(Mn(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Kt(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Oe(t),null}if(i=F.current,oa(t))Ou(t);else{var r=Rs(me.current);switch(i){case 1:i=r.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:i=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":i=r.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":i=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":i=r.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof a.is=="string"?r.createElement("select",{is:a.is}):r.createElement("select"),a.multiple?i.multiple=!0:a.size&&(i.size=a.size);break;default:i=typeof a.is=="string"?r.createElement(n,{is:a.is}):r.createElement(n)}}i[Je]=t,i[at]=a;e:for(r=t.child;r!==null;){if(r.tag===5||r.tag===6)i.appendChild(r.stateNode);else if(r.tag!==4&&r.tag!==27&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}t.stateNode=i;e:switch(Ie(i,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Kt(t)}}return Oe(t),Tr(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Kt(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=me.current,oa(t)){if(e=t.stateNode,l=t.memoizedProps,a=null,n=$e,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}e[Je]=t,e=!!(e.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Fd(e.nodeValue,l)),e||il(t,!0)}else e=Rs(e).createTextNode(a),e[Je]=t,t.stateNode=e}return Oe(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(a=oa(t),l!==null){if(e===null){if(!a)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Je]=t}else Ll(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Oe(t),e=!1}else l=Di(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(ht(t),t):(ht(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Oe(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(n=oa(t),a!==null&&a.dehydrated!==null){if(e===null){if(!n)throw Error(o(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));n[Je]=t}else Ll(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Oe(t),n=!1}else n=Di(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),n=!0;if(!n)return t.flags&256?(ht(t),t):(ht(t),null)}return ht(t),(t.flags&128)!==0?(t.lanes=l,t):(l=a!==null,e=e!==null&&e.memoizedState!==null,l&&(a=t.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==n&&(a.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),ps(t,t.updateQueue),Oe(t),null);case 4:return Ue(),e===null&&Zr(t.stateNode.containerInfo),Oe(t),null;case 10:return Qt(t.type),Oe(t),null;case 19:if(U(Be),a=t.memoizedState,a===null)return Oe(t),null;if(n=(t.flags&128)!==0,i=a.rendering,i===null)if(n)cn(a,!1);else{if(Le!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=ns(e),i!==null){for(t.flags|=128,cn(a,!1),e=i.updateQueue,t.updateQueue=e,ps(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Mu(l,e),l=l.sibling;return X(Be,Be.current&1|2),ye&&Yt(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&ot()>Ss&&(t.flags|=128,n=!0,cn(a,!1),t.lanes=4194304)}else{if(!n)if(e=ns(i),e!==null){if(t.flags|=128,n=!0,e=e.updateQueue,t.updateQueue=e,ps(t,e),cn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!ye)return Oe(t),null}else 2*ot()-a.renderingStartTime>Ss&&l!==536870912&&(t.flags|=128,n=!0,cn(a,!1),t.lanes=4194304);a.isBackwards?(i.sibling=t.child,t.child=i):(e=a.last,e!==null?e.sibling=i:t.child=i,a.last=i)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=ot(),e.sibling=null,l=Be.current,X(Be,n?l&1|2:l&1),ye&&Yt(t,a.treeForkCount),e):(Oe(t),null);case 22:case 23:return ht(t),Ki(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(l&536870912)!==0&&(t.flags&128)===0&&(Oe(t),t.subtreeFlags&6&&(t.flags|=8192)):Oe(t),l=t.updateQueue,l!==null&&ps(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==l&&(t.flags|=2048),e!==null&&U(Hl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Qt(qe),Oe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function _x(e,t){switch(Ri(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qt(qe),Ue(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Mn(t),null;case 31:if(t.memoizedState!==null){if(ht(t),t.alternate===null)throw Error(o(340));Ll()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ht(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ll()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(Be),null;case 4:return Ue(),null;case 10:return Qt(t.type),null;case 22:case 23:return ht(t),Ki(),e!==null&&U(Hl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qt(qe),null;case 25:return null;default:return null}}function ld(e,t){switch(Ri(t),t.tag){case 3:Qt(qe),Ue();break;case 26:case 27:case 5:Mn(t);break;case 4:Ue();break;case 31:t.memoizedState!==null&&ht(t);break;case 13:ht(t);break;case 19:U(Be);break;case 10:Qt(t.type);break;case 22:case 23:ht(t),Ki(),e!==null&&U(Hl);break;case 24:Qt(qe)}}function un(e,t){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var n=a.next;l=n;do{if((l.tag&e)===e){a=void 0;var i=l.create,r=l.inst;a=i(),r.destroy=a}l=l.next}while(l!==n)}}catch(d){Ae(t,t.return,d)}}function ml(e,t,l){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var i=n.next;a=i;do{if((a.tag&e)===e){var r=a.inst,d=r.destroy;if(d!==void 0){r.destroy=void 0,n=t;var v=l,A=d;try{A()}catch(D){Ae(n,v,D)}}}a=a.next}while(a!==i)}}catch(D){Ae(t,t.return,D)}}function ad(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Zu(t,l)}catch(a){Ae(e,e.return,a)}}}function nd(e,t,l){l.props=Xl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(a){Ae(e,t,a)}}function on(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof l=="function"?e.refCleanup=l(a):l.current=a}}catch(n){Ae(e,t,n)}}function wt(e,t){var l=e.ref,a=e.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){Ae(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(n){Ae(e,t,n)}else l.current=null}function sd(e){var t=e.type,l=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break e;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(n){Ae(e,e.return,n)}}function Er(e,t,l){try{var a=e.stateNode;Fx(a,e.type,l,t),a[at]=t}catch(n){Ae(e,e.return,n)}}function id(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&bl(e.type)||e.tag===4}function Cr(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||id(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&bl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ar(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=Bt));else if(a!==4&&(a===27&&bl(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Ar(e,t,l),e=e.sibling;e!==null;)Ar(e,t,l),e=e.sibling}function ys(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(a!==4&&(a===27&&bl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(ys(e,t,l),e=e.sibling;e!==null;)ys(e,t,l),e=e.sibling}function rd(e){var t=e.stateNode,l=e.memoizedProps;try{for(var a=e.type,n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Ie(t,a,l),t[Je]=e,t[at]=l}catch(i){Ae(e,e.return,i)}}var Jt=!1,Qe=!1,Mr=!1,cd=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function zx(e,t){if(e=e.containerInfo,$r=Hs,e=gu(e),ji(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var a=l.getSelection&&l.getSelection();if(a&&a.rangeCount!==0){l=a.anchorNode;var n=a.anchorOffset,i=a.focusNode;a=a.focusOffset;try{l.nodeType,i.nodeType}catch{l=null;break e}var r=0,d=-1,v=-1,A=0,D=0,L=e,M=null;t:for(;;){for(var _;L!==l||n!==0&&L.nodeType!==3||(d=r+n),L!==i||a!==0&&L.nodeType!==3||(v=r+a),L.nodeType===3&&(r+=L.nodeValue.length),(_=L.firstChild)!==null;)M=L,L=_;for(;;){if(L===e)break t;if(M===l&&++A===n&&(d=r),M===i&&++D===a&&(v=r),(_=L.nextSibling)!==null)break;L=M,M=L.parentNode}L=_}l=d===-1||v===-1?null:{start:d,end:v}}else l=null}l=l||{start:0,end:0}}else l=null;for(Wr={focusedElem:e,selectionRange:l},Hs=!1,Ke=t;Ke!==null;)if(t=Ke,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ke=e;else for(;Ke!==null;){switch(t=Ke,i=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)n=e[l],n.ref.impl=n.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,l=t,n=i.memoizedProps,i=i.memoizedState,a=l.stateNode;try{var W=Xl(l.type,n);e=a.getSnapshotBeforeUpdate(W,i),a.__reactInternalSnapshotBeforeUpdate=e}catch(ne){Ae(l,l.return,ne)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Pr(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Pr(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Ke=e;break}Ke=t.return}}function ud(e,t,l){var a=l.flags;switch(l.tag){case 0:case 11:case 15:Wt(e,l),a&4&&un(5,l);break;case 1:if(Wt(e,l),a&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(r){Ae(l,l.return,r)}else{var n=Xl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(n,t,e.__reactInternalSnapshotBeforeUpdate)}catch(r){Ae(l,l.return,r)}}a&64&&ad(l),a&512&&on(l,l.return);break;case 3:if(Wt(e,l),a&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{Zu(e,t)}catch(r){Ae(l,l.return,r)}}break;case 27:t===null&&a&4&&rd(l);case 26:case 5:Wt(e,l),t===null&&a&4&&sd(l),a&512&&on(l,l.return);break;case 12:Wt(e,l);break;case 31:Wt(e,l),a&4&&fd(e,l);break;case 13:Wt(e,l),a&4&&md(e,l),a&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Hx.bind(null,l),sv(e,l))));break;case 22:if(a=l.memoizedState!==null||Jt,!a){t=t!==null&&t.memoizedState!==null||Qe,n=Jt;var i=Qe;Jt=a,(Qe=t)&&!i?Ft(e,l,(l.subtreeFlags&8772)!==0):Wt(e,l),Jt=n,Qe=i}break;case 30:break;default:Wt(e,l)}}function od(e){var t=e.alternate;t!==null&&(e.alternate=null,od(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ni(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var De=null,st=!1;function $t(e,t,l){for(l=l.child;l!==null;)dd(e,t,l),l=l.sibling}function dd(e,t,l){if(dt&&typeof dt.onCommitFiberUnmount=="function")try{dt.onCommitFiberUnmount(Oa,l)}catch{}switch(l.tag){case 26:Qe||wt(l,t),$t(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Qe||wt(l,t);var a=De,n=st;bl(l.type)&&(De=l.stateNode,st=!1),$t(e,t,l),gn(l.stateNode),De=a,st=n;break;case 5:Qe||wt(l,t);case 6:if(a=De,n=st,De=null,$t(e,t,l),De=a,st=n,De!==null)if(st)try{(De.nodeType===9?De.body:De.nodeName==="HTML"?De.ownerDocument.body:De).removeChild(l.stateNode)}catch(i){Ae(l,t,i)}else try{De.removeChild(l.stateNode)}catch(i){Ae(l,t,i)}break;case 18:De!==null&&(st?(e=De,af(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),ka(e)):af(De,l.stateNode));break;case 4:a=De,n=st,De=l.stateNode.containerInfo,st=!0,$t(e,t,l),De=a,st=n;break;case 0:case 11:case 14:case 15:ml(2,l,t),Qe||ml(4,l,t),$t(e,t,l);break;case 1:Qe||(wt(l,t),a=l.stateNode,typeof a.componentWillUnmount=="function"&&nd(l,t,a)),$t(e,t,l);break;case 21:$t(e,t,l);break;case 22:Qe=(a=Qe)||l.memoizedState!==null,$t(e,t,l),Qe=a;break;default:$t(e,t,l)}}function fd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ka(e)}catch(l){Ae(t,t.return,l)}}}function md(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ka(e)}catch(l){Ae(t,t.return,l)}}function kx(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new cd),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new cd),t;default:throw Error(o(435,e.tag))}}function gs(e,t){var l=kx(e);t.forEach(function(a){if(!l.has(a)){l.add(a);var n=qx.bind(null,e,a);a.then(n,n)}})}function it(e,t){var l=t.deletions;if(l!==null)for(var a=0;a<l.length;a++){var n=l[a],i=e,r=t,d=r;e:for(;d!==null;){switch(d.tag){case 27:if(bl(d.type)){De=d.stateNode,st=!1;break e}break;case 5:De=d.stateNode,st=!1;break e;case 3:case 4:De=d.stateNode.containerInfo,st=!0;break e}d=d.return}if(De===null)throw Error(o(160));dd(i,r,n),De=null,st=!1,i=n.alternate,i!==null&&(i.return=null),n.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)xd(t,e),t=t.sibling}var kt=null;function xd(e,t){var l=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:it(t,e),rt(e),a&4&&(ml(3,e,e.return),un(3,e),ml(5,e,e.return));break;case 1:it(t,e),rt(e),a&512&&(Qe||l===null||wt(l,l.return)),a&64&&Jt&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?a:l.concat(a))));break;case 26:var n=kt;if(it(t,e),rt(e),a&512&&(Qe||l===null||wt(l,l.return)),a&4){var i=l!==null?l.memoizedState:null;if(a=e.memoizedState,l===null)if(a===null)if(e.stateNode===null){e:{a=e.type,l=e.memoizedProps,n=n.ownerDocument||n;t:switch(a){case"title":i=n.getElementsByTagName("title")[0],(!i||i[La]||i[Je]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=n.createElement(a),n.head.insertBefore(i,n.querySelector("head > title"))),Ie(i,a,l),i[Je]=e,Ze(i),a=i;break e;case"link":var r=vf("link","href",n).get(a+(l.href||""));if(r){for(var d=0;d<r.length;d++)if(i=r[d],i.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&i.getAttribute("rel")===(l.rel==null?null:l.rel)&&i.getAttribute("title")===(l.title==null?null:l.title)&&i.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){r.splice(d,1);break t}}i=n.createElement(a),Ie(i,a,l),n.head.appendChild(i);break;case"meta":if(r=vf("meta","content",n).get(a+(l.content||""))){for(d=0;d<r.length;d++)if(i=r[d],i.getAttribute("content")===(l.content==null?null:""+l.content)&&i.getAttribute("name")===(l.name==null?null:l.name)&&i.getAttribute("property")===(l.property==null?null:l.property)&&i.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&i.getAttribute("charset")===(l.charSet==null?null:l.charSet)){r.splice(d,1);break t}}i=n.createElement(a),Ie(i,a,l),n.head.appendChild(i);break;default:throw Error(o(468,a))}i[Je]=e,Ze(i),a=i}e.stateNode=a}else hf(n,e.type,e.stateNode);else e.stateNode=xf(n,a,e.memoizedProps);else i!==a?(i===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):i.count--,a===null?hf(n,e.type,e.stateNode):xf(n,a,e.memoizedProps)):a===null&&e.stateNode!==null&&Er(e,e.memoizedProps,l.memoizedProps)}break;case 27:it(t,e),rt(e),a&512&&(Qe||l===null||wt(l,l.return)),l!==null&&a&4&&Er(e,e.memoizedProps,l.memoizedProps);break;case 5:if(it(t,e),rt(e),a&512&&(Qe||l===null||wt(l,l.return)),e.flags&32){n=e.stateNode;try{ea(n,"")}catch(W){Ae(e,e.return,W)}}a&4&&e.stateNode!=null&&(n=e.memoizedProps,Er(e,n,l!==null?l.memoizedProps:n)),a&1024&&(Mr=!0);break;case 6:if(it(t,e),rt(e),a&4){if(e.stateNode===null)throw Error(o(162));a=e.memoizedProps,l=e.stateNode;try{l.nodeValue=a}catch(W){Ae(e,e.return,W)}}break;case 3:if(ws=null,n=kt,kt=Os(t.containerInfo),it(t,e),kt=n,rt(e),a&4&&l!==null&&l.memoizedState.isDehydrated)try{ka(t.containerInfo)}catch(W){Ae(e,e.return,W)}Mr&&(Mr=!1,vd(e));break;case 4:a=kt,kt=Os(e.stateNode.containerInfo),it(t,e),rt(e),kt=a;break;case 12:it(t,e),rt(e);break;case 31:it(t,e),rt(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,gs(e,a)));break;case 13:it(t,e),rt(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(js=ot()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,gs(e,a)));break;case 22:n=e.memoizedState!==null;var v=l!==null&&l.memoizedState!==null,A=Jt,D=Qe;if(Jt=A||n,Qe=D||v,it(t,e),Qe=D,Jt=A,rt(e),a&8192)e:for(t=e.stateNode,t._visibility=n?t._visibility&-2:t._visibility|1,n&&(l===null||v||Jt||Qe||Vl(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){v=l=t;try{if(i=v.stateNode,n)r=i.style,typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none";else{d=v.stateNode;var L=v.memoizedProps.style,M=L!=null&&L.hasOwnProperty("display")?L.display:null;d.style.display=M==null||typeof M=="boolean"?"":(""+M).trim()}}catch(W){Ae(v,v.return,W)}}}else if(t.tag===6){if(l===null){v=t;try{v.stateNode.nodeValue=n?"":v.memoizedProps}catch(W){Ae(v,v.return,W)}}}else if(t.tag===18){if(l===null){v=t;try{var _=v.stateNode;n?nf(_,!0):nf(v.stateNode,!1)}catch(W){Ae(v,v.return,W)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(l=a.retryQueue,l!==null&&(a.retryQueue=null,gs(e,l))));break;case 19:it(t,e),rt(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,gs(e,a)));break;case 30:break;case 21:break;default:it(t,e),rt(e)}}function rt(e){var t=e.flags;if(t&2){try{for(var l,a=e.return;a!==null;){if(id(a)){l=a;break}a=a.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var n=l.stateNode,i=Cr(e);ys(e,i,n);break;case 5:var r=l.stateNode;l.flags&32&&(ea(r,""),l.flags&=-33);var d=Cr(e);ys(e,d,r);break;case 3:case 4:var v=l.stateNode.containerInfo,A=Cr(e);Ar(e,A,v);break;default:throw Error(o(161))}}catch(D){Ae(e,e.return,D)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function vd(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;vd(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Wt(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ud(e,t.alternate,t),t=t.sibling}function Vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ml(4,t,t.return),Vl(t);break;case 1:wt(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&nd(t,t.return,l),Vl(t);break;case 27:gn(t.stateNode);case 26:case 5:wt(t,t.return),Vl(t);break;case 22:t.memoizedState===null&&Vl(t);break;case 30:Vl(t);break;default:Vl(t)}e=e.sibling}}function Ft(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,n=e,i=t,r=i.flags;switch(i.tag){case 0:case 11:case 15:Ft(n,i,l),un(4,i);break;case 1:if(Ft(n,i,l),a=i,n=a.stateNode,typeof n.componentDidMount=="function")try{n.componentDidMount()}catch(A){Ae(a,a.return,A)}if(a=i,n=a.updateQueue,n!==null){var d=a.stateNode;try{var v=n.shared.hiddenCallbacks;if(v!==null)for(n.shared.hiddenCallbacks=null,n=0;n<v.length;n++)Vu(v[n],d)}catch(A){Ae(a,a.return,A)}}l&&r&64&&ad(i),on(i,i.return);break;case 27:rd(i);case 26:case 5:Ft(n,i,l),l&&a===null&&r&4&&sd(i),on(i,i.return);break;case 12:Ft(n,i,l);break;case 31:Ft(n,i,l),l&&r&4&&fd(n,i);break;case 13:Ft(n,i,l),l&&r&4&&md(n,i);break;case 22:i.memoizedState===null&&Ft(n,i,l),on(i,i.return);break;case 30:break;default:Ft(n,i,l)}t=t.sibling}}function _r(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&$a(l))}function zr(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&$a(e))}function Rt(e,t,l,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)hd(e,t,l,a),t=t.sibling}function hd(e,t,l,a){var n=t.flags;switch(t.tag){case 0:case 11:case 15:Rt(e,t,l,a),n&2048&&un(9,t);break;case 1:Rt(e,t,l,a);break;case 3:Rt(e,t,l,a),n&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&$a(e)));break;case 12:if(n&2048){Rt(e,t,l,a),e=t.stateNode;try{var i=t.memoizedProps,r=i.id,d=i.onPostCommit;typeof d=="function"&&d(r,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(v){Ae(t,t.return,v)}}else Rt(e,t,l,a);break;case 31:Rt(e,t,l,a);break;case 13:Rt(e,t,l,a);break;case 23:break;case 22:i=t.stateNode,r=t.alternate,t.memoizedState!==null?i._visibility&2?Rt(e,t,l,a):dn(e,t):i._visibility&2?Rt(e,t,l,a):(i._visibility|=2,ba(e,t,l,a,(t.subtreeFlags&10256)!==0||!1)),n&2048&&_r(r,t);break;case 24:Rt(e,t,l,a),n&2048&&zr(t.alternate,t);break;default:Rt(e,t,l,a)}}function ba(e,t,l,a,n){for(n=n&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,r=t,d=l,v=a,A=r.flags;switch(r.tag){case 0:case 11:case 15:ba(i,r,d,v,n),un(8,r);break;case 23:break;case 22:var D=r.stateNode;r.memoizedState!==null?D._visibility&2?ba(i,r,d,v,n):dn(i,r):(D._visibility|=2,ba(i,r,d,v,n)),n&&A&2048&&_r(r.alternate,r);break;case 24:ba(i,r,d,v,n),n&&A&2048&&zr(r.alternate,r);break;default:ba(i,r,d,v,n)}t=t.sibling}}function dn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,a=t,n=a.flags;switch(a.tag){case 22:dn(l,a),n&2048&&_r(a.alternate,a);break;case 24:dn(l,a),n&2048&&zr(a.alternate,a);break;default:dn(l,a)}t=t.sibling}}var fn=8192;function ja(e,t,l){if(e.subtreeFlags&fn)for(e=e.child;e!==null;)pd(e,t,l),e=e.sibling}function pd(e,t,l){switch(e.tag){case 26:ja(e,t,l),e.flags&fn&&e.memoizedState!==null&&pv(l,kt,e.memoizedState,e.memoizedProps);break;case 5:ja(e,t,l);break;case 3:case 4:var a=kt;kt=Os(e.stateNode.containerInfo),ja(e,t,l),kt=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=fn,fn=16777216,ja(e,t,l),fn=a):ja(e,t,l));break;default:ja(e,t,l)}}function yd(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function mn(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];Ke=a,bd(a,e)}yd(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)gd(e),e=e.sibling}function gd(e){switch(e.tag){case 0:case 11:case 15:mn(e),e.flags&2048&&ml(9,e,e.return);break;case 3:mn(e);break;case 12:mn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,bs(e)):mn(e);break;default:mn(e)}}function bs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];Ke=a,bd(a,e)}yd(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ml(8,t,t.return),bs(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,bs(t));break;default:bs(t)}e=e.sibling}}function bd(e,t){for(;Ke!==null;){var l=Ke;switch(l.tag){case 0:case 11:case 15:ml(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var a=l.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:$a(l.memoizedState.cache)}if(a=l.child,a!==null)a.return=l,Ke=a;else e:for(l=e;Ke!==null;){a=Ke;var n=a.sibling,i=a.return;if(od(a),a===l){Ke=null;break e}if(n!==null){n.return=i,Ke=n;break e}Ke=i}}}var Rx={getCacheForType:function(e){var t=We(qe),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return We(qe).controller.signal}},Ox=typeof WeakMap=="function"?WeakMap:Map,Ne=0,ke=null,xe=null,he=0,Ce=0,pt=null,xl=!1,Sa=!1,kr=!1,It=0,Le=0,vl=0,Zl=0,Rr=0,yt=0,Na=0,xn=null,ct=null,Or=!1,js=0,jd=0,Ss=1/0,Ns=null,hl=null,Ve=0,pl=null,Ta=null,Pt=0,Dr=0,wr=null,Sd=null,vn=0,Lr=null;function gt(){return(Ne&2)!==0&&he!==0?he&-he:k.T!==null?Gr():Uc()}function Nd(){if(yt===0)if((he&536870912)===0||ye){var e=kn;kn<<=1,(kn&3932160)===0&&(kn=262144),yt=e}else yt=536870912;return e=vt.current,e!==null&&(e.flags|=32),yt}function ut(e,t,l){(e===ke&&(Ce===2||Ce===9)||e.cancelPendingCommit!==null)&&(Ea(e,0),yl(e,he,yt,!1)),wa(e,l),((Ne&2)===0||e!==ke)&&(e===ke&&((Ne&2)===0&&(Zl|=l),Le===4&&yl(e,he,yt,!1)),Lt(e))}function Td(e,t,l){if((Ne&6)!==0)throw Error(o(327));var a=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Da(e,t),n=a?Lx(e,t):Br(e,t,!0),i=a;do{if(n===0){Sa&&!a&&yl(e,t,0,!1);break}else{if(l=e.current.alternate,i&&!Dx(l)){n=Br(e,t,!1),i=!1;continue}if(n===2){if(i=t,e.errorRecoveryDisabledLanes&i)var r=0;else r=e.pendingLanes&-536870913,r=r!==0?r:r&536870912?536870912:0;if(r!==0){t=r;e:{var d=e;n=xn;var v=d.current.memoizedState.isDehydrated;if(v&&(Ea(d,r).flags|=256),r=Br(d,r,!1),r!==2){if(kr&&!v){d.errorRecoveryDisabledLanes|=i,Zl|=i,n=4;break e}i=ct,ct=n,i!==null&&(ct===null?ct=i:ct.push.apply(ct,i))}n=r}if(i=!1,n!==2)continue}}if(n===1){Ea(e,0),yl(e,t,0,!0);break}e:{switch(a=e,i=n,i){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:yl(a,t,yt,!xl);break e;case 2:ct=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(n=js+300-ot(),10<n)){if(yl(a,t,yt,!xl),On(a,0,!0)!==0)break e;Pt=t,a.timeoutHandle=tf(Ed.bind(null,a,l,ct,Ns,Or,t,yt,Zl,Na,xl,i,"Throttled",-0,0),n);break e}Ed(a,l,ct,Ns,Or,t,yt,Zl,Na,xl,i,null,-0,0)}}break}while(!0);Lt(e)}function Ed(e,t,l,a,n,i,r,d,v,A,D,L,M,_){if(e.timeoutHandle=-1,L=t.subtreeFlags,L&8192||(L&16785408)===16785408){L={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bt},pd(t,i,L);var W=(i&62914560)===i?js-ot():(i&4194048)===i?jd-ot():0;if(W=yv(L,W),W!==null){Pt=i,e.cancelPendingCommit=W(Od.bind(null,e,t,i,l,a,n,r,d,v,D,L,null,M,_)),yl(e,i,r,!A);return}}Od(e,t,i,l,a,n,r,d,v)}function Dx(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var a=0;a<l.length;a++){var n=l[a],i=n.getSnapshot;n=n.value;try{if(!mt(i(),n))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function yl(e,t,l,a){t&=~Rr,t&=~Zl,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var n=t;0<n;){var i=31-ft(n),r=1<<i;a[i]=-1,n&=~r}l!==0&&Dc(e,l,t)}function Ts(){return(Ne&6)===0?(hn(0),!1):!0}function Ur(){if(xe!==null){if(Ce===0)var e=xe.return;else e=xe,Gt=Ul=null,Pi(e),va=null,Fa=0,e=xe;for(;e!==null;)ld(e.alternate,e),e=e.return;xe=null}}function Ea(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,ev(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Pt=0,Ur(),ke=e,xe=l=qt(e.current,null),he=t,Ce=0,pt=null,xl=!1,Sa=Da(e,t),kr=!1,Na=yt=Rr=Zl=vl=Le=0,ct=xn=null,Or=!1,(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var n=31-ft(a),i=1<<n;t|=e[n],a&=~i}return It=t,Vn(),l}function Cd(e,t){oe=null,k.H=sn,t===xa||t===Pn?(t=Yu(),Ce=3):t===Yi?(t=Yu(),Ce=4):Ce=t===vr?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,pt=t,xe===null&&(Le=1,ms(e,Nt(t,e.current)))}function Ad(){var e=vt.current;return e===null?!0:(he&4194048)===he?At===null:(he&62914560)===he||(he&536870912)!==0?e===At:!1}function Md(){var e=k.H;return k.H=sn,e===null?sn:e}function _d(){var e=k.A;return k.A=Rx,e}function Es(){Le=4,xl||(he&4194048)!==he&&vt.current!==null||(Sa=!0),(vl&134217727)===0&&(Zl&134217727)===0||ke===null||yl(ke,he,yt,!1)}function Br(e,t,l){var a=Ne;Ne|=2;var n=Md(),i=_d();(ke!==e||he!==t)&&(Ns=null,Ea(e,t)),t=!1;var r=Le;e:do try{if(Ce!==0&&xe!==null){var d=xe,v=pt;switch(Ce){case 8:Ur(),r=6;break e;case 3:case 2:case 9:case 6:vt.current===null&&(t=!0);var A=Ce;if(Ce=0,pt=null,Ca(e,d,v,A),l&&Sa){r=0;break e}break;default:A=Ce,Ce=0,pt=null,Ca(e,d,v,A)}}wx(),r=Le;break}catch(D){Cd(e,D)}while(!0);return t&&e.shellSuspendCounter++,Gt=Ul=null,Ne=a,k.H=n,k.A=i,xe===null&&(ke=null,he=0,Vn()),r}function wx(){for(;xe!==null;)zd(xe)}function Lx(e,t){var l=Ne;Ne|=2;var a=Md(),n=_d();ke!==e||he!==t?(Ns=null,Ss=ot()+500,Ea(e,t)):Sa=Da(e,t);e:do try{if(Ce!==0&&xe!==null){t=xe;var i=pt;t:switch(Ce){case 1:Ce=0,pt=null,Ca(e,t,i,1);break;case 2:case 9:if(Hu(i)){Ce=0,pt=null,kd(t);break}t=function(){Ce!==2&&Ce!==9||ke!==e||(Ce=7),Lt(e)},i.then(t,t);break e;case 3:Ce=7;break e;case 4:Ce=5;break e;case 7:Hu(i)?(Ce=0,pt=null,kd(t)):(Ce=0,pt=null,Ca(e,t,i,7));break;case 5:var r=null;switch(xe.tag){case 26:r=xe.memoizedState;case 5:case 27:var d=xe;if(r?pf(r):d.stateNode.complete){Ce=0,pt=null;var v=d.sibling;if(v!==null)xe=v;else{var A=d.return;A!==null?(xe=A,Cs(A)):xe=null}break t}}Ce=0,pt=null,Ca(e,t,i,5);break;case 6:Ce=0,pt=null,Ca(e,t,i,6);break;case 8:Ur(),Le=6;break e;default:throw Error(o(462))}}Ux();break}catch(D){Cd(e,D)}while(!0);return Gt=Ul=null,k.H=a,k.A=n,Ne=l,xe!==null?0:(ke=null,he=0,Vn(),Le)}function Ux(){for(;xe!==null&&!im();)zd(xe)}function zd(e){var t=ed(e.alternate,e,It);e.memoizedProps=e.pendingProps,t===null?Cs(e):xe=t}function kd(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Jo(l,t,t.pendingProps,t.type,void 0,he);break;case 11:t=Jo(l,t,t.pendingProps,t.type.render,t.ref,he);break;case 5:Pi(t);default:ld(l,t),t=xe=Mu(t,It),t=ed(l,t,It)}e.memoizedProps=e.pendingProps,t===null?Cs(e):xe=t}function Ca(e,t,l,a){Gt=Ul=null,Pi(t),va=null,Fa=0;var n=t.return;try{if(Ex(e,n,t,l,he)){Le=1,ms(e,Nt(l,e.current)),xe=null;return}}catch(i){if(n!==null)throw xe=n,i;Le=1,ms(e,Nt(l,e.current)),xe=null;return}t.flags&32768?(ye||a===1?e=!0:Sa||(he&536870912)!==0?e=!1:(xl=e=!0,(a===2||a===9||a===3||a===6)&&(a=vt.current,a!==null&&a.tag===13&&(a.flags|=16384))),Rd(t,e)):Cs(t)}function Cs(e){var t=e;do{if((t.flags&32768)!==0){Rd(t,xl);return}e=t.return;var l=Mx(t.alternate,t,It);if(l!==null){xe=l;return}if(t=t.sibling,t!==null){xe=t;return}xe=t=e}while(t!==null);Le===0&&(Le=5)}function Rd(e,t){do{var l=_x(e.alternate,e);if(l!==null){l.flags&=32767,xe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){xe=e;return}xe=e=l}while(e!==null);Le=6,xe=null}function Od(e,t,l,a,n,i,r,d,v){e.cancelPendingCommit=null;do As();while(Ve!==0);if((Ne&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(i=t.lanes|t.childLanes,i|=Ci,hm(e,l,i,r,d,v),e===ke&&(xe=ke=null,he=0),Ta=t,pl=e,Pt=l,Dr=i,wr=n,Sd=a,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Yx(_n,function(){return Bd(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=k.T,k.T=null,n=Q.p,Q.p=2,r=Ne,Ne|=4;try{zx(e,t,l)}finally{Ne=r,Q.p=n,k.T=a}}Ve=1,Dd(),wd(),Ld()}}function Dd(){if(Ve===1){Ve=0;var e=pl,t=Ta,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=k.T,k.T=null;var a=Q.p;Q.p=2;var n=Ne;Ne|=4;try{xd(t,e);var i=Wr,r=gu(e.containerInfo),d=i.focusedElem,v=i.selectionRange;if(r!==d&&d&&d.ownerDocument&&yu(d.ownerDocument.documentElement,d)){if(v!==null&&ji(d)){var A=v.start,D=v.end;if(D===void 0&&(D=A),"selectionStart"in d)d.selectionStart=A,d.selectionEnd=Math.min(D,d.value.length);else{var L=d.ownerDocument||document,M=L&&L.defaultView||window;if(M.getSelection){var _=M.getSelection(),W=d.textContent.length,ne=Math.min(v.start,W),ze=v.end===void 0?ne:Math.min(v.end,W);!_.extend&&ne>ze&&(r=ze,ze=ne,ne=r);var S=pu(d,ne),y=pu(d,ze);if(S&&y&&(_.rangeCount!==1||_.anchorNode!==S.node||_.anchorOffset!==S.offset||_.focusNode!==y.node||_.focusOffset!==y.offset)){var C=L.createRange();C.setStart(S.node,S.offset),_.removeAllRanges(),ne>ze?(_.addRange(C),_.extend(y.node,y.offset)):(C.setEnd(y.node,y.offset),_.addRange(C))}}}}for(L=[],_=d;_=_.parentNode;)_.nodeType===1&&L.push({element:_,left:_.scrollLeft,top:_.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<L.length;d++){var w=L[d];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}Hs=!!$r,Wr=$r=null}finally{Ne=n,Q.p=a,k.T=l}}e.current=t,Ve=2}}function wd(){if(Ve===2){Ve=0;var e=pl,t=Ta,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=k.T,k.T=null;var a=Q.p;Q.p=2;var n=Ne;Ne|=4;try{ud(e,t.alternate,t)}finally{Ne=n,Q.p=a,k.T=l}}Ve=3}}function Ld(){if(Ve===4||Ve===3){Ve=0,rm();var e=pl,t=Ta,l=Pt,a=Sd;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ve=5:(Ve=0,Ta=pl=null,Ud(e,e.pendingLanes));var n=e.pendingLanes;if(n===0&&(hl=null),li(l),t=t.stateNode,dt&&typeof dt.onCommitFiberRoot=="function")try{dt.onCommitFiberRoot(Oa,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=k.T,n=Q.p,Q.p=2,k.T=null;try{for(var i=e.onRecoverableError,r=0;r<a.length;r++){var d=a[r];i(d.value,{componentStack:d.stack})}}finally{k.T=t,Q.p=n}}(Pt&3)!==0&&As(),Lt(e),n=e.pendingLanes,(l&261930)!==0&&(n&42)!==0?e===Lr?vn++:(vn=0,Lr=e):vn=0,hn(0)}}function Ud(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,$a(t)))}function As(){return Dd(),wd(),Ld(),Bd()}function Bd(){if(Ve!==5)return!1;var e=pl,t=Dr;Dr=0;var l=li(Pt),a=k.T,n=Q.p;try{Q.p=32>l?32:l,k.T=null,l=wr,wr=null;var i=pl,r=Pt;if(Ve=0,Ta=pl=null,Pt=0,(Ne&6)!==0)throw Error(o(331));var d=Ne;if(Ne|=4,gd(i.current),hd(i,i.current,r,l),Ne=d,hn(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(Oa,i)}catch{}return!0}finally{Q.p=n,k.T=a,Ud(e,t)}}function Hd(e,t,l){t=Nt(l,t),t=xr(e.stateNode,t,2),e=ol(e,t,2),e!==null&&(wa(e,2),Lt(e))}function Ae(e,t,l){if(e.tag===3)Hd(e,e,l);else for(;t!==null;){if(t.tag===3){Hd(t,e,l);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(hl===null||!hl.has(a))){e=Nt(l,e),l=qo(2),a=ol(t,l,2),a!==null&&(Yo(l,a,t,e),wa(a,2),Lt(a));break}}t=t.return}}function Hr(e,t,l){var a=e.pingCache;if(a===null){a=e.pingCache=new Ox;var n=new Set;a.set(t,n)}else n=a.get(t),n===void 0&&(n=new Set,a.set(t,n));n.has(l)||(kr=!0,n.add(l),e=Bx.bind(null,e,t,l),t.then(e,e))}function Bx(e,t,l){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ke===e&&(he&l)===l&&(Le===4||Le===3&&(he&62914560)===he&&300>ot()-js?(Ne&2)===0&&Ea(e,0):Rr|=l,Na===he&&(Na=0)),Lt(e)}function qd(e,t){t===0&&(t=Oc()),e=Dl(e,t),e!==null&&(wa(e,t),Lt(e))}function Hx(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),qd(e,l)}function qx(e,t){var l=0;switch(e.tag){case 31:case 13:var a=e.stateNode,n=e.memoizedState;n!==null&&(l=n.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(t),qd(e,l)}function Yx(e,t){return Is(e,t)}var Ms=null,Aa=null,qr=!1,_s=!1,Yr=!1,gl=0;function Lt(e){e!==Aa&&e.next===null&&(Aa===null?Ms=Aa=e:Aa=Aa.next=e),_s=!0,qr||(qr=!0,Qx())}function hn(e,t){if(!Yr&&_s){Yr=!0;do for(var l=!1,a=Ms;a!==null;){if(e!==0){var n=a.pendingLanes;if(n===0)var i=0;else{var r=a.suspendedLanes,d=a.pingedLanes;i=(1<<31-ft(42|e)+1)-1,i&=n&~(r&~d),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(l=!0,Xd(a,i))}else i=he,i=On(a,a===ke?i:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(i&3)===0||Da(a,i)||(l=!0,Xd(a,i));a=a.next}while(l);Yr=!1}}function Gx(){Yd()}function Yd(){_s=qr=!1;var e=0;gl!==0&&Px()&&(e=gl);for(var t=ot(),l=null,a=Ms;a!==null;){var n=a.next,i=Gd(a,t);i===0?(a.next=null,l===null?Ms=n:l.next=n,n===null&&(Aa=l)):(l=a,(e!==0||(i&3)!==0)&&(_s=!0)),a=n}Ve!==0&&Ve!==5||hn(e),gl!==0&&(gl=0)}function Gd(e,t){for(var l=e.suspendedLanes,a=e.pingedLanes,n=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var r=31-ft(i),d=1<<r,v=n[r];v===-1?((d&l)===0||(d&a)!==0)&&(n[r]=vm(d,t)):v<=t&&(e.expiredLanes|=d),i&=~d}if(t=ke,l=he,l=On(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,l===0||e===t&&(Ce===2||Ce===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Ps(a),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Da(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(a!==null&&Ps(a),li(l)){case 2:case 8:l=kc;break;case 32:l=_n;break;case 268435456:l=Rc;break;default:l=_n}return a=Qd.bind(null,e),l=Is(l,a),e.callbackPriority=t,e.callbackNode=l,t}return a!==null&&a!==null&&Ps(a),e.callbackPriority=2,e.callbackNode=null,2}function Qd(e,t){if(Ve!==0&&Ve!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(As()&&e.callbackNode!==l)return null;var a=he;return a=On(e,e===ke?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(Td(e,a,t),Gd(e,ot()),e.callbackNode!=null&&e.callbackNode===l?Qd.bind(null,e):null)}function Xd(e,t){if(As())return null;Td(e,t,!0)}function Qx(){tv(function(){(Ne&6)!==0?Is(zc,Gx):Yd()})}function Gr(){if(gl===0){var e=fa;e===0&&(e=zn,zn<<=1,(zn&261888)===0&&(zn=256)),gl=e}return gl}function Vd(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Un(""+e)}function Zd(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function Xx(e,t,l,a,n){if(t==="submit"&&l&&l.stateNode===n){var i=Vd((n[at]||null).action),r=a.submitter;r&&(t=(t=r[at]||null)?Vd(t.formAction):r.getAttribute("formAction"),t!==null&&(i=t,r=null));var d=new Yn("action","action",null,a,n);e.push({event:d,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(gl!==0){var v=r?Zd(n,r):new FormData(n);cr(l,{pending:!0,data:v,method:n.method,action:i},null,v)}}else typeof i=="function"&&(d.preventDefault(),v=r?Zd(n,r):new FormData(n),cr(l,{pending:!0,data:v,method:n.method,action:i},i,v))},currentTarget:n}]})}}for(var Qr=0;Qr<Ei.length;Qr++){var Xr=Ei[Qr],Vx=Xr.toLowerCase(),Zx=Xr[0].toUpperCase()+Xr.slice(1);zt(Vx,"on"+Zx)}zt(Su,"onAnimationEnd"),zt(Nu,"onAnimationIteration"),zt(Tu,"onAnimationStart"),zt("dblclick","onDoubleClick"),zt("focusin","onFocus"),zt("focusout","onBlur"),zt(cx,"onTransitionRun"),zt(ux,"onTransitionStart"),zt(ox,"onTransitionCancel"),zt(Eu,"onTransitionEnd"),Il("onMouseEnter",["mouseout","mouseover"]),Il("onMouseLeave",["mouseout","mouseover"]),Il("onPointerEnter",["pointerout","pointerover"]),Il("onPointerLeave",["pointerout","pointerover"]),zl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zl("onBeforeInput",["compositionend","keypress","textInput","paste"]),zl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pn="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(" "),Kx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pn));function Kd(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var a=e[l],n=a.event;a=a.listeners;e:{var i=void 0;if(t)for(var r=a.length-1;0<=r;r--){var d=a[r],v=d.instance,A=d.currentTarget;if(d=d.listener,v!==i&&n.isPropagationStopped())break e;i=d,n.currentTarget=A;try{i(n)}catch(D){Xn(D)}n.currentTarget=null,i=v}else for(r=0;r<a.length;r++){if(d=a[r],v=d.instance,A=d.currentTarget,d=d.listener,v!==i&&n.isPropagationStopped())break e;i=d,n.currentTarget=A;try{i(n)}catch(D){Xn(D)}n.currentTarget=null,i=v}}}}function ve(e,t){var l=t[ai];l===void 0&&(l=t[ai]=new Set);var a=e+"__bubble";l.has(a)||(Jd(t,e,2,!1),l.add(a))}function Vr(e,t,l){var a=0;t&&(a|=4),Jd(l,e,a,t)}var zs="_reactListening"+Math.random().toString(36).slice(2);function Zr(e){if(!e[zs]){e[zs]=!0,qc.forEach(function(l){l!=="selectionchange"&&(Kx.has(l)||Vr(l,!1,e),Vr(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[zs]||(t[zs]=!0,Vr("selectionchange",!1,t))}}function Jd(e,t,l,a){switch(Tf(t)){case 2:var n=jv;break;case 8:n=Sv;break;default:n=rc}l=n.bind(null,t,l,e),n=void 0,!fi||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),a?n!==void 0?e.addEventListener(t,l,{capture:!0,passive:n}):e.addEventListener(t,l,!0):n!==void 0?e.addEventListener(t,l,{passive:n}):e.addEventListener(t,l,!1)}function Kr(e,t,l,a,n){var i=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var r=a.tag;if(r===3||r===4){var d=a.stateNode.containerInfo;if(d===n)break;if(r===4)for(r=a.return;r!==null;){var v=r.tag;if((v===3||v===4)&&r.stateNode.containerInfo===n)return;r=r.return}for(;d!==null;){if(r=$l(d),r===null)return;if(v=r.tag,v===5||v===6||v===26||v===27){a=i=r;continue e}d=d.parentNode}}a=a.return}Ic(function(){var A=i,D=oi(l),L=[];e:{var M=Cu.get(e);if(M!==void 0){var _=Yn,W=e;switch(e){case"keypress":if(Hn(l)===0)break e;case"keydown":case"keyup":_=qm;break;case"focusin":W="focus",_=hi;break;case"focusout":W="blur",_=hi;break;case"beforeblur":case"afterblur":_=hi;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_=tu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_=Mm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_=Qm;break;case Su:case Nu:case Tu:_=km;break;case Eu:_=Vm;break;case"scroll":case"scrollend":_=Cm;break;case"wheel":_=Km;break;case"copy":case"cut":case"paste":_=Om;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_=au;break;case"toggle":case"beforetoggle":_=$m}var ne=(t&4)!==0,ze=!ne&&(e==="scroll"||e==="scrollend"),S=ne?M!==null?M+"Capture":null:M;ne=[];for(var y=A,C;y!==null;){var w=y;if(C=w.stateNode,w=w.tag,w!==5&&w!==26&&w!==27||C===null||S===null||(w=Ba(y,S),w!=null&&ne.push(yn(y,w,C))),ze)break;y=y.return}0<ne.length&&(M=new _(M,W,null,l,D),L.push({event:M,listeners:ne}))}}if((t&7)===0){e:{if(M=e==="mouseover"||e==="pointerover",_=e==="mouseout"||e==="pointerout",M&&l!==ui&&(W=l.relatedTarget||l.fromElement)&&($l(W)||W[Jl]))break e;if((_||M)&&(M=D.window===D?D:(M=D.ownerDocument)?M.defaultView||M.parentWindow:window,_?(W=l.relatedTarget||l.toElement,_=A,W=W?$l(W):null,W!==null&&(ze=j(W),ne=W.tag,W!==ze||ne!==5&&ne!==27&&ne!==6)&&(W=null)):(_=null,W=A),_!==W)){if(ne=tu,w="onMouseLeave",S="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(ne=au,w="onPointerLeave",S="onPointerEnter",y="pointer"),ze=_==null?M:Ua(_),C=W==null?M:Ua(W),M=new ne(w,y+"leave",_,l,D),M.target=ze,M.relatedTarget=C,w=null,$l(D)===A&&(ne=new ne(S,y+"enter",W,l,D),ne.target=C,ne.relatedTarget=ze,w=ne),ze=w,_&&W)t:{for(ne=Jx,S=_,y=W,C=0,w=S;w;w=ne(w))C++;w=0;for(var le=y;le;le=ne(le))w++;for(;0<C-w;)S=ne(S),C--;for(;0<w-C;)y=ne(y),w--;for(;C--;){if(S===y||y!==null&&S===y.alternate){ne=S;break t}S=ne(S),y=ne(y)}ne=null}else ne=null;_!==null&&$d(L,M,_,ne,!1),W!==null&&ze!==null&&$d(L,ze,W,ne,!0)}}e:{if(M=A?Ua(A):window,_=M.nodeName&&M.nodeName.toLowerCase(),_==="select"||_==="input"&&M.type==="file")var be=du;else if(uu(M))if(fu)be=sx;else{be=ax;var I=lx}else _=M.nodeName,!_||_.toLowerCase()!=="input"||M.type!=="checkbox"&&M.type!=="radio"?A&&ci(A.elementType)&&(be=du):be=nx;if(be&&(be=be(e,A))){ou(L,be,l,D);break e}I&&I(e,M,A),e==="focusout"&&A&&M.type==="number"&&A.memoizedProps.value!=null&&ri(M,"number",M.value)}switch(I=A?Ua(A):window,e){case"focusin":(uu(I)||I.contentEditable==="true")&&(na=I,Si=A,Za=null);break;case"focusout":Za=Si=na=null;break;case"mousedown":Ni=!0;break;case"contextmenu":case"mouseup":case"dragend":Ni=!1,bu(L,l,D);break;case"selectionchange":if(rx)break;case"keydown":case"keyup":bu(L,l,D)}var de;if(yi)e:{switch(e){case"compositionstart":var pe="onCompositionStart";break e;case"compositionend":pe="onCompositionEnd";break e;case"compositionupdate":pe="onCompositionUpdate";break e}pe=void 0}else aa?ru(e,l)&&(pe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(pe="onCompositionStart");pe&&(nu&&l.locale!=="ko"&&(aa||pe!=="onCompositionStart"?pe==="onCompositionEnd"&&aa&&(de=Pc()):(al=D,mi="value"in al?al.value:al.textContent,aa=!0)),I=ks(A,pe),0<I.length&&(pe=new lu(pe,e,null,l,D),L.push({event:pe,listeners:I}),de?pe.data=de:(de=cu(l),de!==null&&(pe.data=de)))),(de=Fm?Im(e,l):Pm(e,l))&&(pe=ks(A,"onBeforeInput"),0<pe.length&&(I=new lu("onBeforeInput","beforeinput",null,l,D),L.push({event:I,listeners:pe}),I.data=de)),Xx(L,e,A,l,D)}Kd(L,t)})}function yn(e,t,l){return{instance:e,listener:t,currentTarget:l}}function ks(e,t){for(var l=t+"Capture",a=[];e!==null;){var n=e,i=n.stateNode;if(n=n.tag,n!==5&&n!==26&&n!==27||i===null||(n=Ba(e,l),n!=null&&a.unshift(yn(e,n,i)),n=Ba(e,t),n!=null&&a.push(yn(e,n,i))),e.tag===3)return a;e=e.return}return[]}function Jx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function $d(e,t,l,a,n){for(var i=t._reactName,r=[];l!==null&&l!==a;){var d=l,v=d.alternate,A=d.stateNode;if(d=d.tag,v!==null&&v===a)break;d!==5&&d!==26&&d!==27||A===null||(v=A,n?(A=Ba(l,i),A!=null&&r.unshift(yn(l,A,v))):n||(A=Ba(l,i),A!=null&&r.push(yn(l,A,v)))),l=l.return}r.length!==0&&e.push({event:t,listeners:r})}var $x=/\r\n?/g,Wx=/\u0000|\uFFFD/g;function Wd(e){return(typeof e=="string"?e:""+e).replace($x,`
49
- `).replace(Wx,"")}function Fd(e,t){return t=Wd(t),Wd(e)===t}function _e(e,t,l,a,n,i){switch(l){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||ea(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&ea(e,""+a);break;case"className":wn(e,"class",a);break;case"tabIndex":wn(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":wn(e,l,a);break;case"style":Wc(e,a,i);break;case"data":if(t!=="object"){wn(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=Un(""+a),e.setAttribute(l,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(l==="formAction"?(t!=="input"&&_e(e,t,"name",n.name,n,null),_e(e,t,"formEncType",n.formEncType,n,null),_e(e,t,"formMethod",n.formMethod,n,null),_e(e,t,"formTarget",n.formTarget,n,null)):(_e(e,t,"encType",n.encType,n,null),_e(e,t,"method",n.method,n,null),_e(e,t,"target",n.target,n,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=Un(""+a),e.setAttribute(l,a);break;case"onClick":a!=null&&(e.onclick=Bt);break;case"onScroll":a!=null&&ve("scroll",e);break;case"onScrollEnd":a!=null&&ve("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}l=Un(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""+a):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":a===!0?e.setAttribute(l,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,a):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(l,a):e.removeAttribute(l);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(l):e.setAttribute(l,a);break;case"popover":ve("beforetoggle",e),ve("toggle",e),Dn(e,"popover",a);break;case"xlinkActuate":Ut(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Ut(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Ut(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Ut(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Ut(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Ut(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Ut(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Ut(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Ut(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Dn(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Tm.get(l)||l,Dn(e,l,a))}}function Jr(e,t,l,a,n,i){switch(l){case"style":Wc(e,a,i);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof a=="string"?ea(e,a):(typeof a=="number"||typeof a=="bigint")&&ea(e,""+a);break;case"onScroll":a!=null&&ve("scroll",e);break;case"onScrollEnd":a!=null&&ve("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Bt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yc.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(n=l.endsWith("Capture"),t=l.slice(2,n?l.length-7:void 0),i=e[at]||null,i=i!=null?i[l]:null,typeof i=="function"&&e.removeEventListener(t,i,n),typeof a=="function")){typeof i!="function"&&i!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,a,n);break e}l in e?e[l]=a:a===!0?e.setAttribute(l,""):Dn(e,l,a)}}}function Ie(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ve("error",e),ve("load",e);var a=!1,n=!1,i;for(i in l)if(l.hasOwnProperty(i)){var r=l[i];if(r!=null)switch(i){case"src":a=!0;break;case"srcSet":n=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:_e(e,t,i,r,l,null)}}n&&_e(e,t,"srcSet",l.srcSet,l,null),a&&_e(e,t,"src",l.src,l,null);return;case"input":ve("invalid",e);var d=i=r=n=null,v=null,A=null;for(a in l)if(l.hasOwnProperty(a)){var D=l[a];if(D!=null)switch(a){case"name":n=D;break;case"type":r=D;break;case"checked":v=D;break;case"defaultChecked":A=D;break;case"value":i=D;break;case"defaultValue":d=D;break;case"children":case"dangerouslySetInnerHTML":if(D!=null)throw Error(o(137,t));break;default:_e(e,t,a,D,l,null)}}Zc(e,i,d,v,A,r,n,!1);return;case"select":ve("invalid",e),a=r=i=null;for(n in l)if(l.hasOwnProperty(n)&&(d=l[n],d!=null))switch(n){case"value":i=d;break;case"defaultValue":r=d;break;case"multiple":a=d;default:_e(e,t,n,d,l,null)}t=i,l=r,e.multiple=!!a,t!=null?Pl(e,!!a,t,!1):l!=null&&Pl(e,!!a,l,!0);return;case"textarea":ve("invalid",e),i=n=a=null;for(r in l)if(l.hasOwnProperty(r)&&(d=l[r],d!=null))switch(r){case"value":a=d;break;case"defaultValue":n=d;break;case"children":i=d;break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(o(91));break;default:_e(e,t,r,d,l,null)}Jc(e,a,n,i);return;case"option":for(v in l)if(l.hasOwnProperty(v)&&(a=l[v],a!=null))switch(v){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:_e(e,t,v,a,l,null)}return;case"dialog":ve("beforetoggle",e),ve("toggle",e),ve("cancel",e),ve("close",e);break;case"iframe":case"object":ve("load",e);break;case"video":case"audio":for(a=0;a<pn.length;a++)ve(pn[a],e);break;case"image":ve("error",e),ve("load",e);break;case"details":ve("toggle",e);break;case"embed":case"source":case"link":ve("error",e),ve("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(A in l)if(l.hasOwnProperty(A)&&(a=l[A],a!=null))switch(A){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:_e(e,t,A,a,l,null)}return;default:if(ci(t)){for(D in l)l.hasOwnProperty(D)&&(a=l[D],a!==void 0&&Jr(e,t,D,a,l,void 0));return}}for(d in l)l.hasOwnProperty(d)&&(a=l[d],a!=null&&_e(e,t,d,a,l,null))}function Fx(e,t,l,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var n=null,i=null,r=null,d=null,v=null,A=null,D=null;for(_ in l){var L=l[_];if(l.hasOwnProperty(_)&&L!=null)switch(_){case"checked":break;case"value":break;case"defaultValue":v=L;default:a.hasOwnProperty(_)||_e(e,t,_,null,a,L)}}for(var M in a){var _=a[M];if(L=l[M],a.hasOwnProperty(M)&&(_!=null||L!=null))switch(M){case"type":i=_;break;case"name":n=_;break;case"checked":A=_;break;case"defaultChecked":D=_;break;case"value":r=_;break;case"defaultValue":d=_;break;case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(o(137,t));break;default:_!==L&&_e(e,t,M,_,a,L)}}ii(e,r,d,v,A,D,i,n);return;case"select":_=r=d=M=null;for(i in l)if(v=l[i],l.hasOwnProperty(i)&&v!=null)switch(i){case"value":break;case"multiple":_=v;default:a.hasOwnProperty(i)||_e(e,t,i,null,a,v)}for(n in a)if(i=a[n],v=l[n],a.hasOwnProperty(n)&&(i!=null||v!=null))switch(n){case"value":M=i;break;case"defaultValue":d=i;break;case"multiple":r=i;default:i!==v&&_e(e,t,n,i,a,v)}t=d,l=r,a=_,M!=null?Pl(e,!!l,M,!1):!!a!=!!l&&(t!=null?Pl(e,!!l,t,!0):Pl(e,!!l,l?[]:"",!1));return;case"textarea":_=M=null;for(d in l)if(n=l[d],l.hasOwnProperty(d)&&n!=null&&!a.hasOwnProperty(d))switch(d){case"value":break;case"children":break;default:_e(e,t,d,null,a,n)}for(r in a)if(n=a[r],i=l[r],a.hasOwnProperty(r)&&(n!=null||i!=null))switch(r){case"value":M=n;break;case"defaultValue":_=n;break;case"children":break;case"dangerouslySetInnerHTML":if(n!=null)throw Error(o(91));break;default:n!==i&&_e(e,t,r,n,a,i)}Kc(e,M,_);return;case"option":for(var W in l)if(M=l[W],l.hasOwnProperty(W)&&M!=null&&!a.hasOwnProperty(W))switch(W){case"selected":e.selected=!1;break;default:_e(e,t,W,null,a,M)}for(v in a)if(M=a[v],_=l[v],a.hasOwnProperty(v)&&M!==_&&(M!=null||_!=null))switch(v){case"selected":e.selected=M&&typeof M!="function"&&typeof M!="symbol";break;default:_e(e,t,v,M,a,_)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ne in l)M=l[ne],l.hasOwnProperty(ne)&&M!=null&&!a.hasOwnProperty(ne)&&_e(e,t,ne,null,a,M);for(A in a)if(M=a[A],_=l[A],a.hasOwnProperty(A)&&M!==_&&(M!=null||_!=null))switch(A){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(o(137,t));break;default:_e(e,t,A,M,a,_)}return;default:if(ci(t)){for(var ze in l)M=l[ze],l.hasOwnProperty(ze)&&M!==void 0&&!a.hasOwnProperty(ze)&&Jr(e,t,ze,void 0,a,M);for(D in a)M=a[D],_=l[D],!a.hasOwnProperty(D)||M===_||M===void 0&&_===void 0||Jr(e,t,D,M,a,_);return}}for(var S in l)M=l[S],l.hasOwnProperty(S)&&M!=null&&!a.hasOwnProperty(S)&&_e(e,t,S,null,a,M);for(L in a)M=a[L],_=l[L],!a.hasOwnProperty(L)||M===_||M==null&&_==null||_e(e,t,L,M,a,_)}function Id(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ix(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),a=0;a<l.length;a++){var n=l[a],i=n.transferSize,r=n.initiatorType,d=n.duration;if(i&&d&&Id(r)){for(r=0,d=n.responseEnd,a+=1;a<l.length;a++){var v=l[a],A=v.startTime;if(A>d)break;var D=v.transferSize,L=v.initiatorType;D&&Id(L)&&(v=v.responseEnd,r+=D*(v<d?1:(d-A)/(v-A)))}if(--a,t+=8*(i+r)/(n.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var $r=null,Wr=null;function Rs(e){return e.nodeType===9?e:e.ownerDocument}function Pd(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ef(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Fr(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ir=null;function Px(){var e=window.event;return e&&e.type==="popstate"?e===Ir?!1:(Ir=e,!0):(Ir=null,!1)}var tf=typeof setTimeout=="function"?setTimeout:void 0,ev=typeof clearTimeout=="function"?clearTimeout:void 0,lf=typeof Promise=="function"?Promise:void 0,tv=typeof queueMicrotask=="function"?queueMicrotask:typeof lf<"u"?function(e){return lf.resolve(null).then(e).catch(lv)}:tf;function lv(e){setTimeout(function(){throw e})}function bl(e){return e==="head"}function af(e,t){var l=t,a=0;do{var n=l.nextSibling;if(e.removeChild(l),n&&n.nodeType===8)if(l=n.data,l==="/$"||l==="/&"){if(a===0){e.removeChild(n),ka(t);return}a--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")a++;else if(l==="html")gn(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,gn(l);for(var i=l.firstChild;i;){var r=i.nextSibling,d=i.nodeName;i[La]||d==="SCRIPT"||d==="STYLE"||d==="LINK"&&i.rel.toLowerCase()==="stylesheet"||l.removeChild(i),i=r}}else l==="body"&&gn(e.ownerDocument.body);l=n}while(l);ka(t)}function nf(e,t){var l=e;e=0;do{var a=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),a&&a.nodeType===8)if(l=a.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=a}while(l)}function Pr(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Pr(l),ni(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function av(e,t,l,a){for(;e.nodeType===1;){var n=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[La])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==n.rel||e.getAttribute("href")!==(n.href==null||n.href===""?null:n.href)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin)||e.getAttribute("title")!==(n.title==null?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(n.src==null?null:n.src)||e.getAttribute("type")!==(n.type==null?null:n.type)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=n.name==null?null:""+n.name;if(n.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Mt(e.nextSibling),e===null)break}return null}function nv(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Mt(e.nextSibling),e===null))return null;return e}function sf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Mt(e.nextSibling),e===null))return null;return e}function ec(e){return e.data==="$?"||e.data==="$~"}function tc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function sv(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var a=function(){t(),l.removeEventListener("DOMContentLoaded",a)};l.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function Mt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var lc=null;function rf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Mt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function cf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function uf(e,t,l){switch(t=Rs(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function gn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ni(e)}var _t=new Map,of=new Set;function Os(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var el=Q.d;Q.d={f:iv,r:rv,D:cv,C:uv,L:ov,m:dv,X:mv,S:fv,M:xv};function iv(){var e=el.f(),t=Ts();return e||t}function rv(e){var t=Wl(e);t!==null&&t.tag===5&&t.type==="form"?Co(t):el.r(e)}var Ma=typeof document>"u"?null:document;function df(e,t,l){var a=Ma;if(a&&typeof t=="string"&&t){var n=jt(t);n='link[rel="'+e+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),of.has(n)||(of.add(n),e={rel:e,crossOrigin:l,href:t},a.querySelector(n)===null&&(t=a.createElement("link"),Ie(t,"link",e),Ze(t),a.head.appendChild(t)))}}function cv(e){el.D(e),df("dns-prefetch",e,null)}function uv(e,t){el.C(e,t),df("preconnect",e,t)}function ov(e,t,l){el.L(e,t,l);var a=Ma;if(a&&e&&t){var n='link[rel="preload"][as="'+jt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+jt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+jt(l.imageSizes)+'"]')):n+='[href="'+jt(e)+'"]';var i=n;switch(t){case"style":i=_a(e);break;case"script":i=za(e)}_t.has(i)||(e=h({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),_t.set(i,e),a.querySelector(n)!==null||t==="style"&&a.querySelector(bn(i))||t==="script"&&a.querySelector(jn(i))||(t=a.createElement("link"),Ie(t,"link",e),Ze(t),a.head.appendChild(t)))}}function dv(e,t){el.m(e,t);var l=Ma;if(l&&e){var a=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+jt(a)+'"][href="'+jt(e)+'"]',i=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=za(e)}if(!_t.has(i)&&(e=h({rel:"modulepreload",href:e},t),_t.set(i,e),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(jn(i)))return}a=l.createElement("link"),Ie(a,"link",e),Ze(a),l.head.appendChild(a)}}}function fv(e,t,l){el.S(e,t,l);var a=Ma;if(a&&e){var n=Fl(a).hoistableStyles,i=_a(e);t=t||"default";var r=n.get(i);if(!r){var d={loading:0,preload:null};if(r=a.querySelector(bn(i)))d.loading=5;else{e=h({rel:"stylesheet",href:e,"data-precedence":t},l),(l=_t.get(i))&&ac(e,l);var v=r=a.createElement("link");Ze(v),Ie(v,"link",e),v._p=new Promise(function(A,D){v.onload=A,v.onerror=D}),v.addEventListener("load",function(){d.loading|=1}),v.addEventListener("error",function(){d.loading|=2}),d.loading|=4,Ds(r,t,a)}r={type:"stylesheet",instance:r,count:1,state:d},n.set(i,r)}}}function mv(e,t){el.X(e,t);var l=Ma;if(l&&e){var a=Fl(l).hoistableScripts,n=za(e),i=a.get(n);i||(i=l.querySelector(jn(n)),i||(e=h({src:e,async:!0},t),(t=_t.get(n))&&nc(e,t),i=l.createElement("script"),Ze(i),Ie(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function xv(e,t){el.M(e,t);var l=Ma;if(l&&e){var a=Fl(l).hoistableScripts,n=za(e),i=a.get(n);i||(i=l.querySelector(jn(n)),i||(e=h({src:e,async:!0,type:"module"},t),(t=_t.get(n))&&nc(e,t),i=l.createElement("script"),Ze(i),Ie(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function ff(e,t,l,a){var n=(n=me.current)?Os(n):null;if(!n)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=_a(l.href),l=Fl(n).hoistableStyles,a=l.get(t),a||(a={type:"style",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=_a(l.href);var i=Fl(n).hoistableStyles,r=i.get(e);if(r||(n=n.ownerDocument||n,r={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,r),(i=n.querySelector(bn(e)))&&!i._p&&(r.instance=i,r.state.loading=5),_t.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},_t.set(e,l),i||vv(n,e,l,r.state))),t&&a===null)throw Error(o(528,""));return r}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=za(l),l=Fl(n).hoistableScripts,a=l.get(t),a||(a={type:"script",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function _a(e){return'href="'+jt(e)+'"'}function bn(e){return'link[rel="stylesheet"]['+e+"]"}function mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function vv(e,t,l,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Ie(t,"link",l),Ze(t),e.head.appendChild(t))}function za(e){return'[src="'+jt(e)+'"]'}function jn(e){return"script[async]"+e}function xf(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+jt(l.href)+'"]');if(a)return t.instance=a,Ze(a),a;var n=h({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Ze(a),Ie(a,"style",n),Ds(a,l.precedence,e),t.instance=a;case"stylesheet":n=_a(l.href);var i=e.querySelector(bn(n));if(i)return t.state.loading|=4,t.instance=i,Ze(i),i;a=mf(l),(n=_t.get(n))&&ac(a,n),i=(e.ownerDocument||e).createElement("link"),Ze(i);var r=i;return r._p=new Promise(function(d,v){r.onload=d,r.onerror=v}),Ie(i,"link",a),t.state.loading|=4,Ds(i,l.precedence,e),t.instance=i;case"script":return i=za(l.src),(n=e.querySelector(jn(i)))?(t.instance=n,Ze(n),n):(a=l,(n=_t.get(i))&&(a=h({},l),nc(a,n)),e=e.ownerDocument||e,n=e.createElement("script"),Ze(n),Ie(n,"link",a),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Ds(a,l.precedence,e));return t.instance}function Ds(e,t,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,i=n,r=0;r<a.length;r++){var d=a[r];if(d.dataset.precedence===t)i=d;else if(i!==n)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function ac(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function nc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ws=null;function vf(e,t,l){if(ws===null){var a=new Map,n=ws=new Map;n.set(l,a)}else n=ws,a=n.get(l),a||(a=new Map,n.set(l,a));if(a.has(e))return a;for(a.set(e,null),l=l.getElementsByTagName(e),n=0;n<l.length;n++){var i=l[n];if(!(i[La]||i[Je]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var r=i.getAttribute(t)||"";r=e+r;var d=a.get(r);d?d.push(i):a.set(r,[i])}}return a}function hf(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function hv(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function pf(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function pv(e,t,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var n=_a(a.href),i=t.querySelector(bn(n));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ls.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=i,Ze(i);return}i=t.ownerDocument||t,a=mf(a),(n=_t.get(n))&&ac(a,n),i=i.createElement("link"),Ze(i);var r=i;r._p=new Promise(function(d,v){r.onload=d,r.onerror=v}),Ie(i,"link",a),l.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Ls.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var sc=0;function yv(e,t){return e.stylesheets&&e.count===0&&Bs(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var a=setTimeout(function(){if(e.stylesheets&&Bs(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&sc===0&&(sc=62500*Ix());var n=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bs(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>sc?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function Ls(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Us=null;function Bs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Us=new Map,t.forEach(gv,e),Us=null,Ls.call(e))}function gv(e,t){if(!(t.state.loading&4)){var l=Us.get(e);if(l)var a=l.get(null);else{l=new Map,Us.set(e,l);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<n.length;i++){var r=n[i];(r.nodeName==="LINK"||r.getAttribute("media")!=="not all")&&(l.set(r.dataset.precedence,r),a=r)}a&&l.set(null,a)}n=t.instance,r=n.getAttribute("data-precedence"),i=l.get(r)||a,i===a&&l.set(null,n),l.set(r,n),this.count++,a=Ls.bind(this),n.addEventListener("load",a),n.addEventListener("error",a),i?i.parentNode.insertBefore(n,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(n,e.firstChild)),t.state.loading|=4}}var Sn={$$typeof:P,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function bv(e,t,l,a,n,i,r,d,v){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ei(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ei(0),this.hiddenUpdates=ei(null),this.identifierPrefix=a,this.onUncaughtError=n,this.onCaughtError=i,this.onRecoverableError=r,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=v,this.incompleteTransitions=new Map}function yf(e,t,l,a,n,i,r,d,v,A,D,L){return e=new bv(e,t,l,r,v,A,D,L,d),t=1,i===!0&&(t|=24),i=xt(3,null,null,t),e.current=i,i.stateNode=e,t=Bi(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:a,isDehydrated:l,cache:t},Gi(i),e}function gf(e){return e?(e=ra,e):ra}function bf(e,t,l,a,n,i){n=gf(n),a.context===null?a.context=n:a.pendingContext=n,a=ul(t),a.payload={element:l},i=i===void 0?null:i,i!==null&&(a.callback=i),l=ol(e,a,t),l!==null&&(ut(l,e,t),Pa(l,e,t))}function jf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function ic(e,t){jf(e,t),(e=e.alternate)&&jf(e,t)}function Sf(e){if(e.tag===13||e.tag===31){var t=Dl(e,67108864);t!==null&&ut(t,e,67108864),ic(e,67108864)}}function Nf(e){if(e.tag===13||e.tag===31){var t=gt();t=ti(t);var l=Dl(e,t);l!==null&&ut(l,e,t),ic(e,t)}}var Hs=!0;function jv(e,t,l,a){var n=k.T;k.T=null;var i=Q.p;try{Q.p=2,rc(e,t,l,a)}finally{Q.p=i,k.T=n}}function Sv(e,t,l,a){var n=k.T;k.T=null;var i=Q.p;try{Q.p=8,rc(e,t,l,a)}finally{Q.p=i,k.T=n}}function rc(e,t,l,a){if(Hs){var n=cc(a);if(n===null)Kr(e,t,a,qs,l),Ef(e,a);else if(Tv(n,e,t,l,a))a.stopPropagation();else if(Ef(e,a),t&4&&-1<Nv.indexOf(e)){for(;n!==null;){var i=Wl(n);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var r=_l(i.pendingLanes);if(r!==0){var d=i;for(d.pendingLanes|=2,d.entangledLanes|=2;r;){var v=1<<31-ft(r);d.entanglements[1]|=v,r&=~v}Lt(i),(Ne&6)===0&&(Ss=ot()+500,hn(0))}}break;case 31:case 13:d=Dl(i,2),d!==null&&ut(d,i,2),Ts(),ic(i,2)}if(i=cc(a),i===null&&Kr(e,t,a,qs,l),i===n)break;n=i}n!==null&&a.stopPropagation()}else Kr(e,t,a,null,l)}}function cc(e){return e=oi(e),uc(e)}var qs=null;function uc(e){if(qs=null,e=$l(e),e!==null){var t=j(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=p(t),e!==null)return e;e=null}else if(l===31){if(e=T(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return qs=e,null}function Tf(e){switch(e){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(cm()){case zc:return 2;case kc:return 8;case _n:case um:return 32;case Rc:return 268435456;default:return 32}default:return 32}}var oc=!1,jl=null,Sl=null,Nl=null,Nn=new Map,Tn=new Map,Tl=[],Nv="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".split(" ");function Ef(e,t){switch(e){case"focusin":case"focusout":jl=null;break;case"dragenter":case"dragleave":Sl=null;break;case"mouseover":case"mouseout":Nl=null;break;case"pointerover":case"pointerout":Nn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tn.delete(t.pointerId)}}function En(e,t,l,a,n,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:l,eventSystemFlags:a,nativeEvent:i,targetContainers:[n]},t!==null&&(t=Wl(t),t!==null&&Sf(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function Tv(e,t,l,a,n){switch(t){case"focusin":return jl=En(jl,e,t,l,a,n),!0;case"dragenter":return Sl=En(Sl,e,t,l,a,n),!0;case"mouseover":return Nl=En(Nl,e,t,l,a,n),!0;case"pointerover":var i=n.pointerId;return Nn.set(i,En(Nn.get(i)||null,e,t,l,a,n)),!0;case"gotpointercapture":return i=n.pointerId,Tn.set(i,En(Tn.get(i)||null,e,t,l,a,n)),!0}return!1}function Cf(e){var t=$l(e.target);if(t!==null){var l=j(t);if(l!==null){if(t=l.tag,t===13){if(t=p(l),t!==null){e.blockedOn=t,Bc(e.priority,function(){Nf(l)});return}}else if(t===31){if(t=T(l),t!==null){e.blockedOn=t,Bc(e.priority,function(){Nf(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ys(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=cc(e.nativeEvent);if(l===null){l=e.nativeEvent;var a=new l.constructor(l.type,l);ui=a,l.target.dispatchEvent(a),ui=null}else return t=Wl(l),t!==null&&Sf(t),e.blockedOn=l,!1;t.shift()}return!0}function Af(e,t,l){Ys(e)&&l.delete(t)}function Ev(){oc=!1,jl!==null&&Ys(jl)&&(jl=null),Sl!==null&&Ys(Sl)&&(Sl=null),Nl!==null&&Ys(Nl)&&(Nl=null),Nn.forEach(Af),Tn.forEach(Af)}function Gs(e,t){e.blockedOn===t&&(e.blockedOn=null,oc||(oc=!0,c.unstable_scheduleCallback(c.unstable_NormalPriority,Ev)))}var Qs=null;function Mf(e){Qs!==e&&(Qs=e,c.unstable_scheduleCallback(c.unstable_NormalPriority,function(){Qs===e&&(Qs=null);for(var t=0;t<e.length;t+=3){var l=e[t],a=e[t+1],n=e[t+2];if(typeof a!="function"){if(uc(a||l)===null)continue;break}var i=Wl(l);i!==null&&(e.splice(t,3),t-=3,cr(i,{pending:!0,data:n,method:l.method,action:a},a,n))}}))}function ka(e){function t(v){return Gs(v,e)}jl!==null&&Gs(jl,e),Sl!==null&&Gs(Sl,e),Nl!==null&&Gs(Nl,e),Nn.forEach(t),Tn.forEach(t);for(var l=0;l<Tl.length;l++){var a=Tl[l];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Tl.length&&(l=Tl[0],l.blockedOn===null);)Cf(l),l.blockedOn===null&&Tl.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(a=0;a<l.length;a+=3){var n=l[a],i=l[a+1],r=n[at]||null;if(typeof i=="function")r||Mf(l);else if(r){var d=null;if(i&&i.hasAttribute("formAction")){if(n=i,r=i[at]||null)d=r.formAction;else if(uc(n)!==null)continue}else d=r.action;typeof d=="function"?l[a+1]=d:(l.splice(a,3),a-=3),Mf(l)}}}function _f(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(r){return n=r})},focusReset:"manual",scroll:"manual"})}function t(){n!==null&&(n(),n=null),a||setTimeout(l,20)}function l(){if(!a&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,n=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),n!==null&&(n(),n=null)}}}function dc(e){this._internalRoot=e}Xs.prototype.render=dc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,a=gt();bf(l,a,e,t,null,null)},Xs.prototype.unmount=dc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bf(e.current,2,null,e,null,null),Ts(),t[Jl]=null}};function Xs(e){this._internalRoot=e}Xs.prototype.unstable_scheduleHydration=function(e){if(e){var t=Uc();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Tl.length&&t!==0&&t<Tl[l].priority;l++);Tl.splice(l,0,e),l===0&&Cf(e)}};var zf=u.version;if(zf!=="19.2.4")throw Error(o(527,zf,"19.2.4"));Q.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var Cv={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vs.isDisabled&&Vs.supportsFiber)try{Oa=Vs.inject(Cv),dt=Vs}catch{}}return An.createRoot=function(e,t){if(!x(e))throw Error(o(299));var l=!1,a="",n=Lo,i=Uo,r=Bo;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(n=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=yf(e,1,!1,null,null,l,a,null,n,i,r,_f),e[Jl]=t.current,Zr(e),new dc(t)},An.hydrateRoot=function(e,t,l){if(!x(e))throw Error(o(299));var a=!1,n="",i=Lo,r=Uo,d=Bo,v=null;return l!=null&&(l.unstable_strictMode===!0&&(a=!0),l.identifierPrefix!==void 0&&(n=l.identifierPrefix),l.onUncaughtError!==void 0&&(i=l.onUncaughtError),l.onCaughtError!==void 0&&(r=l.onCaughtError),l.onRecoverableError!==void 0&&(d=l.onRecoverableError),l.formState!==void 0&&(v=l.formState)),t=yf(e,1,!0,t,l??null,a,n,v,i,r,d,_f),t.context=gf(null),l=t.current,a=gt(),a=ti(a),n=ul(a),n.callback=null,ol(l,n,a),l=a,t.current.lanes=l,wa(t,l),Lt(t),e[Jl]=t.current,Zr(e),new Xs(t)},An.version="19.2.4",An}var qf;function Lv(){if(qf)return xc.exports;qf=1;function c(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c)}catch(u){console.error(u)}}return c(),xc.exports=wv(),xc.exports}var Uv=Lv();const Bv="";async function Xe(c,u){const f=await fetch(`${Bv}${c}`,u);if(!f.ok){const o=await f.json().catch(()=>({error:f.statusText}));throw new Error(o.error||`HTTP ${f.status}`)}return f.json()}const ge={getConfig(){return Xe("/api/config")},setConfig(c,u){return Xe("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:c,model:u})})},getSkills(){return Xe("/api/skills")},getSkillDetail(c,u){return Xe(`/api/skills/${c}/${u}`)},getEvals(c,u){return Xe(`/api/skills/${c}/${u}/evals`)},saveEvals(c,u,f){return Xe(`/api/skills/${c}/${u}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)})},generateEvals(c,u){return Xe(`/api/skills/${c}/${u}/generate-evals`,{method:"POST"})},getLatestBenchmark(c,u){return Xe(`/api/skills/${c}/${u}/benchmark/latest`)},getHistory(c,u,f){const o=new URLSearchParams;f!=null&&f.model&&o.set("model",f.model),f!=null&&f.type&&o.set("type",f.type),f!=null&&f.from&&o.set("from",f.from),f!=null&&f.to&&o.set("to",f.to);const x=o.toString();return Xe(`/api/skills/${c}/${u}/history${x?"?"+x:""}`)},getHistoryEntry(c,u,f){return Xe(`/api/skills/${c}/${u}/history/${encodeURIComponent(f)}`)},compareRuns(c,u,f,o){return Xe(`/api/skills/${c}/${u}/history-compare?a=${encodeURIComponent(f)}&b=${encodeURIComponent(o)}`)},getCaseHistory(c,u,f,o){const x=new URLSearchParams;o&&x.set("model",o);const j=x.toString();return Xe(`/api/skills/${c}/${u}/history/case/${f}${j?"?"+j:""}`)},deleteHistoryEntry(c,u,f){return Xe(`/api/skills/${c}/${u}/history/${encodeURIComponent(f)}`,{method:"DELETE"})},improveSkill(c,u,f){return Xe(`/api/skills/${c}/${u}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)})},applyImprovement(c,u,f){return Xe(`/api/skills/${c}/${u}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:f})})},getStats(c,u){return Xe(`/api/skills/${c}/${u}/stats`)},getDependencies(c,u){return Xe(`/api/skills/${c}/${u}/dependencies`)},getProjectLayout(){return Xe("/api/project-layout")},createSkill(c){return Xe("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})},getSkillCreatorStatus(){return Xe("/api/skill-creator-status")}};function Hv(c){const[u,f]=N.useState(()=>typeof window>"u"?!1:window.matchMedia(c).matches);return N.useEffect(()=>{const o=window.matchMedia(c);f(o.matches);const x=j=>f(j.matches);return o.addEventListener("change",x),()=>o.removeEventListener("change",x)},[c]),u}const qv={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list"};function Yv(c,u){switch(u.type){case"SELECT_SKILL":return{...c,selectedSkill:u.skill,mode:"browse",mobileView:c.isMobile?"detail":c.mobileView};case"CLEAR_SELECTION":return{...c,selectedSkill:null};case"SET_MODE":return{...c,mode:u.mode,selectedSkill:u.mode==="create"?null:c.selectedSkill};case"SET_SEARCH":return{...c,searchQuery:u.query};case"SET_SKILLS":return{...c,skills:u.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...c,skillsError:u.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...c,skillsLoading:u.loading};case"SET_MOBILE":return{...c,isMobile:u.isMobile};case"SET_MOBILE_VIEW":return{...c,mobileView:u.view};default:return c}}const Wf=N.createContext(null);function Kl(){const c=N.useContext(Wf);if(!c)throw new Error("useStudio must be used within StudioProvider");return c}function Gv({children:c}){const[u,f]=N.useReducer(Yv,qv),o=Hv("(max-width: 767px)");N.useEffect(()=>{f({type:"SET_MOBILE",isMobile:o})},[o]);const x=N.useCallback(()=>{f({type:"SET_SKILLS_LOADING",loading:!0}),ge.getSkills().then(h=>f({type:"SET_SKILLS",skills:h})).catch(h=>f({type:"SET_SKILLS_ERROR",error:h.message}))},[]);N.useEffect(()=>{x()},[x]);const j=N.useCallback(h=>{f({type:"SELECT_SKILL",skill:h})},[]),p=N.useCallback(()=>{f({type:"CLEAR_SELECTION"})},[]),T=N.useCallback(h=>{f({type:"SET_MODE",mode:h})},[]),b=N.useCallback(h=>{f({type:"SET_SEARCH",query:h})},[]),m=N.useCallback(h=>{f({type:"SET_MOBILE_VIEW",view:h})},[]),E=N.useMemo(()=>({state:u,selectSkill:j,clearSelection:p,setMode:T,setSearch:b,setMobileView:m,refreshSkills:x}),[u,j,p,T,b,m,x]);return s.jsx(Wf.Provider,{value:E,children:c})}function Qv({left:c,right:u}){const{state:f}=Kl();return f.isMobile?s.jsx("div",{style:{height:"100vh",overflow:"hidden",background:"var(--surface-0)"},children:f.mobileView==="list"?s.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--surface-1)"},children:c}):s.jsx("div",{style:{height:"100%",overflowY:"auto"},children:u})}):s.jsxs("div",{className:"studio-grid",style:{display:"grid",gridTemplateColumns:"280px 1px 1fr",height:"100vh",overflow:"hidden"},children:[s.jsx("div",{style:{overflowY:"auto",background:"var(--surface-1)"},children:c}),s.jsx("div",{style:{background:"var(--border-subtle)"}}),s.jsx("div",{style:{overflowY:"auto",background:"var(--surface-0)"},children:u})]})}function Xv(){const{state:c,setSearch:u}=Kl(),[f,o]=N.useState(c.searchQuery),x=N.useRef(null);N.useEffect(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{u(f)},200),()=>{x.current&&clearTimeout(x.current)}),[f,u]),N.useEffect(()=>{c.searchQuery===""&&f!==""&&o("")},[c.searchQuery]);const j=new Set(c.skills.map(p=>p.plugin)).size;return s.jsxs("div",{className:"px-3 py-2",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)"},children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("input",{type:"text",value:f,onChange:p=>o(p.target.value),placeholder:"Search skills...",className:"w-full py-2 pl-8 pr-3 rounded-lg text-[13px] transition-colors duration-150",style:{background:"var(--surface-2)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none"},onFocus:p=>{p.currentTarget.style.borderColor="var(--accent)"},onBlur:p=>{p.currentTarget.style.borderColor="var(--border-subtle)"}}),f&&s.jsx("button",{onClick:()=>{o(""),u("")},style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:2},children:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!c.skillsLoading&&s.jsxs("div",{className:"text-[11px] mt-1.5 px-1",style:{color:"var(--text-tertiary)"},children:[c.skills.length," skill",c.skills.length!==1?"s":""," across ",j," plugin",j!==1?"s":""]})]})}const Yf={pass:{bg:"var(--green-muted)",text:"var(--green)",dot:"var(--green)",label:"Passing"},fail:{bg:"var(--red-muted)",text:"var(--red)",dot:"var(--red)",label:"Failing"},pending:{bg:"var(--yellow-muted)",text:"var(--yellow)",dot:"var(--yellow)",label:"Pending"},missing:{bg:"var(--surface-3)",text:"var(--text-tertiary)",dot:"var(--text-tertiary)",label:"No evals"}};function Vv({skill:c,isSelected:u,onSelect:f}){const o=Yf[c.benchmarkStatus]||Yf.missing;return s.jsxs("button",{onClick:f,className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:u?"var(--surface-2)":"transparent",cursor:"pointer",borderTop:"none",borderRight:"none",borderBottom:"1px solid var(--border-subtle)",borderLeft:u?"2px solid var(--accent)":"2px solid transparent",display:"block"},onMouseEnter:x=>{u||(x.currentTarget.style.background="var(--surface-2)")},onMouseLeave:x=>{u||(x.currentTarget.style.background="transparent")},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[13px] font-medium truncate",style:{color:"var(--text-primary)"},children:c.skill}),s.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full flex-shrink-0 ml-2",style:{background:o.bg,color:o.text},children:[s.jsx("span",{className:"rounded-full",style:{width:5,height:5,background:o.dot}}),o.label]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-[11px]",style:{color:"var(--text-tertiary)"},children:[s.jsxs("span",{children:[c.evalCount," eval",c.evalCount!==1?"s":""]}),s.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),s.jsxs("span",{children:[c.assertionCount," assert",c.assertionCount!==1?"s":""]}),c.lastBenchmark&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),s.jsx("span",{children:new Date(c.lastBenchmark).toLocaleDateString()})]})]})]})}function Zv(){const{state:c,selectSkill:u}=Kl(),{skills:f,searchQuery:o,selectedSkill:x}=c,j=N.useMemo(()=>{var E;const T=o.toLowerCase(),b=T?f.filter(h=>h.skill.toLowerCase().includes(T)||h.plugin.toLowerCase().includes(T)):f,m={};for(const h of b)(m[E=h.plugin]||(m[E]=[])).push(h);return m},[f,o]),p=Object.entries(j);return c.skillsLoading?s.jsx("div",{className:"px-3 py-4 space-y-3",children:[1,2,3].map(T=>s.jsx("div",{className:"skeleton h-14 w-full rounded-lg"},T))}):p.length===0?s.jsx("div",{className:"px-4 py-8 text-center",children:s.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No skills match your search"})}):s.jsx("div",{className:"flex-1",children:p.map(([T,b])=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:T}),s.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",b.length,")"]}),s.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border-subtle)"}})]}),b.map(m=>{const E=(x==null?void 0:x.plugin)===m.plugin&&(x==null?void 0:x.skill)===m.skill;return s.jsx(Vv,{skill:m,isSelected:E,onSelect:()=>u({plugin:m.plugin,skill:m.skill})},`${m.plugin}/${m.skill}`)})]},T))})}function Kv(){const[c,u]=N.useState(null),[f,o]=N.useState(!1),[x,j]=N.useState(!1),p=N.useRef(null);N.useEffect(()=>{ge.getConfig().then(u).catch(()=>{})},[]),N.useEffect(()=>{function m(E){p.current&&!p.current.contains(E.target)&&o(!1)}return f&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[f]);async function T(m,E){j(!0);try{const h=await ge.setConfig(m.id,E.id);u(h),o(!1)}catch{const h=await ge.getConfig();u(h)}finally{j(!1)}}if(!c)return null;const b=Jv(c);return s.jsxs("div",{ref:p,className:"relative",children:[s.jsxs("button",{onClick:()=>o(!f),className:"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},onMouseEnter:m=>{m.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:m=>{m.currentTarget.style.borderColor="var(--border-subtle)"},children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"})]}),s.jsx("span",{className:"flex-1 text-left font-medium truncate",children:b}),s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",style:{transform:f?"rotate(180deg)":"rotate(0)",transition:"transform 0.15s ease"},children:s.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),f&&s.jsxs("div",{className:"absolute bottom-full mb-1 left-0 w-64 rounded-xl shadow-xl z-50 overflow-hidden animate-fade-in",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Select Model"})}),s.jsx("div",{className:"py-1 max-h-80 overflow-y-auto",children:c.providers.map(m=>s.jsxs("div",{children:[s.jsxs("div",{className:"px-4 py-1.5 flex items-center gap-2",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:m.available?"var(--green)":"var(--text-tertiary)",opacity:m.available?1:.3}}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",opacity:m.available?1:.5},children:m.label})]}),m.models.map(E=>{const h=Ff(c,m.id,E.id),O=!m.available||x;return s.jsxs("button",{onClick:()=>!O&&T(m,E),disabled:O,className:"w-full px-4 py-2 flex items-center gap-2.5 text-left transition-all duration-100",style:{background:h?"var(--accent-muted)":"transparent",color:O?"var(--text-tertiary)":"var(--text-primary)",opacity:O?.4:1,cursor:O?"not-allowed":"pointer"},onMouseEnter:q=>{!O&&!h&&(q.currentTarget.style.background="var(--surface-3)")},onMouseLeave:q=>{h||(q.currentTarget.style.background="transparent")},children:[s.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 flex items-center justify-center",style:{border:`2px solid ${h?"var(--accent)":"var(--border-subtle)"}`},children:h&&s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}})}),s.jsx("span",{className:"text-[12px]",style:{fontWeight:h?600:400},title:E.id,children:E.label})]},`${m.id}-${E.id}`)})]},m.id))})]})]})}function Ff(c,u,f){return c.provider!==u?!1:u==="claude-cli"?c.model===`claude-${f}`:c.model===f}function Jv(c){for(const u of c.providers)for(const f of u.models)if(Ff(c,u.id,f.id))return f.label;return c.model}function $v(){const{state:c,setMode:u}=Kl(),[f,o]=N.useState(null);return N.useEffect(()=>{ge.getConfig().then(x=>o(x.projectName)).catch(()=>{})},[]),s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx("div",{className:"px-4 py-4 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"var(--accent-muted)"},children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[14px] font-semibold truncate",style:{color:"var(--text-primary)",letterSpacing:"-0.01em"},children:"Skill Studio"}),s.jsx("div",{className:"text-[11px] truncate",style:{color:"var(--text-tertiary)"},children:f||"vskill"})]})]})}),s.jsx(Xv,{}),s.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:s.jsxs("button",{onClick:()=>u("create"),className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:c.mode==="create"?"var(--accent)":"var(--surface-3)",color:c.mode==="create"?"#fff":"var(--text-secondary)",border:"none",cursor:"pointer"},onMouseEnter:x=>{c.mode!=="create"&&(x.currentTarget.style.background="var(--surface-4)",x.currentTarget.style.color="var(--text-primary)")},onMouseLeave:x=>{c.mode!=="create"&&(x.currentTarget.style.background="var(--surface-3)",x.currentTarget.style.color="var(--text-secondary)")},children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]})}),s.jsx("div",{className:"flex-1 overflow-y-auto",style:{borderTop:"1px solid var(--border-subtle)"},children:s.jsx(Zv,{})}),s.jsxs("div",{className:"px-3 py-3 flex-shrink-0",style:{borderTop:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest px-1 mb-2",style:{color:"var(--text-tertiary)"},children:"Model"}),s.jsx(Kv,{})]})]})}function Wv(){const[c,u]=N.useState([]),[f,o]=N.useState(!1),[x,j]=N.useState(!1),[p,T]=N.useState(null),b=N.useRef(null),m=N.useCallback(async(h,O)=>{u([]),o(!0),j(!1),T(null);const q=new AbortController;b.current=q;try{const H=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:O?JSON.stringify(O):void 0,signal:q.signal});if(!H.ok||!H.body)throw new Error(`HTTP ${H.status}`);const B=H.body.getReader(),Y=new TextDecoder;let V="",G="";for(;;){const{done:P,value:K}=await B.read();if(P)break;V+=Y.decode(K,{stream:!0});const se=V.split(`
50
- `);V=se.pop()||"";for(const re of se)if(re.startsWith("event: "))G=re.slice(7).trim();else if(re.startsWith("data: ")){try{const ee=JSON.parse(re.slice(6)),fe={event:G,data:ee};G==="done"?(j(!0),u(Se=>[...Se,fe])):u(Se=>[...Se,fe])}catch{}G=""}}}catch(H){H.name!=="AbortError"&&T(H.message)}finally{o(!1),b.current=null}},[]),E=N.useCallback(()=>{var h;(h=b.current)==null||h.abort()},[]);return{events:c,running:f,done:x,error:p,start:m,stop:E}}function Fv(c){const u=N.useRef(c);u.current=c;const[f,o]=N.useState(new Set),x=N.useRef(new Map),j=N.useCallback(async(m,E,h)=>{var q;(q=x.current.get(m))==null||q.abort();const O=new AbortController;x.current.set(m,O),o(H=>{const B=new Set(H);return B.add(m),B});try{const H=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:h?JSON.stringify(h):void 0,signal:O.signal});if(!H.ok||!H.body)throw new Error(`HTTP ${H.status}`);const B=H.body.getReader(),Y=new TextDecoder;let V="",G="";for(;;){const{done:P,value:K}=await B.read();if(P)break;V+=Y.decode(K,{stream:!0});const se=V.split(`
51
- `);V=se.pop()||"";for(const re of se)if(re.startsWith("event: "))G=re.slice(7).trim();else if(re.startsWith("data: ")){try{const ee=JSON.parse(re.slice(6)),fe={event:G,data:ee};u.current.onEvent(m,fe)}catch{}G=""}}u.current.onDone(m)}catch(H){H.name!=="AbortError"&&u.current.onError(m,H.message)}finally{o(H=>{const B=new Set(H);return B.delete(m),B}),x.current.delete(m)}},[]),p=N.useCallback(m=>{var E;(E=x.current.get(m))==null||E.abort()},[]),T=N.useCallback(()=>{for(const m of x.current.values())m.abort()},[]),b=f.size>0;return{runningSet:f,startCase:j,stopCase:p,stopAll:T,isAnyCaseRunning:b}}const Iv={plugin:"",skill:"",skillContent:"",savedContent:"",isDirty:!1,evals:null,activePanel:"tests",selectedCaseId:null,caseRunStates:new Map,bulkRunActive:!1,runMode:null,latestBenchmark:null,inlineResults:new Map,improveTarget:null,regressions:[],iterationCount:0,activationPrompts:"",activationResults:[],activationSummary:null,activationRunning:!1,activationError:null,loading:!0,error:null};function Pv(c,u){var f,o;switch(u.type){case"SET_LOADING":return{...c,loading:u.loading};case"SET_ERROR":return{...c,error:u.error};case"INIT_DATA":{const x=new Map;if(u.benchmark)for(const p of u.benchmark.cases)x.set(p.eval_id,{status:p.status,passRate:p.pass_rate,errorMessage:p.error_message||void 0,durationMs:p.durationMs,tokens:p.tokens,output:p.output,assertions:p.assertions.map(T=>({assertion_id:T.id,text:T.text,pass:T.pass,reasoning:T.reasoning}))});const j=((o=(f=u.evals)==null?void 0:f.evals[0])==null?void 0:o.id)??null;return{...c,skillContent:u.skillContent,savedContent:u.skillContent,isDirty:!1,evals:u.evals,latestBenchmark:u.benchmark,inlineResults:x,selectedCaseId:j,loading:!1,error:null}}case"SET_PANEL":return{...c,activePanel:u.panel};case"SET_CONTENT":return{...c,skillContent:u.content,isDirty:u.content!==c.savedContent};case"CONTENT_SAVED":return{...c,savedContent:c.skillContent,isDirty:!1};case"SET_EVALS":return{...c,evals:u.evals};case"SELECT_CASE":return{...c,selectedCaseId:u.caseId};case"CASE_RUN_START":{const x=new Map(c.caseRunStates);return x.set(u.caseId,{status:"running",startedAt:Date.now()}),{...c,caseRunStates:x,runMode:u.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const x=new Map(c.caseRunStates);x.set(u.caseId,{status:"complete"});const j=new Map(c.inlineResults);return j.set(u.caseId,u.result),{...c,caseRunStates:x,inlineResults:j}}case"CASE_RUN_ERROR":{const x=new Map(c.caseRunStates);x.set(u.caseId,{status:"error"});const j=new Map(c.inlineResults);return j.set(u.caseId,{status:"error",errorMessage:u.error,assertions:[]}),{...c,caseRunStates:x,inlineResults:j}}case"CASE_RUN_CANCEL":{const x=new Map(c.caseRunStates);return x.set(u.caseId,{status:"cancelled"}),{...c,caseRunStates:x}}case"BULK_RUN_START":{const x=new Map(c.caseRunStates);for(const j of u.caseIds)x.set(j,{status:"queued"});return{...c,caseRunStates:x,bulkRunActive:!0,runMode:u.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...c,bulkRunActive:!1,latestBenchmark:u.benchmark??c.latestBenchmark,iterationCount:c.iterationCount+1};case"CANCEL_ALL":{const x=new Map(c.caseRunStates);for(const[j,p]of x)(p.status==="running"||p.status==="queued")&&x.set(j,{status:"cancelled"});return{...c,caseRunStates:x,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const x=new Map(c.inlineResults);return x.set(u.evalId,u.result),{...c,inlineResults:x}}case"OPEN_IMPROVE":return{...c,improveTarget:u.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...c,improveTarget:null};case"SET_REGRESSIONS":return{...c,regressions:u.regressions};case"INCREMENT_ITERATION":return{...c,iterationCount:c.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...c,activationPrompts:u.prompts};case"ACTIVATION_START":return{...c,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_RESULT":return{...c,activationResults:[...c.activationResults,u.result]};case"ACTIVATION_DONE":return{...c,activationRunning:!1,activationSummary:u.summary};case"ACTIVATION_ERROR":return{...c,activationRunning:!1,activationError:u.error};case"ACTIVATION_RESET":return{...c,activationResults:[],activationSummary:null,activationError:null};default:return c}}const If=N.createContext(null);function Al(){const c=N.useContext(If);if(!c)throw new Error("useWorkspace must be used within WorkspaceProvider");return c}function eh({plugin:c,skill:u,children:f}){const[o,x]=N.useReducer(Pv,{...Iv,plugin:c,skill:u}),j=N.useRef(new Set),p=N.useRef(new Set),T=N.useRef(new Map),b=N.useCallback((R,J)=>{const z=J.data;let $=T.current.get(R);if($||($={assertions:[]},T.current.set(R,$)),J.event==="output_ready"&&($.output=z.output,z.durationMs!=null&&($.durationMs=z.durationMs),z.tokens!=null&&($.tokens=z.tokens)),J.event==="assertion_result"){const ie={assertion_id:z.assertion_id,text:z.text,pass:z.pass,reasoning:z.reasoning};$.assertions.find(k=>k.assertion_id===ie.assertion_id)||$.assertions.push(ie)}J.event==="case_complete"&&($.status=z.status,$.passRate=z.pass_rate,$.errorMessage=z.error_message||void 0),x({type:"UPDATE_INLINE_RESULT",evalId:R,result:{...$,assertions:[...$.assertions]}})},[]),m=N.useCallback(R=>{if(p.current.has(R))return;p.current.add(R);const J=T.current.get(R)??{assertions:[]};x({type:"CASE_RUN_COMPLETE",caseId:R,result:{...J,assertions:[...J.assertions]}}),j.current.has(R)&&(j.current.delete(R),j.current.size===0&&ge.getLatestBenchmark(c,u).then(z=>x({type:"BULK_RUN_COMPLETE",benchmark:z})).catch(()=>x({type:"BULK_RUN_COMPLETE",benchmark:null})))},[c,u]),E=N.useCallback((R,J)=>{p.current.has(R)||(p.current.add(R),x({type:"CASE_RUN_ERROR",caseId:R,error:J}),j.current.has(R)&&(j.current.delete(R),j.current.size===0&&ge.getLatestBenchmark(c,u).then(z=>x({type:"BULK_RUN_COMPLETE",benchmark:z})).catch(()=>x({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[c,u]),{startCase:h,stopCase:O,stopAll:q}=Fv({onEvent:b,onDone:m,onError:E});N.useEffect(()=>()=>{q()},[q]),N.useEffect(()=>{let R=!1;async function J(){try{const[z,$,ie]=await Promise.allSettled([ge.getSkillDetail(c,u),ge.getEvals(c,u),ge.getLatestBenchmark(c,u)]);if(R)return;x({type:"INIT_DATA",skillContent:z.status==="fulfilled"?z.value.skillContent:"",evals:$.status==="fulfilled"?$.value:null,benchmark:ie.status==="fulfilled"?ie.value:null})}catch(z){R||x({type:"SET_ERROR",error:z.message})}}return J(),()=>{R=!0}},[c,u]);const H=N.useCallback(async()=>{try{await ge.applyImprovement(c,u,o.skillContent),x({type:"CONTENT_SAVED"})}catch(R){x({type:"SET_ERROR",error:R.message})}},[c,u,o.skillContent]),B=N.useCallback(async R=>{try{const J=await ge.saveEvals(c,u,R);x({type:"SET_EVALS",evals:J})}catch(J){x({type:"SET_ERROR",error:J.message})}},[c,u]),Y=N.useCallback((R,J="benchmark")=>{const z=o.caseRunStates.get(R);if((z==null?void 0:z.status)!=="running")if(T.current.delete(R),p.current.delete(R),x({type:"CASE_RUN_START",caseId:R,mode:J}),J==="comparison"){const $=`/api/skills/${c}/${u}/compare`;h(R,$,{eval_ids:[R]})}else{const $=`/api/skills/${c}/${u}/benchmark/case/${R}`;h(R,$,J==="baseline"?{baseline_only:!0}:void 0)}},[c,u,o.caseRunStates,h]),V=N.useCallback((R="benchmark")=>{var $;const J=(($=o.evals)==null?void 0:$.evals)??[];if(J.length===0)return;const z=J.map(ie=>ie.id);for(const ie of z)T.current.delete(ie),p.current.delete(ie);x({type:"BULK_RUN_START",caseIds:z,mode:R}),j.current=new Set(z);for(const ie of z)if(R==="comparison")h(ie,`/api/skills/${c}/${u}/compare`,{eval_ids:[ie]});else{const k=`/api/skills/${c}/${u}/benchmark/case/${ie}`;h(ie,k,R==="baseline"?{baseline_only:!0}:void 0)}},[c,u,o.evals,h]),G=N.useCallback(R=>{O(R),x({type:"CASE_RUN_CANCEL",caseId:R}),j.current.delete(R),p.current.add(R)},[O]),P=N.useCallback(()=>{q(),x({type:"CANCEL_ALL"}),j.current.clear()},[q]),K=N.useCallback(async(R,J)=>{x({type:"OPEN_IMPROVE",evalId:R})},[]),se=N.useCallback(async(R,J)=>{try{await ge.applyImprovement(c,u,J),x({type:"SET_CONTENT",content:J}),x({type:"CONTENT_SAVED"}),x({type:"CLOSE_IMPROVE"}),Y(R,"benchmark")}catch(z){x({type:"SET_ERROR",error:z.message})}},[c,u,Y]),re=N.useCallback(async()=>{try{const R=await ge.getSkillDetail(c,u);x({type:"SET_CONTENT",content:R.skillContent}),x({type:"CONTENT_SAVED"})}catch{}},[c,u]),ee=N.useCallback(async()=>{try{const R=await ge.generateEvals(c,u),J=await ge.saveEvals(c,u,R);x({type:"SET_EVALS",evals:J})}catch(R){x({type:"SET_ERROR",error:R.message})}},[c,u]),fe=Wv();N.useEffect(()=>()=>{fe.stop()},[fe.stop]),N.useEffect(()=>{if(fe.events.length)for(const R of fe.events)R.event==="prompt_result"&&x({type:"ACTIVATION_RESULT",result:R.data}),R.event==="done"&&x({type:"ACTIVATION_DONE",summary:R.data})},[fe.events]),N.useEffect(()=>{fe.error&&x({type:"ACTIVATION_ERROR",error:fe.error})},[fe.error]);const Se=N.useCallback(R=>{const z=R.trim().split(`
52
- `).filter(Boolean).map($=>$.startsWith("!")?{prompt:$.slice(1).trim(),expected:"should_not_activate"}:$.startsWith("+")?{prompt:$.slice(1).trim(),expected:"should_activate"}:{prompt:$.trim(),expected:"auto"});x({type:"ACTIVATION_START"}),fe.start(`/api/skills/${c}/${u}/activation-test`,{prompts:z})},[c,u,fe]),te=N.useMemo(()=>({state:o,dispatch:x,saveContent:H,saveEvals:B,runCase:Y,runAll:V,cancelCase:G,cancelAll:P,improveForCase:K,applyImproveAndRerun:se,refreshSkillContent:re,generateEvals:ee,runActivationTest:Se}),[o,H,B,Y,V,G,P,K,se,re,ee,Se]);return s.jsx(If.Provider,{value:te,children:f})}function th({state:c}){const{plugin:u,skill:f,evals:o,latestBenchmark:x,isDirty:j,caseRunStates:p,regressions:T,iterationCount:b}=c,m=Array.from(p.values()).some(B=>B.status==="running"||B.status==="queued"),E=x==null?void 0:x.overall_pass_rate,h=(o==null?void 0:o.evals.reduce((B,Y)=>B+Y.assertions.length,0))??0,O=(o==null?void 0:o.evals.length)??0,q=E!=null?E>=80?"var(--green)":E>=50?"var(--yellow)":"var(--red)":"var(--text-tertiary)",H=E!=null?E>=80?"var(--green-muted)":E>=50?"var(--yellow-muted)":"var(--red-muted)":"var(--surface-3)";return s.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[s.jsx("span",{style:{color:"var(--text-tertiary)"},children:u}),s.jsx(lh,{}),s.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:f}),j&&s.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),m&&s.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[s.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[T.length>0&&s.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),T.length," regression",T.length>1?"s":""]}),b>0&&s.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",b]}),s.jsx("span",{className:"pill",style:{background:H,color:q},children:E!=null?`${Math.round(E*100)}%`:"--"}),s.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[O," case",O!==1?"s":""," / ",h," assert",h!==1?"s":""]})]})]})}function lh(){return s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:s.jsx("polyline",{points:"9 18 15 12 9 6"})})}const ah=[{label:"Build",tabs:[{id:"editor",label:"Editor",shortcut:"1"},{id:"tests",label:"Tests",shortcut:"2"}]},{label:"Evaluate",tabs:[{id:"run",label:"Run",shortcut:"3"},{id:"activation",label:"Activation",shortcut:"4"}]},{label:"Insights",tabs:[{id:"history",label:"History",shortcut:"5"},{id:"deps",label:"Deps",shortcut:"6"}]}];function nh({id:c}){const u={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(c){case"editor":return s.jsxs("svg",{...u,children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"tests":return s.jsxs("svg",{...u,children:[s.jsx("path",{d:"M9 11l3 3L22 4"}),s.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});case"run":return s.jsx("svg",{...u,children:s.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return s.jsxs("svg",{...u,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"6"}),s.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return s.jsxs("svg",{...u,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"deps":return s.jsxs("svg",{...u,children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}}function sh({activePanel:c,onPanelChange:u,isDirty:f,isRunning:o,hasRegressions:x,isActivationRunning:j}){return s.jsx("div",{className:"flex items-center gap-0.5 px-3 overflow-x-auto",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:ah.map((p,T)=>s.jsxs("div",{className:"flex items-center",children:[T>0&&s.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),p.tabs.map(b=>{const m=c===b.id,E=b.id==="editor"&&f||b.id==="run"&&o||b.id==="activation"&&j||b.id==="history"&&x,h=b.id==="run"||b.id==="activation"?"var(--accent)":b.id==="history"?"var(--red)":"var(--yellow)";return s.jsxs("button",{onClick:()=>u(b.id),title:`${b.label} (Ctrl+${b.shortcut})`,className:"relative flex items-center gap-1.5 px-3 py-2.5 text-[12px] font-medium transition-colors duration-150",style:{background:"transparent",color:m?"var(--text-primary)":"var(--text-tertiary)",borderBottom:m?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:m?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:O=>{m||(O.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:O=>{m||(O.currentTarget.style.color="var(--text-tertiary)")},children:[s.jsx(nh,{id:b.id}),b.label,E&&s.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:h}})]},b.id)})]},p.label))})}function ih(c){const u=c.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!u)return{metadata:{},body:c};const f=u[1],o=u[2].trim(),x={},j=f.split(`
53
- `);let p="",T=!1;for(const b of j){const m=b.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(m&&p&&T){const O=m[1],q=m[2].trim();let H=x[p];if((typeof H!="object"||Array.isArray(H))&&(H={},x[p]=H),!q)H[O]=[];else{const B=q.match(/^\[(.+)\]$/);B?H[O]=B[1].split(",").map(Y=>Y.trim().replace(/^["']|["']$/g,"")).filter(Boolean):H[O]=q.replace(/^["']|["']$/g,"")}continue}const E=b.match(/^\s+-\s+(.+)$/);if(E&&p){T=!1;const O=x[p];Array.isArray(O)?O.push(E[1].trim().replace(/^["']|["']$/g,"")):x[p]=[E[1].trim().replace(/^["']|["']$/g,"")];continue}const h=b.match(/^([\w-]+):\s*(.*)$/);if(h){p=h[1];const O=h[2].trim();if(T=!1,!O){x[p]={},T=!0;continue}const q=O.match(/^\[(.+)\]$/);if(q){x[p]=q[1].split(",").map(H=>H.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}x[p]=O.replace(/^["']|["']$/g,"")}}return{metadata:x,body:o}}function Pf(c){if(!c)return"";let u=rh(c);return u=u.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),u=u.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),u=u.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),u=u.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),u=u.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),u=u.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),u=u.replace(/\*([^*]+)\*/g,"<em>$1</em>"),u=u.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),u=u.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),u=u.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),u=u.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),u=u.replace(/\n/g,"<br/>"),u}function rh(c){const u=c.split(`
49
+ `).replace(Wx,"")}function Fd(e,t){return t=Wd(t),Wd(e)===t}function _e(e,t,l,a,n,i){switch(l){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||ea(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&ea(e,""+a);break;case"className":wn(e,"class",a);break;case"tabIndex":wn(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":wn(e,l,a);break;case"style":Wc(e,a,i);break;case"data":if(t!=="object"){wn(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=Un(""+a),e.setAttribute(l,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(l==="formAction"?(t!=="input"&&_e(e,t,"name",n.name,n,null),_e(e,t,"formEncType",n.formEncType,n,null),_e(e,t,"formMethod",n.formMethod,n,null),_e(e,t,"formTarget",n.formTarget,n,null)):(_e(e,t,"encType",n.encType,n,null),_e(e,t,"method",n.method,n,null),_e(e,t,"target",n.target,n,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=Un(""+a),e.setAttribute(l,a);break;case"onClick":a!=null&&(e.onclick=Bt);break;case"onScroll":a!=null&&ve("scroll",e);break;case"onScrollEnd":a!=null&&ve("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}l=Un(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""+a):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":a===!0?e.setAttribute(l,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,a):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(l,a):e.removeAttribute(l);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(l):e.setAttribute(l,a);break;case"popover":ve("beforetoggle",e),ve("toggle",e),Dn(e,"popover",a);break;case"xlinkActuate":Ut(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Ut(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Ut(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Ut(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Ut(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Ut(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Ut(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Ut(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Ut(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Dn(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Tm.get(l)||l,Dn(e,l,a))}}function Jr(e,t,l,a,n,i){switch(l){case"style":Wc(e,a,i);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof a=="string"?ea(e,a):(typeof a=="number"||typeof a=="bigint")&&ea(e,""+a);break;case"onScroll":a!=null&&ve("scroll",e);break;case"onScrollEnd":a!=null&&ve("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Bt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yc.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(n=l.endsWith("Capture"),t=l.slice(2,n?l.length-7:void 0),i=e[at]||null,i=i!=null?i[l]:null,typeof i=="function"&&e.removeEventListener(t,i,n),typeof a=="function")){typeof i!="function"&&i!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,a,n);break e}l in e?e[l]=a:a===!0?e.setAttribute(l,""):Dn(e,l,a)}}}function Ie(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ve("error",e),ve("load",e);var a=!1,n=!1,i;for(i in l)if(l.hasOwnProperty(i)){var r=l[i];if(r!=null)switch(i){case"src":a=!0;break;case"srcSet":n=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:_e(e,t,i,r,l,null)}}n&&_e(e,t,"srcSet",l.srcSet,l,null),a&&_e(e,t,"src",l.src,l,null);return;case"input":ve("invalid",e);var d=i=r=n=null,v=null,A=null;for(a in l)if(l.hasOwnProperty(a)){var D=l[a];if(D!=null)switch(a){case"name":n=D;break;case"type":r=D;break;case"checked":v=D;break;case"defaultChecked":A=D;break;case"value":i=D;break;case"defaultValue":d=D;break;case"children":case"dangerouslySetInnerHTML":if(D!=null)throw Error(o(137,t));break;default:_e(e,t,a,D,l,null)}}Zc(e,i,d,v,A,r,n,!1);return;case"select":ve("invalid",e),a=r=i=null;for(n in l)if(l.hasOwnProperty(n)&&(d=l[n],d!=null))switch(n){case"value":i=d;break;case"defaultValue":r=d;break;case"multiple":a=d;default:_e(e,t,n,d,l,null)}t=i,l=r,e.multiple=!!a,t!=null?Pl(e,!!a,t,!1):l!=null&&Pl(e,!!a,l,!0);return;case"textarea":ve("invalid",e),i=n=a=null;for(r in l)if(l.hasOwnProperty(r)&&(d=l[r],d!=null))switch(r){case"value":a=d;break;case"defaultValue":n=d;break;case"children":i=d;break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(o(91));break;default:_e(e,t,r,d,l,null)}Jc(e,a,n,i);return;case"option":for(v in l)if(l.hasOwnProperty(v)&&(a=l[v],a!=null))switch(v){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:_e(e,t,v,a,l,null)}return;case"dialog":ve("beforetoggle",e),ve("toggle",e),ve("cancel",e),ve("close",e);break;case"iframe":case"object":ve("load",e);break;case"video":case"audio":for(a=0;a<pn.length;a++)ve(pn[a],e);break;case"image":ve("error",e),ve("load",e);break;case"details":ve("toggle",e);break;case"embed":case"source":case"link":ve("error",e),ve("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(A in l)if(l.hasOwnProperty(A)&&(a=l[A],a!=null))switch(A){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:_e(e,t,A,a,l,null)}return;default:if(ci(t)){for(D in l)l.hasOwnProperty(D)&&(a=l[D],a!==void 0&&Jr(e,t,D,a,l,void 0));return}}for(d in l)l.hasOwnProperty(d)&&(a=l[d],a!=null&&_e(e,t,d,a,l,null))}function Fx(e,t,l,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var n=null,i=null,r=null,d=null,v=null,A=null,D=null;for(_ in l){var L=l[_];if(l.hasOwnProperty(_)&&L!=null)switch(_){case"checked":break;case"value":break;case"defaultValue":v=L;default:a.hasOwnProperty(_)||_e(e,t,_,null,a,L)}}for(var M in a){var _=a[M];if(L=l[M],a.hasOwnProperty(M)&&(_!=null||L!=null))switch(M){case"type":i=_;break;case"name":n=_;break;case"checked":A=_;break;case"defaultChecked":D=_;break;case"value":r=_;break;case"defaultValue":d=_;break;case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(o(137,t));break;default:_!==L&&_e(e,t,M,_,a,L)}}ii(e,r,d,v,A,D,i,n);return;case"select":_=r=d=M=null;for(i in l)if(v=l[i],l.hasOwnProperty(i)&&v!=null)switch(i){case"value":break;case"multiple":_=v;default:a.hasOwnProperty(i)||_e(e,t,i,null,a,v)}for(n in a)if(i=a[n],v=l[n],a.hasOwnProperty(n)&&(i!=null||v!=null))switch(n){case"value":M=i;break;case"defaultValue":d=i;break;case"multiple":r=i;default:i!==v&&_e(e,t,n,i,a,v)}t=d,l=r,a=_,M!=null?Pl(e,!!l,M,!1):!!a!=!!l&&(t!=null?Pl(e,!!l,t,!0):Pl(e,!!l,l?[]:"",!1));return;case"textarea":_=M=null;for(d in l)if(n=l[d],l.hasOwnProperty(d)&&n!=null&&!a.hasOwnProperty(d))switch(d){case"value":break;case"children":break;default:_e(e,t,d,null,a,n)}for(r in a)if(n=a[r],i=l[r],a.hasOwnProperty(r)&&(n!=null||i!=null))switch(r){case"value":M=n;break;case"defaultValue":_=n;break;case"children":break;case"dangerouslySetInnerHTML":if(n!=null)throw Error(o(91));break;default:n!==i&&_e(e,t,r,n,a,i)}Kc(e,M,_);return;case"option":for(var W in l)if(M=l[W],l.hasOwnProperty(W)&&M!=null&&!a.hasOwnProperty(W))switch(W){case"selected":e.selected=!1;break;default:_e(e,t,W,null,a,M)}for(v in a)if(M=a[v],_=l[v],a.hasOwnProperty(v)&&M!==_&&(M!=null||_!=null))switch(v){case"selected":e.selected=M&&typeof M!="function"&&typeof M!="symbol";break;default:_e(e,t,v,M,a,_)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ne in l)M=l[ne],l.hasOwnProperty(ne)&&M!=null&&!a.hasOwnProperty(ne)&&_e(e,t,ne,null,a,M);for(A in a)if(M=a[A],_=l[A],a.hasOwnProperty(A)&&M!==_&&(M!=null||_!=null))switch(A){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(o(137,t));break;default:_e(e,t,A,M,a,_)}return;default:if(ci(t)){for(var ze in l)M=l[ze],l.hasOwnProperty(ze)&&M!==void 0&&!a.hasOwnProperty(ze)&&Jr(e,t,ze,void 0,a,M);for(D in a)M=a[D],_=l[D],!a.hasOwnProperty(D)||M===_||M===void 0&&_===void 0||Jr(e,t,D,M,a,_);return}}for(var S in l)M=l[S],l.hasOwnProperty(S)&&M!=null&&!a.hasOwnProperty(S)&&_e(e,t,S,null,a,M);for(L in a)M=a[L],_=l[L],!a.hasOwnProperty(L)||M===_||M==null&&_==null||_e(e,t,L,M,a,_)}function Id(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ix(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),a=0;a<l.length;a++){var n=l[a],i=n.transferSize,r=n.initiatorType,d=n.duration;if(i&&d&&Id(r)){for(r=0,d=n.responseEnd,a+=1;a<l.length;a++){var v=l[a],A=v.startTime;if(A>d)break;var D=v.transferSize,L=v.initiatorType;D&&Id(L)&&(v=v.responseEnd,r+=D*(v<d?1:(d-A)/(v-A)))}if(--a,t+=8*(i+r)/(n.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var $r=null,Wr=null;function Rs(e){return e.nodeType===9?e:e.ownerDocument}function Pd(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ef(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Fr(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ir=null;function Px(){var e=window.event;return e&&e.type==="popstate"?e===Ir?!1:(Ir=e,!0):(Ir=null,!1)}var tf=typeof setTimeout=="function"?setTimeout:void 0,ev=typeof clearTimeout=="function"?clearTimeout:void 0,lf=typeof Promise=="function"?Promise:void 0,tv=typeof queueMicrotask=="function"?queueMicrotask:typeof lf<"u"?function(e){return lf.resolve(null).then(e).catch(lv)}:tf;function lv(e){setTimeout(function(){throw e})}function bl(e){return e==="head"}function af(e,t){var l=t,a=0;do{var n=l.nextSibling;if(e.removeChild(l),n&&n.nodeType===8)if(l=n.data,l==="/$"||l==="/&"){if(a===0){e.removeChild(n),ka(t);return}a--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")a++;else if(l==="html")gn(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,gn(l);for(var i=l.firstChild;i;){var r=i.nextSibling,d=i.nodeName;i[La]||d==="SCRIPT"||d==="STYLE"||d==="LINK"&&i.rel.toLowerCase()==="stylesheet"||l.removeChild(i),i=r}}else l==="body"&&gn(e.ownerDocument.body);l=n}while(l);ka(t)}function nf(e,t){var l=e;e=0;do{var a=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),a&&a.nodeType===8)if(l=a.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=a}while(l)}function Pr(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Pr(l),ni(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function av(e,t,l,a){for(;e.nodeType===1;){var n=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[La])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==n.rel||e.getAttribute("href")!==(n.href==null||n.href===""?null:n.href)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin)||e.getAttribute("title")!==(n.title==null?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(n.src==null?null:n.src)||e.getAttribute("type")!==(n.type==null?null:n.type)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=n.name==null?null:""+n.name;if(n.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Mt(e.nextSibling),e===null)break}return null}function nv(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Mt(e.nextSibling),e===null))return null;return e}function sf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Mt(e.nextSibling),e===null))return null;return e}function ec(e){return e.data==="$?"||e.data==="$~"}function tc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function sv(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var a=function(){t(),l.removeEventListener("DOMContentLoaded",a)};l.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function Mt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var lc=null;function rf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Mt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function cf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function uf(e,t,l){switch(t=Rs(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function gn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ni(e)}var _t=new Map,of=new Set;function Os(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var el=Q.d;Q.d={f:iv,r:rv,D:cv,C:uv,L:ov,m:dv,X:mv,S:fv,M:xv};function iv(){var e=el.f(),t=Ts();return e||t}function rv(e){var t=Wl(e);t!==null&&t.tag===5&&t.type==="form"?Co(t):el.r(e)}var Ma=typeof document>"u"?null:document;function df(e,t,l){var a=Ma;if(a&&typeof t=="string"&&t){var n=jt(t);n='link[rel="'+e+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),of.has(n)||(of.add(n),e={rel:e,crossOrigin:l,href:t},a.querySelector(n)===null&&(t=a.createElement("link"),Ie(t,"link",e),Ze(t),a.head.appendChild(t)))}}function cv(e){el.D(e),df("dns-prefetch",e,null)}function uv(e,t){el.C(e,t),df("preconnect",e,t)}function ov(e,t,l){el.L(e,t,l);var a=Ma;if(a&&e&&t){var n='link[rel="preload"][as="'+jt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+jt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+jt(l.imageSizes)+'"]')):n+='[href="'+jt(e)+'"]';var i=n;switch(t){case"style":i=_a(e);break;case"script":i=za(e)}_t.has(i)||(e=h({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),_t.set(i,e),a.querySelector(n)!==null||t==="style"&&a.querySelector(bn(i))||t==="script"&&a.querySelector(jn(i))||(t=a.createElement("link"),Ie(t,"link",e),Ze(t),a.head.appendChild(t)))}}function dv(e,t){el.m(e,t);var l=Ma;if(l&&e){var a=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+jt(a)+'"][href="'+jt(e)+'"]',i=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=za(e)}if(!_t.has(i)&&(e=h({rel:"modulepreload",href:e},t),_t.set(i,e),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(jn(i)))return}a=l.createElement("link"),Ie(a,"link",e),Ze(a),l.head.appendChild(a)}}}function fv(e,t,l){el.S(e,t,l);var a=Ma;if(a&&e){var n=Fl(a).hoistableStyles,i=_a(e);t=t||"default";var r=n.get(i);if(!r){var d={loading:0,preload:null};if(r=a.querySelector(bn(i)))d.loading=5;else{e=h({rel:"stylesheet",href:e,"data-precedence":t},l),(l=_t.get(i))&&ac(e,l);var v=r=a.createElement("link");Ze(v),Ie(v,"link",e),v._p=new Promise(function(A,D){v.onload=A,v.onerror=D}),v.addEventListener("load",function(){d.loading|=1}),v.addEventListener("error",function(){d.loading|=2}),d.loading|=4,Ds(r,t,a)}r={type:"stylesheet",instance:r,count:1,state:d},n.set(i,r)}}}function mv(e,t){el.X(e,t);var l=Ma;if(l&&e){var a=Fl(l).hoistableScripts,n=za(e),i=a.get(n);i||(i=l.querySelector(jn(n)),i||(e=h({src:e,async:!0},t),(t=_t.get(n))&&nc(e,t),i=l.createElement("script"),Ze(i),Ie(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function xv(e,t){el.M(e,t);var l=Ma;if(l&&e){var a=Fl(l).hoistableScripts,n=za(e),i=a.get(n);i||(i=l.querySelector(jn(n)),i||(e=h({src:e,async:!0,type:"module"},t),(t=_t.get(n))&&nc(e,t),i=l.createElement("script"),Ze(i),Ie(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function ff(e,t,l,a){var n=(n=me.current)?Os(n):null;if(!n)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=_a(l.href),l=Fl(n).hoistableStyles,a=l.get(t),a||(a={type:"style",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=_a(l.href);var i=Fl(n).hoistableStyles,r=i.get(e);if(r||(n=n.ownerDocument||n,r={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,r),(i=n.querySelector(bn(e)))&&!i._p&&(r.instance=i,r.state.loading=5),_t.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},_t.set(e,l),i||vv(n,e,l,r.state))),t&&a===null)throw Error(o(528,""));return r}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=za(l),l=Fl(n).hoistableScripts,a=l.get(t),a||(a={type:"script",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function _a(e){return'href="'+jt(e)+'"'}function bn(e){return'link[rel="stylesheet"]['+e+"]"}function mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function vv(e,t,l,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Ie(t,"link",l),Ze(t),e.head.appendChild(t))}function za(e){return'[src="'+jt(e)+'"]'}function jn(e){return"script[async]"+e}function xf(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+jt(l.href)+'"]');if(a)return t.instance=a,Ze(a),a;var n=h({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Ze(a),Ie(a,"style",n),Ds(a,l.precedence,e),t.instance=a;case"stylesheet":n=_a(l.href);var i=e.querySelector(bn(n));if(i)return t.state.loading|=4,t.instance=i,Ze(i),i;a=mf(l),(n=_t.get(n))&&ac(a,n),i=(e.ownerDocument||e).createElement("link"),Ze(i);var r=i;return r._p=new Promise(function(d,v){r.onload=d,r.onerror=v}),Ie(i,"link",a),t.state.loading|=4,Ds(i,l.precedence,e),t.instance=i;case"script":return i=za(l.src),(n=e.querySelector(jn(i)))?(t.instance=n,Ze(n),n):(a=l,(n=_t.get(i))&&(a=h({},l),nc(a,n)),e=e.ownerDocument||e,n=e.createElement("script"),Ze(n),Ie(n,"link",a),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Ds(a,l.precedence,e));return t.instance}function Ds(e,t,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,i=n,r=0;r<a.length;r++){var d=a[r];if(d.dataset.precedence===t)i=d;else if(i!==n)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function ac(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function nc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ws=null;function vf(e,t,l){if(ws===null){var a=new Map,n=ws=new Map;n.set(l,a)}else n=ws,a=n.get(l),a||(a=new Map,n.set(l,a));if(a.has(e))return a;for(a.set(e,null),l=l.getElementsByTagName(e),n=0;n<l.length;n++){var i=l[n];if(!(i[La]||i[Je]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var r=i.getAttribute(t)||"";r=e+r;var d=a.get(r);d?d.push(i):a.set(r,[i])}}return a}function hf(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function hv(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function pf(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function pv(e,t,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var n=_a(a.href),i=t.querySelector(bn(n));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ls.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=i,Ze(i);return}i=t.ownerDocument||t,a=mf(a),(n=_t.get(n))&&ac(a,n),i=i.createElement("link"),Ze(i);var r=i;r._p=new Promise(function(d,v){r.onload=d,r.onerror=v}),Ie(i,"link",a),l.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Ls.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var sc=0;function yv(e,t){return e.stylesheets&&e.count===0&&Bs(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var a=setTimeout(function(){if(e.stylesheets&&Bs(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&sc===0&&(sc=62500*Ix());var n=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bs(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>sc?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function Ls(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Us=null;function Bs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Us=new Map,t.forEach(gv,e),Us=null,Ls.call(e))}function gv(e,t){if(!(t.state.loading&4)){var l=Us.get(e);if(l)var a=l.get(null);else{l=new Map,Us.set(e,l);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<n.length;i++){var r=n[i];(r.nodeName==="LINK"||r.getAttribute("media")!=="not all")&&(l.set(r.dataset.precedence,r),a=r)}a&&l.set(null,a)}n=t.instance,r=n.getAttribute("data-precedence"),i=l.get(r)||a,i===a&&l.set(null,n),l.set(r,n),this.count++,a=Ls.bind(this),n.addEventListener("load",a),n.addEventListener("error",a),i?i.parentNode.insertBefore(n,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(n,e.firstChild)),t.state.loading|=4}}var Sn={$$typeof:P,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function bv(e,t,l,a,n,i,r,d,v){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ei(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ei(0),this.hiddenUpdates=ei(null),this.identifierPrefix=a,this.onUncaughtError=n,this.onCaughtError=i,this.onRecoverableError=r,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=v,this.incompleteTransitions=new Map}function yf(e,t,l,a,n,i,r,d,v,A,D,L){return e=new bv(e,t,l,r,v,A,D,L,d),t=1,i===!0&&(t|=24),i=xt(3,null,null,t),e.current=i,i.stateNode=e,t=Bi(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:a,isDehydrated:l,cache:t},Gi(i),e}function gf(e){return e?(e=ra,e):ra}function bf(e,t,l,a,n,i){n=gf(n),a.context===null?a.context=n:a.pendingContext=n,a=ul(t),a.payload={element:l},i=i===void 0?null:i,i!==null&&(a.callback=i),l=ol(e,a,t),l!==null&&(ut(l,e,t),Pa(l,e,t))}function jf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function ic(e,t){jf(e,t),(e=e.alternate)&&jf(e,t)}function Sf(e){if(e.tag===13||e.tag===31){var t=Dl(e,67108864);t!==null&&ut(t,e,67108864),ic(e,67108864)}}function Nf(e){if(e.tag===13||e.tag===31){var t=gt();t=ti(t);var l=Dl(e,t);l!==null&&ut(l,e,t),ic(e,t)}}var Hs=!0;function jv(e,t,l,a){var n=k.T;k.T=null;var i=Q.p;try{Q.p=2,rc(e,t,l,a)}finally{Q.p=i,k.T=n}}function Sv(e,t,l,a){var n=k.T;k.T=null;var i=Q.p;try{Q.p=8,rc(e,t,l,a)}finally{Q.p=i,k.T=n}}function rc(e,t,l,a){if(Hs){var n=cc(a);if(n===null)Kr(e,t,a,qs,l),Ef(e,a);else if(Tv(n,e,t,l,a))a.stopPropagation();else if(Ef(e,a),t&4&&-1<Nv.indexOf(e)){for(;n!==null;){var i=Wl(n);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var r=_l(i.pendingLanes);if(r!==0){var d=i;for(d.pendingLanes|=2,d.entangledLanes|=2;r;){var v=1<<31-ft(r);d.entanglements[1]|=v,r&=~v}Lt(i),(Ne&6)===0&&(Ss=ot()+500,hn(0))}}break;case 31:case 13:d=Dl(i,2),d!==null&&ut(d,i,2),Ts(),ic(i,2)}if(i=cc(a),i===null&&Kr(e,t,a,qs,l),i===n)break;n=i}n!==null&&a.stopPropagation()}else Kr(e,t,a,null,l)}}function cc(e){return e=oi(e),uc(e)}var qs=null;function uc(e){if(qs=null,e=$l(e),e!==null){var t=j(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=p(t),e!==null)return e;e=null}else if(l===31){if(e=T(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return qs=e,null}function Tf(e){switch(e){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(cm()){case zc:return 2;case kc:return 8;case _n:case um:return 32;case Rc:return 268435456;default:return 32}default:return 32}}var oc=!1,jl=null,Sl=null,Nl=null,Nn=new Map,Tn=new Map,Tl=[],Nv="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".split(" ");function Ef(e,t){switch(e){case"focusin":case"focusout":jl=null;break;case"dragenter":case"dragleave":Sl=null;break;case"mouseover":case"mouseout":Nl=null;break;case"pointerover":case"pointerout":Nn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tn.delete(t.pointerId)}}function En(e,t,l,a,n,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:l,eventSystemFlags:a,nativeEvent:i,targetContainers:[n]},t!==null&&(t=Wl(t),t!==null&&Sf(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function Tv(e,t,l,a,n){switch(t){case"focusin":return jl=En(jl,e,t,l,a,n),!0;case"dragenter":return Sl=En(Sl,e,t,l,a,n),!0;case"mouseover":return Nl=En(Nl,e,t,l,a,n),!0;case"pointerover":var i=n.pointerId;return Nn.set(i,En(Nn.get(i)||null,e,t,l,a,n)),!0;case"gotpointercapture":return i=n.pointerId,Tn.set(i,En(Tn.get(i)||null,e,t,l,a,n)),!0}return!1}function Cf(e){var t=$l(e.target);if(t!==null){var l=j(t);if(l!==null){if(t=l.tag,t===13){if(t=p(l),t!==null){e.blockedOn=t,Bc(e.priority,function(){Nf(l)});return}}else if(t===31){if(t=T(l),t!==null){e.blockedOn=t,Bc(e.priority,function(){Nf(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ys(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=cc(e.nativeEvent);if(l===null){l=e.nativeEvent;var a=new l.constructor(l.type,l);ui=a,l.target.dispatchEvent(a),ui=null}else return t=Wl(l),t!==null&&Sf(t),e.blockedOn=l,!1;t.shift()}return!0}function Af(e,t,l){Ys(e)&&l.delete(t)}function Ev(){oc=!1,jl!==null&&Ys(jl)&&(jl=null),Sl!==null&&Ys(Sl)&&(Sl=null),Nl!==null&&Ys(Nl)&&(Nl=null),Nn.forEach(Af),Tn.forEach(Af)}function Gs(e,t){e.blockedOn===t&&(e.blockedOn=null,oc||(oc=!0,c.unstable_scheduleCallback(c.unstable_NormalPriority,Ev)))}var Qs=null;function Mf(e){Qs!==e&&(Qs=e,c.unstable_scheduleCallback(c.unstable_NormalPriority,function(){Qs===e&&(Qs=null);for(var t=0;t<e.length;t+=3){var l=e[t],a=e[t+1],n=e[t+2];if(typeof a!="function"){if(uc(a||l)===null)continue;break}var i=Wl(l);i!==null&&(e.splice(t,3),t-=3,cr(i,{pending:!0,data:n,method:l.method,action:a},a,n))}}))}function ka(e){function t(v){return Gs(v,e)}jl!==null&&Gs(jl,e),Sl!==null&&Gs(Sl,e),Nl!==null&&Gs(Nl,e),Nn.forEach(t),Tn.forEach(t);for(var l=0;l<Tl.length;l++){var a=Tl[l];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Tl.length&&(l=Tl[0],l.blockedOn===null);)Cf(l),l.blockedOn===null&&Tl.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(a=0;a<l.length;a+=3){var n=l[a],i=l[a+1],r=n[at]||null;if(typeof i=="function")r||Mf(l);else if(r){var d=null;if(i&&i.hasAttribute("formAction")){if(n=i,r=i[at]||null)d=r.formAction;else if(uc(n)!==null)continue}else d=r.action;typeof d=="function"?l[a+1]=d:(l.splice(a,3),a-=3),Mf(l)}}}function _f(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(r){return n=r})},focusReset:"manual",scroll:"manual"})}function t(){n!==null&&(n(),n=null),a||setTimeout(l,20)}function l(){if(!a&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,n=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),n!==null&&(n(),n=null)}}}function dc(e){this._internalRoot=e}Xs.prototype.render=dc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,a=gt();bf(l,a,e,t,null,null)},Xs.prototype.unmount=dc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bf(e.current,2,null,e,null,null),Ts(),t[Jl]=null}};function Xs(e){this._internalRoot=e}Xs.prototype.unstable_scheduleHydration=function(e){if(e){var t=Uc();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Tl.length&&t!==0&&t<Tl[l].priority;l++);Tl.splice(l,0,e),l===0&&Cf(e)}};var zf=u.version;if(zf!=="19.2.4")throw Error(o(527,zf,"19.2.4"));Q.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(t),e=e!==null?E(e):null,e=e===null?null:e.stateNode,e};var Cv={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vs=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vs.isDisabled&&Vs.supportsFiber)try{Oa=Vs.inject(Cv),dt=Vs}catch{}}return An.createRoot=function(e,t){if(!x(e))throw Error(o(299));var l=!1,a="",n=Lo,i=Uo,r=Bo;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(n=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=yf(e,1,!1,null,null,l,a,null,n,i,r,_f),e[Jl]=t.current,Zr(e),new dc(t)},An.hydrateRoot=function(e,t,l){if(!x(e))throw Error(o(299));var a=!1,n="",i=Lo,r=Uo,d=Bo,v=null;return l!=null&&(l.unstable_strictMode===!0&&(a=!0),l.identifierPrefix!==void 0&&(n=l.identifierPrefix),l.onUncaughtError!==void 0&&(i=l.onUncaughtError),l.onCaughtError!==void 0&&(r=l.onCaughtError),l.onRecoverableError!==void 0&&(d=l.onRecoverableError),l.formState!==void 0&&(v=l.formState)),t=yf(e,1,!0,t,l??null,a,n,v,i,r,d,_f),t.context=gf(null),l=t.current,a=gt(),a=ti(a),n=ul(a),n.callback=null,ol(l,n,a),l=a,t.current.lanes=l,wa(t,l),Lt(t),e[Jl]=t.current,Zr(e),new Xs(t)},An.version="19.2.4",An}var qf;function Lv(){if(qf)return xc.exports;qf=1;function c(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c)}catch(u){console.error(u)}}return c(),xc.exports=wv(),xc.exports}var Uv=Lv();const Bv="";class Hv extends Error{constructor(u,f){super(u),this.name="ApiError",this.status=f}}async function Xe(c,u){const f=await fetch(`${Bv}${c}`,u);if(!f.ok){const o=await f.json().catch(()=>({error:f.statusText}));throw new Hv(o.error||`HTTP ${f.status}`,f.status)}return f.json()}const ge={getConfig(){return Xe("/api/config")},setConfig(c,u){return Xe("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:c,model:u})})},getSkills(){return Xe("/api/skills")},getSkillDetail(c,u){return Xe(`/api/skills/${c}/${u}`)},getEvals(c,u){return Xe(`/api/skills/${c}/${u}/evals`)},saveEvals(c,u,f){return Xe(`/api/skills/${c}/${u}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)})},generateEvals(c,u){return Xe(`/api/skills/${c}/${u}/generate-evals`,{method:"POST"})},getLatestBenchmark(c,u){return Xe(`/api/skills/${c}/${u}/benchmark/latest`)},getHistory(c,u,f){const o=new URLSearchParams;f!=null&&f.model&&o.set("model",f.model),f!=null&&f.type&&o.set("type",f.type),f!=null&&f.from&&o.set("from",f.from),f!=null&&f.to&&o.set("to",f.to);const x=o.toString();return Xe(`/api/skills/${c}/${u}/history${x?"?"+x:""}`)},getHistoryEntry(c,u,f){return Xe(`/api/skills/${c}/${u}/history/${encodeURIComponent(f)}`)},compareRuns(c,u,f,o){return Xe(`/api/skills/${c}/${u}/history-compare?a=${encodeURIComponent(f)}&b=${encodeURIComponent(o)}`)},getCaseHistory(c,u,f,o){const x=new URLSearchParams;o&&x.set("model",o);const j=x.toString();return Xe(`/api/skills/${c}/${u}/history/case/${f}${j?"?"+j:""}`)},deleteHistoryEntry(c,u,f){return Xe(`/api/skills/${c}/${u}/history/${encodeURIComponent(f)}`,{method:"DELETE"})},improveSkill(c,u,f){return Xe(`/api/skills/${c}/${u}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)})},applyImprovement(c,u,f){return Xe(`/api/skills/${c}/${u}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:f})})},getStats(c,u){return Xe(`/api/skills/${c}/${u}/stats`)},getDependencies(c,u){return Xe(`/api/skills/${c}/${u}/dependencies`)},getProjectLayout(){return Xe("/api/project-layout")},createSkill(c){return Xe("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})},getSkillCreatorStatus(){return Xe("/api/skill-creator-status")}};function qv(c){const[u,f]=N.useState(()=>typeof window>"u"?!1:window.matchMedia(c).matches);return N.useEffect(()=>{const o=window.matchMedia(c);f(o.matches);const x=j=>f(j.matches);return o.addEventListener("change",x),()=>o.removeEventListener("change",x)},[c]),u}const Yv={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list"};function Gv(c,u){switch(u.type){case"SELECT_SKILL":return{...c,selectedSkill:u.skill,mode:"browse",mobileView:c.isMobile?"detail":c.mobileView};case"CLEAR_SELECTION":return{...c,selectedSkill:null};case"SET_MODE":return{...c,mode:u.mode,selectedSkill:u.mode==="create"?null:c.selectedSkill};case"SET_SEARCH":return{...c,searchQuery:u.query};case"SET_SKILLS":return{...c,skills:u.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...c,skillsError:u.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...c,skillsLoading:u.loading};case"SET_MOBILE":return{...c,isMobile:u.isMobile};case"SET_MOBILE_VIEW":return{...c,mobileView:u.view};default:return c}}const Wf=N.createContext(null);function Kl(){const c=N.useContext(Wf);if(!c)throw new Error("useStudio must be used within StudioProvider");return c}function Qv({children:c}){const[u,f]=N.useReducer(Gv,Yv),o=qv("(max-width: 767px)");N.useEffect(()=>{f({type:"SET_MOBILE",isMobile:o})},[o]);const x=N.useCallback(()=>{f({type:"SET_SKILLS_LOADING",loading:!0}),ge.getSkills().then(h=>f({type:"SET_SKILLS",skills:h})).catch(h=>f({type:"SET_SKILLS_ERROR",error:h.message}))},[]);N.useEffect(()=>{x()},[x]);const j=N.useCallback(h=>{f({type:"SELECT_SKILL",skill:h})},[]),p=N.useCallback(()=>{f({type:"CLEAR_SELECTION"})},[]),T=N.useCallback(h=>{f({type:"SET_MODE",mode:h})},[]),b=N.useCallback(h=>{f({type:"SET_SEARCH",query:h})},[]),m=N.useCallback(h=>{f({type:"SET_MOBILE_VIEW",view:h})},[]),E=N.useMemo(()=>({state:u,selectSkill:j,clearSelection:p,setMode:T,setSearch:b,setMobileView:m,refreshSkills:x}),[u,j,p,T,b,m,x]);return s.jsx(Wf.Provider,{value:E,children:c})}function Xv({left:c,right:u}){const{state:f}=Kl();return f.isMobile?s.jsx("div",{style:{height:"100vh",overflow:"hidden",background:"var(--surface-0)"},children:f.mobileView==="list"?s.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--surface-1)"},children:c}):s.jsx("div",{style:{height:"100%",overflowY:"auto"},children:u})}):s.jsxs("div",{className:"studio-grid",style:{display:"grid",gridTemplateColumns:"280px 1px 1fr",height:"100vh",overflow:"hidden"},children:[s.jsx("div",{style:{overflowY:"auto",background:"var(--surface-1)"},children:c}),s.jsx("div",{style:{background:"var(--border-subtle)"}}),s.jsx("div",{style:{overflowY:"auto",background:"var(--surface-0)"},children:u})]})}function Vv(){const{state:c,setSearch:u}=Kl(),[f,o]=N.useState(c.searchQuery),x=N.useRef(null);N.useEffect(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{u(f)},200),()=>{x.current&&clearTimeout(x.current)}),[f,u]),N.useEffect(()=>{c.searchQuery===""&&f!==""&&o("")},[c.searchQuery]);const j=new Set(c.skills.map(p=>p.plugin)).size;return s.jsxs("div",{className:"px-3 py-2",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)"},children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("input",{type:"text",value:f,onChange:p=>o(p.target.value),placeholder:"Search skills...",className:"w-full py-2 pl-8 pr-3 rounded-lg text-[13px] transition-colors duration-150",style:{background:"var(--surface-2)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none"},onFocus:p=>{p.currentTarget.style.borderColor="var(--accent)"},onBlur:p=>{p.currentTarget.style.borderColor="var(--border-subtle)"}}),f&&s.jsx("button",{onClick:()=>{o(""),u("")},style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:2},children:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!c.skillsLoading&&s.jsxs("div",{className:"text-[11px] mt-1.5 px-1",style:{color:"var(--text-tertiary)"},children:[c.skills.length," skill",c.skills.length!==1?"s":""," across ",j," plugin",j!==1?"s":""]})]})}const Yf={pass:{bg:"var(--green-muted)",text:"var(--green)",dot:"var(--green)",label:"Passing"},fail:{bg:"var(--red-muted)",text:"var(--red)",dot:"var(--red)",label:"Failing"},pending:{bg:"var(--yellow-muted)",text:"var(--yellow)",dot:"var(--yellow)",label:"Pending"},missing:{bg:"var(--surface-3)",text:"var(--text-tertiary)",dot:"var(--text-tertiary)",label:"No evals"}};function Zv({skill:c,isSelected:u,onSelect:f}){const o=Yf[c.benchmarkStatus]||Yf.missing;return s.jsxs("button",{onClick:f,className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:u?"var(--surface-2)":"transparent",cursor:"pointer",borderTop:"none",borderRight:"none",borderBottom:"1px solid var(--border-subtle)",borderLeft:u?"2px solid var(--accent)":"2px solid transparent",display:"block"},onMouseEnter:x=>{u||(x.currentTarget.style.background="var(--surface-2)")},onMouseLeave:x=>{u||(x.currentTarget.style.background="transparent")},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[13px] font-medium truncate",style:{color:"var(--text-primary)"},children:c.skill}),s.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full flex-shrink-0 ml-2",style:{background:o.bg,color:o.text},children:[s.jsx("span",{className:"rounded-full",style:{width:5,height:5,background:o.dot}}),o.label]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-[11px]",style:{color:"var(--text-tertiary)"},children:[s.jsxs("span",{children:[c.evalCount," eval",c.evalCount!==1?"s":""]}),s.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),s.jsxs("span",{children:[c.assertionCount," assert",c.assertionCount!==1?"s":""]}),c.lastBenchmark&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),s.jsx("span",{children:new Date(c.lastBenchmark).toLocaleDateString()})]})]})]})}function Kv(){const{state:c,selectSkill:u}=Kl(),{skills:f,searchQuery:o,selectedSkill:x}=c,j=N.useMemo(()=>{var E;const T=o.toLowerCase(),b=T?f.filter(h=>h.skill.toLowerCase().includes(T)||h.plugin.toLowerCase().includes(T)):f,m={};for(const h of b)(m[E=h.plugin]||(m[E]=[])).push(h);return m},[f,o]),p=Object.entries(j);return c.skillsLoading?s.jsx("div",{className:"px-3 py-4 space-y-3",children:[1,2,3].map(T=>s.jsx("div",{className:"skeleton h-14 w-full rounded-lg"},T))}):p.length===0?s.jsx("div",{className:"px-4 py-8 text-center",children:s.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No skills match your search"})}):s.jsx("div",{className:"flex-1",children:p.map(([T,b])=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:T}),s.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",b.length,")"]}),s.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border-subtle)"}})]}),b.map(m=>{const E=(x==null?void 0:x.plugin)===m.plugin&&(x==null?void 0:x.skill)===m.skill;return s.jsx(Zv,{skill:m,isSelected:E,onSelect:()=>u({plugin:m.plugin,skill:m.skill})},`${m.plugin}/${m.skill}`)})]},T))})}function Jv(){const[c,u]=N.useState(null),[f,o]=N.useState(!1),[x,j]=N.useState(!1),p=N.useRef(null);N.useEffect(()=>{ge.getConfig().then(u).catch(()=>{})},[]),N.useEffect(()=>{function m(E){p.current&&!p.current.contains(E.target)&&o(!1)}return f&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[f]);async function T(m,E){j(!0);try{const h=await ge.setConfig(m.id,E.id);u(h),o(!1)}catch{const h=await ge.getConfig();u(h)}finally{j(!1)}}if(!c)return null;const b=$v(c);return s.jsxs("div",{ref:p,className:"relative",children:[s.jsxs("button",{onClick:()=>o(!f),className:"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},onMouseEnter:m=>{m.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:m=>{m.currentTarget.style.borderColor="var(--border-subtle)"},children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"})]}),s.jsx("span",{className:"flex-1 text-left font-medium truncate",children:b}),s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",style:{transform:f?"rotate(180deg)":"rotate(0)",transition:"transform 0.15s ease"},children:s.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),f&&s.jsxs("div",{className:"absolute bottom-full mb-1 left-0 w-64 rounded-xl shadow-xl z-50 overflow-hidden animate-fade-in",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Select Model"})}),s.jsx("div",{className:"py-1 max-h-80 overflow-y-auto",children:c.providers.map(m=>s.jsxs("div",{children:[s.jsxs("div",{className:"px-4 py-1.5 flex items-center gap-2",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:m.available?"var(--green)":"var(--text-tertiary)",opacity:m.available?1:.3}}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",opacity:m.available?1:.5},children:m.label})]}),m.models.map(E=>{const h=Ff(c,m.id,E.id),O=!m.available||x;return s.jsxs("button",{onClick:()=>!O&&T(m,E),disabled:O,className:"w-full px-4 py-2 flex items-center gap-2.5 text-left transition-all duration-100",style:{background:h?"var(--accent-muted)":"transparent",color:O?"var(--text-tertiary)":"var(--text-primary)",opacity:O?.4:1,cursor:O?"not-allowed":"pointer"},onMouseEnter:q=>{!O&&!h&&(q.currentTarget.style.background="var(--surface-3)")},onMouseLeave:q=>{h||(q.currentTarget.style.background="transparent")},children:[s.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 flex items-center justify-center",style:{border:`2px solid ${h?"var(--accent)":"var(--border-subtle)"}`},children:h&&s.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}})}),s.jsx("span",{className:"text-[12px]",style:{fontWeight:h?600:400},title:E.id,children:E.label})]},`${m.id}-${E.id}`)})]},m.id))})]})]})}function Ff(c,u,f){return c.provider!==u?!1:u==="claude-cli"?c.model===`claude-${f}`:c.model===f}function $v(c){for(const u of c.providers)for(const f of u.models)if(Ff(c,u.id,f.id))return f.label;return c.model}function Wv(){const{state:c,setMode:u}=Kl(),[f,o]=N.useState(null);return N.useEffect(()=>{ge.getConfig().then(x=>o(x.projectName)).catch(()=>{})},[]),s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx("div",{className:"px-4 py-4 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"var(--accent-muted)"},children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[14px] font-semibold truncate",style:{color:"var(--text-primary)",letterSpacing:"-0.01em"},children:"Skill Studio"}),s.jsx("div",{className:"text-[11px] truncate",style:{color:"var(--text-tertiary)"},children:f||"vskill"})]})]})}),s.jsx(Vv,{}),s.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:s.jsxs("button",{onClick:()=>u("create"),className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:c.mode==="create"?"var(--accent)":"var(--surface-3)",color:c.mode==="create"?"#fff":"var(--text-secondary)",border:"none",cursor:"pointer"},onMouseEnter:x=>{c.mode!=="create"&&(x.currentTarget.style.background="var(--surface-4)",x.currentTarget.style.color="var(--text-primary)")},onMouseLeave:x=>{c.mode!=="create"&&(x.currentTarget.style.background="var(--surface-3)",x.currentTarget.style.color="var(--text-secondary)")},children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]})}),s.jsx("div",{className:"flex-1 overflow-y-auto",style:{borderTop:"1px solid var(--border-subtle)"},children:s.jsx(Kv,{})}),s.jsxs("div",{className:"px-3 py-3 flex-shrink-0",style:{borderTop:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest px-1 mb-2",style:{color:"var(--text-tertiary)"},children:"Model"}),s.jsx(Jv,{})]})]})}function Fv(){const[c,u]=N.useState([]),[f,o]=N.useState(!1),[x,j]=N.useState(!1),[p,T]=N.useState(null),b=N.useRef(null),m=N.useCallback(async(h,O)=>{u([]),o(!0),j(!1),T(null);const q=new AbortController;b.current=q;try{const H=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:O?JSON.stringify(O):void 0,signal:q.signal});if(!H.ok||!H.body)throw new Error(`HTTP ${H.status}`);const B=H.body.getReader(),Y=new TextDecoder;let V="",G="";for(;;){const{done:P,value:K}=await B.read();if(P)break;V+=Y.decode(K,{stream:!0});const se=V.split(`
50
+ `);V=se.pop()||"";for(const re of se)if(re.startsWith("event: "))G=re.slice(7).trim();else if(re.startsWith("data: ")){try{const ee=JSON.parse(re.slice(6)),fe={event:G,data:ee};G==="done"?(j(!0),u(Se=>[...Se,fe])):u(Se=>[...Se,fe])}catch{}G=""}}}catch(H){H.name!=="AbortError"&&T(H.message)}finally{o(!1),b.current=null}},[]),E=N.useCallback(()=>{var h;(h=b.current)==null||h.abort()},[]);return{events:c,running:f,done:x,error:p,start:m,stop:E}}function Iv(c){const u=N.useRef(c);u.current=c;const[f,o]=N.useState(new Set),x=N.useRef(new Map),j=N.useCallback(async(m,E,h)=>{var q;(q=x.current.get(m))==null||q.abort();const O=new AbortController;x.current.set(m,O),o(H=>{const B=new Set(H);return B.add(m),B});try{const H=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:h?JSON.stringify(h):void 0,signal:O.signal});if(!H.ok||!H.body)throw new Error(`HTTP ${H.status}`);const B=H.body.getReader(),Y=new TextDecoder;let V="",G="";for(;;){const{done:P,value:K}=await B.read();if(P)break;V+=Y.decode(K,{stream:!0});const se=V.split(`
51
+ `);V=se.pop()||"";for(const re of se)if(re.startsWith("event: "))G=re.slice(7).trim();else if(re.startsWith("data: ")){try{const ee=JSON.parse(re.slice(6)),fe={event:G,data:ee};u.current.onEvent(m,fe)}catch{}G=""}}u.current.onDone(m)}catch(H){H.name!=="AbortError"&&u.current.onError(m,H.message)}finally{o(H=>{const B=new Set(H);return B.delete(m),B}),x.current.delete(m)}},[]),p=N.useCallback(m=>{var E;(E=x.current.get(m))==null||E.abort()},[]),T=N.useCallback(()=>{for(const m of x.current.values())m.abort()},[]),b=f.size>0;return{runningSet:f,startCase:j,stopCase:p,stopAll:T,isAnyCaseRunning:b}}const Pv={plugin:"",skill:"",skillContent:"",savedContent:"",isDirty:!1,evals:null,activePanel:"tests",selectedCaseId:null,caseRunStates:new Map,bulkRunActive:!1,runMode:null,latestBenchmark:null,inlineResults:new Map,improveTarget:null,regressions:[],iterationCount:0,activationPrompts:"",activationResults:[],activationSummary:null,activationRunning:!1,activationError:null,loading:!0,error:null};function eh(c,u){var f,o;switch(u.type){case"SET_LOADING":return{...c,loading:u.loading};case"SET_ERROR":return{...c,error:u.error};case"INIT_DATA":{const x=new Map;if(u.benchmark)for(const p of u.benchmark.cases)x.set(p.eval_id,{status:p.status,passRate:p.pass_rate,errorMessage:p.error_message||void 0,durationMs:p.durationMs,tokens:p.tokens,output:p.output,assertions:p.assertions.map(T=>({assertion_id:T.id,text:T.text,pass:T.pass,reasoning:T.reasoning}))});const j=((o=(f=u.evals)==null?void 0:f.evals[0])==null?void 0:o.id)??null;return{...c,skillContent:u.skillContent,savedContent:u.skillContent,isDirty:!1,evals:u.evals,latestBenchmark:u.benchmark,inlineResults:x,selectedCaseId:j,loading:!1,error:null}}case"SET_PANEL":return{...c,activePanel:u.panel};case"SET_CONTENT":return{...c,skillContent:u.content,isDirty:u.content!==c.savedContent};case"CONTENT_SAVED":return{...c,savedContent:c.skillContent,isDirty:!1};case"SET_EVALS":return{...c,evals:u.evals};case"SELECT_CASE":return{...c,selectedCaseId:u.caseId};case"CASE_RUN_START":{const x=new Map(c.caseRunStates);return x.set(u.caseId,{status:"running",startedAt:Date.now()}),{...c,caseRunStates:x,runMode:u.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const x=new Map(c.caseRunStates);x.set(u.caseId,{status:"complete"});const j=new Map(c.inlineResults);return j.set(u.caseId,u.result),{...c,caseRunStates:x,inlineResults:j}}case"CASE_RUN_ERROR":{const x=new Map(c.caseRunStates);x.set(u.caseId,{status:"error"});const j=new Map(c.inlineResults);return j.set(u.caseId,{status:"error",errorMessage:u.error,assertions:[]}),{...c,caseRunStates:x,inlineResults:j}}case"CASE_RUN_CANCEL":{const x=new Map(c.caseRunStates);return x.set(u.caseId,{status:"cancelled"}),{...c,caseRunStates:x}}case"BULK_RUN_START":{const x=new Map(c.caseRunStates);for(const j of u.caseIds)x.set(j,{status:"queued"});return{...c,caseRunStates:x,bulkRunActive:!0,runMode:u.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...c,bulkRunActive:!1,latestBenchmark:u.benchmark??c.latestBenchmark,iterationCount:c.iterationCount+1};case"CANCEL_ALL":{const x=new Map(c.caseRunStates);for(const[j,p]of x)(p.status==="running"||p.status==="queued")&&x.set(j,{status:"cancelled"});return{...c,caseRunStates:x,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const x=new Map(c.inlineResults);return x.set(u.evalId,u.result),{...c,inlineResults:x}}case"OPEN_IMPROVE":return{...c,improveTarget:u.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...c,improveTarget:null};case"SET_REGRESSIONS":return{...c,regressions:u.regressions};case"INCREMENT_ITERATION":return{...c,iterationCount:c.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...c,activationPrompts:u.prompts};case"ACTIVATION_START":return{...c,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_RESULT":return{...c,activationResults:[...c.activationResults,u.result]};case"ACTIVATION_DONE":return{...c,activationRunning:!1,activationSummary:u.summary};case"ACTIVATION_ERROR":return{...c,activationRunning:!1,activationError:u.error};case"ACTIVATION_RESET":return{...c,activationResults:[],activationSummary:null,activationError:null};default:return c}}const If=N.createContext(null);function Al(){const c=N.useContext(If);if(!c)throw new Error("useWorkspace must be used within WorkspaceProvider");return c}function th({plugin:c,skill:u,children:f}){const[o,x]=N.useReducer(eh,{...Pv,plugin:c,skill:u}),j=N.useRef(new Set),p=N.useRef(new Set),T=N.useRef(new Map),b=N.useCallback((R,J)=>{const z=J.data;let $=T.current.get(R);if($||($={assertions:[]},T.current.set(R,$)),J.event==="output_ready"&&($.output=z.output,z.durationMs!=null&&($.durationMs=z.durationMs),z.tokens!=null&&($.tokens=z.tokens)),J.event==="assertion_result"){const ie={assertion_id:z.assertion_id,text:z.text,pass:z.pass,reasoning:z.reasoning};$.assertions.find(k=>k.assertion_id===ie.assertion_id)||$.assertions.push(ie)}J.event==="case_complete"&&($.status=z.status,$.passRate=z.pass_rate,$.errorMessage=z.error_message||void 0),x({type:"UPDATE_INLINE_RESULT",evalId:R,result:{...$,assertions:[...$.assertions]}})},[]),m=N.useCallback(R=>{if(p.current.has(R))return;p.current.add(R);const J=T.current.get(R)??{assertions:[]};x({type:"CASE_RUN_COMPLETE",caseId:R,result:{...J,assertions:[...J.assertions]}}),j.current.has(R)&&(j.current.delete(R),j.current.size===0&&ge.getLatestBenchmark(c,u).then(z=>x({type:"BULK_RUN_COMPLETE",benchmark:z})).catch(()=>x({type:"BULK_RUN_COMPLETE",benchmark:null})))},[c,u]),E=N.useCallback((R,J)=>{p.current.has(R)||(p.current.add(R),x({type:"CASE_RUN_ERROR",caseId:R,error:J}),j.current.has(R)&&(j.current.delete(R),j.current.size===0&&ge.getLatestBenchmark(c,u).then(z=>x({type:"BULK_RUN_COMPLETE",benchmark:z})).catch(()=>x({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[c,u]),{startCase:h,stopCase:O,stopAll:q}=Iv({onEvent:b,onDone:m,onError:E});N.useEffect(()=>()=>{q()},[q]),N.useEffect(()=>{let R=!1;async function J(){try{const[z,$,ie]=await Promise.allSettled([ge.getSkillDetail(c,u),ge.getEvals(c,u),ge.getLatestBenchmark(c,u)]);if(R)return;x({type:"INIT_DATA",skillContent:z.status==="fulfilled"?z.value.skillContent:"",evals:$.status==="fulfilled"?$.value:null,benchmark:ie.status==="fulfilled"?ie.value:null})}catch(z){R||x({type:"SET_ERROR",error:z.message})}}return J(),()=>{R=!0}},[c,u]);const H=N.useCallback(async()=>{try{await ge.applyImprovement(c,u,o.skillContent),x({type:"CONTENT_SAVED"})}catch(R){x({type:"SET_ERROR",error:R.message})}},[c,u,o.skillContent]),B=N.useCallback(async R=>{try{const J=await ge.saveEvals(c,u,R);x({type:"SET_EVALS",evals:J})}catch(J){x({type:"SET_ERROR",error:J.message})}},[c,u]),Y=N.useCallback((R,J="benchmark")=>{const z=o.caseRunStates.get(R);if((z==null?void 0:z.status)!=="running")if(T.current.delete(R),p.current.delete(R),x({type:"CASE_RUN_START",caseId:R,mode:J}),J==="comparison"){const $=`/api/skills/${c}/${u}/compare`;h(R,$,{eval_ids:[R]})}else{const $=`/api/skills/${c}/${u}/benchmark/case/${R}`;h(R,$,J==="baseline"?{baseline_only:!0}:void 0)}},[c,u,o.caseRunStates,h]),V=N.useCallback((R="benchmark")=>{var $;const J=(($=o.evals)==null?void 0:$.evals)??[];if(J.length===0)return;const z=J.map(ie=>ie.id);for(const ie of z)T.current.delete(ie),p.current.delete(ie);x({type:"BULK_RUN_START",caseIds:z,mode:R}),j.current=new Set(z);for(const ie of z)if(R==="comparison")h(ie,`/api/skills/${c}/${u}/compare`,{eval_ids:[ie]});else{const k=`/api/skills/${c}/${u}/benchmark/case/${ie}`;h(ie,k,R==="baseline"?{baseline_only:!0}:void 0)}},[c,u,o.evals,h]),G=N.useCallback(R=>{O(R),x({type:"CASE_RUN_CANCEL",caseId:R}),j.current.delete(R),p.current.add(R)},[O]),P=N.useCallback(()=>{q(),x({type:"CANCEL_ALL"}),j.current.clear()},[q]),K=N.useCallback(async(R,J)=>{x({type:"OPEN_IMPROVE",evalId:R})},[]),se=N.useCallback(async(R,J)=>{try{await ge.applyImprovement(c,u,J),x({type:"SET_CONTENT",content:J}),x({type:"CONTENT_SAVED"}),x({type:"CLOSE_IMPROVE"}),Y(R,"benchmark")}catch(z){x({type:"SET_ERROR",error:z.message})}},[c,u,Y]),re=N.useCallback(async()=>{try{const R=await ge.getSkillDetail(c,u);x({type:"SET_CONTENT",content:R.skillContent}),x({type:"CONTENT_SAVED"})}catch{}},[c,u]),ee=N.useCallback(async()=>{try{const R=await ge.generateEvals(c,u),J=await ge.saveEvals(c,u,R);x({type:"SET_EVALS",evals:J})}catch(R){x({type:"SET_ERROR",error:R.message})}},[c,u]),fe=Fv();N.useEffect(()=>()=>{fe.stop()},[fe.stop]),N.useEffect(()=>{if(fe.events.length)for(const R of fe.events)R.event==="prompt_result"&&x({type:"ACTIVATION_RESULT",result:R.data}),R.event==="done"&&x({type:"ACTIVATION_DONE",summary:R.data})},[fe.events]),N.useEffect(()=>{fe.error&&x({type:"ACTIVATION_ERROR",error:fe.error})},[fe.error]);const Se=N.useCallback(R=>{const z=R.trim().split(`
52
+ `).filter(Boolean).map($=>$.startsWith("!")?{prompt:$.slice(1).trim(),expected:"should_not_activate"}:$.startsWith("+")?{prompt:$.slice(1).trim(),expected:"should_activate"}:{prompt:$.trim(),expected:"auto"});x({type:"ACTIVATION_START"}),fe.start(`/api/skills/${c}/${u}/activation-test`,{prompts:z})},[c,u,fe]),te=N.useMemo(()=>({state:o,dispatch:x,saveContent:H,saveEvals:B,runCase:Y,runAll:V,cancelCase:G,cancelAll:P,improveForCase:K,applyImproveAndRerun:se,refreshSkillContent:re,generateEvals:ee,runActivationTest:Se}),[o,H,B,Y,V,G,P,K,se,re,ee,Se]);return s.jsx(If.Provider,{value:te,children:f})}function lh({state:c}){const{plugin:u,skill:f,evals:o,latestBenchmark:x,isDirty:j,caseRunStates:p,regressions:T,iterationCount:b}=c,m=Array.from(p.values()).some(B=>B.status==="running"||B.status==="queued"),E=x==null?void 0:x.overall_pass_rate,h=(o==null?void 0:o.evals.reduce((B,Y)=>B+Y.assertions.length,0))??0,O=(o==null?void 0:o.evals.length)??0,q=E!=null?E>=80?"var(--green)":E>=50?"var(--yellow)":"var(--red)":"var(--text-tertiary)",H=E!=null?E>=80?"var(--green-muted)":E>=50?"var(--yellow-muted)":"var(--red-muted)":"var(--surface-3)";return s.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[s.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[s.jsx("span",{style:{color:"var(--text-tertiary)"},children:u}),s.jsx(ah,{}),s.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:f}),j&&s.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),m&&s.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[s.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[T.length>0&&s.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),T.length," regression",T.length>1?"s":""]}),b>0&&s.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",b]}),s.jsx("span",{className:"pill",style:{background:H,color:q},children:E!=null?`${Math.round(E*100)}%`:"--"}),s.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[O," case",O!==1?"s":""," / ",h," assert",h!==1?"s":""]})]})]})}function ah(){return s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:s.jsx("polyline",{points:"9 18 15 12 9 6"})})}const nh=[{label:"Build",tabs:[{id:"editor",label:"Editor",shortcut:"1"},{id:"tests",label:"Tests",shortcut:"2"}]},{label:"Evaluate",tabs:[{id:"run",label:"Run",shortcut:"3"},{id:"activation",label:"Activation",shortcut:"4"}]},{label:"Insights",tabs:[{id:"history",label:"History",shortcut:"5"},{id:"deps",label:"Deps",shortcut:"6"}]}];function sh({id:c}){const u={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(c){case"editor":return s.jsxs("svg",{...u,children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"tests":return s.jsxs("svg",{...u,children:[s.jsx("path",{d:"M9 11l3 3L22 4"}),s.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});case"run":return s.jsx("svg",{...u,children:s.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return s.jsxs("svg",{...u,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"6"}),s.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return s.jsxs("svg",{...u,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"deps":return s.jsxs("svg",{...u,children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}}function ih({activePanel:c,onPanelChange:u,isDirty:f,isRunning:o,hasRegressions:x,isActivationRunning:j}){return s.jsx("div",{className:"flex items-center gap-0.5 px-3 overflow-x-auto",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:nh.map((p,T)=>s.jsxs("div",{className:"flex items-center",children:[T>0&&s.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),p.tabs.map(b=>{const m=c===b.id,E=b.id==="editor"&&f||b.id==="run"&&o||b.id==="activation"&&j||b.id==="history"&&x,h=b.id==="run"||b.id==="activation"?"var(--accent)":b.id==="history"?"var(--red)":"var(--yellow)";return s.jsxs("button",{onClick:()=>u(b.id),title:`${b.label} (Ctrl+${b.shortcut})`,className:"relative flex items-center gap-1.5 px-3 py-2.5 text-[12px] font-medium transition-colors duration-150",style:{background:"transparent",color:m?"var(--text-primary)":"var(--text-tertiary)",borderBottom:m?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:m?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:O=>{m||(O.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:O=>{m||(O.currentTarget.style.color="var(--text-tertiary)")},children:[s.jsx(sh,{id:b.id}),b.label,E&&s.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:h}})]},b.id)})]},p.label))})}function rh(c){const u=c.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!u)return{metadata:{},body:c};const f=u[1],o=u[2].trim(),x={},j=f.split(`
53
+ `);let p="",T=!1;for(const b of j){const m=b.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(m&&p&&T){const O=m[1],q=m[2].trim();let H=x[p];if((typeof H!="object"||Array.isArray(H))&&(H={},x[p]=H),!q)H[O]=[];else{const B=q.match(/^\[(.+)\]$/);B?H[O]=B[1].split(",").map(Y=>Y.trim().replace(/^["']|["']$/g,"")).filter(Boolean):H[O]=q.replace(/^["']|["']$/g,"")}continue}const E=b.match(/^\s+-\s+(.+)$/);if(E&&p){T=!1;const O=x[p];Array.isArray(O)?O.push(E[1].trim().replace(/^["']|["']$/g,"")):x[p]=[E[1].trim().replace(/^["']|["']$/g,"")];continue}const h=b.match(/^([\w-]+):\s*(.*)$/);if(h){p=h[1];const O=h[2].trim();if(T=!1,!O){x[p]={},T=!0;continue}const q=O.match(/^\[(.+)\]$/);if(q){x[p]=q[1].split(",").map(H=>H.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}x[p]=O.replace(/^["']|["']$/g,"")}}return{metadata:x,body:o}}function Pf(c){if(!c)return"";let u=ch(c);return u=u.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),u=u.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),u=u.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),u=u.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),u=u.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),u=u.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),u=u.replace(/\*([^*]+)\*/g,"<em>$1</em>"),u=u.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),u=u.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),u=u.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),u=u.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),u=u.replace(/\n/g,"<br/>"),u}function ch(c){const u=c.split(`
54
54
  `),f=[];let o=0;for(;o<u.length;)if(u[o].trim().startsWith("|")&&o+1<u.length&&u[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(u[o+1])){const x=Gf(u[o]);o+=2;const j=[];for(;o<u.length&&u[o].trim().startsWith("|");)j.push(Gf(u[o])),o++;const p='style="text-align:left;padding:0.4rem 0.6rem;font-weight:600;font-size:12px;color:var(--text-primary);border-bottom:1px solid var(--border-default)"',T='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let b='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';b+="<thead><tr>";for(const m of x)b+=`<th ${p}>${m}</th>`;b+="</tr></thead><tbody>";for(const m of j){b+="<tr>";for(const E of m)b+=`<td ${T}>${E}</td>`;b+="</tr>"}b+="</tbody></table>",f.push(b)}else f.push(u[o]),o++;return f.join(`
55
55
  `)}function Gf(c){return c.split("|").map(u=>u.trim()).filter(u=>u.length>0)}function em(c,u){const f=c.split(`
56
56
  `),o=u.split(`
57
- `);if(f.length>1e3||o.length>1e3)return[...f.map(E=>({type:"unchanged",content:E}))];const x=f.length,j=o.length,p=Array.from({length:x+1},()=>new Array(j+1).fill(0));for(let E=1;E<=x;E++)for(let h=1;h<=j;h++)f[E-1]===o[h-1]?p[E][h]=p[E-1][h-1]+1:p[E][h]=Math.max(p[E-1][h],p[E][h-1]);const T=[];let b=x,m=j;for(;b>0||m>0;)b>0&&m>0&&f[b-1]===o[m-1]?(T.push({type:"unchanged",content:f[b-1]}),b--,m--):m>0&&(b===0||p[b][m-1]>=p[b-1][m])?(T.push({type:"added",content:o[m-1]}),m--):(T.push({type:"removed",content:f[b-1]}),b--);return T.reverse()}function ch({plugin:c,skill:u,skillContent:f,onApplied:o}){const[x,j]=N.useState("closed"),[p,T]=N.useState(null),[b,m]=N.useState("claude-cli"),[E,h]=N.useState("opus"),[O,q]=N.useState([]),[H,B]=N.useState(""),[Y,V]=N.useState(""),[G,P]=N.useState(null),[K,se]=N.useState(!1);N.useEffect(()=>{ge.getConfig().then(R=>{T(R),R.providers.find(z=>z.id==="claude-cli"&&z.available)&&(m("claude-cli"),h("opus"))}).catch(()=>{})},[]);function re(){return p==null?void 0:p.providers.find(R=>R.id===b&&R.available)}async function ee(){j("loading"),P(null);try{const R=await ge.improveSkill(c,u,{provider:b,model:E});B(R.improved),V(R.reasoning),q(em(R.original,R.improved)),j("diff_shown")}catch(R){P(R.message),j("open")}}async function fe(){se(!0);try{await ge.applyImprovement(c,u,H),o(H),j("closed")}catch(R){P(R.message)}finally{se(!1)}}function Se(){j("closed"),q([]),B(""),V(""),P(null)}if(x==="closed")return s.jsxs("button",{onClick:()=>j("open"),className:"btn btn-secondary mb-5",disabled:!f,children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),s.jsx("path",{d:"M2 17l10 5 10-5"}),s.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const te=re();return s.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),s.jsx("path",{d:"M2 17l10 5 10-5"}),s.jsx("path",{d:"M2 12l10 5 10-5"})]})}),s.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),s.jsx("button",{onClick:Se,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:R=>{R.currentTarget.style.background="var(--surface-3)"},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),s.jsxs("div",{className:"px-5 py-4",children:[(x==="open"||x==="loading")&&s.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),s.jsx("select",{className:"input-field text-[12px] py-1.5",value:b,onChange:R=>{m(R.target.value);const J=p==null?void 0:p.providers.find(z=>z.id===R.target.value);J!=null&&J.models[0]&&h(J.models[0].id)},disabled:x==="loading",children:p==null?void 0:p.providers.filter(R=>R.available).map(R=>s.jsx("option",{value:R.id,children:R.label},R.id))})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),s.jsx("select",{className:"input-field text-[12px] py-1.5",value:E,onChange:R=>h(R.target.value),disabled:x==="loading",children:te==null?void 0:te.models.map(R=>s.jsx("option",{value:R.id,children:R.label},R.id))})]}),s.jsx("button",{onClick:ee,disabled:x==="loading",className:"btn btn-primary flex-shrink-0",children:x==="loading"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"spinner",style:{width:12,height:12}})," Improving..."]}):"Improve"})]}),G&&s.jsx("div",{className:"mb-4 px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:G}),x==="diff_shown"&&s.jsxs(s.Fragment,{children:[Y&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[s.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),Y]}),s.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:O.map((R,J)=>s.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:R.type==="added"?"rgba(34,197,94,0.1)":R.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:R.type==="added"?"var(--green)":R.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:R.type==="added"?"3px solid var(--green)":R.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[s.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:R.type==="added"?"+":R.type==="removed"?"-":" "}),R.content]},J))}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:fe,disabled:K,className:"btn btn-primary",children:K?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),s.jsx("button",{onClick:Se,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}function uh({size:c=15}){return s.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("polyline",{points:"16 18 22 12 16 6"}),s.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function oh({size:c=15}){return s.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),s.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function dh({size:c=15}){return s.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function fh(){const{state:c,dispatch:u,saveContent:f}=Al(),{plugin:o,skill:x,skillContent:j,isDirty:p,improveTarget:T}=c,[b,m]=N.useState("split"),[E,h]=N.useState(!1),O=N.useRef(null),{metadata:q,body:H}=ih(j),B=q["allowed-tools"],Y=Array.isArray(B)?B:typeof B=="string"?[B]:[],V=q.name,G=q.description,P=q.metadata,K=typeof P=="object"&&!Array.isArray(P)?P:null,se=q.version||(K==null?void 0:K.version),re=q.tags||(K==null?void 0:K.tags),ee=Array.isArray(re)?re:typeof re=="string"?re.split(",").map(z=>z.trim()).filter(Boolean):[],fe=new Set(["name","description","metadata","allowed-tools","version","tags"]),Se=Object.entries(q).filter(([z])=>!fe.has(z)),te=N.useCallback(async()=>{h(!0),await f(),h(!1)},[f]),R=N.useCallback(z=>{(z.ctrlKey||z.metaKey)&&z.key==="s"&&(z.preventDefault(),z.stopPropagation(),p&&te())},[p,te]),J=[{mode:"raw",icon:s.jsx(uh,{}),label:"Editor"},{mode:"split",icon:s.jsx(oh,{}),label:"Split"},{mode:"preview",icon:s.jsx(dh,{}),label:"Preview"}];return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[s.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:J.map(({mode:z,icon:$,label:ie})=>s.jsxs("button",{onClick:()=>m(z),title:ie,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:b===z?"var(--surface-4)":"transparent",color:b===z?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:b===z?600:400,border:"none",cursor:"pointer"},children:[$,s.jsx("span",{style:{letterSpacing:"0.01em"},children:ie})]},z))}),s.jsxs("div",{className:"flex items-center gap-2",children:[p&&s.jsx("button",{onClick:()=>u({type:"SET_CONTENT",content:c.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),s.jsx("button",{onClick:te,disabled:!p||E,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:E?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]})]}),s.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:b==="raw"||b==="preview"?"1fr":"1fr 1fr"},children:[b!=="preview"&&s.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:b==="split"?"1px solid var(--border-subtle)":"none"},children:s.jsx("textarea",{ref:O,value:j,onChange:z=>u({type:"SET_CONTENT",content:z.target.value}),onKeyDown:R,spellCheck:!1,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px"}})}),b!=="raw"&&s.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:s.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(V||se||G)&&s.jsxs("div",{style:{marginBottom:20},children:[s.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[V&&s.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:V}),se&&s.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",se]})]}),G&&s.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:G})]}),ee.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ee.map(z=>s.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:z},z))}),Y.length>0&&s.jsx("div",{style:{marginBottom:16},children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Y.map(z=>s.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:z},z))]})}),Se.length>0&&s.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Se.map(([z,$],ie)=>{const k=Array.isArray($)?$.join(", "):typeof $=="object"?Object.entries($).map(([Q,ae])=>`${Q}: ${Array.isArray(ae)?ae.join(", "):ae}`).join(" | "):$;return s.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:ie>0?"1px solid var(--border-subtle)":"none"},children:[s.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:z}),s.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:k})]},z)})}),(V||G||ee.length>0||Y.length>0||Se.length>0)&&H&&s.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),H&&s.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Pf(H)}})]})})]}),T!==null&&o&&x&&s.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:s.jsx(ch,{plugin:o,skill:x,skillContent:j,onApplied:z=>{u({type:"SET_CONTENT",content:z}),u({type:"CONTENT_SAVED"}),u({type:"CLOSE_IMPROVE"})}})})]})}function Tc(c){return c>=.8?"var(--green)":c>=.5?"var(--yellow)":"var(--red)"}function tm(c){const u=new Date(c);return u.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+u.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function lm(c){return c==null?"--":c>=1e3?`${(c/1e3).toFixed(1)}s`:`${c}ms`}function am({entries:c}){if(c.length<2)return null;const u=80,f=24,o=2,x=c.slice().reverse(),j=x.length,p=x.map((T,b)=>{const m=o+b/(j-1)*(u-o*2),E=o+(f-o*2)-T.pass_rate*(f-o*2);return`${m},${E}`});return s.jsxs("svg",{width:u,height:f,style:{display:"block",flexShrink:0},children:[s.jsx("polyline",{points:p.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),p.length>0&&s.jsx("circle",{cx:parseFloat(p[p.length-1].split(",")[0]),cy:parseFloat(p[p.length-1].split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function mh(){var V;const{state:c,dispatch:u,saveEvals:f,runCase:o,cancelCase:x,generateEvals:j}=Al(),{evals:p,selectedCaseId:T,inlineResults:b,caseRunStates:m}=c,[E,h]=N.useState(!1),[O,q]=N.useState(!1),H=(p==null?void 0:p.evals)??[],B=H.find(G=>G.id===T)??null,Y=N.useCallback(async()=>{q(!0),await j(),q(!1)},[j]);return!p||H.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:s.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M9 11l3 3L22 4"}),s.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),s.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>h(!0),className:"btn btn-primary text-[12px]",children:"Create Test Case"}),s.jsx("button",{onClick:Y,disabled:O,className:"btn btn-secondary text-[12px]",children:O?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate with AI"})]}),E&&p&&s.jsx(Qf,{evals:p,onSave:G=>{f(G),h(!1)},onCancel:()=>h(!1)})]}):s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[s.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[s.jsxs("div",{className:"px-3 py-2 text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",borderBottom:"1px solid var(--border-subtle)"},children:["Test Cases (",H.length,")"]}),s.jsx("div",{className:"py-1",children:H.map(G=>{const P=b.get(G.id),K=T===G.id;return s.jsxs("button",{onClick:()=>u({type:"SELECT_CASE",caseId:G.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:K?"var(--accent-muted)":"transparent",borderLeft:K?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:se=>{K||(se.currentTarget.style.background="var(--surface-2)")},onMouseLeave:se=>{K||(se.currentTarget.style.background="transparent")},children:[s.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[s.jsxs("span",{className:"text-[12px] font-medium truncate",style:{color:K?"var(--text-primary)":"var(--text-secondary)"},children:["#",G.id," ",G.name]}),s.jsx(nm,{result:P})]}),s.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[G.assertions.length," assertion",G.assertions.length!==1?"s":"",(P==null?void 0:P.passRate)!=null&&s.jsx(hh,{passRate:P.passRate})]})]},G.id)})}),s.jsx("div",{className:"px-3 py-2",children:s.jsx("button",{onClick:()=>h(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:G=>{G.currentTarget.style.borderColor="var(--accent)",G.currentTarget.style.color="var(--accent)"},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-default)",G.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})})]}),s.jsx("div",{className:"overflow-auto",children:B?s.jsx(xh,{evalCase:B,result:b.get(B.id),evals:p,caseStatus:((V=m.get(B.id))==null?void 0:V.status)??"idle",onSaveEvals:f,onRun:G=>o(G,"benchmark"),onCompare:G=>o(G,"comparison"),onCancel:G=>x(G),onImprove:G=>u({type:"OPEN_IMPROVE",evalId:G})}):s.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),E&&p&&s.jsx(Qf,{evals:p,onSave:G=>{f(G),h(!1)},onCancel:()=>h(!1)})]})}function xh({evalCase:c,result:u,evals:f,caseStatus:o,onSaveEvals:x,onRun:j,onCompare:p,onCancel:T,onImprove:b}){const[m,E]=N.useState(!1),[h,O]=N.useState(c.prompt),[q,H]=N.useState(!1),[B,Y]=N.useState(c.expected_output);N.useState(()=>{O(c.prompt),Y(c.expected_output)});const V=N.useCallback(te=>{x({...f,evals:f.evals.map(R=>R.id===te.id?te:R)})},[f,x]),G=N.useCallback(()=>{V({...c,prompt:h}),E(!1)},[c,h,V]),P=N.useCallback(()=>{V({...c,expected_output:B}),H(!1)},[c,B,V]),K=N.useCallback(()=>{V({...c,assertions:[...c.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[c,V]),se=N.useCallback((te,R)=>{V({...c,assertions:c.assertions.map(J=>J.id===te?{...J,text:R}:J)})},[c,V]),re=N.useCallback(te=>{V({...c,assertions:c.assertions.filter(R=>R.id!==te)})},[c,V]),ee=N.useCallback(()=>{confirm("Delete this test case?")&&x({...f,evals:f.evals.filter(te=>te.id!==c.id)})},[f,c.id,x]),fe=u&&u.assertions.length>0&&u.assertions.every(te=>te.pass),Se=u&&u.assertions.some(te=>!te.pass);return s.jsxs("div",{className:"p-5 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",c.id," ",c.name]}),s.jsx(nm,{result:u})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?s.jsxs("button",{onClick:()=>T(c.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:s.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>j(c.id),className:"btn btn-primary text-[12px]",children:"Run"}),s.jsx("button",{onClick:()=>p(c.id),className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),Se&&o!=="running"&&o!=="queued"&&s.jsx("button",{onClick:()=>b(c.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),o!=="running"&&o!=="queued"&&s.jsx("button",{onClick:ee,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),fe&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid rgba(52, 211, 153, 0.2)"},children:[s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[s.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),s.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),s.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),s.jsx(yc,{title:"Prompt",children:m?s.jsxs("div",{children:[s.jsx("textarea",{value:h,onChange:te=>O(te.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),s.jsxs("div",{className:"flex gap-2 mt-2",children:[s.jsx("button",{onClick:G,className:"btn btn-primary text-[12px]",children:"Save"}),s.jsx("button",{onClick:()=>{O(c.prompt),E(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):s.jsx("div",{className:"p-3 rounded-lg text-[12px] cursor-pointer transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)"},onClick:()=>E(!0),onMouseEnter:te=>{te.currentTarget.style.borderColor="var(--border-hover)"},onMouseLeave:te=>{te.currentTarget.style.borderColor="var(--border-subtle)"},children:c.prompt||s.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:"Click to edit prompt..."})})}),s.jsx(yc,{title:"Expected Output",children:q?s.jsxs("div",{children:[s.jsx("textarea",{value:B,onChange:te=>Y(te.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),s.jsxs("div",{className:"flex gap-2 mt-2",children:[s.jsx("button",{onClick:P,className:"btn btn-primary text-[12px]",children:"Save"}),s.jsx("button",{onClick:()=>{Y(c.expected_output),H(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):s.jsx("div",{className:"p-3 rounded-lg text-[12px] cursor-pointer transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)"},onClick:()=>H(!0),onMouseEnter:te=>{te.currentTarget.style.borderColor="var(--border-hover)"},onMouseLeave:te=>{te.currentTarget.style.borderColor="var(--border-subtle)"},children:c.expected_output||s.jsx("span",{style:{fontStyle:"italic"},children:"Click to edit expected output..."})})}),s.jsx(yc,{title:`Assertions (${c.assertions.length})`,action:s.jsx("button",{onClick:K,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:c.assertions.length===0?s.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):s.jsx("div",{className:"space-y-2",children:c.assertions.map(te=>{const R=u==null?void 0:u.assertions.find(J=>J.assertion_id===te.id);return s.jsx(vh,{assertion:te,result:R,onUpdate:J=>se(te.id,J),onDelete:()=>re(te.id)},te.id)})})}),(u==null?void 0:u.output)&&s.jsx(ph,{output:u.output,durationMs:u.durationMs,tokens:u.tokens}),s.jsx(yh,{evalId:c.id})]},c.id)}function vh({assertion:c,result:u,onUpdate:f,onDelete:o}){const[x,j]=N.useState(!1),[p,T]=N.useState(c.text),[b,m]=N.useState(!1),E=()=>{f(p),j(!1)};return s.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:s.jsxs("div",{className:"flex items-start gap-2",children:[u?s.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:u.pass?"var(--green-muted)":"var(--red-muted)"},children:u.pass?s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}):s.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):s.jsx("span",{className:"mt-0.5 w-[18px] h-[18px] rounded-full flex-shrink-0",style:{background:"var(--surface-4)"}}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:s.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:c.id})}),x?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:p,onChange:h=>T(h.target.value),onKeyDown:h=>{h.key==="Enter"&&E(),h.key==="Escape"&&j(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),s.jsx("button",{onClick:E,className:"btn btn-primary text-[11px]",children:"Save"})]}):s.jsx("div",{className:"text-[12px] cursor-pointer",style:{color:"var(--text-secondary)"},onClick:()=>{T(c.text),j(!0)},children:c.text}),(u==null?void 0:u.reasoning)&&s.jsx("button",{onClick:()=>m(!b),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:b?"Hide reasoning":"Show reasoning"}),b&&(u==null?void 0:u.reasoning)&&s.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:u.reasoning})]}),s.jsx("button",{onClick:o,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:h=>{h.currentTarget.style.color="var(--red)",h.currentTarget.style.opacity="1"},onMouseLeave:h=>{h.currentTarget.style.color="var(--text-tertiary)",h.currentTarget.style.opacity=""},children:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function yc({title:c,action:u,children:f}){return s.jsxs("div",{className:"mb-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:c}),u]}),f]})}function nm({result:c}){if(!c||c.status==null)return s.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const u=c.status==="pass";return s.jsx("span",{className:"pill text-[10px]",style:{background:u?"var(--green-muted)":"var(--red-muted)",color:u?"var(--green)":"var(--red)"},children:c.passRate!=null?`${Math.round(c.passRate*100)}%`:c.status})}function hh({passRate:c}){const u=Math.round(c*100);return s.jsx("div",{className:"flex items-center gap-1",children:s.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:s.jsx("div",{className:"h-full rounded-full",style:{width:`${u}%`,background:u>=80?"var(--green)":u>=50?"var(--yellow)":"var(--red)"}})})})}function ph({output:c,durationMs:u,tokens:f}){const[o,x]=N.useState(!1);return s.jsxs("div",{className:"mb-5",children:[s.jsxs("button",{onClick:()=>x(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:s.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",u!=null&&s.jsxs("span",{style:{fontWeight:400},children:["(",(u/1e3).toFixed(1),"s)"]}),f!=null&&s.jsxs("span",{style:{fontWeight:400},children:["(",f," tokens)"]})]}),o&&s.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:c})]})}function yh({evalId:c}){const{state:u,dispatch:f}=Al(),{plugin:o,skill:x}=u,[j,p]=N.useState(!0),[T,b]=N.useState(!1),[m,E]=N.useState({}),h=m[c]??null,O=N.useCallback(async B=>{b(!0);try{const Y=await ge.getCaseHistory(o,x,B);E(V=>({...V,[B]:Y}))}catch{E(Y=>({...Y,[B]:[]}))}finally{b(!1)}},[o,x]);N.useEffect(()=>{j&&!m[c]&&O(c)},[c,o,x]);const q=N.useCallback(()=>{const B=!j;p(B),B&&!m[c]&&O(c)},[j,c,m,O]),H=h?h.slice(0,10):[];return s.jsxs("div",{className:"mb-5",children:[s.jsxs("button",{onClick:q,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:j?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:s.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",h&&h.length>0&&s.jsxs("span",{style:{fontWeight:400},children:["(",h.length," run",h.length!==1?"s":"",")"]})]}),j&&s.jsx("div",{className:"animate-fade-in",children:T?s.jsxs("div",{className:"flex items-center gap-2 py-3",children:[s.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),s.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!h||h.length===0?s.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):s.jsxs("div",{children:[H.length>=2&&s.jsx("div",{className:"mb-2",children:s.jsx(am,{entries:H})}),s.jsx("div",{className:"space-y-2",children:H.map((B,Y)=>s.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:tm(B.timestamp)}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:B.model}),s.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:B.type==="benchmark"?"rgba(99,131,255,0.15)":B.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:B.type==="benchmark"?"#6383ff":B.type==="comparison"?"var(--purple)":"#fb923c"},children:B.type}),s.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Tc(B.pass_rate)},children:[Math.round(B.pass_rate*100),"%"]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[B.durationMs!=null&&s.jsx("span",{children:lm(B.durationMs)}),B.tokens!=null&&s.jsxs("span",{children:[B.tokens>=1e3?`${(B.tokens/1e3).toFixed(1)}k`:B.tokens," tok"]})]}),s.jsx("div",{className:"space-y-0.5",children:B.assertions.map(V=>s.jsxs("div",{className:"flex items-start gap-1.5",children:[s.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:V.pass?"var(--green-muted)":"var(--red-muted)"},children:V.pass?s.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}):s.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:V.text})]},V.id))})]},Y))}),s.jsx("button",{onClick:()=>f({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:B=>{B.currentTarget.style.textDecoration="underline"},onMouseLeave:B=>{B.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Qf({evals:c,onSave:u,onCancel:f}){const[o,x]=N.useState(""),[j,p]=N.useState(""),[T,b]=N.useState(""),[m,E]=N.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),h=Math.max(0,...c.evals.map(q=>q.id))+1,O=()=>{if(!o.trim()||!j.trim())return;const q={id:h,name:o.trim(),prompt:j.trim(),expected_output:T.trim(),files:[],assertions:m.filter(H=>H.text.trim())};u({...c,evals:[...c.evals,q]})};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:s.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),s.jsxs("label",{className:"block mb-3",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),s.jsx("input",{value:o,onChange:q=>x(q.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),s.jsxs("label",{className:"block mb-3",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),s.jsx("textarea",{value:j,onChange:q=>p(q.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),s.jsxs("label",{className:"block mb-3",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),s.jsx("textarea",{value:T,onChange:q=>b(q.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),s.jsxs("div",{className:"mb-4",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),m.map((q,H)=>s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx("input",{value:q.text,onChange:B=>E(m.map((Y,V)=>V===H?{...Y,text:B.target.value}:Y)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),m.length>1&&s.jsx("button",{onClick:()=>E(m.filter((B,Y)=>Y!==H)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},q.id)),s.jsx("button",{onClick:()=>E([...m,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:f,className:"btn btn-secondary text-[12px]",children:"Cancel"}),s.jsx("button",{onClick:O,disabled:!o.trim()||!j.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function gh(){const{state:c,runCase:u,runAll:f,cancelCase:o,cancelAll:x}=Al(),{evals:j,caseRunStates:p,bulkRunActive:T,runMode:b,latestBenchmark:m,inlineResults:E}=c,h=(j==null?void 0:j.evals)??[],O=N.useMemo(()=>{for(const B of p.values())if(B.status==="running"||B.status==="queued")return!0;return!1},[p]),q=h.filter(B=>{const Y=p.get(B.id);return Y&&(Y.status==="complete"||Y.status==="error"||Y.status==="cancelled")}).length,H=h.filter(B=>{const Y=p.get(B.id);return Y&&(Y.status==="running"||Y.status==="queued")}).length;return s.jsxs("div",{className:"p-5",children:[s.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),O&&s.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[H," running"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[O&&s.jsxs("button",{onClick:x,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:s.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),s.jsx("button",{onClick:()=>f("comparison"),disabled:h.length===0||O,className:"btn btn-primary text-[12px]",children:"Compare All"}),s.jsx("button",{onClick:()=>f("benchmark"),disabled:h.length===0||O,className:"btn btn-secondary text-[12px]",children:"Skill Only"}),s.jsx("button",{onClick:()=>f("baseline"),disabled:h.length===0||O,className:"btn btn-secondary text-[12px]",children:"Baseline Only"})]})]}),O&&h.length>0&&s.jsxs("div",{className:"mb-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",q,"/",h.length," cases"]}),s.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(q/h.length*100),"%"]})]}),s.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${q/h.length*100}%`,background:"var(--accent)"}})})]}),s.jsx("div",{className:"space-y-3 stagger-children",children:h.map(B=>{var G;const Y=E.get(B.id),V=((G=p.get(B.id))==null?void 0:G.status)??"idle";return s.jsx(jh,{name:B.name,evalId:B.id,result:Y,caseStatus:V,runMode:b,onRun:P=>u(P,"benchmark"),onBaseline:P=>u(P,"baseline"),onCompare:P=>u(P,"comparison"),onCancel:P=>o(P)},B.id)})}),!O&&m&&m.cases.length>0&&s.jsxs("div",{className:"mt-5",children:[s.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Overall Pass Rate"}),s.jsx("span",{className:"text-[20px] font-bold",style:{color:(m.overall_pass_rate??0)>=.8?"var(--green)":(m.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:m.overall_pass_rate!=null?`${Math.round(m.overall_pass_rate*100)}%`:"--"})]}),m.totalDurationMs!=null&&s.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(m.totalDurationMs/1e3).toFixed(1),"s",m.model&&` | Model: ${m.model}`]})]}),m.comparison&&s.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Xf,{label:"Skill",value:m.comparison.skillPassRate,color:"var(--accent)"}),s.jsx(Xf,{label:"Baseline",value:m.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),s.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:m.comparison.delta>0?"var(--green)":m.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",m.comparison.delta>0?"+":"",(m.comparison.delta*100).toFixed(1),"%",m.verdict&&` | ${m.verdict}`]})]})]})]})}const bh={benchmark:{label:"Skill",bg:"var(--accent-muted)",color:"var(--accent)"},baseline:{label:"Baseline",bg:"var(--surface-3)",color:"var(--text-tertiary)"},comparison:{label:"Compare",bg:"rgba(168,85,247,0.12)",color:"rgb(168,85,247)"}};function jh({name:c,evalId:u,result:f,caseStatus:o,runMode:x,onRun:j,onBaseline:p,onCompare:T,onCancel:b}){const[m,E]=N.useState(!1),h=o==="running"||o==="queued",O=o==="complete"||o==="error";return s.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:h?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:h?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"&&s.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),o==="queued"&&s.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),s.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",u," ",c]}),x&&(h||O)&&(()=>{const q=bh[x];return q?s.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:q.bg,color:q.color,padding:"1px 6px"},children:q.label}):null})()]}),s.jsxs("div",{className:"flex items-center gap-2",children:[h?s.jsx("button",{onClick:()=>b(u),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel"}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>T(u),className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),s.jsx("button",{onClick:()=>j(u),className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),s.jsx("button",{onClick:()=>p(u),className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),f&&f.status!=null&&s.jsx("span",{className:"pill text-[10px]",style:{background:f.status==="pass"?"var(--green-muted)":(f.status==="error","var(--red-muted)"),color:f.status==="pass"?"var(--green)":"var(--red)"},children:f.passRate!=null?`${Math.round(f.passRate*100)}%`:f.status}),o==="cancelled"&&s.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),f&&f.assertions.length>0&&s.jsxs("div",{className:"px-4 pb-3",children:[s.jsx("div",{className:"space-y-1",children:f.assertions.map(q=>s.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[s.jsx("span",{style:{color:q.pass?"var(--green)":"var(--red)"},children:q.pass?"PASS":"FAIL"}),s.jsx("span",{style:{color:"var(--text-secondary)"},children:q.text})]},q.assertion_id))}),f.output&&s.jsx("button",{onClick:()=>E(!m),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:m?"Hide output":"Show output"}),m&&f.output&&s.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:f.output})]}),f&&f.errorMessage&&s.jsx("div",{className:"px-4 pb-3",children:s.jsx("div",{className:"text-[11px] p-2 rounded-lg",style:{background:"var(--red-muted)",color:"var(--red)"},children:f.errorMessage})})]})}function Xf({label:c,value:u,color:f}){return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:c}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:f},children:[Math.round(u*100),"%"]})]}),s.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u*100}%`,background:f}})})]})}const Vf={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"rgba(52,211,153,0.06)",text:"rgba(52,211,153,0.6)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"rgba(248,113,113,0.06)",text:"rgba(248,113,113,0.6)"}},Sh=[{label:"Should activate",prompts:["+How do I use this feature?","+Show me best practices for this","+What's the recommended approach?"]},{label:"Should NOT activate",prompts:["!What's the weather today?","!Write me a poem","!How do I cook pasta?"]}];function Nh(){const{state:c,dispatch:u,runActivationTest:f}=Al(),{plugin:o,skill:x,activationPrompts:j,activationResults:p,activationSummary:T,activationRunning:b,activationError:m}=c,[E,h]=N.useState(j),[O,q]=N.useState(null),[H,B]=N.useState(!1);N.useEffect(()=>{u({type:"SET_ACTIVATION_PROMPTS",prompts:E})},[E,u]),N.useEffect(()=>{fetch(`/api/skills/${o}/${x}/description`).then(K=>K.json()).then(K=>q(K.rawContent||K.description||null)).catch(()=>q(null))},[o,x]);function Y(){f(E)}function V(K){const se=E.trim(),re=se?`${se}
57
+ `);if(f.length>1e3||o.length>1e3)return[...f.map(E=>({type:"unchanged",content:E}))];const x=f.length,j=o.length,p=Array.from({length:x+1},()=>new Array(j+1).fill(0));for(let E=1;E<=x;E++)for(let h=1;h<=j;h++)f[E-1]===o[h-1]?p[E][h]=p[E-1][h-1]+1:p[E][h]=Math.max(p[E-1][h],p[E][h-1]);const T=[];let b=x,m=j;for(;b>0||m>0;)b>0&&m>0&&f[b-1]===o[m-1]?(T.push({type:"unchanged",content:f[b-1]}),b--,m--):m>0&&(b===0||p[b][m-1]>=p[b-1][m])?(T.push({type:"added",content:o[m-1]}),m--):(T.push({type:"removed",content:f[b-1]}),b--);return T.reverse()}function uh({plugin:c,skill:u,skillContent:f,onApplied:o}){const[x,j]=N.useState("closed"),[p,T]=N.useState(null),[b,m]=N.useState("claude-cli"),[E,h]=N.useState("opus"),[O,q]=N.useState([]),[H,B]=N.useState(""),[Y,V]=N.useState(""),[G,P]=N.useState(null),[K,se]=N.useState(!1);N.useEffect(()=>{ge.getConfig().then(R=>{T(R),R.providers.find(z=>z.id==="claude-cli"&&z.available)&&(m("claude-cli"),h("opus"))}).catch(()=>{})},[]);function re(){return p==null?void 0:p.providers.find(R=>R.id===b&&R.available)}async function ee(){j("loading"),P(null);try{const R=await ge.improveSkill(c,u,{provider:b,model:E});B(R.improved),V(R.reasoning),q(em(R.original,R.improved)),j("diff_shown")}catch(R){P(R.message),j("open")}}async function fe(){se(!0);try{await ge.applyImprovement(c,u,H),o(H),j("closed")}catch(R){P(R.message)}finally{se(!1)}}function Se(){j("closed"),q([]),B(""),V(""),P(null)}if(x==="closed")return s.jsxs("button",{onClick:()=>j("open"),className:"btn btn-secondary mb-5",disabled:!f,children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),s.jsx("path",{d:"M2 17l10 5 10-5"}),s.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const te=re();return s.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),s.jsx("path",{d:"M2 17l10 5 10-5"}),s.jsx("path",{d:"M2 12l10 5 10-5"})]})}),s.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),s.jsx("button",{onClick:Se,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:R=>{R.currentTarget.style.background="var(--surface-3)"},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),s.jsxs("div",{className:"px-5 py-4",children:[(x==="open"||x==="loading")&&s.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),s.jsx("select",{className:"input-field text-[12px] py-1.5",value:b,onChange:R=>{m(R.target.value);const J=p==null?void 0:p.providers.find(z=>z.id===R.target.value);J!=null&&J.models[0]&&h(J.models[0].id)},disabled:x==="loading",children:p==null?void 0:p.providers.filter(R=>R.available).map(R=>s.jsx("option",{value:R.id,children:R.label},R.id))})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),s.jsx("select",{className:"input-field text-[12px] py-1.5",value:E,onChange:R=>h(R.target.value),disabled:x==="loading",children:te==null?void 0:te.models.map(R=>s.jsx("option",{value:R.id,children:R.label},R.id))})]}),s.jsx("button",{onClick:ee,disabled:x==="loading",className:"btn btn-primary flex-shrink-0",children:x==="loading"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"spinner",style:{width:12,height:12}})," Improving..."]}):"Improve"})]}),G&&s.jsx("div",{className:"mb-4 px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:G}),x==="diff_shown"&&s.jsxs(s.Fragment,{children:[Y&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[s.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),Y]}),s.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:O.map((R,J)=>s.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:R.type==="added"?"rgba(34,197,94,0.1)":R.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:R.type==="added"?"var(--green)":R.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:R.type==="added"?"3px solid var(--green)":R.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[s.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:R.type==="added"?"+":R.type==="removed"?"-":" "}),R.content]},J))}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:fe,disabled:K,className:"btn btn-primary",children:K?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),s.jsx("button",{onClick:Se,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}function oh({size:c=15}){return s.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("polyline",{points:"16 18 22 12 16 6"}),s.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function dh({size:c=15}){return s.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),s.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function fh({size:c=15}){return s.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function mh(){const{state:c,dispatch:u,saveContent:f}=Al(),{plugin:o,skill:x,skillContent:j,isDirty:p,improveTarget:T}=c,[b,m]=N.useState("split"),[E,h]=N.useState(!1),O=N.useRef(null),{metadata:q,body:H}=rh(j),B=q["allowed-tools"],Y=Array.isArray(B)?B:typeof B=="string"?[B]:[],V=q.name,G=q.description,P=q.metadata,K=typeof P=="object"&&!Array.isArray(P)?P:null,se=q.version||(K==null?void 0:K.version),re=q.tags||(K==null?void 0:K.tags),ee=Array.isArray(re)?re:typeof re=="string"?re.split(",").map(z=>z.trim()).filter(Boolean):[],fe=new Set(["name","description","metadata","allowed-tools","version","tags"]),Se=Object.entries(q).filter(([z])=>!fe.has(z)),te=N.useCallback(async()=>{h(!0),await f(),h(!1)},[f]),R=N.useCallback(z=>{(z.ctrlKey||z.metaKey)&&z.key==="s"&&(z.preventDefault(),z.stopPropagation(),p&&te())},[p,te]),J=[{mode:"raw",icon:s.jsx(oh,{}),label:"Editor"},{mode:"split",icon:s.jsx(dh,{}),label:"Split"},{mode:"preview",icon:s.jsx(fh,{}),label:"Preview"}];return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[s.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:J.map(({mode:z,icon:$,label:ie})=>s.jsxs("button",{onClick:()=>m(z),title:ie,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:b===z?"var(--surface-4)":"transparent",color:b===z?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:b===z?600:400,border:"none",cursor:"pointer"},children:[$,s.jsx("span",{style:{letterSpacing:"0.01em"},children:ie})]},z))}),s.jsxs("div",{className:"flex items-center gap-2",children:[p&&s.jsx("button",{onClick:()=>u({type:"SET_CONTENT",content:c.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),s.jsx("button",{onClick:te,disabled:!p||E,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:E?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]})]}),s.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:b==="raw"||b==="preview"?"1fr":"1fr 1fr"},children:[b!=="preview"&&s.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:b==="split"?"1px solid var(--border-subtle)":"none"},children:s.jsx("textarea",{ref:O,value:j,onChange:z=>u({type:"SET_CONTENT",content:z.target.value}),onKeyDown:R,spellCheck:!1,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px"}})}),b!=="raw"&&s.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:s.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(V||se||G)&&s.jsxs("div",{style:{marginBottom:20},children:[s.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[V&&s.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:V}),se&&s.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",se]})]}),G&&s.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:G})]}),ee.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ee.map(z=>s.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:z},z))}),Y.length>0&&s.jsx("div",{style:{marginBottom:16},children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Y.map(z=>s.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:z},z))]})}),Se.length>0&&s.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Se.map(([z,$],ie)=>{const k=Array.isArray($)?$.join(", "):typeof $=="object"?Object.entries($).map(([Q,ae])=>`${Q}: ${Array.isArray(ae)?ae.join(", "):ae}`).join(" | "):$;return s.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:ie>0?"1px solid var(--border-subtle)":"none"},children:[s.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:z}),s.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:k})]},z)})}),(V||G||ee.length>0||Y.length>0||Se.length>0)&&H&&s.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),H&&s.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Pf(H)}})]})})]}),T!==null&&o&&x&&s.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:s.jsx(uh,{plugin:o,skill:x,skillContent:j,onApplied:z=>{u({type:"SET_CONTENT",content:z}),u({type:"CONTENT_SAVED"}),u({type:"CLOSE_IMPROVE"})}})})]})}function Tc(c){return c>=.8?"var(--green)":c>=.5?"var(--yellow)":"var(--red)"}function tm(c){const u=new Date(c);return u.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+u.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function lm(c){return c==null?"--":c>=1e3?`${(c/1e3).toFixed(1)}s`:`${c}ms`}function am({entries:c}){if(c.length<2)return null;const u=80,f=24,o=2,x=c.slice().reverse(),j=x.length,p=x.map((T,b)=>{const m=o+b/(j-1)*(u-o*2),E=o+(f-o*2)-T.pass_rate*(f-o*2);return`${m},${E}`});return s.jsxs("svg",{width:u,height:f,style:{display:"block",flexShrink:0},children:[s.jsx("polyline",{points:p.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),p.length>0&&s.jsx("circle",{cx:parseFloat(p[p.length-1].split(",")[0]),cy:parseFloat(p[p.length-1].split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function xh(){var V;const{state:c,dispatch:u,saveEvals:f,runCase:o,cancelCase:x,generateEvals:j}=Al(),{evals:p,selectedCaseId:T,inlineResults:b,caseRunStates:m}=c,[E,h]=N.useState(!1),[O,q]=N.useState(!1),H=(p==null?void 0:p.evals)??[],B=H.find(G=>G.id===T)??null,Y=N.useCallback(async()=>{q(!0),await j(),q(!1)},[j]);return!p||H.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:s.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M9 11l3 3L22 4"}),s.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),s.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>h(!0),className:"btn btn-primary text-[12px]",children:"Create Test Case"}),s.jsx("button",{onClick:Y,disabled:O,className:"btn btn-secondary text-[12px]",children:O?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate with AI"})]}),E&&p&&s.jsx(Qf,{evals:p,onSave:G=>{f(G),h(!1)},onCancel:()=>h(!1)})]}):s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[s.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[s.jsxs("div",{className:"px-3 py-2 text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",borderBottom:"1px solid var(--border-subtle)"},children:["Test Cases (",H.length,")"]}),s.jsx("div",{className:"py-1",children:H.map(G=>{const P=b.get(G.id),K=T===G.id;return s.jsxs("button",{onClick:()=>u({type:"SELECT_CASE",caseId:G.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:K?"var(--accent-muted)":"transparent",borderLeft:K?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:se=>{K||(se.currentTarget.style.background="var(--surface-2)")},onMouseLeave:se=>{K||(se.currentTarget.style.background="transparent")},children:[s.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[s.jsxs("span",{className:"text-[12px] font-medium truncate",style:{color:K?"var(--text-primary)":"var(--text-secondary)"},children:["#",G.id," ",G.name]}),s.jsx(nm,{result:P})]}),s.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[G.assertions.length," assertion",G.assertions.length!==1?"s":"",(P==null?void 0:P.passRate)!=null&&s.jsx(ph,{passRate:P.passRate})]})]},G.id)})}),s.jsx("div",{className:"px-3 py-2",children:s.jsx("button",{onClick:()=>h(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:G=>{G.currentTarget.style.borderColor="var(--accent)",G.currentTarget.style.color="var(--accent)"},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-default)",G.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})})]}),s.jsx("div",{className:"overflow-auto",children:B?s.jsx(vh,{evalCase:B,result:b.get(B.id),evals:p,caseStatus:((V=m.get(B.id))==null?void 0:V.status)??"idle",onSaveEvals:f,onRun:G=>o(G,"benchmark"),onCompare:G=>o(G,"comparison"),onCancel:G=>x(G),onImprove:G=>u({type:"OPEN_IMPROVE",evalId:G})}):s.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),E&&p&&s.jsx(Qf,{evals:p,onSave:G=>{f(G),h(!1)},onCancel:()=>h(!1)})]})}function vh({evalCase:c,result:u,evals:f,caseStatus:o,onSaveEvals:x,onRun:j,onCompare:p,onCancel:T,onImprove:b}){const[m,E]=N.useState(!1),[h,O]=N.useState(c.prompt),[q,H]=N.useState(!1),[B,Y]=N.useState(c.expected_output);N.useState(()=>{O(c.prompt),Y(c.expected_output)});const V=N.useCallback(te=>{x({...f,evals:f.evals.map(R=>R.id===te.id?te:R)})},[f,x]),G=N.useCallback(()=>{V({...c,prompt:h}),E(!1)},[c,h,V]),P=N.useCallback(()=>{V({...c,expected_output:B}),H(!1)},[c,B,V]),K=N.useCallback(()=>{V({...c,assertions:[...c.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[c,V]),se=N.useCallback((te,R)=>{V({...c,assertions:c.assertions.map(J=>J.id===te?{...J,text:R}:J)})},[c,V]),re=N.useCallback(te=>{V({...c,assertions:c.assertions.filter(R=>R.id!==te)})},[c,V]),ee=N.useCallback(()=>{confirm("Delete this test case?")&&x({...f,evals:f.evals.filter(te=>te.id!==c.id)})},[f,c.id,x]),fe=u&&u.assertions.length>0&&u.assertions.every(te=>te.pass),Se=u&&u.assertions.some(te=>!te.pass);return s.jsxs("div",{className:"p-5 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",c.id," ",c.name]}),s.jsx(nm,{result:u})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?s.jsxs("button",{onClick:()=>T(c.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:s.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>j(c.id),className:"btn btn-primary text-[12px]",children:"Run"}),s.jsx("button",{onClick:()=>p(c.id),className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),Se&&o!=="running"&&o!=="queued"&&s.jsx("button",{onClick:()=>b(c.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),o!=="running"&&o!=="queued"&&s.jsx("button",{onClick:ee,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),fe&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid rgba(52, 211, 153, 0.2)"},children:[s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[s.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),s.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),s.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),s.jsx(yc,{title:"Prompt",children:m?s.jsxs("div",{children:[s.jsx("textarea",{value:h,onChange:te=>O(te.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),s.jsxs("div",{className:"flex gap-2 mt-2",children:[s.jsx("button",{onClick:G,className:"btn btn-primary text-[12px]",children:"Save"}),s.jsx("button",{onClick:()=>{O(c.prompt),E(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):s.jsx("div",{className:"p-3 rounded-lg text-[12px] cursor-pointer transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)"},onClick:()=>E(!0),onMouseEnter:te=>{te.currentTarget.style.borderColor="var(--border-hover)"},onMouseLeave:te=>{te.currentTarget.style.borderColor="var(--border-subtle)"},children:c.prompt||s.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:"Click to edit prompt..."})})}),s.jsx(yc,{title:"Expected Output",children:q?s.jsxs("div",{children:[s.jsx("textarea",{value:B,onChange:te=>Y(te.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),s.jsxs("div",{className:"flex gap-2 mt-2",children:[s.jsx("button",{onClick:P,className:"btn btn-primary text-[12px]",children:"Save"}),s.jsx("button",{onClick:()=>{Y(c.expected_output),H(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):s.jsx("div",{className:"p-3 rounded-lg text-[12px] cursor-pointer transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)"},onClick:()=>H(!0),onMouseEnter:te=>{te.currentTarget.style.borderColor="var(--border-hover)"},onMouseLeave:te=>{te.currentTarget.style.borderColor="var(--border-subtle)"},children:c.expected_output||s.jsx("span",{style:{fontStyle:"italic"},children:"Click to edit expected output..."})})}),s.jsx(yc,{title:`Assertions (${c.assertions.length})`,action:s.jsx("button",{onClick:K,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:c.assertions.length===0?s.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):s.jsx("div",{className:"space-y-2",children:c.assertions.map(te=>{const R=u==null?void 0:u.assertions.find(J=>J.assertion_id===te.id);return s.jsx(hh,{assertion:te,result:R,onUpdate:J=>se(te.id,J),onDelete:()=>re(te.id)},te.id)})})}),(u==null?void 0:u.output)&&s.jsx(yh,{output:u.output,durationMs:u.durationMs,tokens:u.tokens}),s.jsx(gh,{evalId:c.id})]},c.id)}function hh({assertion:c,result:u,onUpdate:f,onDelete:o}){const[x,j]=N.useState(!1),[p,T]=N.useState(c.text),[b,m]=N.useState(!1),E=()=>{f(p),j(!1)};return s.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:s.jsxs("div",{className:"flex items-start gap-2",children:[u?s.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:u.pass?"var(--green-muted)":"var(--red-muted)"},children:u.pass?s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}):s.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):s.jsx("span",{className:"mt-0.5 w-[18px] h-[18px] rounded-full flex-shrink-0",style:{background:"var(--surface-4)"}}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:s.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:c.id})}),x?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:p,onChange:h=>T(h.target.value),onKeyDown:h=>{h.key==="Enter"&&E(),h.key==="Escape"&&j(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),s.jsx("button",{onClick:E,className:"btn btn-primary text-[11px]",children:"Save"})]}):s.jsx("div",{className:"text-[12px] cursor-pointer",style:{color:"var(--text-secondary)"},onClick:()=>{T(c.text),j(!0)},children:c.text}),(u==null?void 0:u.reasoning)&&s.jsx("button",{onClick:()=>m(!b),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:b?"Hide reasoning":"Show reasoning"}),b&&(u==null?void 0:u.reasoning)&&s.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:u.reasoning})]}),s.jsx("button",{onClick:o,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:h=>{h.currentTarget.style.color="var(--red)",h.currentTarget.style.opacity="1"},onMouseLeave:h=>{h.currentTarget.style.color="var(--text-tertiary)",h.currentTarget.style.opacity=""},children:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function yc({title:c,action:u,children:f}){return s.jsxs("div",{className:"mb-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:c}),u]}),f]})}function nm({result:c}){if(!c||c.status==null)return s.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const u=c.status==="pass";return s.jsx("span",{className:"pill text-[10px]",style:{background:u?"var(--green-muted)":"var(--red-muted)",color:u?"var(--green)":"var(--red)"},children:c.passRate!=null?`${Math.round(c.passRate*100)}%`:c.status})}function ph({passRate:c}){const u=Math.round(c*100);return s.jsx("div",{className:"flex items-center gap-1",children:s.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:s.jsx("div",{className:"h-full rounded-full",style:{width:`${u}%`,background:u>=80?"var(--green)":u>=50?"var(--yellow)":"var(--red)"}})})})}function yh({output:c,durationMs:u,tokens:f}){const[o,x]=N.useState(!1);return s.jsxs("div",{className:"mb-5",children:[s.jsxs("button",{onClick:()=>x(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:s.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",u!=null&&s.jsxs("span",{style:{fontWeight:400},children:["(",(u/1e3).toFixed(1),"s)"]}),f!=null&&s.jsxs("span",{style:{fontWeight:400},children:["(",f," tokens)"]})]}),o&&s.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:c})]})}function gh({evalId:c}){const{state:u,dispatch:f}=Al(),{plugin:o,skill:x}=u,[j,p]=N.useState(!0),[T,b]=N.useState(!1),[m,E]=N.useState({}),h=m[c]??null,O=N.useCallback(async B=>{b(!0);try{const Y=await ge.getCaseHistory(o,x,B);E(V=>({...V,[B]:Y}))}catch{E(Y=>({...Y,[B]:[]}))}finally{b(!1)}},[o,x]);N.useEffect(()=>{j&&!m[c]&&O(c)},[c,o,x]);const q=N.useCallback(()=>{const B=!j;p(B),B&&!m[c]&&O(c)},[j,c,m,O]),H=h?h.slice(0,10):[];return s.jsxs("div",{className:"mb-5",children:[s.jsxs("button",{onClick:q,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:j?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:s.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",h&&h.length>0&&s.jsxs("span",{style:{fontWeight:400},children:["(",h.length," run",h.length!==1?"s":"",")"]})]}),j&&s.jsx("div",{className:"animate-fade-in",children:T?s.jsxs("div",{className:"flex items-center gap-2 py-3",children:[s.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),s.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!h||h.length===0?s.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):s.jsxs("div",{children:[H.length>=2&&s.jsx("div",{className:"mb-2",children:s.jsx(am,{entries:H})}),s.jsx("div",{className:"space-y-2",children:H.map((B,Y)=>s.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:tm(B.timestamp)}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:B.model}),s.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:B.type==="benchmark"?"rgba(99,131,255,0.15)":B.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:B.type==="benchmark"?"#6383ff":B.type==="comparison"?"var(--purple)":"#fb923c"},children:B.type}),s.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Tc(B.pass_rate)},children:[Math.round(B.pass_rate*100),"%"]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[B.durationMs!=null&&s.jsx("span",{children:lm(B.durationMs)}),B.tokens!=null&&s.jsxs("span",{children:[B.tokens>=1e3?`${(B.tokens/1e3).toFixed(1)}k`:B.tokens," tok"]})]}),s.jsx("div",{className:"space-y-0.5",children:B.assertions.map(V=>s.jsxs("div",{className:"flex items-start gap-1.5",children:[s.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:V.pass?"var(--green-muted)":"var(--red-muted)"},children:V.pass?s.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}):s.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:V.text})]},V.id))})]},Y))}),s.jsx("button",{onClick:()=>f({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:B=>{B.currentTarget.style.textDecoration="underline"},onMouseLeave:B=>{B.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Qf({evals:c,onSave:u,onCancel:f}){const[o,x]=N.useState(""),[j,p]=N.useState(""),[T,b]=N.useState(""),[m,E]=N.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),h=Math.max(0,...c.evals.map(q=>q.id))+1,O=()=>{if(!o.trim()||!j.trim())return;const q={id:h,name:o.trim(),prompt:j.trim(),expected_output:T.trim(),files:[],assertions:m.filter(H=>H.text.trim())};u({...c,evals:[...c.evals,q]})};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:s.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),s.jsxs("label",{className:"block mb-3",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),s.jsx("input",{value:o,onChange:q=>x(q.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),s.jsxs("label",{className:"block mb-3",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),s.jsx("textarea",{value:j,onChange:q=>p(q.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),s.jsxs("label",{className:"block mb-3",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),s.jsx("textarea",{value:T,onChange:q=>b(q.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),s.jsxs("div",{className:"mb-4",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),m.map((q,H)=>s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx("input",{value:q.text,onChange:B=>E(m.map((Y,V)=>V===H?{...Y,text:B.target.value}:Y)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),m.length>1&&s.jsx("button",{onClick:()=>E(m.filter((B,Y)=>Y!==H)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},q.id)),s.jsx("button",{onClick:()=>E([...m,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:f,className:"btn btn-secondary text-[12px]",children:"Cancel"}),s.jsx("button",{onClick:O,disabled:!o.trim()||!j.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function bh(){const{state:c,runCase:u,runAll:f,cancelCase:o,cancelAll:x}=Al(),{evals:j,caseRunStates:p,bulkRunActive:T,runMode:b,latestBenchmark:m,inlineResults:E}=c,h=(j==null?void 0:j.evals)??[],O=N.useMemo(()=>{for(const B of p.values())if(B.status==="running"||B.status==="queued")return!0;return!1},[p]),q=h.filter(B=>{const Y=p.get(B.id);return Y&&(Y.status==="complete"||Y.status==="error"||Y.status==="cancelled")}).length,H=h.filter(B=>{const Y=p.get(B.id);return Y&&(Y.status==="running"||Y.status==="queued")}).length;return s.jsxs("div",{className:"p-5",children:[s.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),O&&s.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[H," running"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[O&&s.jsxs("button",{onClick:x,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:s.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),s.jsx("button",{onClick:()=>f("comparison"),disabled:h.length===0||O,className:"btn btn-primary text-[12px]",children:"Compare All"}),s.jsx("button",{onClick:()=>f("benchmark"),disabled:h.length===0||O,className:"btn btn-secondary text-[12px]",children:"Skill Only"}),s.jsx("button",{onClick:()=>f("baseline"),disabled:h.length===0||O,className:"btn btn-secondary text-[12px]",children:"Baseline Only"})]})]}),O&&h.length>0&&s.jsxs("div",{className:"mb-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",q,"/",h.length," cases"]}),s.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(q/h.length*100),"%"]})]}),s.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${q/h.length*100}%`,background:"var(--accent)"}})})]}),s.jsx("div",{className:"space-y-3 stagger-children",children:h.map(B=>{var G;const Y=E.get(B.id),V=((G=p.get(B.id))==null?void 0:G.status)??"idle";return s.jsx(Sh,{name:B.name,evalId:B.id,result:Y,caseStatus:V,runMode:b,onRun:P=>u(P,"benchmark"),onBaseline:P=>u(P,"baseline"),onCompare:P=>u(P,"comparison"),onCancel:P=>o(P)},B.id)})}),!O&&m&&m.cases.length>0&&s.jsxs("div",{className:"mt-5",children:[s.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Overall Pass Rate"}),s.jsx("span",{className:"text-[20px] font-bold",style:{color:(m.overall_pass_rate??0)>=.8?"var(--green)":(m.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:m.overall_pass_rate!=null?`${Math.round(m.overall_pass_rate*100)}%`:"--"})]}),m.totalDurationMs!=null&&s.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(m.totalDurationMs/1e3).toFixed(1),"s",m.model&&` | Model: ${m.model}`]})]}),m.comparison&&s.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Xf,{label:"Skill",value:m.comparison.skillPassRate,color:"var(--accent)"}),s.jsx(Xf,{label:"Baseline",value:m.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),s.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:m.comparison.delta>0?"var(--green)":m.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",m.comparison.delta>0?"+":"",(m.comparison.delta*100).toFixed(1),"%",m.verdict&&` | ${m.verdict}`]})]})]})]})}const jh={benchmark:{label:"Skill",bg:"var(--accent-muted)",color:"var(--accent)"},baseline:{label:"Baseline",bg:"var(--surface-3)",color:"var(--text-tertiary)"},comparison:{label:"Compare",bg:"rgba(168,85,247,0.12)",color:"rgb(168,85,247)"}};function Sh({name:c,evalId:u,result:f,caseStatus:o,runMode:x,onRun:j,onBaseline:p,onCompare:T,onCancel:b}){const[m,E]=N.useState(!1),h=o==="running"||o==="queued",O=o==="complete"||o==="error";return s.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:h?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:h?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"&&s.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),o==="queued"&&s.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),s.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",u," ",c]}),x&&(h||O)&&(()=>{const q=jh[x];return q?s.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:q.bg,color:q.color,padding:"1px 6px"},children:q.label}):null})()]}),s.jsxs("div",{className:"flex items-center gap-2",children:[h?s.jsx("button",{onClick:()=>b(u),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel"}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>T(u),className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),s.jsx("button",{onClick:()=>j(u),className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),s.jsx("button",{onClick:()=>p(u),className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),f&&f.status!=null&&s.jsx("span",{className:"pill text-[10px]",style:{background:f.status==="pass"?"var(--green-muted)":(f.status==="error","var(--red-muted)"),color:f.status==="pass"?"var(--green)":"var(--red)"},children:f.passRate!=null?`${Math.round(f.passRate*100)}%`:f.status}),o==="cancelled"&&s.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),f&&f.assertions.length>0&&s.jsxs("div",{className:"px-4 pb-3",children:[s.jsx("div",{className:"space-y-1",children:f.assertions.map(q=>s.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[s.jsx("span",{style:{color:q.pass?"var(--green)":"var(--red)"},children:q.pass?"PASS":"FAIL"}),s.jsx("span",{style:{color:"var(--text-secondary)"},children:q.text})]},q.assertion_id))}),f.output&&s.jsx("button",{onClick:()=>E(!m),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:m?"Hide output":"Show output"}),m&&f.output&&s.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:f.output})]}),f&&f.errorMessage&&s.jsx("div",{className:"px-4 pb-3",children:s.jsx("div",{className:"text-[11px] p-2 rounded-lg",style:{background:"var(--red-muted)",color:"var(--red)"},children:f.errorMessage})})]})}function Xf({label:c,value:u,color:f}){return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:c}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:f},children:[Math.round(u*100),"%"]})]}),s.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u*100}%`,background:f}})})]})}const Vf={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"rgba(52,211,153,0.06)",text:"rgba(52,211,153,0.6)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"rgba(248,113,113,0.06)",text:"rgba(248,113,113,0.6)"}},Nh=[{label:"Should activate",prompts:["+How do I use this feature?","+Show me best practices for this","+What's the recommended approach?"]},{label:"Should NOT activate",prompts:["!What's the weather today?","!Write me a poem","!How do I cook pasta?"]}];function Th(){const{state:c,dispatch:u,runActivationTest:f}=Al(),{plugin:o,skill:x,activationPrompts:j,activationResults:p,activationSummary:T,activationRunning:b,activationError:m}=c,[E,h]=N.useState(j),[O,q]=N.useState(null),[H,B]=N.useState(!1);N.useEffect(()=>{u({type:"SET_ACTIVATION_PROMPTS",prompts:E})},[E,u]),N.useEffect(()=>{fetch(`/api/skills/${o}/${x}/description`).then(K=>K.json()).then(K=>q(K.rawContent||K.description||null)).catch(()=>q(null))},[o,x]);function Y(){f(E)}function V(K){const se=E.trim(),re=se?`${se}
58
58
  ${K.join(`
59
59
  `)}`:K.join(`
60
- `);h(re)}const G=p.filter(K=>K.classification==="TP"||K.classification==="TN"),P=p.filter(K=>K.classification==="FP"||K.classification==="FN");return s.jsxs("div",{className:"p-5",children:[s.jsxs("div",{className:"mb-5",children:[s.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),s.jsx("div",{className:"text-[12px] mt-1",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),s.jsxs("div",{className:"grid grid-cols-5 gap-4 mb-5",children:[s.jsxs("div",{className:"col-span-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("label",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:"Test Prompts"}),s.jsx("div",{className:"flex gap-1.5",children:Sh.map(K=>s.jsxs("button",{onClick:()=>V(K.prompts),className:"text-[10px] px-2 py-1 rounded-md transition-colors duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},onMouseEnter:se=>{se.currentTarget.style.color="var(--text-primary)",se.currentTarget.style.background="var(--surface-3)"},onMouseLeave:se=>{se.currentTarget.style.color="var(--text-tertiary)",se.currentTarget.style.background="var(--surface-2)"},children:["+ ",K.label]},K.label))})]}),s.jsx("textarea",{className:"input-field h-32 resize-y font-mono text-[12px]",value:E,onChange:K=>h(K.target.value),placeholder:`How do I write a unit test?
60
+ `);h(re)}const G=p.filter(K=>K.classification==="TP"||K.classification==="TN"),P=p.filter(K=>K.classification==="FP"||K.classification==="FN");return s.jsxs("div",{className:"p-5",children:[s.jsxs("div",{className:"mb-5",children:[s.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),s.jsx("div",{className:"text-[12px] mt-1",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),s.jsxs("div",{className:"grid grid-cols-5 gap-4 mb-5",children:[s.jsxs("div",{className:"col-span-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("label",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:"Test Prompts"}),s.jsx("div",{className:"flex gap-1.5",children:Nh.map(K=>s.jsxs("button",{onClick:()=>V(K.prompts),className:"text-[10px] px-2 py-1 rounded-md transition-colors duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},onMouseEnter:se=>{se.currentTarget.style.color="var(--text-primary)",se.currentTarget.style.background="var(--surface-3)"},onMouseLeave:se=>{se.currentTarget.style.color="var(--text-tertiary)",se.currentTarget.style.background="var(--surface-2)"},children:["+ ",K.label]},K.label))})]}),s.jsx("textarea",{className:"input-field h-32 resize-y font-mono text-[12px]",value:E,onChange:K=>h(K.target.value),placeholder:`How do I write a unit test?
61
61
  What edge cases should I test?
62
62
  +Deploy this to production
63
63
  !What's the weather like today?
64
64
  !Write me a poem about flowers`}),s.jsxs("div",{className:"flex items-center gap-4 mt-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[s.jsx("span",{children:"One prompt per line"}),s.jsx("span",{children:"No prefix = auto-classify"}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"})," = must activate"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"})," = must NOT activate"]}),s.jsxs("span",{children:[E.trim().split(`
65
65
  `).filter(Boolean).length," prompt",E.trim().split(`
66
- `).filter(Boolean).length!==1?"s":""]})]})]}),s.jsx("div",{className:"col-span-2 flex flex-col",children:s.jsxs("div",{className:`glass-card flex flex-col ${H?"flex-1":""}`,children:[s.jsxs("button",{onClick:()=>B(!H),className:"w-full p-3 flex items-center justify-between text-left flex-shrink-0",style:{borderBottom:H?"1px solid var(--border-subtle)":void 0},children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"}),s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",style:{transform:H?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s ease"},children:s.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),H&&O&&s.jsx("div",{className:"p-3 flex-1 overflow-auto animate-fade-in",style:{maxHeight:320},children:s.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:Pf(O)}})}),!H&&O&&s.jsx("div",{className:"px-3 pb-3 pt-1",children:s.jsx("div",{className:"text-[11px] line-clamp-2 leading-relaxed",style:{color:"var(--text-tertiary)"},children:O.replace(/^---[\s\S]*?---\s*/,"").trim().slice(0,150)})})]})})]}),s.jsx("button",{onClick:Y,disabled:b||!E.trim(),className:"btn btn-primary mb-5",children:b?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"spinner",style:{borderTopColor:"#fff",borderColor:"rgba(255,255,255,0.2)",width:14,height:14}})," Testing..."]}):s.jsxs(s.Fragment,{children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"6"}),s.jsx("circle",{cx:"12",cy:"12",r:"2"})]})," Run Activation Test"]})}),m&&s.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:m}),p.length>0&&s.jsxs("div",{className:"space-y-5 mb-5",children:[P.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),s.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",P.length,")"]}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),s.jsx("div",{className:"space-y-1.5 stagger-children",children:P.map((K,se)=>s.jsx(Zf,{result:K},`incorrect-${se}`))})]}),G.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"16 10 11 15 8 12"})]}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",G.length,")"]})]}),s.jsx("div",{className:"space-y-1.5 stagger-children",children:G.map((K,se)=>s.jsx(Zf,{result:K},`correct-${se}`))})]})]}),T&&s.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),T.autoClassifiedCount!=null&&T.autoClassifiedCount>0&&s.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[T.autoClassifiedCount," of ",T.total," prompts auto-classified from skill name and tags"]}),s.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[s.jsx(gc,{label:"Precision",value:T.precision,description:"Of all activations, how many were correct?",detail:`${T.tp} true / ${T.tp+T.fp} total activations`}),s.jsx(gc,{label:"Recall",value:T.recall,description:"Of expected activations, how many fired?",detail:`${T.tp} activated / ${T.tp+T.fn} expected`}),s.jsx(gc,{label:"Reliability",value:T.reliability,description:"Overall correct classification rate",detail:`${T.tp+T.tn} correct / ${T.total} total`})]}),s.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[s.jsx(Zs,{label:"True Positive",abbr:"TP",count:T.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),s.jsx(Zs,{label:"False Positive",abbr:"FP",count:T.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),s.jsx(Zs,{label:"False Negative",abbr:"FN",count:T.fn,bg:"rgba(248,113,113,0.06)",color:"rgba(248,113,113,0.6)",description:"Missed activation"}),s.jsx(Zs,{label:"True Negative",abbr:"TN",count:T.tn,bg:"rgba(52,211,153,0.06)",color:"rgba(52,211,153,0.6)",description:"Correctly silent"})]})]})]}),b&&p.length===0&&s.jsxs("div",{className:"text-center py-16 animate-fade-in",children:[s.jsx("div",{className:"spinner-lg mx-auto mb-4"}),s.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]})]})}function Zf({result:c}){const u=Vf[c.classification]||Vf.FN,f=c.classification==="TP"||c.classification==="TN";return s.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:u.bg,border:"1px solid transparent"},children:[s.jsx("div",{className:"flex-shrink-0 mt-0.5",children:s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${u.text} 20%, transparent)`},children:f?s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:u.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}):s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:u.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:c.prompt})}),s.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[s.jsx("span",{className:"pill",style:{background:"rgba(0,0,0,0.1)",color:u.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:c.classification}),s.jsx("span",{style:{color:c.activate?"var(--green)":"var(--text-tertiary)"},children:c.activate?"Activated":"Silent"}),s.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",c.expected==="should_activate"?"activate":"stay silent"]}),s.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[c.confidence," confidence"]}),c.autoClassified&&s.jsx("span",{className:"pill",style:{background:"rgba(139,92,246,0.1)",color:"rgba(139,92,246,0.8)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),c.reasoning&&s.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:c.reasoning})]})]})}function gc({label:c,value:u,description:f,detail:o}){const x=Math.round(u*100),j=x>=80?"var(--green)":x>=60?"var(--yellow)":"var(--red)";return s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:j},children:[x,"%"]}),s.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:c}),s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:f}),s.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function Zs({abbr:c,count:u,bg:f,color:o,description:x}){return s.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:f},children:[s.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:u}),s.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:c}),s.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:x})]})}const bc={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Kf={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},Ec=600,Cc=180,lt=40,jc=Ec-lt*2,Cl=Cc-lt*2,Th=[25,50,75,100];function Jf(c){return new Date(c).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Eh({entries:c}){const[u,f]=N.useState(null);if(c.length<2)return null;const o=c.length,x=c.map((T,b)=>{const m=lt+b/(o-1)*jc,E=T.passRate*100,h=lt+Cl-E/100*Cl;return{x:m,y:h,pct:E,entry:T}}),j=x.map(T=>`${T.x},${T.y}`).join(" "),p=Array.from(new Set(c.map(T=>T.type)));return s.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative"},children:[s.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),s.jsx("div",{className:"flex items-center gap-5 mb-3",children:p.map(T=>s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:bc[T]??"var(--text-tertiary)"}}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Kf[T]??T})]},T))}),s.jsxs("svg",{width:Ec,height:Cc,viewBox:`0 0 ${Ec} ${Cc}`,style:{display:"block",overflow:"visible"},children:[Th.map(T=>{const b=lt+Cl-T/100*Cl;return s.jsxs("g",{children:[s.jsx("line",{x1:lt,y1:b,x2:lt+jc,y2:b,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),s.jsxs("text",{x:lt-8,y:b+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[T,"%"]})]},T)}),s.jsx("line",{x1:lt,y1:lt+Cl,x2:lt+jc,y2:lt+Cl,stroke:"var(--border-subtle)",strokeWidth:1}),s.jsx("text",{x:lt-8,y:lt+Cl+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),s.jsx("polyline",{points:j,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),x.map((T,b)=>s.jsx("circle",{cx:T.x,cy:T.y,r:5,fill:bc[T.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:m=>{m.currentTarget.setAttribute("r","7"),f({x:T.x,y:T.y,entry:T.entry})},onMouseLeave:m=>{m.currentTarget.setAttribute("r","5"),f(null)}},b)),Ch(o).map(T=>s.jsx("text",{x:x[T].x,y:lt+Cl+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Jf(c[T].timestamp)},T))]}),u&&s.jsxs("div",{style:{position:"absolute",left:u.x,top:u.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[s.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Jf(u.entry.timestamp)}),s.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:u.entry.model}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:bc[u.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Kf[u.entry.type]??u.entry.type}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(u.entry.passRate*100),"%"]})]})]})]})}function Ch(c){return c<=3?Array.from({length:c},(u,f)=>f):c<=6?[0,Math.floor(c/2),c-1]:[0,Math.floor(c/3),Math.floor(2*c/3),c-1]}function Ks(c){return c>=.8?"var(--green)":c>=.5?"var(--yellow)":"var(--red)"}function Ah(c){return c>=1e3?`${(c/1e3).toFixed(1)}s`:`${Math.round(c)}ms`}function Mh({rate:c,label:u}){const f=Math.round(c*100);return s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:u}),s.jsxs("span",{className:"text-[11px] font-semibold",style:{color:Ks(c)},children:[f,"%"]})]}),s.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${f}%`,background:Ks(c)}})})]})})}function _h({points:c}){if(c.length<2)return null;const u=200,f=48,o=4,x=c.length,j=c.map((b,m)=>{const E=o+m/(x-1)*(u-o*2),h=o+(f-o*2)-b.passRate*(f-o*2);return{x:E,y:h}}),p=`M ${j[0].x},${f-o} `+j.map(b=>`L ${b.x},${b.y}`).join(" ")+` L ${j[j.length-1].x},${f-o} Z`,T=j.map((b,m)=>`${m===0?"M":"L"} ${b.x},${b.y}`).join(" ");return s.jsxs("svg",{width:u,height:f,style:{display:"block"},children:[s.jsx("path",{d:p,fill:"var(--accent-muted)"}),s.jsx("path",{d:T,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),s.jsx("circle",{cx:j[j.length-1].x,cy:j[j.length-1].y,r:3,fill:"var(--accent)"})]})}function zh({plugin:c,skill:u}){const[f,o]=N.useState(null),[x,j]=N.useState(!0);if(N.useEffect(()=>{j(!0),ge.getStats(c,u).then(o).catch(()=>o(null)).finally(()=>j(!1))},[c,u]),x)return s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"skeleton h-24 rounded-xl"}),s.jsx("div",{className:"skeleton h-48 rounded-xl"}),s.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!f||f.totalRuns===0)return s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[s.jsx("path",{d:"M18 20V10"}),s.jsx("path",{d:"M12 20V4"}),s.jsx("path",{d:"M6 20v-6"})]})}),s.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),s.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const p=f.trendPoints.length>0?f.trendPoints[f.trendPoints.length-1].passRate:0,T=f.trendPoints.length>0?f.trendPoints[0].passRate:0,b=p-T,m=f.assertionStats.slice(0,10);return s.jsxs("div",{className:"space-y-4 stagger-children",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),s.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:f.totalRuns})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),s.jsxs("div",{className:"text-[24px] font-bold",style:{color:Ks(p)},children:[Math.round(p*100),"%"]})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),s.jsxs("div",{className:"text-[24px] font-bold",style:{color:b>=0?"var(--green)":"var(--red)"},children:[b>=0?"+":"",Math.round(b*100),"%"]})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),s.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:f.modelStats.length})]})]}),f.trendPoints.length>=2&&s.jsxs("div",{className:"glass-card p-5",children:[s.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),s.jsx(_h,{points:f.trendPoints})]}),f.modelStats.length>0&&s.jsxs("div",{className:"glass-card p-5",children:[s.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),s.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[s.jsx("thead",{children:s.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),s.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),s.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),s.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"})]})}),s.jsx("tbody",{children:f.modelStats.map(E=>s.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:E.model}),s.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:E.runs}),s.jsx("td",{style:{padding:"8px",textAlign:"center"},children:s.jsxs("span",{className:"font-semibold",style:{color:Ks(E.avgPassRate)},children:[Math.round(E.avgPassRate*100),"%"]})}),s.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:Ah(E.avgDurationMs)})]},E.model))})]})]}),m.length>0&&s.jsxs("div",{className:"glass-card p-5",children:[s.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),s.jsx("div",{className:"space-y-3",children:m.map(E=>s.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--surface-2)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},onClick:()=>{},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",E.evalId]}),s.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:E.evalName}),s.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[E.totalRuns," runs"]})]}),s.jsx(Mh,{rate:E.passRate,label:E.text})]},`${E.evalId}:${E.id}`))})]})]})}function kh({plugin:c,skill:u}){const[f,o]=N.useState(null),[x,j]=N.useState(null),[p,T]=N.useState({}),[b,m]=N.useState({});N.useEffect(()=>{ge.getEvals(c,u).then(o).catch(()=>o(null))},[c,u]);async function E(h){if(x===h){j(null);return}if(j(h),!p[h]){m(O=>({...O,[h]:!0}));try{const O=await ge.getCaseHistory(c,u,h);T(q=>({...q,[h]:O}))}catch{T(O=>({...O,[h]:[]}))}finally{m(O=>({...O,[h]:!1}))}}}return f?s.jsx("div",{className:"space-y-2 stagger-children",children:f.evals.map(h=>{const O=p[h.id]||[],q=x===h.id,H=b[h.id],B=O.length>0?O[0].pass_rate:null;return s.jsxs("div",{className:"glass-card overflow-hidden",children:[s.jsxs("button",{onClick:()=>E(h.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:q?"var(--surface-2)":"transparent"},onMouseEnter:Y=>{q||(Y.currentTarget.style.background="var(--surface-2)")},onMouseLeave:Y=>{q||(Y.currentTarget.style.background="transparent")},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:q?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:s.jsx("polyline",{points:"9 18 15 12 9 6"})}),s.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",h.id]}),s.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:h.name}),O.length>=2&&s.jsx(am,{entries:O}),B!=null&&s.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:Tc(B)},children:[Math.round(B*100),"%"]}),O.length>0&&s.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[O.length," runs"]})]}),q&&s.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:H?s.jsxs("div",{className:"p-4 flex items-center gap-2",children:[s.jsx("div",{className:"spinner",style:{width:14,height:14}}),s.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):O.length===0?s.jsx("div",{className:"p-4",children:s.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):s.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:O.map((Y,V)=>s.jsxs("div",{className:"p-4",style:{background:V===0?"var(--surface-2)":"transparent"},children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:tm(Y.timestamp)}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:Y.model}),s.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:Y.type==="benchmark"?"rgba(99,131,255,0.15)":Y.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:Y.type==="benchmark"?"#6383ff":Y.type==="comparison"?"var(--purple)":"#fb923c"},children:Y.type}),s.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Tc(Y.pass_rate)},children:[Math.round(Y.pass_rate*100),"%"]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[Y.durationMs!=null&&s.jsx("span",{children:lm(Y.durationMs)}),Y.tokens!=null&&s.jsxs("span",{children:[Y.tokens>=1e3?`${(Y.tokens/1e3).toFixed(1)}k`:Y.tokens," tok"]})]}),s.jsx("div",{className:"space-y-1",children:Y.assertions.map(G=>s.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[s.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:G.pass?"var(--green)":"var(--red)"},children:s.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:G.pass?s.jsx("polyline",{points:"20 6 9 17 4 12"}):s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:G.text}),G.reasoning&&s.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:G.reasoning})]})]},G.id))})]},V))})})]},h.id)})}):s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function Rh(){const{state:c,dispatch:u}=Al(),{plugin:f,skill:o}=c,[x,j]=N.useState("timeline"),[p,T]=N.useState([]),[b,m]=N.useState(!0),[E,h]=N.useState(""),[O,q]=N.useState(""),[H,B]=N.useState(!1),[Y,V]=N.useState([]),[G,P]=N.useState(null),[K,se]=N.useState(!1),[re,ee]=N.useState(null),[fe,Se]=N.useState(!1);N.useEffect(()=>{m(!0),ge.getHistory(f,o,{model:E||void 0,type:O||void 0}).then(z=>{T(z),z.length>=2&&ge.compareRuns(f,o,z[0].timestamp,z[1].timestamp).then($=>{const ie=$.regressions.filter(k=>k.change==="regression");u({type:"SET_REGRESSIONS",regressions:ie})}).catch(()=>{})}).catch(()=>{}).finally(()=>m(!1))},[f,o,E,O]);const te=N.useCallback(async z=>{if(H){V($=>$.includes(z)?$.filter(ie=>ie!==z):$.length>=2?[$[1],z]:[...$,z]);return}Se(!0);try{const $=await ge.getHistoryEntry(f,o,z);ee($)}catch{}finally{Se(!1)}},[f,o,H]),R=N.useCallback(async()=>{if(Y.length===2){se(!0);try{const z=await ge.compareRuns(f,o,Y[0],Y[1]);P(z)}catch{}finally{se(!1)}}},[f,o,Y]),J=[...new Set(p.map(z=>z.model))];return b?s.jsxs("div",{className:"p-5",children:[s.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),s.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"skeleton h-12 rounded-lg"}),s.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):s.jsxs("div",{className:"p-5",children:[s.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(z=>s.jsx("button",{onClick:()=>j(z),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:x===z?"var(--accent-muted)":"transparent",color:x===z?"var(--accent)":"var(--text-tertiary)"},children:z==="timeline"?"Timeline":z==="per-eval"?"Per Eval":"Statistics"},z))}),x==="timeline"&&s.jsxs("div",{children:[p.length>0&&s.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:s.jsx(Eh,{entries:p})}),s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsxs("select",{value:E,onChange:z=>h(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[s.jsx("option",{value:"",children:"All Models"}),J.map(z=>s.jsx("option",{value:z,children:z},z))]}),s.jsxs("select",{value:O,onChange:z=>q(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[s.jsx("option",{value:"",children:"All Types"}),s.jsx("option",{value:"benchmark",children:"Benchmark"}),s.jsx("option",{value:"comparison",children:"Comparison"}),s.jsx("option",{value:"baseline",children:"Baseline"}),s.jsx("option",{value:"model-compare",children:"Model Compare"}),s.jsx("option",{value:"improve",children:"AI Improve"})]}),s.jsx("div",{className:"flex-1"}),s.jsx("button",{onClick:()=>{B(!H),V([]),P(null)},className:`btn text-[12px] ${H?"btn-primary":"btn-secondary"}`,children:H?"Exit Compare":"Compare Runs"}),H&&Y.length===2&&s.jsx("button",{onClick:R,disabled:K,className:"btn btn-primary text-[12px]",children:K?"Comparing...":"Compare"})]}),s.jsx("div",{className:"space-y-2",children:p.length===0?s.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):p.map(z=>{const $=Y.includes(z.timestamp);return s.jsx("button",{onClick:()=>te(z.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:$?"var(--accent-muted)":"var(--surface-1)",border:$?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:ie=>{$||(ie.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:ie=>{$||(ie.currentTarget.style.borderColor="var(--border-subtle)")},children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[H&&s.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:$?"var(--accent)":"var(--border-default)",background:$?"var(--accent)":"transparent"},children:$&&s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})}),s.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(z.timestamp).toLocaleString()}),s.jsx("span",{className:"pill text-[9px]",style:{background:z.type==="comparison"?"var(--purple-muted)":z.type==="baseline"?"var(--surface-3)":z.type==="model-compare"?"rgba(56,189,248,0.15)":z.type==="improve"?"rgba(168,85,247,0.15)":"var(--accent-muted)",color:z.type==="comparison"?"var(--purple)":z.type==="baseline"?"var(--text-tertiary)":z.type==="model-compare"?"#38bdf8":z.type==="improve"?"#a855f7":"var(--accent)"},children:z.type==="model-compare"?"model compare":z.type==="improve"?"ai improve":z.type})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:z.model}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:z.passRate>=.8?"var(--green)":z.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(z.passRate*100),"%"]})]})]})},z.timestamp)})}),G&&s.jsx(Oh,{result:G}),re&&!H&&s.jsx(Dh,{run:re,onClose:()=>ee(null)})]}),x==="per-eval"&&s.jsx(kh,{plugin:f,skill:o}),x==="statistics"&&s.jsx(zh,{plugin:f,skill:o})]})}function Oh({result:c}){const u=c.regressions.filter(o=>o.change==="regression"),f=c.regressions.filter(o=>o.change==="improvement");return s.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(c.runA.timestamp).toLocaleDateString()," vs ",new Date(c.runB.timestamp).toLocaleDateString()]}),u.length>0&&s.jsxs("div",{className:"mb-3",children:[s.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",u.length,")"]}),u.map(o=>s.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",s.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),f.length>0&&s.jsxs("div",{className:"mb-3",children:[s.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",f.length,")"]}),f.map(o=>s.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",s.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),s.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:s.jsxs("table",{className:"w-full text-[12px]",children:[s.jsx("thead",{children:s.jsxs("tr",{style:{background:"var(--surface-2)"},children:[s.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),s.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),s.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),s.jsx("tbody",{children:c.caseDiffs.map(o=>s.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[s.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),s.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),s.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function Dh({run:c,onClose:u}){return c.type==="improve"&&c.improve?s.jsx(wh,{run:c,onClose:u}):s.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(c.timestamp).toLocaleString()]}),s.jsx("button",{onClick:u,className:"btn btn-ghost text-[11px]",children:"Close"})]}),s.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",c.model," | Cases: ",c.cases.length," | Pass Rate: ",c.overall_pass_rate!=null?`${Math.round(c.overall_pass_rate*100)}%`:"--"]}),s.jsx("div",{className:"space-y-2",children:c.cases.map(f=>s.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",f.eval_id," ",f.eval_name]}),s.jsx("span",{className:"text-[11px] font-semibold",style:{color:f.status==="pass"?"var(--green)":"var(--red)"},children:f.pass_rate!=null?`${Math.round(f.pass_rate*100)}%`:f.status})]})},f.eval_id))})]})}function wh({run:c,onClose:u}){var j;const f=N.useMemo(()=>c.improve?em(c.improve.original,c.improve.improved):[],[c.improve]),o=N.useMemo(()=>{const p=f.filter(b=>b.type==="added").length,T=f.filter(b=>b.type==="removed").length;return{added:p,removed:T}},[f]),x=N.useMemo(()=>{let p=0,T=0;return f.map(b=>b.type==="removed"?(p++,{...b,origNum:p,newNum:null}):b.type==="added"?(T++,{...b,origNum:null,newNum:T}):(p++,T++,{...b,origNum:p,newNum:T}))},[f]);return s.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),s.jsx("path",{d:"M2 17l10 5 10-5"}),s.jsx("path",{d:"M2 12l10 5 10-5"})]})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),s.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(c.timestamp).toLocaleString()," · ",c.model]})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[s.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),s.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),s.jsx("button",{onClick:u,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--surface-3)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((j=c.improve)==null?void 0:j.reasoning)&&s.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.06)",border:"1px solid rgba(168,85,247,0.15)",color:"var(--text-secondary)"},children:[s.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),c.improve.reasoning]}),s.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:s.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:s.jsx("tbody",{children:x.map((p,T)=>s.jsxs("tr",{style:{background:p.type==="added"?"rgba(34,197,94,0.08)":p.type==="removed"?"rgba(239,68,68,0.08)":"transparent"},children:[s.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="removed"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:p.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.origNum??""}),s.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="added"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:p.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.newNum??""}),s.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"transparent",borderRight:p.type==="added"?"2px solid var(--green)":p.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:p.type==="added"?"+":p.type==="removed"?"-":" "}),s.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"var(--text-secondary)"},children:p.content||"​"})]},T))})})})]})}function Lh({plugin:c,skill:u}){const[f,o]=N.useState([]),[x,j]=N.useState([]),[p,T]=N.useState(!0),[b,m]=N.useState(null);N.useEffect(()=>{ge.getDependencies(c,u).then(h=>{o(h.mcpDependencies),j(h.skillDependencies)}).catch(()=>{}).finally(()=>T(!1))},[c,u]);async function E(h,O){try{await navigator.clipboard.writeText(O),m(h),setTimeout(()=>m(null),2e3)}catch{}}return p?null:f.length===0&&x.length===0?s.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):s.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[s.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),s.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),s.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:f.length+x.length})]}),s.jsxs("div",{className:"px-5 py-4",children:[f.length>0&&s.jsxs("div",{className:"space-y-3 mb-4",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),f.map(h=>s.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:h.server}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:h.transport})]}),s.jsx("button",{onClick:()=>E(h.server,h.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:b===h.server?"var(--green)":"var(--accent)"},children:b===h.server?s.jsxs(s.Fragment,{children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):s.jsxs(s.Fragment,{children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),s.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:h.url}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:h.matchedTools.map(O=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:O},O))})]},h.server))]}),x.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),s.jsx("div",{className:"space-y-1.5",children:x.map(h=>s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),s.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:h.name}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:h.source==="frontmatter"?"frontmatter":"referenced"})]},h.name))})]})]})]})}function Uh(){const{state:c}=Al(),{plugin:u,skill:f}=c,[o,x]=N.useState(null),[j,p]=N.useState(!0);return N.useEffect(()=>{ge.getDependencies(u,f).then(x).catch(()=>{}).finally(()=>p(!1))},[u,f]),j?s.jsxs("div",{className:"p-5",children:[s.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),s.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?s.jsx("div",{className:"p-5 max-w-3xl",children:s.jsx(Lh,{plugin:u,skill:f})}):s.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"No dependency information available"})}function Bh(){const{state:c,dispatch:u,saveContent:f}=Al(),o=N.useCallback(j=>{const p=j.ctrlKey||j.metaKey;if(p&&j.key>="1"&&j.key<="6"){j.preventDefault(),u({type:"SET_PANEL",panel:["editor","tests","run","activation","history","deps"][parseInt(j.key)-1]});return}if(p&&j.key==="s"&&!j.shiftKey){j.preventDefault(),c.isDirty&&f();return}},[c.isDirty,f,u]);if(N.useEffect(()=>(window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)),[o]),c.loading)return s.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:"spinner spinner-lg"}),s.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const x=Array.from(c.caseRunStates.values()).some(j=>j.status==="running"||j.status==="queued");return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsx(th,{state:c}),s.jsx(sh,{activePanel:c.activePanel,onPanelChange:j=>u({type:"SET_PANEL",panel:j}),isDirty:c.isDirty,isRunning:x,hasRegressions:c.regressions.length>0,isActivationRunning:c.activationRunning}),s.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:s.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[c.activePanel==="editor"&&s.jsx(fh,{}),c.activePanel==="tests"&&s.jsx(mh,{}),c.activePanel==="run"&&s.jsx(gh,{}),c.activePanel==="activation"&&s.jsx(Nh,{}),c.activePanel==="history"&&s.jsx(Rh,{}),c.activePanel==="deps"&&s.jsx(Uh,{})]},c.activePanel)})]})}function Sc(c){return c.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Hh(c,u,f,o){const j=`.../${c.split("/").slice(-2).join("/")}`;switch(u){case 1:return`${j}/${f}/skills/${o}/SKILL.md`;case 2:return`${j}/plugins/${f}/skills/${o}/SKILL.md`;case 3:return`${j}/skills/${o}/SKILL.md`}}function qh({onCreated:c,onCancel:u}){const[f,o]=N.useState(null),[x,j]=N.useState(!0),[p,T]=N.useState(null),[b,m]=N.useState(null),[E,h]=N.useState(""),[O,q]=N.useState(3),[H,B]=N.useState(""),[Y,V]=N.useState(""),[G,P]=N.useState(""),[K,se]=N.useState(""),[re,ee]=N.useState(""),[fe,Se]=N.useState(""),[te,R]=N.useState(!1),[J,z]=N.useState(null);N.useEffect(()=>{ge.getProjectLayout().then(Z=>{o(Z),q(Z.suggestedLayout);const g=Z.detectedLayouts.find(U=>U.layout===Z.suggestedLayout);g!=null&&g.existingPlugins.length&&B(g.existingPlugins[0])}).catch(()=>{}).finally(()=>j(!1)),ge.getConfig().then(m).catch(()=>{}),ge.getSkillCreatorStatus().then(T).catch(()=>{})},[]);const $=N.useMemo(()=>{var Z;return f?((Z=f.detectedLayouts.find(g=>g.layout===O))==null?void 0:Z.existingPlugins)||[]:[]},[f,O]),ie=H==="__new__"?Y:H,k=f?Hh(f.root,O,ie||"{plugin}",E||"{skill}"):"",Q=N.useMemo(()=>f?f.detectedLayouts.filter(Z=>Z.layout!==4):[],[f]),ae=(b==null?void 0:b.provider)==="claude-cli"&&p!==null;async function Te(){if(z(null),!E.trim()){z("Skill name is required");return}if(!G.trim()){z("Description is required");return}if(O!==3&&!ie.trim()){z("Plugin name is required");return}R(!0);try{const Z=await ge.createSkill({name:Sc(E),plugin:ie||"",layout:O,description:G,model:K||void 0,allowedTools:re||void 0,body:fe});c(Z.plugin,Z.skill)}catch(Z){z(Z.message)}finally{R(!1)}}return s.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[s.jsxs("div",{className:"mb-5",children:[s.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),s.jsx("p",{className:"text-[13px] mt-1",style:{color:"var(--text-tertiary)"},children:"Define your skill's metadata, content, and placement"})]}),ae&&s.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[13px]",style:{background:p.installed?"var(--accent-muted)":"var(--surface-2)",border:p.installed?"1px solid var(--accent)":"1px solid var(--border-subtle)",color:"var(--text-primary)"},children:p.installed?s.jsxs("span",{children:[s.jsx("span",{className:"font-medium",children:"AI-Assisted Authoring Available"}),s.jsxs("span",{className:"ml-1",style:{color:"var(--text-secondary)"},children:["— Run ",s.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-3)"},children:"/skill-creator"})," in Claude Code for guided creation."]})]}):s.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Tip: Install the Skill Creator — ",s.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-3)"},children:p.installCommand})]})}),x?s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),s.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}):f?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),Q.length>1&&s.jsxs("div",{className:"mb-3",children:[s.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),s.jsx("div",{className:"flex gap-2",children:Q.map(Z=>s.jsx("button",{onClick:()=>{q(Z.layout),B(Z.existingPlugins[0]||""),V("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:O===Z.layout?"var(--accent)":"var(--surface-3)",color:O===Z.layout?"#fff":"var(--text-secondary)",border:`1px solid ${O===Z.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:Z.label},Z.layout))})]}),O!==3&&s.jsxs("div",{className:"mb-3",children:[s.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),s.jsxs("select",{value:H,onChange:Z=>{B(Z.target.value),V("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:[$.map(Z=>s.jsx("option",{value:Z,children:Z},Z)),s.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),H==="__new__"&&s.jsx("input",{type:"text",value:Y,onChange:Z=>V(Sc(Z.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"}})]}),s.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:k})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),s.jsxs("div",{className:"mb-3",children:[s.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",s.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),s.jsx("input",{type:"text",value:E,onChange:Z=>h(Sc(Z.target.value)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"}})]}),s.jsxs("div",{className:"mb-3",children:[s.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",s.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),s.jsx("textarea",{value:G,onChange:Z=>P(Z.target.value),placeholder:"Brief description",rows:2,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-none",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"}})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),s.jsxs("select",{value:K,onChange:Z=>se(Z.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:[s.jsx("option",{value:"",children:"Any"}),s.jsx("option",{value:"opus",children:"Opus"}),s.jsx("option",{value:"sonnet",children:"Sonnet"}),s.jsx("option",{value:"haiku",children:"Haiku"})]})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),s.jsx("input",{type:"text",value:re,onChange:Z=>ee(Z.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"}})]})]})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"System Prompt"}),s.jsx("textarea",{value:fe,onChange:Z=>Se(Z.target.value),placeholder:`# /my-skill
66
+ `).filter(Boolean).length!==1?"s":""]})]})]}),s.jsx("div",{className:"col-span-2 flex flex-col",children:s.jsxs("div",{className:`glass-card flex flex-col ${H?"flex-1":""}`,children:[s.jsxs("button",{onClick:()=>B(!H),className:"w-full p-3 flex items-center justify-between text-left flex-shrink-0",style:{borderBottom:H?"1px solid var(--border-subtle)":void 0},children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"}),s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",style:{transform:H?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s ease"},children:s.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),H&&O&&s.jsx("div",{className:"p-3 flex-1 overflow-auto animate-fade-in",style:{maxHeight:320},children:s.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:Pf(O)}})}),!H&&O&&s.jsx("div",{className:"px-3 pb-3 pt-1",children:s.jsx("div",{className:"text-[11px] line-clamp-2 leading-relaxed",style:{color:"var(--text-tertiary)"},children:O.replace(/^---[\s\S]*?---\s*/,"").trim().slice(0,150)})})]})})]}),s.jsx("button",{onClick:Y,disabled:b||!E.trim(),className:"btn btn-primary mb-5",children:b?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"spinner",style:{borderTopColor:"#fff",borderColor:"rgba(255,255,255,0.2)",width:14,height:14}})," Testing..."]}):s.jsxs(s.Fragment,{children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"6"}),s.jsx("circle",{cx:"12",cy:"12",r:"2"})]})," Run Activation Test"]})}),m&&s.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:m}),p.length>0&&s.jsxs("div",{className:"space-y-5 mb-5",children:[P.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),s.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",P.length,")"]}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),s.jsx("div",{className:"space-y-1.5 stagger-children",children:P.map((K,se)=>s.jsx(Zf,{result:K},`incorrect-${se}`))})]}),G.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"16 10 11 15 8 12"})]}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",G.length,")"]})]}),s.jsx("div",{className:"space-y-1.5 stagger-children",children:G.map((K,se)=>s.jsx(Zf,{result:K},`correct-${se}`))})]})]}),T&&s.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),T.autoClassifiedCount!=null&&T.autoClassifiedCount>0&&s.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[T.autoClassifiedCount," of ",T.total," prompts auto-classified from skill name and tags"]}),s.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[s.jsx(gc,{label:"Precision",value:T.precision,description:"Of all activations, how many were correct?",detail:`${T.tp} true / ${T.tp+T.fp} total activations`}),s.jsx(gc,{label:"Recall",value:T.recall,description:"Of expected activations, how many fired?",detail:`${T.tp} activated / ${T.tp+T.fn} expected`}),s.jsx(gc,{label:"Reliability",value:T.reliability,description:"Overall correct classification rate",detail:`${T.tp+T.tn} correct / ${T.total} total`})]}),s.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[s.jsx(Zs,{label:"True Positive",abbr:"TP",count:T.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),s.jsx(Zs,{label:"False Positive",abbr:"FP",count:T.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),s.jsx(Zs,{label:"False Negative",abbr:"FN",count:T.fn,bg:"rgba(248,113,113,0.06)",color:"rgba(248,113,113,0.6)",description:"Missed activation"}),s.jsx(Zs,{label:"True Negative",abbr:"TN",count:T.tn,bg:"rgba(52,211,153,0.06)",color:"rgba(52,211,153,0.6)",description:"Correctly silent"})]})]})]}),b&&p.length===0&&s.jsxs("div",{className:"text-center py-16 animate-fade-in",children:[s.jsx("div",{className:"spinner-lg mx-auto mb-4"}),s.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]})]})}function Zf({result:c}){const u=Vf[c.classification]||Vf.FN,f=c.classification==="TP"||c.classification==="TN";return s.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:u.bg,border:"1px solid transparent"},children:[s.jsx("div",{className:"flex-shrink-0 mt-0.5",children:s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${u.text} 20%, transparent)`},children:f?s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:u.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}):s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:u.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:c.prompt})}),s.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[s.jsx("span",{className:"pill",style:{background:"rgba(0,0,0,0.1)",color:u.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:c.classification}),s.jsx("span",{style:{color:c.activate?"var(--green)":"var(--text-tertiary)"},children:c.activate?"Activated":"Silent"}),s.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",c.expected==="should_activate"?"activate":"stay silent"]}),s.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[c.confidence," confidence"]}),c.autoClassified&&s.jsx("span",{className:"pill",style:{background:"rgba(139,92,246,0.1)",color:"rgba(139,92,246,0.8)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),c.reasoning&&s.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:c.reasoning})]})]})}function gc({label:c,value:u,description:f,detail:o}){const x=Math.round(u*100),j=x>=80?"var(--green)":x>=60?"var(--yellow)":"var(--red)";return s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:j},children:[x,"%"]}),s.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:c}),s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:f}),s.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function Zs({abbr:c,count:u,bg:f,color:o,description:x}){return s.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:f},children:[s.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:u}),s.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:c}),s.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:x})]})}const bc={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Kf={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},Ec=600,Cc=180,lt=40,jc=Ec-lt*2,Cl=Cc-lt*2,Eh=[25,50,75,100];function Jf(c){return new Date(c).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Ch({entries:c}){const[u,f]=N.useState(null);if(c.length<2)return null;const o=c.length,x=c.map((T,b)=>{const m=lt+b/(o-1)*jc,E=T.passRate*100,h=lt+Cl-E/100*Cl;return{x:m,y:h,pct:E,entry:T}}),j=x.map(T=>`${T.x},${T.y}`).join(" "),p=Array.from(new Set(c.map(T=>T.type)));return s.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative"},children:[s.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),s.jsx("div",{className:"flex items-center gap-5 mb-3",children:p.map(T=>s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:bc[T]??"var(--text-tertiary)"}}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Kf[T]??T})]},T))}),s.jsxs("svg",{width:Ec,height:Cc,viewBox:`0 0 ${Ec} ${Cc}`,style:{display:"block",overflow:"visible"},children:[Eh.map(T=>{const b=lt+Cl-T/100*Cl;return s.jsxs("g",{children:[s.jsx("line",{x1:lt,y1:b,x2:lt+jc,y2:b,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),s.jsxs("text",{x:lt-8,y:b+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[T,"%"]})]},T)}),s.jsx("line",{x1:lt,y1:lt+Cl,x2:lt+jc,y2:lt+Cl,stroke:"var(--border-subtle)",strokeWidth:1}),s.jsx("text",{x:lt-8,y:lt+Cl+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),s.jsx("polyline",{points:j,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),x.map((T,b)=>s.jsx("circle",{cx:T.x,cy:T.y,r:5,fill:bc[T.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:m=>{m.currentTarget.setAttribute("r","7"),f({x:T.x,y:T.y,entry:T.entry})},onMouseLeave:m=>{m.currentTarget.setAttribute("r","5"),f(null)}},b)),Ah(o).map(T=>s.jsx("text",{x:x[T].x,y:lt+Cl+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Jf(c[T].timestamp)},T))]}),u&&s.jsxs("div",{style:{position:"absolute",left:u.x,top:u.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[s.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Jf(u.entry.timestamp)}),s.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:u.entry.model}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:bc[u.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Kf[u.entry.type]??u.entry.type}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(u.entry.passRate*100),"%"]})]})]})]})}function Ah(c){return c<=3?Array.from({length:c},(u,f)=>f):c<=6?[0,Math.floor(c/2),c-1]:[0,Math.floor(c/3),Math.floor(2*c/3),c-1]}function Ks(c){return c>=.8?"var(--green)":c>=.5?"var(--yellow)":"var(--red)"}function Mh(c){return c>=1e3?`${(c/1e3).toFixed(1)}s`:`${Math.round(c)}ms`}function _h({rate:c,label:u}){const f=Math.round(c*100);return s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:u}),s.jsxs("span",{className:"text-[11px] font-semibold",style:{color:Ks(c)},children:[f,"%"]})]}),s.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${f}%`,background:Ks(c)}})})]})})}function zh({points:c}){if(c.length<2)return null;const u=200,f=48,o=4,x=c.length,j=c.map((b,m)=>{const E=o+m/(x-1)*(u-o*2),h=o+(f-o*2)-b.passRate*(f-o*2);return{x:E,y:h}}),p=`M ${j[0].x},${f-o} `+j.map(b=>`L ${b.x},${b.y}`).join(" ")+` L ${j[j.length-1].x},${f-o} Z`,T=j.map((b,m)=>`${m===0?"M":"L"} ${b.x},${b.y}`).join(" ");return s.jsxs("svg",{width:u,height:f,style:{display:"block"},children:[s.jsx("path",{d:p,fill:"var(--accent-muted)"}),s.jsx("path",{d:T,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),s.jsx("circle",{cx:j[j.length-1].x,cy:j[j.length-1].y,r:3,fill:"var(--accent)"})]})}function kh({plugin:c,skill:u}){const[f,o]=N.useState(null),[x,j]=N.useState(!0);if(N.useEffect(()=>{j(!0),ge.getStats(c,u).then(o).catch(()=>o(null)).finally(()=>j(!1))},[c,u]),x)return s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"skeleton h-24 rounded-xl"}),s.jsx("div",{className:"skeleton h-48 rounded-xl"}),s.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!f||f.totalRuns===0)return s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[s.jsx("path",{d:"M18 20V10"}),s.jsx("path",{d:"M12 20V4"}),s.jsx("path",{d:"M6 20v-6"})]})}),s.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),s.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const p=f.trendPoints.length>0?f.trendPoints[f.trendPoints.length-1].passRate:0,T=f.trendPoints.length>0?f.trendPoints[0].passRate:0,b=p-T,m=f.assertionStats.slice(0,10);return s.jsxs("div",{className:"space-y-4 stagger-children",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),s.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:f.totalRuns})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),s.jsxs("div",{className:"text-[24px] font-bold",style:{color:Ks(p)},children:[Math.round(p*100),"%"]})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),s.jsxs("div",{className:"text-[24px] font-bold",style:{color:b>=0?"var(--green)":"var(--red)"},children:[b>=0?"+":"",Math.round(b*100),"%"]})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),s.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:f.modelStats.length})]})]}),f.trendPoints.length>=2&&s.jsxs("div",{className:"glass-card p-5",children:[s.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),s.jsx(zh,{points:f.trendPoints})]}),f.modelStats.length>0&&s.jsxs("div",{className:"glass-card p-5",children:[s.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),s.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[s.jsx("thead",{children:s.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),s.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),s.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),s.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"})]})}),s.jsx("tbody",{children:f.modelStats.map(E=>s.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:E.model}),s.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:E.runs}),s.jsx("td",{style:{padding:"8px",textAlign:"center"},children:s.jsxs("span",{className:"font-semibold",style:{color:Ks(E.avgPassRate)},children:[Math.round(E.avgPassRate*100),"%"]})}),s.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:Mh(E.avgDurationMs)})]},E.model))})]})]}),m.length>0&&s.jsxs("div",{className:"glass-card p-5",children:[s.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),s.jsx("div",{className:"space-y-3",children:m.map(E=>s.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--surface-2)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},onClick:()=>{},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",E.evalId]}),s.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:E.evalName}),s.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[E.totalRuns," runs"]})]}),s.jsx(_h,{rate:E.passRate,label:E.text})]},`${E.evalId}:${E.id}`))})]})]})}function Rh({plugin:c,skill:u}){const[f,o]=N.useState(null),[x,j]=N.useState(null),[p,T]=N.useState({}),[b,m]=N.useState({});N.useEffect(()=>{ge.getEvals(c,u).then(o).catch(()=>o(null))},[c,u]);async function E(h){if(x===h){j(null);return}if(j(h),!p[h]){m(O=>({...O,[h]:!0}));try{const O=await ge.getCaseHistory(c,u,h);T(q=>({...q,[h]:O}))}catch{T(O=>({...O,[h]:[]}))}finally{m(O=>({...O,[h]:!1}))}}}return f?s.jsx("div",{className:"space-y-2 stagger-children",children:f.evals.map(h=>{const O=p[h.id]||[],q=x===h.id,H=b[h.id],B=O.length>0?O[0].pass_rate:null;return s.jsxs("div",{className:"glass-card overflow-hidden",children:[s.jsxs("button",{onClick:()=>E(h.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:q?"var(--surface-2)":"transparent"},onMouseEnter:Y=>{q||(Y.currentTarget.style.background="var(--surface-2)")},onMouseLeave:Y=>{q||(Y.currentTarget.style.background="transparent")},children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:q?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:s.jsx("polyline",{points:"9 18 15 12 9 6"})}),s.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",h.id]}),s.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:h.name}),O.length>=2&&s.jsx(am,{entries:O}),B!=null&&s.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:Tc(B)},children:[Math.round(B*100),"%"]}),O.length>0&&s.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[O.length," runs"]})]}),q&&s.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:H?s.jsxs("div",{className:"p-4 flex items-center gap-2",children:[s.jsx("div",{className:"spinner",style:{width:14,height:14}}),s.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):O.length===0?s.jsx("div",{className:"p-4",children:s.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):s.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:O.map((Y,V)=>s.jsxs("div",{className:"p-4",style:{background:V===0?"var(--surface-2)":"transparent"},children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:tm(Y.timestamp)}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:Y.model}),s.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:Y.type==="benchmark"?"rgba(99,131,255,0.15)":Y.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:Y.type==="benchmark"?"#6383ff":Y.type==="comparison"?"var(--purple)":"#fb923c"},children:Y.type}),s.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Tc(Y.pass_rate)},children:[Math.round(Y.pass_rate*100),"%"]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[Y.durationMs!=null&&s.jsx("span",{children:lm(Y.durationMs)}),Y.tokens!=null&&s.jsxs("span",{children:[Y.tokens>=1e3?`${(Y.tokens/1e3).toFixed(1)}k`:Y.tokens," tok"]})]}),s.jsx("div",{className:"space-y-1",children:Y.assertions.map(G=>s.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[s.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:G.pass?"var(--green)":"var(--red)"},children:s.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:G.pass?s.jsx("polyline",{points:"20 6 9 17 4 12"}):s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:G.text}),G.reasoning&&s.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:G.reasoning})]})]},G.id))})]},V))})})]},h.id)})}):s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function Oh(){const{state:c,dispatch:u}=Al(),{plugin:f,skill:o}=c,[x,j]=N.useState("timeline"),[p,T]=N.useState([]),[b,m]=N.useState(!0),[E,h]=N.useState(""),[O,q]=N.useState(""),[H,B]=N.useState(!1),[Y,V]=N.useState([]),[G,P]=N.useState(null),[K,se]=N.useState(!1),[re,ee]=N.useState(null),[fe,Se]=N.useState(!1);N.useEffect(()=>{m(!0),ge.getHistory(f,o,{model:E||void 0,type:O||void 0}).then(z=>{T(z),z.length>=2&&ge.compareRuns(f,o,z[0].timestamp,z[1].timestamp).then($=>{const ie=$.regressions.filter(k=>k.change==="regression");u({type:"SET_REGRESSIONS",regressions:ie})}).catch(()=>{})}).catch(()=>{}).finally(()=>m(!1))},[f,o,E,O]);const te=N.useCallback(async z=>{if(H){V($=>$.includes(z)?$.filter(ie=>ie!==z):$.length>=2?[$[1],z]:[...$,z]);return}Se(!0);try{const $=await ge.getHistoryEntry(f,o,z);ee($)}catch{}finally{Se(!1)}},[f,o,H]),R=N.useCallback(async()=>{if(Y.length===2){se(!0);try{const z=await ge.compareRuns(f,o,Y[0],Y[1]);P(z)}catch{}finally{se(!1)}}},[f,o,Y]),J=[...new Set(p.map(z=>z.model))];return b?s.jsxs("div",{className:"p-5",children:[s.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),s.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"skeleton h-12 rounded-lg"}),s.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):s.jsxs("div",{className:"p-5",children:[s.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(z=>s.jsx("button",{onClick:()=>j(z),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:x===z?"var(--accent-muted)":"transparent",color:x===z?"var(--accent)":"var(--text-tertiary)"},children:z==="timeline"?"Timeline":z==="per-eval"?"Per Eval":"Statistics"},z))}),x==="timeline"&&s.jsxs("div",{children:[p.length>0&&s.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:s.jsx(Ch,{entries:p})}),s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsxs("select",{value:E,onChange:z=>h(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[s.jsx("option",{value:"",children:"All Models"}),J.map(z=>s.jsx("option",{value:z,children:z},z))]}),s.jsxs("select",{value:O,onChange:z=>q(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[s.jsx("option",{value:"",children:"All Types"}),s.jsx("option",{value:"benchmark",children:"Benchmark"}),s.jsx("option",{value:"comparison",children:"Comparison"}),s.jsx("option",{value:"baseline",children:"Baseline"}),s.jsx("option",{value:"model-compare",children:"Model Compare"}),s.jsx("option",{value:"improve",children:"AI Improve"})]}),s.jsx("div",{className:"flex-1"}),s.jsx("button",{onClick:()=>{B(!H),V([]),P(null)},className:`btn text-[12px] ${H?"btn-primary":"btn-secondary"}`,children:H?"Exit Compare":"Compare Runs"}),H&&Y.length===2&&s.jsx("button",{onClick:R,disabled:K,className:"btn btn-primary text-[12px]",children:K?"Comparing...":"Compare"})]}),s.jsx("div",{className:"space-y-2",children:p.length===0?s.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):p.map(z=>{const $=Y.includes(z.timestamp);return s.jsx("button",{onClick:()=>te(z.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:$?"var(--accent-muted)":"var(--surface-1)",border:$?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:ie=>{$||(ie.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:ie=>{$||(ie.currentTarget.style.borderColor="var(--border-subtle)")},children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[H&&s.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:$?"var(--accent)":"var(--border-default)",background:$?"var(--accent)":"transparent"},children:$&&s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})}),s.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(z.timestamp).toLocaleString()}),s.jsx("span",{className:"pill text-[9px]",style:{background:z.type==="comparison"?"var(--purple-muted)":z.type==="baseline"?"var(--surface-3)":z.type==="model-compare"?"rgba(56,189,248,0.15)":z.type==="improve"?"rgba(168,85,247,0.15)":"var(--accent-muted)",color:z.type==="comparison"?"var(--purple)":z.type==="baseline"?"var(--text-tertiary)":z.type==="model-compare"?"#38bdf8":z.type==="improve"?"#a855f7":"var(--accent)"},children:z.type==="model-compare"?"model compare":z.type==="improve"?"ai improve":z.type})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:z.model}),s.jsxs("span",{className:"text-[12px] font-semibold",style:{color:z.passRate>=.8?"var(--green)":z.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(z.passRate*100),"%"]})]})]})},z.timestamp)})}),G&&s.jsx(Dh,{result:G}),re&&!H&&s.jsx(wh,{run:re,onClose:()=>ee(null)})]}),x==="per-eval"&&s.jsx(Rh,{plugin:f,skill:o}),x==="statistics"&&s.jsx(kh,{plugin:f,skill:o})]})}function Dh({result:c}){const u=c.regressions.filter(o=>o.change==="regression"),f=c.regressions.filter(o=>o.change==="improvement");return s.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(c.runA.timestamp).toLocaleDateString()," vs ",new Date(c.runB.timestamp).toLocaleDateString()]}),u.length>0&&s.jsxs("div",{className:"mb-3",children:[s.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",u.length,")"]}),u.map(o=>s.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",s.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),f.length>0&&s.jsxs("div",{className:"mb-3",children:[s.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",f.length,")"]}),f.map(o=>s.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",s.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),s.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:s.jsxs("table",{className:"w-full text-[12px]",children:[s.jsx("thead",{children:s.jsxs("tr",{style:{background:"var(--surface-2)"},children:[s.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),s.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),s.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),s.jsx("tbody",{children:c.caseDiffs.map(o=>s.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[s.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),s.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),s.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function wh({run:c,onClose:u}){return c.type==="improve"&&c.improve?s.jsx(Lh,{run:c,onClose:u}):s.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(c.timestamp).toLocaleString()]}),s.jsx("button",{onClick:u,className:"btn btn-ghost text-[11px]",children:"Close"})]}),s.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",c.model," | Cases: ",c.cases.length," | Pass Rate: ",c.overall_pass_rate!=null?`${Math.round(c.overall_pass_rate*100)}%`:"--"]}),s.jsx("div",{className:"space-y-2",children:c.cases.map(f=>s.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",f.eval_id," ",f.eval_name]}),s.jsx("span",{className:"text-[11px] font-semibold",style:{color:f.status==="pass"?"var(--green)":"var(--red)"},children:f.pass_rate!=null?`${Math.round(f.pass_rate*100)}%`:f.status})]})},f.eval_id))})]})}function Lh({run:c,onClose:u}){var j;const f=N.useMemo(()=>c.improve?em(c.improve.original,c.improve.improved):[],[c.improve]),o=N.useMemo(()=>{const p=f.filter(b=>b.type==="added").length,T=f.filter(b=>b.type==="removed").length;return{added:p,removed:T}},[f]),x=N.useMemo(()=>{let p=0,T=0;return f.map(b=>b.type==="removed"?(p++,{...b,origNum:p,newNum:null}):b.type==="added"?(T++,{...b,origNum:null,newNum:T}):(p++,T++,{...b,origNum:p,newNum:T}))},[f]);return s.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),s.jsx("path",{d:"M2 17l10 5 10-5"}),s.jsx("path",{d:"M2 12l10 5 10-5"})]})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),s.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(c.timestamp).toLocaleString()," · ",c.model]})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[s.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),s.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),s.jsx("button",{onClick:u,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--surface-3)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((j=c.improve)==null?void 0:j.reasoning)&&s.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.06)",border:"1px solid rgba(168,85,247,0.15)",color:"var(--text-secondary)"},children:[s.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),c.improve.reasoning]}),s.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:s.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:s.jsx("tbody",{children:x.map((p,T)=>s.jsxs("tr",{style:{background:p.type==="added"?"rgba(34,197,94,0.08)":p.type==="removed"?"rgba(239,68,68,0.08)":"transparent"},children:[s.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="removed"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:p.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.origNum??""}),s.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="added"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:p.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.newNum??""}),s.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"transparent",borderRight:p.type==="added"?"2px solid var(--green)":p.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:p.type==="added"?"+":p.type==="removed"?"-":" "}),s.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"var(--text-secondary)"},children:p.content||"​"})]},T))})})})]})}function Uh({plugin:c,skill:u}){const[f,o]=N.useState([]),[x,j]=N.useState([]),[p,T]=N.useState(!0),[b,m]=N.useState(null);N.useEffect(()=>{ge.getDependencies(c,u).then(h=>{o(h.mcpDependencies),j(h.skillDependencies)}).catch(()=>{}).finally(()=>T(!1))},[c,u]);async function E(h,O){try{await navigator.clipboard.writeText(O),m(h),setTimeout(()=>m(null),2e3)}catch{}}return p?null:f.length===0&&x.length===0?s.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):s.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[s.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),s.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),s.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:f.length+x.length})]}),s.jsxs("div",{className:"px-5 py-4",children:[f.length>0&&s.jsxs("div",{className:"space-y-3 mb-4",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),f.map(h=>s.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:h.server}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:h.transport})]}),s.jsx("button",{onClick:()=>E(h.server,h.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:b===h.server?"var(--green)":"var(--accent)"},children:b===h.server?s.jsxs(s.Fragment,{children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):s.jsxs(s.Fragment,{children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),s.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:h.url}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:h.matchedTools.map(O=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:O},O))})]},h.server))]}),x.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),s.jsx("div",{className:"space-y-1.5",children:x.map(h=>s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),s.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:h.name}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:h.source==="frontmatter"?"frontmatter":"referenced"})]},h.name))})]})]})]})}function Bh(){const{state:c}=Al(),{plugin:u,skill:f}=c,[o,x]=N.useState(null),[j,p]=N.useState(!0);return N.useEffect(()=>{ge.getDependencies(u,f).then(x).catch(()=>{}).finally(()=>p(!1))},[u,f]),j?s.jsxs("div",{className:"p-5",children:[s.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),s.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?s.jsx("div",{className:"p-5 max-w-3xl",children:s.jsx(Uh,{plugin:u,skill:f})}):s.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"No dependency information available"})}function Hh(){const{state:c,dispatch:u,saveContent:f}=Al(),o=N.useCallback(j=>{const p=j.ctrlKey||j.metaKey;if(p&&j.key>="1"&&j.key<="6"){j.preventDefault(),u({type:"SET_PANEL",panel:["editor","tests","run","activation","history","deps"][parseInt(j.key)-1]});return}if(p&&j.key==="s"&&!j.shiftKey){j.preventDefault(),c.isDirty&&f();return}},[c.isDirty,f,u]);if(N.useEffect(()=>(window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)),[o]),c.loading)return s.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:"spinner spinner-lg"}),s.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const x=Array.from(c.caseRunStates.values()).some(j=>j.status==="running"||j.status==="queued");return s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[s.jsx(lh,{state:c}),s.jsx(ih,{activePanel:c.activePanel,onPanelChange:j=>u({type:"SET_PANEL",panel:j}),isDirty:c.isDirty,isRunning:x,hasRegressions:c.regressions.length>0,isActivationRunning:c.activationRunning}),s.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:s.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[c.activePanel==="editor"&&s.jsx(mh,{}),c.activePanel==="tests"&&s.jsx(xh,{}),c.activePanel==="run"&&s.jsx(bh,{}),c.activePanel==="activation"&&s.jsx(Th,{}),c.activePanel==="history"&&s.jsx(Oh,{}),c.activePanel==="deps"&&s.jsx(Bh,{})]},c.activePanel)})]})}function Sc(c){return c.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function qh(c,u,f,o){const j=`.../${c.split("/").slice(-2).join("/")}`;switch(u){case 1:return`${j}/${f}/skills/${o}/SKILL.md`;case 2:return`${j}/plugins/${f}/skills/${o}/SKILL.md`;case 3:return`${j}/skills/${o}/SKILL.md`}}function Yh({onCreated:c,onCancel:u}){const[f,o]=N.useState(null),[x,j]=N.useState(!0),[p,T]=N.useState(null),[b,m]=N.useState(null),[E,h]=N.useState(""),[O,q]=N.useState(3),[H,B]=N.useState(""),[Y,V]=N.useState(""),[G,P]=N.useState(""),[K,se]=N.useState(""),[re,ee]=N.useState(""),[fe,Se]=N.useState(""),[te,R]=N.useState(!1),[J,z]=N.useState(null);N.useEffect(()=>{ge.getProjectLayout().then(Z=>{o(Z),q(Z.suggestedLayout);const g=Z.detectedLayouts.find(U=>U.layout===Z.suggestedLayout);g!=null&&g.existingPlugins.length&&B(g.existingPlugins[0])}).catch(()=>{}).finally(()=>j(!1)),ge.getConfig().then(m).catch(()=>{}),ge.getSkillCreatorStatus().then(T).catch(()=>{})},[]);const $=N.useMemo(()=>{var Z;return f?((Z=f.detectedLayouts.find(g=>g.layout===O))==null?void 0:Z.existingPlugins)||[]:[]},[f,O]),ie=H==="__new__"?Y:H,k=f?qh(f.root,O,ie||"{plugin}",E||"{skill}"):"",Q=N.useMemo(()=>f?f.detectedLayouts.filter(Z=>Z.layout!==4):[],[f]),ae=(b==null?void 0:b.provider)==="claude-cli"&&p!==null;async function Te(){if(z(null),!E.trim()){z("Skill name is required");return}if(!G.trim()){z("Description is required");return}if(O!==3&&!ie.trim()){z("Plugin name is required");return}R(!0);try{const Z=await ge.createSkill({name:Sc(E),plugin:ie||"",layout:O,description:G,model:K||void 0,allowedTools:re||void 0,body:fe});c(Z.plugin,Z.skill)}catch(Z){z(Z.message)}finally{R(!1)}}return s.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[s.jsxs("div",{className:"mb-5",children:[s.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),s.jsx("p",{className:"text-[13px] mt-1",style:{color:"var(--text-tertiary)"},children:"Define your skill's metadata, content, and placement"})]}),ae&&s.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[13px]",style:{background:p.installed?"var(--accent-muted)":"var(--surface-2)",border:p.installed?"1px solid var(--accent)":"1px solid var(--border-subtle)",color:"var(--text-primary)"},children:p.installed?s.jsxs("span",{children:[s.jsx("span",{className:"font-medium",children:"AI-Assisted Authoring Available"}),s.jsxs("span",{className:"ml-1",style:{color:"var(--text-secondary)"},children:["— Run ",s.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-3)"},children:"/skill-creator"})," in Claude Code for guided creation."]})]}):s.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Tip: Install the Skill Creator — ",s.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-3)"},children:p.installCommand})]})}),x?s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),s.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}):f?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),Q.length>1&&s.jsxs("div",{className:"mb-3",children:[s.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),s.jsx("div",{className:"flex gap-2",children:Q.map(Z=>s.jsx("button",{onClick:()=>{q(Z.layout),B(Z.existingPlugins[0]||""),V("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:O===Z.layout?"var(--accent)":"var(--surface-3)",color:O===Z.layout?"#fff":"var(--text-secondary)",border:`1px solid ${O===Z.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:Z.label},Z.layout))})]}),O!==3&&s.jsxs("div",{className:"mb-3",children:[s.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),s.jsxs("select",{value:H,onChange:Z=>{B(Z.target.value),V("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:[$.map(Z=>s.jsx("option",{value:Z,children:Z},Z)),s.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),H==="__new__"&&s.jsx("input",{type:"text",value:Y,onChange:Z=>V(Sc(Z.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"}})]}),s.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:k})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),s.jsxs("div",{className:"mb-3",children:[s.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",s.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),s.jsx("input",{type:"text",value:E,onChange:Z=>h(Sc(Z.target.value)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"}})]}),s.jsxs("div",{className:"mb-3",children:[s.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",s.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),s.jsx("textarea",{value:G,onChange:Z=>P(Z.target.value),placeholder:"Brief description",rows:2,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-none",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"}})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),s.jsxs("select",{value:K,onChange:Z=>se(Z.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:[s.jsx("option",{value:"",children:"Any"}),s.jsx("option",{value:"opus",children:"Opus"}),s.jsx("option",{value:"sonnet",children:"Sonnet"}),s.jsx("option",{value:"haiku",children:"Haiku"})]})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),s.jsx("input",{type:"text",value:re,onChange:Z=>ee(Z.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"}})]})]})]}),s.jsxs("div",{className:"glass-card p-4",children:[s.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"System Prompt"}),s.jsx("textarea",{value:fe,onChange:Z=>Se(Z.target.value),placeholder:`# /my-skill
67
67
 
68
68
  You are an expert at...
69
- `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",minHeight:"150px"}})]}),J&&s.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:J}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:Te,disabled:te||!E||!G,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:te||!E||!G?"var(--surface-3)":"var(--accent)",color:te||!E||!G?"var(--text-tertiary)":"#fff",cursor:te||!E||!G?"not-allowed":"pointer",border:"none"},children:te?"Creating...":"Create Skill"}),s.jsx("button",{onClick:u,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]}):null]})}function Nc({variant:c,message:u,onRetry:f}){const{setMode:o,setSearch:x}=Kl();return c==="no-selection"?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[s.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center mb-5",style:{background:"var(--surface-2)"},children:s.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),s.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),s.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})}),s.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),s.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):c==="no-skills"?s.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:s.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),s.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),s.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",s.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),s.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:j=>{j.currentTarget.style.opacity="0.9"},onMouseLeave:j=>{j.currentTarget.style.opacity="1"},children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):c==="error"?s.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:s.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[s.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:u||"Failed to load skill data"}),f&&s.jsx("button",{onClick:f,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):s.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[s.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),s.jsx("button",{onClick:()=>x(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function $f(){const{state:c,setMobileView:u}=Kl();return c.isMobile?s.jsxs("button",{onClick:()=>u("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function Yh(){const{state:c,selectSkill:u,setMode:f,refreshSkills:o}=Kl();if(c.mode==="create")return s.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[s.jsx($f,{}),s.jsx(qh,{onCreated:(p,T)=>{f("browse"),o(),u({plugin:p,skill:T})},onCancel:()=>f("browse")})]});if(!c.selectedSkill)return c.skillsError?s.jsx(Nc,{variant:"error",message:c.skillsError,onRetry:o}):!c.skillsLoading&&c.skills.length===0?s.jsx(Nc,{variant:"no-skills"}):s.jsx(Nc,{variant:"no-selection"});const{plugin:x,skill:j}=c.selectedSkill;return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx($f,{}),s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(eh,{plugin:x,skill:j,children:s.jsx(Bh,{})},`${x}/${j}`)})]})}function Gh(){return s.jsx(Gv,{children:s.jsx(Qv,{left:s.jsx($v,{}),right:s.jsx(Yh,{})})})}Uv.createRoot(document.getElementById("root")).render(s.jsx(N.StrictMode,{children:s.jsx(Gh,{})}));
69
+ `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",minHeight:"150px"}})]}),J&&s.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:J}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:Te,disabled:te||!E||!G,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:te||!E||!G?"var(--surface-3)":"var(--accent)",color:te||!E||!G?"var(--text-tertiary)":"#fff",cursor:te||!E||!G?"not-allowed":"pointer",border:"none"},children:te?"Creating...":"Create Skill"}),s.jsx("button",{onClick:u,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]}):null]})}function Nc({variant:c,message:u,onRetry:f}){const{setMode:o,setSearch:x}=Kl();return c==="no-selection"?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[s.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center mb-5",style:{background:"var(--surface-2)"},children:s.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),s.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),s.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})}),s.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),s.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):c==="no-skills"?s.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:s.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),s.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),s.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",s.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),s.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:j=>{j.currentTarget.style.opacity="0.9"},onMouseLeave:j=>{j.currentTarget.style.opacity="1"},children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):c==="error"?s.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:s.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[s.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:u||"Failed to load skill data"}),f&&s.jsx("button",{onClick:f,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):s.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[s.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),s.jsx("button",{onClick:()=>x(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function $f(){const{state:c,setMobileView:u}=Kl();return c.isMobile?s.jsxs("button",{onClick:()=>u("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function Gh(){const{state:c,selectSkill:u,setMode:f,refreshSkills:o}=Kl();if(c.mode==="create")return s.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[s.jsx($f,{}),s.jsx(Yh,{onCreated:(p,T)=>{f("browse"),o(),u({plugin:p,skill:T})},onCancel:()=>f("browse")})]});if(!c.selectedSkill)return c.skillsError?s.jsx(Nc,{variant:"error",message:c.skillsError,onRetry:o}):!c.skillsLoading&&c.skills.length===0?s.jsx(Nc,{variant:"no-skills"}):s.jsx(Nc,{variant:"no-selection"});const{plugin:x,skill:j}=c.selectedSkill;return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsx($f,{}),s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(th,{plugin:x,skill:j,children:s.jsx(Hh,{})},`${x}/${j}`)})]})}function Qh(){return s.jsx(Qv,{children:s.jsx(Xv,{left:s.jsx(Wv,{}),right:s.jsx(Gh,{})})})}Uv.createRoot(document.getElementById("root")).render(s.jsx(N.StrictMode,{children:s.jsx(Qh,{})}));