vskill 0.5.47 → 0.5.49

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.
@@ -1,4 +1,4 @@
1
- (function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const x of document.querySelectorAll('link[rel="modulepreload"]'))u(x);new MutationObserver(x=>{for(const v of x)if(v.type==="childList")for(const m of v.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function c(x){const v={};return x.integrity&&(v.integrity=x.integrity),x.referrerPolicy&&(v.referrerPolicy=x.referrerPolicy),x.crossOrigin==="use-credentials"?v.credentials="include":x.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function u(x){if(x.ep)return;x.ep=!0;const v=c(x);fetch(x.href,v)}})();var Wo={exports:{}},rs={};/**
1
+ (function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const x of document.querySelectorAll('link[rel="modulepreload"]'))u(x);new MutationObserver(x=>{for(const v of x)if(v.type==="childList")for(const p of v.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&u(p)}).observe(document,{childList:!0,subtree:!0});function c(x){const v={};return x.integrity&&(v.integrity=x.integrity),x.referrerPolicy&&(v.referrerPolicy=x.referrerPolicy),x.crossOrigin==="use-credentials"?v.credentials="include":x.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function u(x){if(x.ep)return;x.ep=!0;const v=c(x);fetch(x.href,v)}})();var Wo={exports:{}},rs={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var vx;function Ah(){if(vx)return rs;vx=1;var s=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function c(u,x,v){var m=null;if(v!==void 0&&(m=""+v),x.key!==void 0&&(m=""+x.key),"key"in x){v={};for(var b in x)b!=="key"&&(v[b]=x[b])}else v=x;return x=v.ref,{$$typeof:s,type:u,key:m,ref:x!==void 0?x:null,props:v}}return rs.Fragment=o,rs.jsx=c,rs.jsxs=c,rs}var yx;function Rh(){return yx||(yx=1,Wo.exports=Ah()),Wo.exports}var a=Rh(),Fo={exports:{}},je={};/**
9
+ */var vx;function Ah(){if(vx)return rs;vx=1;var s=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function c(u,x,v){var p=null;if(v!==void 0&&(p=""+v),x.key!==void 0&&(p=""+x.key),"key"in x){v={};for(var b in x)b!=="key"&&(v[b]=x[b])}else v=x;return x=v.ref,{$$typeof:s,type:u,key:p,ref:x!==void 0?x:null,props:v}}return rs.Fragment=o,rs.jsx=c,rs.jsxs=c,rs}var yx;function Rh(){return yx||(yx=1,Wo.exports=Ah()),Wo.exports}var a=Rh(),Fo={exports:{}},je={};/**
10
10
  * @license React
11
11
  * react.production.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var gx;function _h(){if(gx)return je;gx=1;var s=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),m=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),k=Symbol.iterator;function R(j){return j===null||typeof j!="object"?null:(j=k&&j[k]||j["@@iterator"],typeof j=="function"?j:null)}var U={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,Y={};function O(j,D,P){this.props=j,this.context=D,this.refs=Y,this.updater=P||U}O.prototype.isReactComponent={},O.prototype.setState=function(j,D){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,D,"setState")},O.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function Z(){}Z.prototype=O.prototype;function W(j,D,P){this.props=j,this.context=D,this.refs=Y,this.updater=P||U}var F=W.prototype=new Z;F.constructor=W,L(F,O.prototype),F.isPureReactComponent=!0;var ae=Array.isArray;function re(){}var q={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function G(j,D,P){var le=P.ref;return{$$typeof:s,type:j,key:D,ref:le!==void 0?le:null,props:P}}function X(j,D){return G(j.type,D,j.props)}function ne(j){return typeof j=="object"&&j!==null&&j.$$typeof===s}function te(j){var D={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(P){return D[P]})}var be=/\/+/g;function he(j,D){return typeof j=="object"&&j!==null&&j.key!=null?te(""+j.key):D.toString(36)}function T(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(re,re):(j.status="pending",j.then(function(D){j.status==="pending"&&(j.status="fulfilled",j.value=D)},function(D){j.status==="pending"&&(j.status="rejected",j.reason=D)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function N(j,D,P,le,ce){var de=typeof j;(de==="undefined"||de==="boolean")&&(j=null);var me=!1;if(j===null)me=!0;else switch(de){case"bigint":case"string":case"number":me=!0;break;case"object":switch(j.$$typeof){case s:case o:me=!0;break;case S:return me=j._init,N(me(j._payload),D,P,le,ce)}}if(me)return ce=ce(j),me=le===""?"."+he(j,0):le,ae(ce)?(P="",me!=null&&(P=me.replace(be,"$&/")+"/"),N(ce,D,P,"",function(pt){return pt})):ce!=null&&(ne(ce)&&(ce=X(ce,P+(ce.key==null||j&&j.key===ce.key?"":(""+ce.key).replace(be,"$&/")+"/")+me)),D.push(ce)),1;me=0;var Oe=le===""?".":le+":";if(ae(j))for(var Re=0;Re<j.length;Re++)le=j[Re],de=Oe+he(le,Re),me+=N(le,D,P,de,ce);else if(Re=R(j),typeof Re=="function")for(j=Re.call(j),Re=0;!(le=j.next()).done;)le=le.value,de=Oe+he(le,Re++),me+=N(le,D,P,de,ce);else if(de==="object"){if(typeof j.then=="function")return N(T(j),D,P,le,ce);throw D=String(j),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return me}function w(j,D,P){if(j==null)return j;var le=[],ce=0;return N(j,le,"","",function(de){return D.call(P,de,ce++)}),le}function ee(j){if(j._status===-1){var D=j._result;D=D(),D.then(function(P){(j._status===0||j._status===-1)&&(j._status=1,j._result=P)},function(P){(j._status===0||j._status===-1)&&(j._status=2,j._result=P)}),j._status===-1&&(j._status=0,j._result=D)}if(j._status===1)return j._result.default;throw j._result}var B=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(D))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},ue={map:w,forEach:function(j,D,P){w(j,function(){D.apply(this,arguments)},P)},count:function(j){var D=0;return w(j,function(){D++}),D},toArray:function(j){return w(j,function(D){return D})||[]},only:function(j){if(!ne(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return je.Activity=y,je.Children=ue,je.Component=O,je.Fragment=c,je.Profiler=x,je.PureComponent=W,je.StrictMode=u,je.Suspense=g,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,je.__COMPILER_RUNTIME={__proto__:null,c:function(j){return q.H.useMemoCache(j)}},je.cache=function(j){return function(){return j.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(j,D,P){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var le=L({},j.props),ce=j.key;if(D!=null)for(de in D.key!==void 0&&(ce=""+D.key),D)!I.call(D,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&D.ref===void 0||(le[de]=D[de]);var de=arguments.length-2;if(de===1)le.children=P;else if(1<de){for(var me=Array(de),Oe=0;Oe<de;Oe++)me[Oe]=arguments[Oe+2];le.children=me}return G(j.type,ce,le)},je.createContext=function(j){return j={$$typeof:m,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:v,_context:j},j},je.createElement=function(j,D,P){var le,ce={},de=null;if(D!=null)for(le in D.key!==void 0&&(de=""+D.key),D)I.call(D,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(ce[le]=D[le]);var me=arguments.length-2;if(me===1)ce.children=P;else if(1<me){for(var Oe=Array(me),Re=0;Re<me;Re++)Oe[Re]=arguments[Re+2];ce.children=Oe}if(j&&j.defaultProps)for(le in me=j.defaultProps,me)ce[le]===void 0&&(ce[le]=me[le]);return G(j,de,ce)},je.createRef=function(){return{current:null}},je.forwardRef=function(j){return{$$typeof:b,render:j}},je.isValidElement=ne,je.lazy=function(j){return{$$typeof:S,_payload:{_status:-1,_result:j},_init:ee}},je.memo=function(j,D){return{$$typeof:f,type:j,compare:D===void 0?null:D}},je.startTransition=function(j){var D=q.T,P={};q.T=P;try{var le=j(),ce=q.S;ce!==null&&ce(P,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(re,B)}catch(de){B(de)}finally{D!==null&&P.types!==null&&(D.types=P.types),q.T=D}},je.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},je.use=function(j){return q.H.use(j)},je.useActionState=function(j,D,P){return q.H.useActionState(j,D,P)},je.useCallback=function(j,D){return q.H.useCallback(j,D)},je.useContext=function(j){return q.H.useContext(j)},je.useDebugValue=function(){},je.useDeferredValue=function(j,D){return q.H.useDeferredValue(j,D)},je.useEffect=function(j,D){return q.H.useEffect(j,D)},je.useEffectEvent=function(j){return q.H.useEffectEvent(j)},je.useId=function(){return q.H.useId()},je.useImperativeHandle=function(j,D,P){return q.H.useImperativeHandle(j,D,P)},je.useInsertionEffect=function(j,D){return q.H.useInsertionEffect(j,D)},je.useLayoutEffect=function(j,D){return q.H.useLayoutEffect(j,D)},je.useMemo=function(j,D){return q.H.useMemo(j,D)},je.useOptimistic=function(j,D){return q.H.useOptimistic(j,D)},je.useReducer=function(j,D,P){return q.H.useReducer(j,D,P)},je.useRef=function(j){return q.H.useRef(j)},je.useState=function(j){return q.H.useState(j)},je.useSyncExternalStore=function(j,D,P){return q.H.useSyncExternalStore(j,D,P)},je.useTransition=function(){return q.H.useTransition()},je.version="19.2.4",je}var bx;function yc(){return bx||(bx=1,Fo.exports=_h()),Fo.exports}var p=yc(),Io={exports:{}},is={},Po={exports:{}},ec={};/**
17
+ */var gx;function _h(){if(gx)return je;gx=1;var s=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),p=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),k=Symbol.iterator;function R(S){return S===null||typeof S!="object"?null:(S=k&&S[k]||S["@@iterator"],typeof S=="function"?S:null)}var U={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,Y={};function O(S,D,P){this.props=S,this.context=D,this.refs=Y,this.updater=P||U}O.prototype.isReactComponent={},O.prototype.setState=function(S,D){if(typeof S!="object"&&typeof S!="function"&&S!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,S,D,"setState")},O.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function Z(){}Z.prototype=O.prototype;function W(S,D,P){this.props=S,this.context=D,this.refs=Y,this.updater=P||U}var F=W.prototype=new Z;F.constructor=W,L(F,O.prototype),F.isPureReactComponent=!0;var ae=Array.isArray;function re(){}var q={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function G(S,D,P){var le=P.ref;return{$$typeof:s,type:S,key:D,ref:le!==void 0?le:null,props:P}}function X(S,D){return G(S.type,D,S.props)}function ne(S){return typeof S=="object"&&S!==null&&S.$$typeof===s}function te(S){var D={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function(P){return D[P]})}var be=/\/+/g;function he(S,D){return typeof S=="object"&&S!==null&&S.key!=null?te(""+S.key):D.toString(36)}function T(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(re,re):(S.status="pending",S.then(function(D){S.status==="pending"&&(S.status="fulfilled",S.value=D)},function(D){S.status==="pending"&&(S.status="rejected",S.reason=D)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function N(S,D,P,le,ce){var de=typeof S;(de==="undefined"||de==="boolean")&&(S=null);var me=!1;if(S===null)me=!0;else switch(de){case"bigint":case"string":case"number":me=!0;break;case"object":switch(S.$$typeof){case s:case o:me=!0;break;case j:return me=S._init,N(me(S._payload),D,P,le,ce)}}if(me)return ce=ce(S),me=le===""?"."+he(S,0):le,ae(ce)?(P="",me!=null&&(P=me.replace(be,"$&/")+"/"),N(ce,D,P,"",function(pt){return pt})):ce!=null&&(ne(ce)&&(ce=X(ce,P+(ce.key==null||S&&S.key===ce.key?"":(""+ce.key).replace(be,"$&/")+"/")+me)),D.push(ce)),1;me=0;var Oe=le===""?".":le+":";if(ae(S))for(var Re=0;Re<S.length;Re++)le=S[Re],de=Oe+he(le,Re),me+=N(le,D,P,de,ce);else if(Re=R(S),typeof Re=="function")for(S=Re.call(S),Re=0;!(le=S.next()).done;)le=le.value,de=Oe+he(le,Re++),me+=N(le,D,P,de,ce);else if(de==="object"){if(typeof S.then=="function")return N(T(S),D,P,le,ce);throw D=String(S),Error("Objects are not valid as a React child (found: "+(D==="[object Object]"?"object with keys {"+Object.keys(S).join(", ")+"}":D)+"). If you meant to render a collection of children, use an array instead.")}return me}function w(S,D,P){if(S==null)return S;var le=[],ce=0;return N(S,le,"","",function(de){return D.call(P,de,ce++)}),le}function ee(S){if(S._status===-1){var D=S._result;D=D(),D.then(function(P){(S._status===0||S._status===-1)&&(S._status=1,S._result=P)},function(P){(S._status===0||S._status===-1)&&(S._status=2,S._result=P)}),S._status===-1&&(S._status=0,S._result=D)}if(S._status===1)return S._result.default;throw S._result}var B=typeof reportError=="function"?reportError:function(S){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var D=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof S=="object"&&S!==null&&typeof S.message=="string"?String(S.message):String(S),error:S});if(!window.dispatchEvent(D))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",S);return}console.error(S)},ue={map:w,forEach:function(S,D,P){w(S,function(){D.apply(this,arguments)},P)},count:function(S){var D=0;return w(S,function(){D++}),D},toArray:function(S){return w(S,function(D){return D})||[]},only:function(S){if(!ne(S))throw Error("React.Children.only expected to receive a single React element child.");return S}};return je.Activity=y,je.Children=ue,je.Component=O,je.Fragment=c,je.Profiler=x,je.PureComponent=W,je.StrictMode=u,je.Suspense=g,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,je.__COMPILER_RUNTIME={__proto__:null,c:function(S){return q.H.useMemoCache(S)}},je.cache=function(S){return function(){return S.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(S,D,P){if(S==null)throw Error("The argument must be a React element, but you passed "+S+".");var le=L({},S.props),ce=S.key;if(D!=null)for(de in D.key!==void 0&&(ce=""+D.key),D)!I.call(D,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&D.ref===void 0||(le[de]=D[de]);var de=arguments.length-2;if(de===1)le.children=P;else if(1<de){for(var me=Array(de),Oe=0;Oe<de;Oe++)me[Oe]=arguments[Oe+2];le.children=me}return G(S.type,ce,le)},je.createContext=function(S){return S={$$typeof:p,_currentValue:S,_currentValue2:S,_threadCount:0,Provider:null,Consumer:null},S.Provider=S,S.Consumer={$$typeof:v,_context:S},S},je.createElement=function(S,D,P){var le,ce={},de=null;if(D!=null)for(le in D.key!==void 0&&(de=""+D.key),D)I.call(D,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(ce[le]=D[le]);var me=arguments.length-2;if(me===1)ce.children=P;else if(1<me){for(var Oe=Array(me),Re=0;Re<me;Re++)Oe[Re]=arguments[Re+2];ce.children=Oe}if(S&&S.defaultProps)for(le in me=S.defaultProps,me)ce[le]===void 0&&(ce[le]=me[le]);return G(S,de,ce)},je.createRef=function(){return{current:null}},je.forwardRef=function(S){return{$$typeof:b,render:S}},je.isValidElement=ne,je.lazy=function(S){return{$$typeof:j,_payload:{_status:-1,_result:S},_init:ee}},je.memo=function(S,D){return{$$typeof:f,type:S,compare:D===void 0?null:D}},je.startTransition=function(S){var D=q.T,P={};q.T=P;try{var le=S(),ce=q.S;ce!==null&&ce(P,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(re,B)}catch(de){B(de)}finally{D!==null&&P.types!==null&&(D.types=P.types),q.T=D}},je.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},je.use=function(S){return q.H.use(S)},je.useActionState=function(S,D,P){return q.H.useActionState(S,D,P)},je.useCallback=function(S,D){return q.H.useCallback(S,D)},je.useContext=function(S){return q.H.useContext(S)},je.useDebugValue=function(){},je.useDeferredValue=function(S,D){return q.H.useDeferredValue(S,D)},je.useEffect=function(S,D){return q.H.useEffect(S,D)},je.useEffectEvent=function(S){return q.H.useEffectEvent(S)},je.useId=function(){return q.H.useId()},je.useImperativeHandle=function(S,D,P){return q.H.useImperativeHandle(S,D,P)},je.useInsertionEffect=function(S,D){return q.H.useInsertionEffect(S,D)},je.useLayoutEffect=function(S,D){return q.H.useLayoutEffect(S,D)},je.useMemo=function(S,D){return q.H.useMemo(S,D)},je.useOptimistic=function(S,D){return q.H.useOptimistic(S,D)},je.useReducer=function(S,D,P){return q.H.useReducer(S,D,P)},je.useRef=function(S){return q.H.useRef(S)},je.useState=function(S){return q.H.useState(S)},je.useSyncExternalStore=function(S,D,P){return q.H.useSyncExternalStore(S,D,P)},je.useTransition=function(){return q.H.useTransition()},je.version="19.2.4",je}var bx;function yc(){return bx||(bx=1,Fo.exports=_h()),Fo.exports}var m=yc(),Io={exports:{}},is={},Po={exports:{}},ec={};/**
18
18
  * @license React
19
19
  * scheduler.production.js
20
20
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var jx;function Mh(){return jx||(jx=1,(function(s){function o(N,w){var ee=N.length;N.push(w);e:for(;0<ee;){var B=ee-1>>>1,ue=N[B];if(0<x(ue,w))N[B]=w,N[ee]=ue,ee=B;else break e}}function c(N){return N.length===0?null:N[0]}function u(N){if(N.length===0)return null;var w=N[0],ee=N.pop();if(ee!==w){N[0]=ee;e:for(var B=0,ue=N.length,j=ue>>>1;B<j;){var D=2*(B+1)-1,P=N[D],le=D+1,ce=N[le];if(0>x(P,ee))le<ue&&0>x(ce,P)?(N[B]=ce,N[le]=ee,B=le):(N[B]=P,N[D]=ee,B=D);else if(le<ue&&0>x(ce,ee))N[B]=ce,N[le]=ee,B=le;else break e}}return w}function x(N,w){var ee=N.sortIndex-w.sortIndex;return ee!==0?ee:N.id-w.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var v=performance;s.unstable_now=function(){return v.now()}}else{var m=Date,b=m.now();s.unstable_now=function(){return m.now()-b}}var g=[],f=[],S=1,y=null,k=3,R=!1,U=!1,L=!1,Y=!1,O=typeof setTimeout=="function"?setTimeout:null,Z=typeof clearTimeout=="function"?clearTimeout:null,W=typeof setImmediate<"u"?setImmediate:null;function F(N){for(var w=c(f);w!==null;){if(w.callback===null)u(f);else if(w.startTime<=N)u(f),w.sortIndex=w.expirationTime,o(g,w);else break;w=c(f)}}function ae(N){if(L=!1,F(N),!U)if(c(g)!==null)U=!0,re||(re=!0,te());else{var w=c(f);w!==null&&T(ae,w.startTime-N)}}var re=!1,q=-1,I=5,G=-1;function X(){return Y?!0:!(s.unstable_now()-G<I)}function ne(){if(Y=!1,re){var N=s.unstable_now();G=N;var w=!0;try{e:{U=!1,L&&(L=!1,Z(q),q=-1),R=!0;var ee=k;try{t:{for(F(N),y=c(g);y!==null&&!(y.expirationTime>N&&X());){var B=y.callback;if(typeof B=="function"){y.callback=null,k=y.priorityLevel;var ue=B(y.expirationTime<=N);if(N=s.unstable_now(),typeof ue=="function"){y.callback=ue,F(N),w=!0;break t}y===c(g)&&u(g),F(N)}else u(g);y=c(g)}if(y!==null)w=!0;else{var j=c(f);j!==null&&T(ae,j.startTime-N),w=!1}}break e}finally{y=null,k=ee,R=!1}w=void 0}}finally{w?te():re=!1}}}var te;if(typeof W=="function")te=function(){W(ne)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,he=be.port2;be.port1.onmessage=ne,te=function(){he.postMessage(null)}}else te=function(){O(ne,0)};function T(N,w){q=O(function(){N(s.unstable_now())},w)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(N){N.callback=null},s.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<N?Math.floor(1e3/N):5},s.unstable_getCurrentPriorityLevel=function(){return k},s.unstable_next=function(N){switch(k){case 1:case 2:case 3:var w=3;break;default:w=k}var ee=k;k=w;try{return N()}finally{k=ee}},s.unstable_requestPaint=function(){Y=!0},s.unstable_runWithPriority=function(N,w){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var ee=k;k=N;try{return w()}finally{k=ee}},s.unstable_scheduleCallback=function(N,w,ee){var B=s.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?B+ee:B):ee=B,N){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=ee+ue,N={id:S++,callback:w,priorityLevel:N,startTime:ee,expirationTime:ue,sortIndex:-1},ee>B?(N.sortIndex=ee,o(f,N),c(g)===null&&N===c(f)&&(L?(Z(q),q=-1):L=!0,T(ae,ee-B))):(N.sortIndex=ue,o(g,N),U||R||(U=!0,re||(re=!0,te()))),N},s.unstable_shouldYield=X,s.unstable_wrapCallback=function(N){var w=k;return function(){var ee=k;k=w;try{return N.apply(this,arguments)}finally{k=ee}}}})(ec)),ec}var Sx;function Lh(){return Sx||(Sx=1,Po.exports=Mh()),Po.exports}var tc={exports:{}},jt={};/**
25
+ */var jx;function Mh(){return jx||(jx=1,(function(s){function o(N,w){var ee=N.length;N.push(w);e:for(;0<ee;){var B=ee-1>>>1,ue=N[B];if(0<x(ue,w))N[B]=w,N[ee]=ue,ee=B;else break e}}function c(N){return N.length===0?null:N[0]}function u(N){if(N.length===0)return null;var w=N[0],ee=N.pop();if(ee!==w){N[0]=ee;e:for(var B=0,ue=N.length,S=ue>>>1;B<S;){var D=2*(B+1)-1,P=N[D],le=D+1,ce=N[le];if(0>x(P,ee))le<ue&&0>x(ce,P)?(N[B]=ce,N[le]=ee,B=le):(N[B]=P,N[D]=ee,B=D);else if(le<ue&&0>x(ce,ee))N[B]=ce,N[le]=ee,B=le;else break e}}return w}function x(N,w){var ee=N.sortIndex-w.sortIndex;return ee!==0?ee:N.id-w.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var v=performance;s.unstable_now=function(){return v.now()}}else{var p=Date,b=p.now();s.unstable_now=function(){return p.now()-b}}var g=[],f=[],j=1,y=null,k=3,R=!1,U=!1,L=!1,Y=!1,O=typeof setTimeout=="function"?setTimeout:null,Z=typeof clearTimeout=="function"?clearTimeout:null,W=typeof setImmediate<"u"?setImmediate:null;function F(N){for(var w=c(f);w!==null;){if(w.callback===null)u(f);else if(w.startTime<=N)u(f),w.sortIndex=w.expirationTime,o(g,w);else break;w=c(f)}}function ae(N){if(L=!1,F(N),!U)if(c(g)!==null)U=!0,re||(re=!0,te());else{var w=c(f);w!==null&&T(ae,w.startTime-N)}}var re=!1,q=-1,I=5,G=-1;function X(){return Y?!0:!(s.unstable_now()-G<I)}function ne(){if(Y=!1,re){var N=s.unstable_now();G=N;var w=!0;try{e:{U=!1,L&&(L=!1,Z(q),q=-1),R=!0;var ee=k;try{t:{for(F(N),y=c(g);y!==null&&!(y.expirationTime>N&&X());){var B=y.callback;if(typeof B=="function"){y.callback=null,k=y.priorityLevel;var ue=B(y.expirationTime<=N);if(N=s.unstable_now(),typeof ue=="function"){y.callback=ue,F(N),w=!0;break t}y===c(g)&&u(g),F(N)}else u(g);y=c(g)}if(y!==null)w=!0;else{var S=c(f);S!==null&&T(ae,S.startTime-N),w=!1}}break e}finally{y=null,k=ee,R=!1}w=void 0}}finally{w?te():re=!1}}}var te;if(typeof W=="function")te=function(){W(ne)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,he=be.port2;be.port1.onmessage=ne,te=function(){he.postMessage(null)}}else te=function(){O(ne,0)};function T(N,w){q=O(function(){N(s.unstable_now())},w)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(N){N.callback=null},s.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<N?Math.floor(1e3/N):5},s.unstable_getCurrentPriorityLevel=function(){return k},s.unstable_next=function(N){switch(k){case 1:case 2:case 3:var w=3;break;default:w=k}var ee=k;k=w;try{return N()}finally{k=ee}},s.unstable_requestPaint=function(){Y=!0},s.unstable_runWithPriority=function(N,w){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var ee=k;k=N;try{return w()}finally{k=ee}},s.unstable_scheduleCallback=function(N,w,ee){var B=s.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?B+ee:B):ee=B,N){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=ee+ue,N={id:j++,callback:w,priorityLevel:N,startTime:ee,expirationTime:ue,sortIndex:-1},ee>B?(N.sortIndex=ee,o(f,N),c(g)===null&&N===c(f)&&(L?(Z(q),q=-1):L=!0,T(ae,ee-B))):(N.sortIndex=ue,o(g,N),U||R||(U=!0,re||(re=!0,te()))),N},s.unstable_shouldYield=X,s.unstable_wrapCallback=function(N){var w=k;return function(){var ee=k;k=w;try{return N.apply(this,arguments)}finally{k=ee}}}})(ec)),ec}var Sx;function Lh(){return Sx||(Sx=1,Po.exports=Mh()),Po.exports}var tc={exports:{}},jt={};/**
26
26
  * @license React
27
27
  * react-dom.production.js
28
28
  *
@@ -30,7 +30,7 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var Nx;function zh(){if(Nx)return jt;Nx=1;var s=yc();function o(g){var f="https://react.dev/errors/"+g;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)f+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+g+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var u={d:{f:c,r:function(){throw Error(o(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},x=Symbol.for("react.portal");function v(g,f,S){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:x,key:y==null?null:""+y,children:g,containerInfo:f,implementation:S}}var m=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function b(g,f){if(g==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,jt.createPortal=function(g,f){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(o(299));return v(g,f,null,S)},jt.flushSync=function(g){var f=m.T,S=u.p;try{if(m.T=null,u.p=2,g)return g()}finally{m.T=f,u.p=S,u.d.f()}},jt.preconnect=function(g,f){typeof g=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,u.d.C(g,f))},jt.prefetchDNS=function(g){typeof g=="string"&&u.d.D(g)},jt.preinit=function(g,f){if(typeof g=="string"&&f&&typeof f.as=="string"){var S=f.as,y=b(S,f.crossOrigin),k=typeof f.integrity=="string"?f.integrity:void 0,R=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;S==="style"?u.d.S(g,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:k,fetchPriority:R}):S==="script"&&u.d.X(g,{crossOrigin:y,integrity:k,fetchPriority:R,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},jt.preinitModule=function(g,f){if(typeof g=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var S=b(f.as,f.crossOrigin);u.d.M(g,{crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&u.d.M(g)},jt.preload=function(g,f){if(typeof g=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var S=f.as,y=b(S,f.crossOrigin);u.d.L(g,S,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},jt.preloadModule=function(g,f){if(typeof g=="string")if(f){var S=b(f.as,f.crossOrigin);u.d.m(g,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else u.d.m(g)},jt.requestFormReset=function(g){u.d.r(g)},jt.unstable_batchedUpdates=function(g,f){return g(f)},jt.useFormState=function(g,f,S){return m.H.useFormState(g,f,S)},jt.useFormStatus=function(){return m.H.useHostTransitionStatus()},jt.version="19.2.4",jt}var Ex;function Dh(){if(Ex)return tc.exports;Ex=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),tc.exports=zh(),tc.exports}/**
33
+ */var Nx;function zh(){if(Nx)return jt;Nx=1;var s=yc();function o(g){var f="https://react.dev/errors/"+g;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var j=2;j<arguments.length;j++)f+="&args[]="+encodeURIComponent(arguments[j])}return"Minified React error #"+g+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var u={d:{f:c,r:function(){throw Error(o(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},x=Symbol.for("react.portal");function v(g,f,j){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:x,key:y==null?null:""+y,children:g,containerInfo:f,implementation:j}}var p=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function b(g,f){if(g==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,jt.createPortal=function(g,f){var j=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(o(299));return v(g,f,null,j)},jt.flushSync=function(g){var f=p.T,j=u.p;try{if(p.T=null,u.p=2,g)return g()}finally{p.T=f,u.p=j,u.d.f()}},jt.preconnect=function(g,f){typeof g=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,u.d.C(g,f))},jt.prefetchDNS=function(g){typeof g=="string"&&u.d.D(g)},jt.preinit=function(g,f){if(typeof g=="string"&&f&&typeof f.as=="string"){var j=f.as,y=b(j,f.crossOrigin),k=typeof f.integrity=="string"?f.integrity:void 0,R=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;j==="style"?u.d.S(g,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:k,fetchPriority:R}):j==="script"&&u.d.X(g,{crossOrigin:y,integrity:k,fetchPriority:R,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},jt.preinitModule=function(g,f){if(typeof g=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var j=b(f.as,f.crossOrigin);u.d.M(g,{crossOrigin:j,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&u.d.M(g)},jt.preload=function(g,f){if(typeof g=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var j=f.as,y=b(j,f.crossOrigin);u.d.L(g,j,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},jt.preloadModule=function(g,f){if(typeof g=="string")if(f){var j=b(f.as,f.crossOrigin);u.d.m(g,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:j,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else u.d.m(g)},jt.requestFormReset=function(g){u.d.r(g)},jt.unstable_batchedUpdates=function(g,f){return g(f)},jt.useFormState=function(g,f,j){return p.H.useFormState(g,f,j)},jt.useFormStatus=function(){return p.H.useHostTransitionStatus()},jt.version="19.2.4",jt}var Ex;function Dh(){if(Ex)return tc.exports;Ex=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),tc.exports=zh(),tc.exports}/**
34
34
  * @license React
35
35
  * react-dom-client.production.js
36
36
  *
@@ -38,36 +38,36 @@
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var kx;function Oh(){if(kx)return is;kx=1;var s=Lh(),o=yc(),c=Dh();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function x(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function v(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function b(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(v(e)!==e)throw Error(u(188))}function f(e){var t=e.alternate;if(!t){if(t=v(e),t===null)throw Error(u(188));return t!==e?null:e}for(var l=e,n=t;;){var r=l.return;if(r===null)break;var i=r.alternate;if(i===null){if(n=r.return,n!==null){l=n;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===l)return g(r),e;if(i===n)return g(r),t;i=i.sibling}throw Error(u(188))}if(l.return!==n.return)l=r,n=i;else{for(var d=!1,h=r.child;h;){if(h===l){d=!0,l=r,n=i;break}if(h===n){d=!0,n=r,l=i;break}h=h.sibling}if(!d){for(h=i.child;h;){if(h===l){d=!0,l=i,n=r;break}if(h===n){d=!0,n=i,l=r;break}h=h.sibling}if(!d)throw Error(u(189))}}if(l.alternate!==n)throw Error(u(190))}if(l.tag!==3)throw Error(u(188));return l.stateNode.current===l?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var y=Object.assign,k=Symbol.for("react.element"),R=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),W=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),X=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function te(e){return e===null||typeof e!="object"?null:(e=ne&&e[ne]||e["@@iterator"],typeof e=="function"?e:null)}var be=Symbol.for("react.client.reference");function he(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===be?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case L:return"Fragment";case O:return"Profiler";case Y:return"StrictMode";case ae:return"Suspense";case re:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case U:return"Portal";case W:return e.displayName||"Context";case Z:return(e._context.displayName||"Context")+".Consumer";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return t=e.displayName||null,t!==null?t:he(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}var T=Array.isArray,N=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,w=c.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},B=[],ue=-1;function j(e){return{current:e}}function D(e){0>ue||(e.current=B[ue],B[ue]=null,ue--)}function P(e,t){ue++,B[ue]=e.current,e.current=t}var le=j(null),ce=j(null),de=j(null),me=j(null);function Oe(e,t){switch(P(de,t),P(ce,e),P(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qf(t),e=Vf(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}D(le),P(le,e)}function Re(){D(le),D(ce),D(de)}function pt(e){e.memoizedState!==null&&P(me,e);var t=le.current,l=Vf(t,e.type);t!==l&&(P(ce,e),P(le,l))}function Dt(e){ce.current===e&&(D(le),D(ce)),me.current===e&&(D(me),ls._currentValue=ee)}var J,ie;function se(e){if(J===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||"",ie=-1<l.stack.indexOf(`
41
+ */var kx;function Oh(){if(kx)return is;kx=1;var s=Lh(),o=yc(),c=Dh();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function x(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function v(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function p(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function b(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(v(e)!==e)throw Error(u(188))}function f(e){var t=e.alternate;if(!t){if(t=v(e),t===null)throw Error(u(188));return t!==e?null:e}for(var l=e,n=t;;){var r=l.return;if(r===null)break;var i=r.alternate;if(i===null){if(n=r.return,n!==null){l=n;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===l)return g(r),e;if(i===n)return g(r),t;i=i.sibling}throw Error(u(188))}if(l.return!==n.return)l=r,n=i;else{for(var d=!1,h=r.child;h;){if(h===l){d=!0,l=r,n=i;break}if(h===n){d=!0,n=r,l=i;break}h=h.sibling}if(!d){for(h=i.child;h;){if(h===l){d=!0,l=i,n=r;break}if(h===n){d=!0,n=i,l=r;break}h=h.sibling}if(!d)throw Error(u(189))}}if(l.alternate!==n)throw Error(u(190))}if(l.tag!==3)throw Error(u(188));return l.stateNode.current===l?e:t}function j(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=j(e),t!==null)return t;e=e.sibling}return null}var y=Object.assign,k=Symbol.for("react.element"),R=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),W=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),X=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function te(e){return e===null||typeof e!="object"?null:(e=ne&&e[ne]||e["@@iterator"],typeof e=="function"?e:null)}var be=Symbol.for("react.client.reference");function he(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===be?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case L:return"Fragment";case O:return"Profiler";case Y:return"StrictMode";case ae:return"Suspense";case re:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case U:return"Portal";case W:return e.displayName||"Context";case Z:return(e._context.displayName||"Context")+".Consumer";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return t=e.displayName||null,t!==null?t:he(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}var T=Array.isArray,N=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,w=c.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},B=[],ue=-1;function S(e){return{current:e}}function D(e){0>ue||(e.current=B[ue],B[ue]=null,ue--)}function P(e,t){ue++,B[ue]=e.current,e.current=t}var le=S(null),ce=S(null),de=S(null),me=S(null);function Oe(e,t){switch(P(de,t),P(ce,e),P(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qf(t),e=Vf(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}D(le),P(le,e)}function Re(){D(le),D(ce),D(de)}function pt(e){e.memoizedState!==null&&P(me,e);var t=le.current,l=Vf(t,e.type);t!==l&&(P(ce,e),P(le,l))}function Dt(e){ce.current===e&&(D(le),D(ce)),me.current===e&&(D(me),ls._currentValue=ee)}var J,ie;function se(e){if(J===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||"",ie=-1<l.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+J+e+ie}var xe=!1;function ye(e,t){if(!e||xe)return"";xe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var $=function(){throw Error()};if(Object.defineProperty($.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct($,[])}catch(H){var z=H}Reflect.construct(e,[],$)}else{try{$.call()}catch(H){z=H}e.call($.prototype)}}else{try{throw Error()}catch(H){z=H}($=e())&&typeof $.catch=="function"&&$.catch(function(){})}}catch(H){if(H&&z&&typeof H.stack=="string")return[H.stack,z.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=n.DetermineComponentFrameRoot(),d=i[0],h=i[1];if(d&&h){var E=d.split(`
43
+ `+J+e+ie}var xe=!1;function ye(e,t){if(!e||xe)return"";xe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(H){var z=H}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(H){z=H}e.call(Q.prototype)}}else{try{throw Error()}catch(H){z=H}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(H){if(H&&z&&typeof H.stack=="string")return[H.stack,z.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=n.DetermineComponentFrameRoot(),d=i[0],h=i[1];if(d&&h){var E=d.split(`
44
44
  `),M=h.split(`
45
45
  `);for(r=n=0;n<E.length&&!E[n].includes("DetermineComponentFrameRoot");)n++;for(;r<M.length&&!M[r].includes("DetermineComponentFrameRoot");)r++;if(n===E.length||r===M.length)for(n=E.length-1,r=M.length-1;1<=n&&0<=r&&E[n]!==M[r];)r--;for(;1<=n&&0<=r;n--,r--)if(E[n]!==M[r]){if(n!==1||r!==1)do if(n--,r--,0>r||E[n]!==M[r]){var V=`
46
46
  `+E[n].replace(" at new "," at ");return e.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",e.displayName)),V}while(1<=n&&0<=r);break}}}finally{xe=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?se(l):""}function Ye(e,t){switch(e.tag){case 26:case 27:case 5:return se(e.type);case 16:return se("Lazy");case 13:return e.child!==t&&t!==null?se("Suspense Fallback"):se("Suspense");case 19:return se("SuspenseList");case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return se("Activity");default:return""}}function ut(e){try{var t="",l=null;do t+=Ye(e,l),l=e,e=e.return;while(e);return t}catch(n){return`
47
47
  Error generating stack: `+n.message+`
48
- `+n.stack}}var $e=Object.prototype.hasOwnProperty,Ot=s.unstable_scheduleCallback,mt=s.unstable_cancelCallback,nl=s.unstable_shouldYield,Xt=s.unstable_requestPaint,We=s.unstable_now,kt=s.unstable_getCurrentPriorityLevel,K=s.unstable_ImmediatePriority,Be=s.unstable_UserBlockingPriority,at=s.unstable_NormalPriority,Je=s.unstable_LowPriority,Ml=s.unstable_IdlePriority,Bt=s.log,oa=s.unstable_setDisableYieldValue,Ct=null,Fe=null;function nt(e){if(typeof Bt=="function"&&oa(e),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Ct,e)}catch{}}var et=Math.clz32?Math.clz32:rl,sl=Math.log,Qe=Math.LN2;function rl(e){return e>>>=0,e===0?32:31-(sl(e)/Qe|0)|0}var st=256,Ve=262144,Ll=4194304;function Tt(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 Ta(e,t,l){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var h=n&134217727;return h!==0?(n=h&~i,n!==0?r=Tt(n):(d&=h,d!==0?r=Tt(d):l||(l=h&~e,l!==0&&(r=Tt(l))))):(h=n&~i,h!==0?r=Tt(h):d!==0?r=Tt(d):l||(l=n&~e,l!==0&&(r=Tt(l)))),r===0?0:t!==0&&t!==r&&(t&i)===0&&(i=r&-r,l=t&-t,i>=l||i===32&&(l&4194048)!==0)?t:r}function mn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function hp(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 bc(){var e=Ll;return Ll<<=1,(Ll&62914560)===0&&(Ll=4194304),e}function Br(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function hn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function vp(e,t,l,n,r,i){var d=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 h=e.entanglements,E=e.expirationTimes,M=e.hiddenUpdates;for(l=d&~l;0<l;){var V=31-et(l),$=1<<V;h[V]=0,E[V]=-1;var z=M[V];if(z!==null)for(M[V]=null,V=0;V<z.length;V++){var H=z[V];H!==null&&(H.lane&=-536870913)}l&=~$}n!==0&&jc(e,n,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(d&~t))}function jc(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-et(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|l&261930}function Sc(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var n=31-et(l),r=1<<n;r&t|e[n]&t&&(e[n]|=t),l&=~r}}function Nc(e,t){var l=t&-t;return l=(l&42)!==0?1:Hr(l),(l&(e.suspendedLanes|t))!==0?0:l}function Hr(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 Ur(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ec(){var e=w.p;return e!==0?e:(e=window.event,e===void 0?32:ux(e.type))}function kc(e,t){var l=w.p;try{return w.p=e,t()}finally{w.p=l}}var zl=Math.random().toString(36).slice(2),ht="__reactFiber$"+zl,wt="__reactProps$"+zl,wa="__reactContainer$"+zl,qr="__reactEvents$"+zl,yp="__reactListeners$"+zl,gp="__reactHandles$"+zl,Cc="__reactResources$"+zl,vn="__reactMarker$"+zl;function Vr(e){delete e[ht],delete e[wt],delete e[qr],delete e[yp],delete e[gp]}function Aa(e){var t=e[ht];if(t)return t;for(var l=e.parentNode;l;){if(t=l[wa]||l[ht]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Zf(e);e!==null;){if(l=e[ht])return l;e=Zf(e)}return t}e=l,l=e.parentNode}return null}function Ra(e){if(e=e[ht]||e[wa]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function yn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function _a(e){var t=e[Cc];return t||(t=e[Cc]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ft(e){e[vn]=!0}var Tc=new Set,wc={};function ca(e,t){Ma(e,t),Ma(e+"Capture",t)}function Ma(e,t){for(wc[e]=t,e=0;e<t.length;e++)Tc.add(t[e])}var bp=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]*$"),Ac={},Rc={};function jp(e){return $e.call(Rc,e)?!0:$e.call(Ac,e)?!1:bp.test(e)?Rc[e]=!0:(Ac[e]=!0,!1)}function xs(e,t,l){if(jp(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function ps(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 pl(e,t,l,n){if(n===null)e.removeAttribute(l);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+n)}}function Kt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _c(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Sp(e,t,l){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(d){l=""+d,i.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(d){l=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Gr(e){if(!e._valueTracker){var t=_c(e)?"checked":"value";e._valueTracker=Sp(e,t,""+e[t])}}function Mc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),n="";return e&&(n=_c(e)?e.checked?"true":"false":e.value),e=n,e!==l?(t.setValue(e),!0):!1}function ms(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 Np=/[\n"\\]/g;function Zt(e){return e.replace(Np,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Yr(e,t,l,n,r,i,d,h){e.name="",d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?e.type=d:e.removeAttribute("type"),t!=null?d==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Kt(t)):e.value!==""+Kt(t)&&(e.value=""+Kt(t)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),t!=null?Qr(e,d,Kt(t)):l!=null?Qr(e,d,Kt(l)):n!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.name=""+Kt(h):e.removeAttribute("name")}function Lc(e,t,l,n,r,i,d,h){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)){Gr(e);return}l=l!=null?""+Kt(l):"",t=t!=null?""+Kt(t):l,h||t===e.value||(e.value=t),e.defaultValue=t}n=n??r,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=h?e.checked:!!n,e.defaultChecked=!!n,d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.name=d),Gr(e)}function Qr(e,t,l){t==="number"&&ms(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function La(e,t,l,n){if(e=e.options,t){t={};for(var r=0;r<l.length;r++)t["$"+l[r]]=!0;for(l=0;l<e.length;l++)r=t.hasOwnProperty("$"+e[l].value),e[l].selected!==r&&(e[l].selected=r),r&&n&&(e[l].defaultSelected=!0)}else{for(l=""+Kt(l),t=null,r=0;r<e.length;r++){if(e[r].value===l){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function zc(e,t,l){if(t!=null&&(t=""+Kt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Kt(l):""}function Dc(e,t,l,n){if(t==null){if(n!=null){if(l!=null)throw Error(u(92));if(T(n)){if(1<n.length)throw Error(u(93));n=n[0]}l=n}l==null&&(l=""),t=l}l=Kt(t),e.defaultValue=l,n=e.textContent,n===l&&n!==""&&n!==null&&(e.value=n),Gr(e)}function za(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Ep=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 Oc(e,t,l){var n=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,l):typeof l!="number"||l===0||Ep.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Bc(e,t,l){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,l!=null){for(var n in l)!l.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var r in t)n=t[r],t.hasOwnProperty(r)&&l[r]!==n&&Oc(e,r,n)}else for(var i in t)t.hasOwnProperty(i)&&Oc(e,i,t[i])}function $r(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 kp=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"]]),Cp=/^[\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 hs(e){return Cp.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ml(){}var Xr=null;function Kr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Da=null,Oa=null;function Hc(e){var t=Ra(e);if(t&&(e=t.stateNode)){var l=e[wt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Yr(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="'+Zt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var n=l[t];if(n!==e&&n.form===e.form){var r=n[wt]||null;if(!r)throw Error(u(90));Yr(n,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<l.length;t++)n=l[t],n.form===e.form&&Mc(n)}break e;case"textarea":zc(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&La(e,!!l.multiple,t,!1)}}}var Zr=!1;function Uc(e,t,l){if(Zr)return e(t,l);Zr=!0;try{var n=e(t);return n}finally{if(Zr=!1,(Da!==null||Oa!==null)&&(ar(),Da&&(t=Da,e=Oa,Oa=Da=null,Hc(t),e)))for(t=0;t<e.length;t++)Hc(e[t])}}function gn(e,t){var l=e.stateNode;if(l===null)return null;var n=l[wt]||null;if(n===null)return null;l=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(u(231,t,typeof l));return l}var hl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jr=!1;if(hl)try{var bn={};Object.defineProperty(bn,"passive",{get:function(){Jr=!0}}),window.addEventListener("test",bn,bn),window.removeEventListener("test",bn,bn)}catch{Jr=!1}var Dl=null,Wr=null,vs=null;function qc(){if(vs)return vs;var e,t=Wr,l=t.length,n,r="value"in Dl?Dl.value:Dl.textContent,i=r.length;for(e=0;e<l&&t[e]===r[e];e++);var d=l-e;for(n=1;n<=d&&t[l-n]===r[i-n];n++);return vs=r.slice(e,1<n?1-n:void 0)}function ys(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 gs(){return!0}function Vc(){return!1}function At(e){function t(l,n,r,i,d){this._reactName=l,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=d,this.currentTarget=null;for(var h in e)e.hasOwnProperty(h)&&(l=e[h],this[h]=l?l(i):i[h]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?gs:Vc,this.isPropagationStopped=Vc,this}return y(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=gs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=gs)},persist:function(){},isPersistent:gs}),t}var ua={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bs=At(ua),jn=y({},ua,{view:0,detail:0}),Tp=At(jn),Fr,Ir,Sn,js=y({},jn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ei,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!==Sn&&(Sn&&e.type==="mousemove"?(Fr=e.screenX-Sn.screenX,Ir=e.screenY-Sn.screenY):Ir=Fr=0,Sn=e),Fr)},movementY:function(e){return"movementY"in e?e.movementY:Ir}}),Gc=At(js),wp=y({},js,{dataTransfer:0}),Ap=At(wp),Rp=y({},jn,{relatedTarget:0}),Pr=At(Rp),_p=y({},ua,{animationName:0,elapsedTime:0,pseudoElement:0}),Mp=At(_p),Lp=y({},ua,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),zp=At(Lp),Dp=y({},ua,{data:0}),Yc=At(Dp),Op={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Bp={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"},Hp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Up(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hp[e])?!!t[e]:!1}function ei(){return Up}var qp=y({},jn,{key:function(e){if(e.key){var t=Op[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ys(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Bp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ei,charCode:function(e){return e.type==="keypress"?ys(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ys(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Vp=At(qp),Gp=y({},js,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qc=At(Gp),Yp=y({},jn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ei}),Qp=At(Yp),$p=y({},ua,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xp=At($p),Kp=y({},js,{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}),Zp=At(Kp),Jp=y({},ua,{newState:0,oldState:0}),Wp=At(Jp),Fp=[9,13,27,32],ti=hl&&"CompositionEvent"in window,Nn=null;hl&&"documentMode"in document&&(Nn=document.documentMode);var Ip=hl&&"TextEvent"in window&&!Nn,$c=hl&&(!ti||Nn&&8<Nn&&11>=Nn),Xc=" ",Kc=!1;function Zc(e,t){switch(e){case"keyup":return Fp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ba=!1;function Pp(e,t){switch(e){case"compositionend":return Jc(t);case"keypress":return t.which!==32?null:(Kc=!0,Xc);case"textInput":return e=t.data,e===Xc&&Kc?null:e;default:return null}}function em(e,t){if(Ba)return e==="compositionend"||!ti&&Zc(e,t)?(e=qc(),vs=Wr=Dl=null,Ba=!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 $c&&t.locale!=="ko"?null:t.data;default:return null}}var tm={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 Wc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!tm[e.type]:t==="textarea"}function Fc(e,t,l,n){Da?Oa?Oa.push(n):Oa=[n]:Da=n,t=ur(t,"onChange"),0<t.length&&(l=new bs("onChange","change",null,l,n),e.push({event:l,listeners:t}))}var En=null,kn=null;function lm(e){zf(e,0)}function Ss(e){var t=yn(e);if(Mc(t))return e}function Ic(e,t){if(e==="change")return t}var Pc=!1;if(hl){var li;if(hl){var ai="oninput"in document;if(!ai){var eu=document.createElement("div");eu.setAttribute("oninput","return;"),ai=typeof eu.oninput=="function"}li=ai}else li=!1;Pc=li&&(!document.documentMode||9<document.documentMode)}function tu(){En&&(En.detachEvent("onpropertychange",lu),kn=En=null)}function lu(e){if(e.propertyName==="value"&&Ss(kn)){var t=[];Fc(t,kn,e,Kr(e)),Uc(lm,t)}}function am(e,t,l){e==="focusin"?(tu(),En=t,kn=l,En.attachEvent("onpropertychange",lu)):e==="focusout"&&tu()}function nm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ss(kn)}function sm(e,t){if(e==="click")return Ss(t)}function rm(e,t){if(e==="input"||e==="change")return Ss(t)}function im(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ht=typeof Object.is=="function"?Object.is:im;function Cn(e,t){if(Ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),n=Object.keys(t);if(l.length!==n.length)return!1;for(n=0;n<l.length;n++){var r=l[n];if(!$e.call(t,r)||!Ht(e[r],t[r]))return!1}return!0}function au(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function nu(e,t){var l=au(e);e=0;for(var n;l;){if(l.nodeType===3){if(n=e+l.textContent.length,e<=t&&n>=t)return{node:l,offset:t-e};e=n}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=au(l)}}function su(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?su(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ru(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ms(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=ms(e.document)}return t}function ni(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 om=hl&&"documentMode"in document&&11>=document.documentMode,Ha=null,si=null,Tn=null,ri=!1;function iu(e,t,l){var n=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ri||Ha==null||Ha!==ms(n)||(n=Ha,"selectionStart"in n&&ni(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Tn&&Cn(Tn,n)||(Tn=n,n=ur(si,"onSelect"),0<n.length&&(t=new bs("onSelect","select",null,t,l),e.push({event:t,listeners:n}),t.target=Ha)))}function da(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Ua={animationend:da("Animation","AnimationEnd"),animationiteration:da("Animation","AnimationIteration"),animationstart:da("Animation","AnimationStart"),transitionrun:da("Transition","TransitionRun"),transitionstart:da("Transition","TransitionStart"),transitioncancel:da("Transition","TransitionCancel"),transitionend:da("Transition","TransitionEnd")},ii={},ou={};hl&&(ou=document.createElement("div").style,"AnimationEvent"in window||(delete Ua.animationend.animation,delete Ua.animationiteration.animation,delete Ua.animationstart.animation),"TransitionEvent"in window||delete Ua.transitionend.transition);function fa(e){if(ii[e])return ii[e];if(!Ua[e])return e;var t=Ua[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in ou)return ii[e]=t[l];return e}var cu=fa("animationend"),uu=fa("animationiteration"),du=fa("animationstart"),cm=fa("transitionrun"),um=fa("transitionstart"),dm=fa("transitioncancel"),fu=fa("transitionend"),xu=new Map,oi="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(" ");oi.push("scrollEnd");function il(e,t){xu.set(e,t),ca(t,[e])}var Ns=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)},Jt=[],qa=0,ci=0;function Es(){for(var e=qa,t=ci=qa=0;t<e;){var l=Jt[t];Jt[t++]=null;var n=Jt[t];Jt[t++]=null;var r=Jt[t];Jt[t++]=null;var i=Jt[t];if(Jt[t++]=null,n!==null&&r!==null){var d=n.pending;d===null?r.next=r:(r.next=d.next,d.next=r),n.pending=r}i!==0&&pu(l,r,i)}}function ks(e,t,l,n){Jt[qa++]=e,Jt[qa++]=t,Jt[qa++]=l,Jt[qa++]=n,ci|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function ui(e,t,l,n){return ks(e,t,l,n),Cs(e)}function xa(e,t){return ks(e,null,null,t),Cs(e)}function pu(e,t,l){e.lanes|=l;var n=e.alternate;n!==null&&(n.lanes|=l);for(var r=!1,i=e.return;i!==null;)i.childLanes|=l,n=i.alternate,n!==null&&(n.childLanes|=l),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(r=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,r&&t!==null&&(r=31-et(l),e=i.hiddenUpdates,n=e[r],n===null?e[r]=[t]:n.push(t),t.lane=l|536870912),i):null}function Cs(e){if(50<Jn)throw Jn=0,bo=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Va={};function fm(e,t,l,n){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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ut(e,t,l,n){return new fm(e,t,l,n)}function di(e){return e=e.prototype,!(!e||!e.isReactComponent)}function vl(e,t){var l=e.alternate;return l===null?(l=Ut(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 Ts(e,t,l,n,r,i){var d=0;if(n=e,typeof e=="function")di(e)&&(d=1);else if(typeof e=="string")d=vh(e,l,le.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Ut(31,l,t,r),e.elementType=G,e.lanes=i,e;case L:return pa(l.children,r,i,t);case Y:d=8,r|=24;break;case O:return e=Ut(12,l,t,r|2),e.elementType=O,e.lanes=i,e;case ae:return e=Ut(13,l,t,r),e.elementType=ae,e.lanes=i,e;case re:return e=Ut(19,l,t,r),e.elementType=re,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case W:d=10;break e;case Z:d=9;break e;case F:d=11;break e;case q:d=14;break e;case I:d=16,n=null;break e}d=29,l=Error(u(130,e===null?"null":typeof e,"")),n=null}return t=Ut(d,l,t,r),t.elementType=e,t.type=n,t.lanes=i,t}function pa(e,t,l,n){return e=Ut(7,e,n,t),e.lanes=l,e}function fi(e,t,l){return e=Ut(6,e,null,t),e.lanes=l,e}function hu(e){var t=Ut(18,null,null,0);return t.stateNode=e,t}function xi(e,t,l){return t=Ut(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var vu=new WeakMap;function Wt(e,t){if(typeof e=="object"&&e!==null){var l=vu.get(e);return l!==void 0?l:(t={value:e,source:t,stack:ut(t)},vu.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var Ga=[],Ya=0,ws=null,wn=0,Ft=[],It=0,Ol=null,ul=1,dl="";function yl(e,t){Ga[Ya++]=wn,Ga[Ya++]=ws,ws=e,wn=t}function yu(e,t,l){Ft[It++]=ul,Ft[It++]=dl,Ft[It++]=Ol,Ol=e;var n=ul;e=dl;var r=32-et(n)-1;n&=~(1<<r),l+=1;var i=32-et(t)+r;if(30<i){var d=r-r%5;i=(n&(1<<d)-1).toString(32),n>>=d,r-=d,ul=1<<32-et(t)+r|l<<r|n,dl=i+e}else ul=1<<i|l<<r|n,dl=e}function pi(e){e.return!==null&&(yl(e,1),yu(e,1,0))}function mi(e){for(;e===ws;)ws=Ga[--Ya],Ga[Ya]=null,wn=Ga[--Ya],Ga[Ya]=null;for(;e===Ol;)Ol=Ft[--It],Ft[It]=null,dl=Ft[--It],Ft[It]=null,ul=Ft[--It],Ft[It]=null}function gu(e,t){Ft[It++]=ul,Ft[It++]=dl,Ft[It++]=Ol,ul=t.id,dl=t.overflow,Ol=e}var vt=null,Xe=null,we=!1,Bl=null,Pt=!1,hi=Error(u(519));function Hl(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw An(Wt(t,e)),hi}function bu(e){var t=e.stateNode,l=e.type,n=e.memoizedProps;switch(t[ht]=e,t[wt]=n,l){case"dialog":ke("cancel",t),ke("close",t);break;case"iframe":case"object":case"embed":ke("load",t);break;case"video":case"audio":for(l=0;l<Fn.length;l++)ke(Fn[l],t);break;case"source":ke("error",t);break;case"img":case"image":case"link":ke("error",t),ke("load",t);break;case"details":ke("toggle",t);break;case"input":ke("invalid",t),Lc(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":ke("invalid",t);break;case"textarea":ke("invalid",t),Dc(t,n.value,n.defaultValue,n.children)}l=n.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||n.suppressHydrationWarning===!0||Hf(t.textContent,l)?(n.popover!=null&&(ke("beforetoggle",t),ke("toggle",t)),n.onScroll!=null&&ke("scroll",t),n.onScrollEnd!=null&&ke("scrollend",t),n.onClick!=null&&(t.onclick=ml),t=!0):t=!1,t||Hl(e,!0)}function ju(e){for(vt=e.return;vt;)switch(vt.tag){case 5:case 31:case 13:Pt=!1;return;case 27:case 3:Pt=!0;return;default:vt=vt.return}}function Qa(e){if(e!==vt)return!1;if(!we)return ju(e),we=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Do(e.type,e.memoizedProps)),l=!l),l&&Xe&&Hl(e),ju(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Xe=Kf(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Xe=Kf(e)}else t===27?(t=Xe,Il(e.type)?(e=qo,qo=null,Xe=e):Xe=t):Xe=vt?tl(e.stateNode.nextSibling):null;return!0}function ma(){Xe=vt=null,we=!1}function vi(){var e=Bl;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),Bl=null),e}function An(e){Bl===null?Bl=[e]:Bl.push(e)}var yi=j(null),ha=null,gl=null;function Ul(e,t,l){P(yi,t._currentValue),t._currentValue=l}function bl(e){e._currentValue=yi.current,D(yi)}function gi(e,t,l){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===l)break;e=e.return}}function bi(e,t,l,n){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var i=r.dependencies;if(i!==null){var d=r.child;i=i.firstContext;e:for(;i!==null;){var h=i;i=r;for(var E=0;E<t.length;E++)if(h.context===t[E]){i.lanes|=l,h=i.alternate,h!==null&&(h.lanes|=l),gi(i.return,l,e),n||(d=null);break e}i=h.next}}else if(r.tag===18){if(d=r.return,d===null)throw Error(u(341));d.lanes|=l,i=d.alternate,i!==null&&(i.lanes|=l),gi(d,l,e),d=null}else d=r.child;if(d!==null)d.return=r;else for(d=r;d!==null;){if(d===e){d=null;break}if(r=d.sibling,r!==null){r.return=d.return,d=r;break}d=d.return}r=d}}function $a(e,t,l,n){e=null;for(var r=t,i=!1;r!==null;){if(!i){if((r.flags&524288)!==0)i=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var d=r.alternate;if(d===null)throw Error(u(387));if(d=d.memoizedProps,d!==null){var h=r.type;Ht(r.pendingProps.value,d.value)||(e!==null?e.push(h):e=[h])}}else if(r===me.current){if(d=r.alternate,d===null)throw Error(u(387));d.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(ls):e=[ls])}r=r.return}e!==null&&bi(t,e,l,n),t.flags|=262144}function As(e){for(e=e.firstContext;e!==null;){if(!Ht(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function va(e){ha=e,gl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return Su(ha,e)}function Rs(e,t){return ha===null&&va(e),Su(e,t)}function Su(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},gl===null){if(e===null)throw Error(u(308));gl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else gl=gl.next=t;return l}var xm=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},pm=s.unstable_scheduleCallback,mm=s.unstable_NormalPriority,rt={$$typeof:W,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ji(){return{controller:new xm,data:new Map,refCount:0}}function Rn(e){e.refCount--,e.refCount===0&&pm(mm,function(){e.controller.abort()})}var _n=null,Si=0,Xa=0,Ka=null;function hm(e,t){if(_n===null){var l=_n=[];Si=0,Xa=Co(),Ka={status:"pending",value:void 0,then:function(n){l.push(n)}}}return Si++,t.then(Nu,Nu),t}function Nu(){if(--Si===0&&_n!==null){Ka!==null&&(Ka.status="fulfilled");var e=_n;_n=null,Xa=0,Ka=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function vm(e,t){var l=[],n={status:"pending",value:null,reason:null,then:function(r){l.push(r)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var r=0;r<l.length;r++)(0,l[r])(t)},function(r){for(n.status="rejected",n.reason=r,r=0;r<l.length;r++)(0,l[r])(void 0)}),n}var Eu=N.S;N.S=function(e,t){of=We(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&hm(e,t),Eu!==null&&Eu(e,t)};var ya=j(null);function Ni(){var e=ya.current;return e!==null?e:Ge.pooledCache}function _s(e,t){t===null?P(ya,ya.current):P(ya,t.pool)}function ku(){var e=Ni();return e===null?null:{parent:rt._currentValue,pool:e}}var Za=Error(u(460)),Ei=Error(u(474)),Ms=Error(u(542)),Ls={then:function(){}};function Cu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Tu(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ml,ml),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Au(e),e;default:if(typeof t.status=="string")t.then(ml,ml);else{if(e=Ge,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=n}},function(n){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Au(e),e}throw ba=t,Za}}function ga(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ba=l,Za):l}}var ba=null;function wu(){if(ba===null)throw Error(u(459));var e=ba;return ba=null,e}function Au(e){if(e===Za||e===Ms)throw Error(u(483))}var Ja=null,Mn=0;function zs(e){var t=Mn;return Mn+=1,Ja===null&&(Ja=[]),Tu(Ja,e,t)}function Ln(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ds(e,t){throw t.$$typeof===k?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Ru(e){function t(A,C){if(e){var _=A.deletions;_===null?(A.deletions=[C],A.flags|=16):_.push(C)}}function l(A,C){if(!e)return null;for(;C!==null;)t(A,C),C=C.sibling;return null}function n(A){for(var C=new Map;A!==null;)A.key!==null?C.set(A.key,A):C.set(A.index,A),A=A.sibling;return C}function r(A,C){return A=vl(A,C),A.index=0,A.sibling=null,A}function i(A,C,_){return A.index=_,e?(_=A.alternate,_!==null?(_=_.index,_<C?(A.flags|=67108866,C):_):(A.flags|=67108866,C)):(A.flags|=1048576,C)}function d(A){return e&&A.alternate===null&&(A.flags|=67108866),A}function h(A,C,_,Q){return C===null||C.tag!==6?(C=fi(_,A.mode,Q),C.return=A,C):(C=r(C,_),C.return=A,C)}function E(A,C,_,Q){var pe=_.type;return pe===L?V(A,C,_.props.children,Q,_.key):C!==null&&(C.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===I&&ga(pe)===C.type)?(C=r(C,_.props),Ln(C,_),C.return=A,C):(C=Ts(_.type,_.key,_.props,null,A.mode,Q),Ln(C,_),C.return=A,C)}function M(A,C,_,Q){return C===null||C.tag!==4||C.stateNode.containerInfo!==_.containerInfo||C.stateNode.implementation!==_.implementation?(C=xi(_,A.mode,Q),C.return=A,C):(C=r(C,_.children||[]),C.return=A,C)}function V(A,C,_,Q,pe){return C===null||C.tag!==7?(C=pa(_,A.mode,Q,pe),C.return=A,C):(C=r(C,_),C.return=A,C)}function $(A,C,_){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=fi(""+C,A.mode,_),C.return=A,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case R:return _=Ts(C.type,C.key,C.props,null,A.mode,_),Ln(_,C),_.return=A,_;case U:return C=xi(C,A.mode,_),C.return=A,C;case I:return C=ga(C),$(A,C,_)}if(T(C)||te(C))return C=pa(C,A.mode,_,null),C.return=A,C;if(typeof C.then=="function")return $(A,zs(C),_);if(C.$$typeof===W)return $(A,Rs(A,C),_);Ds(A,C)}return null}function z(A,C,_,Q){var pe=C!==null?C.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return pe!==null?null:h(A,C,""+_,Q);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case R:return _.key===pe?E(A,C,_,Q):null;case U:return _.key===pe?M(A,C,_,Q):null;case I:return _=ga(_),z(A,C,_,Q)}if(T(_)||te(_))return pe!==null?null:V(A,C,_,Q,null);if(typeof _.then=="function")return z(A,C,zs(_),Q);if(_.$$typeof===W)return z(A,C,Rs(A,_),Q);Ds(A,_)}return null}function H(A,C,_,Q,pe){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return A=A.get(_)||null,h(C,A,""+Q,pe);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case R:return A=A.get(Q.key===null?_:Q.key)||null,E(C,A,Q,pe);case U:return A=A.get(Q.key===null?_:Q.key)||null,M(C,A,Q,pe);case I:return Q=ga(Q),H(A,C,_,Q,pe)}if(T(Q)||te(Q))return A=A.get(_)||null,V(C,A,Q,pe,null);if(typeof Q.then=="function")return H(A,C,_,zs(Q),pe);if(Q.$$typeof===W)return H(A,C,_,Rs(C,Q),pe);Ds(C,Q)}return null}function oe(A,C,_,Q){for(var pe=null,_e=null,fe=C,Ne=C=0,Te=null;fe!==null&&Ne<_.length;Ne++){fe.index>Ne?(Te=fe,fe=null):Te=fe.sibling;var Me=z(A,fe,_[Ne],Q);if(Me===null){fe===null&&(fe=Te);break}e&&fe&&Me.alternate===null&&t(A,fe),C=i(Me,C,Ne),_e===null?pe=Me:_e.sibling=Me,_e=Me,fe=Te}if(Ne===_.length)return l(A,fe),we&&yl(A,Ne),pe;if(fe===null){for(;Ne<_.length;Ne++)fe=$(A,_[Ne],Q),fe!==null&&(C=i(fe,C,Ne),_e===null?pe=fe:_e.sibling=fe,_e=fe);return we&&yl(A,Ne),pe}for(fe=n(fe);Ne<_.length;Ne++)Te=H(fe,A,Ne,_[Ne],Q),Te!==null&&(e&&Te.alternate!==null&&fe.delete(Te.key===null?Ne:Te.key),C=i(Te,C,Ne),_e===null?pe=Te:_e.sibling=Te,_e=Te);return e&&fe.forEach(function(aa){return t(A,aa)}),we&&yl(A,Ne),pe}function ve(A,C,_,Q){if(_==null)throw Error(u(151));for(var pe=null,_e=null,fe=C,Ne=C=0,Te=null,Me=_.next();fe!==null&&!Me.done;Ne++,Me=_.next()){fe.index>Ne?(Te=fe,fe=null):Te=fe.sibling;var aa=z(A,fe,Me.value,Q);if(aa===null){fe===null&&(fe=Te);break}e&&fe&&aa.alternate===null&&t(A,fe),C=i(aa,C,Ne),_e===null?pe=aa:_e.sibling=aa,_e=aa,fe=Te}if(Me.done)return l(A,fe),we&&yl(A,Ne),pe;if(fe===null){for(;!Me.done;Ne++,Me=_.next())Me=$(A,Me.value,Q),Me!==null&&(C=i(Me,C,Ne),_e===null?pe=Me:_e.sibling=Me,_e=Me);return we&&yl(A,Ne),pe}for(fe=n(fe);!Me.done;Ne++,Me=_.next())Me=H(fe,A,Ne,Me.value,Q),Me!==null&&(e&&Me.alternate!==null&&fe.delete(Me.key===null?Ne:Me.key),C=i(Me,C,Ne),_e===null?pe=Me:_e.sibling=Me,_e=Me);return e&&fe.forEach(function(wh){return t(A,wh)}),we&&yl(A,Ne),pe}function qe(A,C,_,Q){if(typeof _=="object"&&_!==null&&_.type===L&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case R:e:{for(var pe=_.key;C!==null;){if(C.key===pe){if(pe=_.type,pe===L){if(C.tag===7){l(A,C.sibling),Q=r(C,_.props.children),Q.return=A,A=Q;break e}}else if(C.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===I&&ga(pe)===C.type){l(A,C.sibling),Q=r(C,_.props),Ln(Q,_),Q.return=A,A=Q;break e}l(A,C);break}else t(A,C);C=C.sibling}_.type===L?(Q=pa(_.props.children,A.mode,Q,_.key),Q.return=A,A=Q):(Q=Ts(_.type,_.key,_.props,null,A.mode,Q),Ln(Q,_),Q.return=A,A=Q)}return d(A);case U:e:{for(pe=_.key;C!==null;){if(C.key===pe)if(C.tag===4&&C.stateNode.containerInfo===_.containerInfo&&C.stateNode.implementation===_.implementation){l(A,C.sibling),Q=r(C,_.children||[]),Q.return=A,A=Q;break e}else{l(A,C);break}else t(A,C);C=C.sibling}Q=xi(_,A.mode,Q),Q.return=A,A=Q}return d(A);case I:return _=ga(_),qe(A,C,_,Q)}if(T(_))return oe(A,C,_,Q);if(te(_)){if(pe=te(_),typeof pe!="function")throw Error(u(150));return _=pe.call(_),ve(A,C,_,Q)}if(typeof _.then=="function")return qe(A,C,zs(_),Q);if(_.$$typeof===W)return qe(A,C,Rs(A,_),Q);Ds(A,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,C!==null&&C.tag===6?(l(A,C.sibling),Q=r(C,_),Q.return=A,A=Q):(l(A,C),Q=fi(_,A.mode,Q),Q.return=A,A=Q),d(A)):l(A,C)}return function(A,C,_,Q){try{Mn=0;var pe=qe(A,C,_,Q);return Ja=null,pe}catch(fe){if(fe===Za||fe===Ms)throw fe;var _e=Ut(29,fe,null,A.mode);return _e.lanes=Q,_e.return=A,_e}finally{}}}var ja=Ru(!0),_u=Ru(!1),ql=!1;function ki(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ci(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 Vl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Gl(e,t,l){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Le&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Cs(e),pu(e,null,l),t}return ks(e,n,t,l),Cs(e)}function zn(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,Sc(e,l)}}function Ti(e,t){var l=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,l===n)){var r=null,i=null;if(l=l.firstBaseUpdate,l!==null){do{var d={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};i===null?r=i=d:i=i.next=d,l=l.next}while(l!==null);i===null?r=i=t:i=i.next=t}else r=i=t;l={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:n.shared,callbacks:n.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var wi=!1;function Dn(){if(wi){var e=Ka;if(e!==null)throw e}}function On(e,t,l,n){wi=!1;var r=e.updateQueue;ql=!1;var i=r.firstBaseUpdate,d=r.lastBaseUpdate,h=r.shared.pending;if(h!==null){r.shared.pending=null;var E=h,M=E.next;E.next=null,d===null?i=M:d.next=M,d=E;var V=e.alternate;V!==null&&(V=V.updateQueue,h=V.lastBaseUpdate,h!==d&&(h===null?V.firstBaseUpdate=M:h.next=M,V.lastBaseUpdate=E))}if(i!==null){var $=r.baseState;d=0,V=M=E=null,h=i;do{var z=h.lane&-536870913,H=z!==h.lane;if(H?(Ce&z)===z:(n&z)===z){z!==0&&z===Xa&&(wi=!0),V!==null&&(V=V.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});e:{var oe=e,ve=h;z=t;var qe=l;switch(ve.tag){case 1:if(oe=ve.payload,typeof oe=="function"){$=oe.call(qe,$,z);break e}$=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=ve.payload,z=typeof oe=="function"?oe.call(qe,$,z):oe,z==null)break e;$=y({},$,z);break e;case 2:ql=!0}}z=h.callback,z!==null&&(e.flags|=64,H&&(e.flags|=8192),H=r.callbacks,H===null?r.callbacks=[z]:H.push(z))}else H={lane:z,tag:h.tag,payload:h.payload,callback:h.callback,next:null},V===null?(M=V=H,E=$):V=V.next=H,d|=z;if(h=h.next,h===null){if(h=r.shared.pending,h===null)break;H=h,h=H.next,H.next=null,r.lastBaseUpdate=H,r.shared.pending=null}}while(!0);V===null&&(E=$),r.baseState=E,r.firstBaseUpdate=M,r.lastBaseUpdate=V,i===null&&(r.shared.lanes=0),Kl|=d,e.lanes=d,e.memoizedState=$}}function Mu(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function Lu(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Mu(l[e],t)}var Wa=j(null),Os=j(0);function zu(e,t){e=Al,P(Os,e),P(Wa,t),Al=e|t.baseLanes}function Ai(){P(Os,Al),P(Wa,Wa.current)}function Ri(){Al=Os.current,D(Wa),D(Os)}var qt=j(null),el=null;function Yl(e){var t=e.alternate;P(tt,tt.current&1),P(qt,e),el===null&&(t===null||Wa.current!==null||t.memoizedState!==null)&&(el=e)}function _i(e){P(tt,tt.current),P(qt,e),el===null&&(el=e)}function Du(e){e.tag===22?(P(tt,tt.current),P(qt,e),el===null&&(el=e)):Ql()}function Ql(){P(tt,tt.current),P(qt,qt.current)}function Vt(e){D(qt),el===e&&(el=null),D(tt)}var tt=j(0);function Bs(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Ho(l)||Uo(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 jl=0,Se=null,He=null,it=null,Hs=!1,Fa=!1,Sa=!1,Us=0,Bn=0,Ia=null,ym=0;function Ie(){throw Error(u(321))}function Mi(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!Ht(e[l],t[l]))return!1;return!0}function Li(e,t,l,n,r,i){return jl=i,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?yd:Zi,Sa=!1,i=l(n,r),Sa=!1,Fa&&(i=Bu(t,l,n,r)),Ou(e),i}function Ou(e){N.H=qn;var t=He!==null&&He.next!==null;if(jl=0,it=He=Se=null,Hs=!1,Bn=0,Ia=null,t)throw Error(u(300));e===null||ot||(e=e.dependencies,e!==null&&As(e)&&(ot=!0))}function Bu(e,t,l,n){Se=e;var r=0;do{if(Fa&&(Ia=null),Bn=0,Fa=!1,25<=r)throw Error(u(301));if(r+=1,it=He=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}N.H=gd,i=t(l,n)}while(Fa);return i}function gm(){var e=N.H,t=e.useState()[0];return t=typeof t.then=="function"?Hn(t):t,e=e.useState()[0],(He!==null?He.memoizedState:null)!==e&&(Se.flags|=1024),t}function zi(){var e=Us!==0;return Us=0,e}function Di(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Oi(e){if(Hs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Hs=!1}jl=0,it=He=Se=null,Fa=!1,Bn=Us=0,Ia=null}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return it===null?Se.memoizedState=it=e:it=it.next=e,it}function lt(){if(He===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=He.next;var t=it===null?Se.memoizedState:it.next;if(t!==null)it=t,He=e;else{if(e===null)throw Se.alternate===null?Error(u(467)):Error(u(310));He=e,e={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},it===null?Se.memoizedState=it=e:it=it.next=e}return it}function qs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Hn(e){var t=Bn;return Bn+=1,Ia===null&&(Ia=[]),e=Tu(Ia,e,t),t=Se,(it===null?t.memoizedState:it.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?yd:Zi),e}function Vs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Hn(e);if(e.$$typeof===W)return yt(e)}throw Error(u(438,String(e)))}function Bi(e){var t=null,l=Se.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var n=Se.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=qs(),Se.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),n=0;n<e;n++)l[n]=X;return t.index++,l}function Sl(e,t){return typeof t=="function"?t(e):t}function Gs(e){var t=lt();return Hi(t,He,e)}function Hi(e,t,l){var n=e.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=l;var r=e.baseQueue,i=n.pending;if(i!==null){if(r!==null){var d=r.next;r.next=i.next,i.next=d}t.baseQueue=r=i,n.pending=null}if(i=e.baseState,r===null)e.memoizedState=i;else{t=r.next;var h=d=null,E=null,M=t,V=!1;do{var $=M.lane&-536870913;if($!==M.lane?(Ce&$)===$:(jl&$)===$){var z=M.revertLane;if(z===0)E!==null&&(E=E.next={lane:0,revertLane:0,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null}),$===Xa&&(V=!0);else if((jl&z)===z){M=M.next,z===Xa&&(V=!0);continue}else $={lane:0,revertLane:M.revertLane,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},E===null?(h=E=$,d=i):E=E.next=$,Se.lanes|=z,Kl|=z;$=M.action,Sa&&l(i,$),i=M.hasEagerState?M.eagerState:l(i,$)}else z={lane:$,revertLane:M.revertLane,gesture:M.gesture,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},E===null?(h=E=z,d=i):E=E.next=z,Se.lanes|=$,Kl|=$;M=M.next}while(M!==null&&M!==t);if(E===null?d=i:E.next=h,!Ht(i,e.memoizedState)&&(ot=!0,V&&(l=Ka,l!==null)))throw l;e.memoizedState=i,e.baseState=d,e.baseQueue=E,n.lastRenderedState=i}return r===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function Ui(e){var t=lt(),l=t.queue;if(l===null)throw Error(u(311));l.lastRenderedReducer=e;var n=l.dispatch,r=l.pending,i=t.memoizedState;if(r!==null){l.pending=null;var d=r=r.next;do i=e(i,d.action),d=d.next;while(d!==r);Ht(i,t.memoizedState)||(ot=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),l.lastRenderedState=i}return[i,n]}function Hu(e,t,l){var n=Se,r=lt(),i=we;if(i){if(l===void 0)throw Error(u(407));l=l()}else l=t();var d=!Ht((He||r).memoizedState,l);if(d&&(r.memoizedState=l,ot=!0),r=r.queue,Gi(Vu.bind(null,n,r,e),[e]),r.getSnapshot!==t||d||it!==null&&it.memoizedState.tag&1){if(n.flags|=2048,Pa(9,{destroy:void 0},qu.bind(null,n,r,l,t),null),Ge===null)throw Error(u(349));i||(jl&127)!==0||Uu(n,t,l)}return l}function Uu(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Se.updateQueue,t===null?(t=qs(),Se.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function qu(e,t,l,n){t.value=l,t.getSnapshot=n,Gu(t)&&Yu(e)}function Vu(e,t,l){return l(function(){Gu(t)&&Yu(e)})}function Gu(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!Ht(e,l)}catch{return!0}}function Yu(e){var t=xa(e,2);t!==null&&zt(t,e,2)}function qi(e){var t=St();if(typeof e=="function"){var l=e;if(e=l(),Sa){nt(!0);try{l()}finally{nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:e},t}function Qu(e,t,l,n){return e.baseState=l,Hi(e,He,typeof n=="function"?n:Sl)}function bm(e,t,l,n,r){if($s(e))throw Error(u(485));if(e=t.action,e!==null){var i={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(d){i.listeners.push(d)}};N.T!==null?l(!0):i.isTransition=!1,n(i),l=t.pending,l===null?(i.next=t.pending=i,$u(t,i)):(i.next=l.next,t.pending=l.next=i)}}function $u(e,t){var l=t.action,n=t.payload,r=e.state;if(t.isTransition){var i=N.T,d={};N.T=d;try{var h=l(r,n),E=N.S;E!==null&&E(d,h),Xu(e,t,h)}catch(M){Vi(e,t,M)}finally{i!==null&&d.types!==null&&(i.types=d.types),N.T=i}}else try{i=l(r,n),Xu(e,t,i)}catch(M){Vi(e,t,M)}}function Xu(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(n){Ku(e,t,n)},function(n){return Vi(e,t,n)}):Ku(e,t,l)}function Ku(e,t,l){t.status="fulfilled",t.value=l,Zu(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,$u(e,l)))}function Vi(e,t,l){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=l,Zu(t),t=t.next;while(t!==n)}e.action=null}function Zu(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ju(e,t){return t}function Wu(e,t){if(we){var l=Ge.formState;if(l!==null){e:{var n=Se;if(we){if(Xe){t:{for(var r=Xe,i=Pt;r.nodeType!==8;){if(!i){r=null;break t}if(r=tl(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){Xe=tl(r.nextSibling),n=r.data==="F!";break e}}Hl(n)}n=!1}n&&(t=l[0])}}return l=St(),l.memoizedState=l.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ju,lastRenderedState:t},l.queue=n,l=md.bind(null,Se,n),n.dispatch=l,n=qi(!1),i=Ki.bind(null,Se,!1,n.queue),n=St(),r={state:t,dispatch:null,action:e,pending:null},n.queue=r,l=bm.bind(null,Se,r,i,l),r.dispatch=l,n.memoizedState=e,[t,l,!1]}function Fu(e){var t=lt();return Iu(t,He,e)}function Iu(e,t,l){if(t=Hi(e,t,Ju)[0],e=Gs(Sl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=Hn(t)}catch(d){throw d===Za?Ms:d}else n=t;t=lt();var r=t.queue,i=r.dispatch;return l!==t.memoizedState&&(Se.flags|=2048,Pa(9,{destroy:void 0},jm.bind(null,r,l),null)),[n,i,e]}function jm(e,t){e.action=t}function Pu(e){var t=lt(),l=He;if(l!==null)return Iu(t,l,e);lt(),t=t.memoizedState,l=lt();var n=l.queue.dispatch;return l.memoizedState=e,[t,n,!1]}function Pa(e,t,l,n){return e={tag:e,create:l,deps:n,inst:t,next:null},t=Se.updateQueue,t===null&&(t=qs(),Se.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(n=l.next,l.next=e,e.next=n,t.lastEffect=e),e}function ed(){return lt().memoizedState}function Ys(e,t,l,n){var r=St();Se.flags|=e,r.memoizedState=Pa(1|t,{destroy:void 0},l,n===void 0?null:n)}function Qs(e,t,l,n){var r=lt();n=n===void 0?null:n;var i=r.memoizedState.inst;He!==null&&n!==null&&Mi(n,He.memoizedState.deps)?r.memoizedState=Pa(t,i,l,n):(Se.flags|=e,r.memoizedState=Pa(1|t,i,l,n))}function td(e,t){Ys(8390656,8,e,t)}function Gi(e,t){Qs(2048,8,e,t)}function Sm(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=qs(),Se.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function ld(e){var t=lt().memoizedState;return Sm({ref:t,nextImpl:e}),function(){if((Le&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function ad(e,t){return Qs(4,2,e,t)}function nd(e,t){return Qs(4,4,e,t)}function sd(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 rd(e,t,l){l=l!=null?l.concat([e]):null,Qs(4,4,sd.bind(null,t,e),l)}function Yi(){}function id(e,t){var l=lt();t=t===void 0?null:t;var n=l.memoizedState;return t!==null&&Mi(t,n[1])?n[0]:(l.memoizedState=[e,t],e)}function od(e,t){var l=lt();t=t===void 0?null:t;var n=l.memoizedState;if(t!==null&&Mi(t,n[1]))return n[0];if(n=e(),Sa){nt(!0);try{e()}finally{nt(!1)}}return l.memoizedState=[n,t],n}function Qi(e,t,l){return l===void 0||(jl&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=uf(),Se.lanes|=e,Kl|=e,l)}function cd(e,t,l,n){return Ht(l,t)?l:Wa.current!==null?(e=Qi(e,l,n),Ht(e,t)||(ot=!0),e):(jl&42)===0||(jl&1073741824)!==0&&(Ce&261930)===0?(ot=!0,e.memoizedState=l):(e=uf(),Se.lanes|=e,Kl|=e,t)}function ud(e,t,l,n,r){var i=w.p;w.p=i!==0&&8>i?i:8;var d=N.T,h={};N.T=h,Ki(e,!1,t,l);try{var E=r(),M=N.S;if(M!==null&&M(h,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var V=vm(E,n);Un(e,t,V,Qt(e))}else Un(e,t,n,Qt(e))}catch($){Un(e,t,{then:function(){},status:"rejected",reason:$},Qt())}finally{w.p=i,d!==null&&h.types!==null&&(d.types=h.types),N.T=d}}function Nm(){}function $i(e,t,l,n){if(e.tag!==5)throw Error(u(476));var r=dd(e).queue;ud(e,r,t,ee,l===null?Nm:function(){return fd(e),l(n)})}function dd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:ee},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function fd(e){var t=dd(e);t.next===null&&(t=e.alternate.memoizedState),Un(e,t.next.queue,{},Qt())}function Xi(){return yt(ls)}function xd(){return lt().memoizedState}function pd(){return lt().memoizedState}function Em(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Qt();e=Vl(l);var n=Gl(t,e,l);n!==null&&(zt(n,t,l),zn(n,t,l)),t={cache:ji()},e.payload=t;return}t=t.return}}function km(e,t,l){var n=Qt();l={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},$s(e)?hd(t,l):(l=ui(e,t,l,n),l!==null&&(zt(l,e,n),vd(l,t,n)))}function md(e,t,l){var n=Qt();Un(e,t,l,n)}function Un(e,t,l,n){var r={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if($s(e))hd(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var d=t.lastRenderedState,h=i(d,l);if(r.hasEagerState=!0,r.eagerState=h,Ht(h,d))return ks(e,t,r,0),Ge===null&&Es(),!1}catch{}finally{}if(l=ui(e,t,r,n),l!==null)return zt(l,e,n),vd(l,t,n),!0}return!1}function Ki(e,t,l,n){if(n={lane:2,revertLane:Co(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},$s(e)){if(t)throw Error(u(479))}else t=ui(e,l,n,2),t!==null&&zt(t,e,2)}function $s(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function hd(e,t){Fa=Hs=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function vd(e,t,l){if((l&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,Sc(e,l)}}var qn={readContext:yt,use:Vs,useCallback:Ie,useContext:Ie,useEffect:Ie,useImperativeHandle:Ie,useLayoutEffect:Ie,useInsertionEffect:Ie,useMemo:Ie,useReducer:Ie,useRef:Ie,useState:Ie,useDebugValue:Ie,useDeferredValue:Ie,useTransition:Ie,useSyncExternalStore:Ie,useId:Ie,useHostTransitionStatus:Ie,useFormState:Ie,useActionState:Ie,useOptimistic:Ie,useMemoCache:Ie,useCacheRefresh:Ie};qn.useEffectEvent=Ie;var yd={readContext:yt,use:Vs,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:td,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Ys(4194308,4,sd.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Ys(4194308,4,e,t)},useInsertionEffect:function(e,t){Ys(4,2,e,t)},useMemo:function(e,t){var l=St();t=t===void 0?null:t;var n=e();if(Sa){nt(!0);try{e()}finally{nt(!1)}}return l.memoizedState=[n,t],n},useReducer:function(e,t,l){var n=St();if(l!==void 0){var r=l(t);if(Sa){nt(!0);try{l(t)}finally{nt(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=km.bind(null,Se,e),[n.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:function(e){e=qi(e);var t=e.queue,l=md.bind(null,Se,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Yi,useDeferredValue:function(e,t){var l=St();return Qi(l,e,t)},useTransition:function(){var e=qi(!1);return e=ud.bind(null,Se,e.queue,!0,!1),St().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var n=Se,r=St();if(we){if(l===void 0)throw Error(u(407));l=l()}else{if(l=t(),Ge===null)throw Error(u(349));(Ce&127)!==0||Uu(n,t,l)}r.memoizedState=l;var i={value:l,getSnapshot:t};return r.queue=i,td(Vu.bind(null,n,i,e),[e]),n.flags|=2048,Pa(9,{destroy:void 0},qu.bind(null,n,i,l,t),null),l},useId:function(){var e=St(),t=Ge.identifierPrefix;if(we){var l=dl,n=ul;l=(n&~(1<<32-et(n)-1)).toString(32)+l,t="_"+t+"R_"+l,l=Us++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=ym++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Xi,useFormState:Wu,useActionState:Wu,useOptimistic:function(e){var t=St();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Ki.bind(null,Se,!0,l),l.dispatch=t,[e,t]},useMemoCache:Bi,useCacheRefresh:function(){return St().memoizedState=Em.bind(null,Se)},useEffectEvent:function(e){var t=St(),l={impl:e};return t.memoizedState=l,function(){if((Le&2)!==0)throw Error(u(440));return l.impl.apply(void 0,arguments)}}},Zi={readContext:yt,use:Vs,useCallback:id,useContext:yt,useEffect:Gi,useImperativeHandle:rd,useInsertionEffect:ad,useLayoutEffect:nd,useMemo:od,useReducer:Gs,useRef:ed,useState:function(){return Gs(Sl)},useDebugValue:Yi,useDeferredValue:function(e,t){var l=lt();return cd(l,He.memoizedState,e,t)},useTransition:function(){var e=Gs(Sl)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Hn(e),t]},useSyncExternalStore:Hu,useId:xd,useHostTransitionStatus:Xi,useFormState:Fu,useActionState:Fu,useOptimistic:function(e,t){var l=lt();return Qu(l,He,e,t)},useMemoCache:Bi,useCacheRefresh:pd};Zi.useEffectEvent=ld;var gd={readContext:yt,use:Vs,useCallback:id,useContext:yt,useEffect:Gi,useImperativeHandle:rd,useInsertionEffect:ad,useLayoutEffect:nd,useMemo:od,useReducer:Ui,useRef:ed,useState:function(){return Ui(Sl)},useDebugValue:Yi,useDeferredValue:function(e,t){var l=lt();return He===null?Qi(l,e,t):cd(l,He.memoizedState,e,t)},useTransition:function(){var e=Ui(Sl)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Hn(e),t]},useSyncExternalStore:Hu,useId:xd,useHostTransitionStatus:Xi,useFormState:Pu,useActionState:Pu,useOptimistic:function(e,t){var l=lt();return He!==null?Qu(l,He,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Bi,useCacheRefresh:pd};gd.useEffectEvent=ld;function Ji(e,t,l,n){t=e.memoizedState,l=l(n,t),l=l==null?t:y({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Wi={enqueueSetState:function(e,t,l){e=e._reactInternals;var n=Qt(),r=Vl(n);r.payload=t,l!=null&&(r.callback=l),t=Gl(e,r,n),t!==null&&(zt(t,e,n),zn(t,e,n))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var n=Qt(),r=Vl(n);r.tag=1,r.payload=t,l!=null&&(r.callback=l),t=Gl(e,r,n),t!==null&&(zt(t,e,n),zn(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=Qt(),n=Vl(l);n.tag=2,t!=null&&(n.callback=t),t=Gl(e,n,l),t!==null&&(zt(t,e,l),zn(t,e,l))}};function bd(e,t,l,n,r,i,d){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,d):t.prototype&&t.prototype.isPureReactComponent?!Cn(l,n)||!Cn(r,i):!0}function jd(e,t,l,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,n),t.state!==e&&Wi.enqueueReplaceState(t,t.state,null)}function Na(e,t){var l=t;if("ref"in t){l={};for(var n in t)n!=="ref"&&(l[n]=t[n])}if(e=e.defaultProps){l===t&&(l=y({},l));for(var r in e)l[r]===void 0&&(l[r]=e[r])}return l}function Sd(e){Ns(e)}function Nd(e){console.error(e)}function Ed(e){Ns(e)}function Xs(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function kd(e,t,l){try{var n=e.onCaughtError;n(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Fi(e,t,l){return l=Vl(l),l.tag=3,l.payload={element:null},l.callback=function(){Xs(e,t)},l}function Cd(e){return e=Vl(e),e.tag=3,e}function Td(e,t,l,n){var r=l.type.getDerivedStateFromError;if(typeof r=="function"){var i=n.value;e.payload=function(){return r(i)},e.callback=function(){kd(t,l,n)}}var d=l.stateNode;d!==null&&typeof d.componentDidCatch=="function"&&(e.callback=function(){kd(t,l,n),typeof r!="function"&&(Zl===null?Zl=new Set([this]):Zl.add(this));var h=n.stack;this.componentDidCatch(n.value,{componentStack:h!==null?h:""})})}function Cm(e,t,l,n,r){if(l.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=l.alternate,t!==null&&$a(t,l,r,!0),l=qt.current,l!==null){switch(l.tag){case 31:case 13:return el===null?nr():l.alternate===null&&Pe===0&&(Pe=3),l.flags&=-257,l.flags|=65536,l.lanes=r,n===Ls?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([n]):t.add(n),No(e,n,r)),!1;case 22:return l.flags|=65536,n===Ls?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([n]):l.add(n)),No(e,n,r)),!1}throw Error(u(435,l.tag))}return No(e,n,r),nr(),!1}if(we)return t=qt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,n!==hi&&(e=Error(u(422),{cause:n}),An(Wt(e,l)))):(n!==hi&&(t=Error(u(423),{cause:n}),An(Wt(t,l))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,n=Wt(n,l),r=Fi(e.stateNode,n,r),Ti(e,r),Pe!==4&&(Pe=2)),!1;var i=Error(u(520),{cause:n});if(i=Wt(i,l),Zn===null?Zn=[i]:Zn.push(i),Pe!==4&&(Pe=2),t===null)return!0;n=Wt(n,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=r&-r,l.lanes|=e,e=Fi(l.stateNode,n,e),Ti(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"&&(Zl===null||!Zl.has(i))))return l.flags|=65536,r&=-r,l.lanes|=r,r=Cd(r),Td(r,e,l,n),Ti(l,r),!1}l=l.return}while(l!==null);return!1}var Ii=Error(u(461)),ot=!1;function gt(e,t,l,n){t.child=e===null?_u(t,null,l,n):ja(t,e.child,l,n)}function wd(e,t,l,n,r){l=l.render;var i=t.ref;if("ref"in n){var d={};for(var h in n)h!=="ref"&&(d[h]=n[h])}else d=n;return va(t),n=Li(e,t,l,d,i,r),h=zi(),e!==null&&!ot?(Di(e,t,r),Nl(e,t,r)):(we&&h&&pi(t),t.flags|=1,gt(e,t,n,r),t.child)}function Ad(e,t,l,n,r){if(e===null){var i=l.type;return typeof i=="function"&&!di(i)&&i.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=i,Rd(e,t,i,n,r)):(e=Ts(l.type,null,n,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!ro(e,r)){var d=i.memoizedProps;if(l=l.compare,l=l!==null?l:Cn,l(d,n)&&e.ref===t.ref)return Nl(e,t,r)}return t.flags|=1,e=vl(i,n),e.ref=t.ref,e.return=t,t.child=e}function Rd(e,t,l,n,r){if(e!==null){var i=e.memoizedProps;if(Cn(i,n)&&e.ref===t.ref)if(ot=!1,t.pendingProps=n=i,ro(e,r))(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,Nl(e,t,r)}return Pi(e,t,l,n,r)}function _d(e,t,l,n){var r=n.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(i=i!==null?i.baseLanes|l:l,e!==null){for(n=t.child=e.child,r=0;n!==null;)r=r|n.lanes|n.childLanes,n=n.sibling;n=r&~i}else n=0,t.child=null;return Md(e,t,i,l,n)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&_s(t,i!==null?i.cachePool:null),i!==null?zu(t,i):Ai(),Du(t);else return n=t.lanes=536870912,Md(e,t,i!==null?i.baseLanes|l:l,l,n)}else i!==null?(_s(t,i.cachePool),zu(t,i),Ql(),t.memoizedState=null):(e!==null&&_s(t,null),Ai(),Ql());return gt(e,t,r,l),t.child}function Vn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Md(e,t,l,n,r){var i=Ni();return i=i===null?null:{parent:rt._currentValue,pool:i},t.memoizedState={baseLanes:l,cachePool:i},e!==null&&_s(t,null),Ai(),Du(t),e!==null&&$a(e,t,n,!0),t.childLanes=r,null}function Ks(e,t){return t=Js({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Ld(e,t,l){return ja(t,e.child,null,l),e=Ks(t,t.pendingProps),e.flags|=2,Vt(t),t.memoizedState=null,e}function Tm(e,t,l){var n=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(we){if(n.mode==="hidden")return e=Ks(t,n),t.lanes=536870912,Vn(null,e);if(_i(t),(e=Xe)?(e=Xf(e,Pt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ol!==null?{id:ul,overflow:dl}:null,retryLane:536870912,hydrationErrors:null},l=hu(e),l.return=t,t.child=l,vt=t,Xe=null)):e=null,e===null)throw Hl(t);return t.lanes=536870912,null}return Ks(t,n)}var i=e.memoizedState;if(i!==null){var d=i.dehydrated;if(_i(t),r)if(t.flags&256)t.flags&=-257,t=Ld(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(ot||$a(e,t,l,!1),r=(l&e.childLanes)!==0,ot||r){if(n=Ge,n!==null&&(d=Nc(n,l),d!==0&&d!==i.retryLane))throw i.retryLane=d,xa(e,d),zt(n,e,d),Ii;nr(),t=Ld(e,t,l)}else e=i.treeContext,Xe=tl(d.nextSibling),vt=t,we=!0,Bl=null,Pt=!1,e!==null&&gu(t,e),t=Ks(t,n),t.flags|=4096;return t}return e=vl(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Zs(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(u(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Pi(e,t,l,n,r){return va(t),l=Li(e,t,l,n,void 0,r),n=zi(),e!==null&&!ot?(Di(e,t,r),Nl(e,t,r)):(we&&n&&pi(t),t.flags|=1,gt(e,t,l,r),t.child)}function zd(e,t,l,n,r,i){return va(t),t.updateQueue=null,l=Bu(t,n,l,r),Ou(e),n=zi(),e!==null&&!ot?(Di(e,t,i),Nl(e,t,i)):(we&&n&&pi(t),t.flags|=1,gt(e,t,l,i),t.child)}function Dd(e,t,l,n,r){if(va(t),t.stateNode===null){var i=Va,d=l.contextType;typeof d=="object"&&d!==null&&(i=yt(d)),i=new l(n,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Wi,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=n,i.state=t.memoizedState,i.refs={},ki(t),d=l.contextType,i.context=typeof d=="object"&&d!==null?yt(d):Va,i.state=t.memoizedState,d=l.getDerivedStateFromProps,typeof d=="function"&&(Ji(t,l,d,n),i.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(d=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),d!==i.state&&Wi.enqueueReplaceState(i,i.state,null),On(t,n,i,r),Dn(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){i=t.stateNode;var h=t.memoizedProps,E=Na(l,h);i.props=E;var M=i.context,V=l.contextType;d=Va,typeof V=="object"&&V!==null&&(d=yt(V));var $=l.getDerivedStateFromProps;V=typeof $=="function"||typeof i.getSnapshotBeforeUpdate=="function",h=t.pendingProps!==h,V||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(h||M!==d)&&jd(t,i,n,d),ql=!1;var z=t.memoizedState;i.state=z,On(t,n,i,r),Dn(),M=t.memoizedState,h||z!==M||ql?(typeof $=="function"&&(Ji(t,l,$,n),M=t.memoizedState),(E=ql||bd(t,l,E,n,z,M,d))?(V||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=n,t.memoizedState=M),i.props=n,i.state=M,i.context=d,n=E):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{i=t.stateNode,Ci(e,t),d=t.memoizedProps,V=Na(l,d),i.props=V,$=t.pendingProps,z=i.context,M=l.contextType,E=Va,typeof M=="object"&&M!==null&&(E=yt(M)),h=l.getDerivedStateFromProps,(M=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(d!==$||z!==E)&&jd(t,i,n,E),ql=!1,z=t.memoizedState,i.state=z,On(t,n,i,r),Dn();var H=t.memoizedState;d!==$||z!==H||ql||e!==null&&e.dependencies!==null&&As(e.dependencies)?(typeof h=="function"&&(Ji(t,l,h,n),H=t.memoizedState),(V=ql||bd(t,l,V,n,z,H,E)||e!==null&&e.dependencies!==null&&As(e.dependencies))?(M||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(n,H,E),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(n,H,E)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=H),i.props=n,i.state=H,i.context=E,n=V):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),n=!1)}return i=n,Zs(e,t),n=(t.flags&128)!==0,i||n?(i=t.stateNode,l=n&&typeof l.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&n?(t.child=ja(t,e.child,null,r),t.child=ja(t,null,l,r)):gt(e,t,l,r),t.memoizedState=i.state,e=t.child):e=Nl(e,t,r),e}function Od(e,t,l,n){return ma(),t.flags|=256,gt(e,t,l,n),t.child}var eo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function to(e){return{baseLanes:e,cachePool:ku()}}function lo(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=Yt),e}function Bd(e,t,l){var n=t.pendingProps,r=!1,i=(t.flags&128)!==0,d;if((d=i)||(d=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),d&&(r=!0,t.flags&=-129),d=(t.flags&32)!==0,t.flags&=-33,e===null){if(we){if(r?Yl(t):Ql(),(e=Xe)?(e=Xf(e,Pt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ol!==null?{id:ul,overflow:dl}:null,retryLane:536870912,hydrationErrors:null},l=hu(e),l.return=t,t.child=l,vt=t,Xe=null)):e=null,e===null)throw Hl(t);return Uo(e)?t.lanes=32:t.lanes=536870912,null}var h=n.children;return n=n.fallback,r?(Ql(),r=t.mode,h=Js({mode:"hidden",children:h},r),n=pa(n,r,l,null),h.return=t,n.return=t,h.sibling=n,t.child=h,n=t.child,n.memoizedState=to(l),n.childLanes=lo(e,d,l),t.memoizedState=eo,Vn(null,n)):(Yl(t),ao(t,h))}var E=e.memoizedState;if(E!==null&&(h=E.dehydrated,h!==null)){if(i)t.flags&256?(Yl(t),t.flags&=-257,t=no(e,t,l)):t.memoizedState!==null?(Ql(),t.child=e.child,t.flags|=128,t=null):(Ql(),h=n.fallback,r=t.mode,n=Js({mode:"visible",children:n.children},r),h=pa(h,r,l,null),h.flags|=2,n.return=t,h.return=t,n.sibling=h,t.child=n,ja(t,e.child,null,l),n=t.child,n.memoizedState=to(l),n.childLanes=lo(e,d,l),t.memoizedState=eo,t=Vn(null,n));else if(Yl(t),Uo(h)){if(d=h.nextSibling&&h.nextSibling.dataset,d)var M=d.dgst;d=M,n=Error(u(419)),n.stack="",n.digest=d,An({value:n,source:null,stack:null}),t=no(e,t,l)}else if(ot||$a(e,t,l,!1),d=(l&e.childLanes)!==0,ot||d){if(d=Ge,d!==null&&(n=Nc(d,l),n!==0&&n!==E.retryLane))throw E.retryLane=n,xa(e,n),zt(d,e,n),Ii;Ho(h)||nr(),t=no(e,t,l)}else Ho(h)?(t.flags|=192,t.child=e.child,t=null):(e=E.treeContext,Xe=tl(h.nextSibling),vt=t,we=!0,Bl=null,Pt=!1,e!==null&&gu(t,e),t=ao(t,n.children),t.flags|=4096);return t}return r?(Ql(),h=n.fallback,r=t.mode,E=e.child,M=E.sibling,n=vl(E,{mode:"hidden",children:n.children}),n.subtreeFlags=E.subtreeFlags&65011712,M!==null?h=vl(M,h):(h=pa(h,r,l,null),h.flags|=2),h.return=t,n.return=t,n.sibling=h,t.child=n,Vn(null,n),n=t.child,h=e.child.memoizedState,h===null?h=to(l):(r=h.cachePool,r!==null?(E=rt._currentValue,r=r.parent!==E?{parent:E,pool:E}:r):r=ku(),h={baseLanes:h.baseLanes|l,cachePool:r}),n.memoizedState=h,n.childLanes=lo(e,d,l),t.memoizedState=eo,Vn(e.child,n)):(Yl(t),l=e.child,e=l.sibling,l=vl(l,{mode:"visible",children:n.children}),l.return=t,l.sibling=null,e!==null&&(d=t.deletions,d===null?(t.deletions=[e],t.flags|=16):d.push(e)),t.child=l,t.memoizedState=null,l)}function ao(e,t){return t=Js({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Js(e,t){return e=Ut(22,e,null,t),e.lanes=0,e}function no(e,t,l){return ja(t,e.child,null,l),e=ao(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Hd(e,t,l){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),gi(e.return,t,l)}function so(e,t,l,n,r,i){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:l,tailMode:r,treeForkCount:i}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=n,d.tail=l,d.tailMode=r,d.treeForkCount=i)}function Ud(e,t,l){var n=t.pendingProps,r=n.revealOrder,i=n.tail;n=n.children;var d=tt.current,h=(d&2)!==0;if(h?(d=d&1|2,t.flags|=128):d&=1,P(tt,d),gt(e,t,n,l),n=we?wn:0,!h&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hd(e,l,t);else if(e.tag===19)Hd(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(r){case"forwards":for(l=t.child,r=null;l!==null;)e=l.alternate,e!==null&&Bs(e)===null&&(r=l),l=l.sibling;l=r,l===null?(r=t.child,t.child=null):(r=l.sibling,l.sibling=null),so(t,!1,r,l,i,n);break;case"backwards":case"unstable_legacy-backwards":for(l=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Bs(e)===null){t.child=r;break}e=r.sibling,r.sibling=l,l=r,r=e}so(t,!0,l,null,i,n);break;case"together":so(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function Nl(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(l&t.childLanes)===0)if(e!==null){if($a(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,l=vl(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=vl(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function ro(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&As(e)))}function wm(e,t,l){switch(t.tag){case 3:Oe(t,t.stateNode.containerInfo),Ul(t,rt,e.memoizedState.cache),ma();break;case 27:case 5:pt(t);break;case 4:Oe(t,t.stateNode.containerInfo);break;case 10:Ul(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,_i(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(Yl(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Bd(e,t,l):(Yl(t),e=Nl(e,t,l),e!==null?e.sibling:null);Yl(t);break;case 19:var r=(e.flags&128)!==0;if(n=(l&t.childLanes)!==0,n||($a(e,t,l,!1),n=(l&t.childLanes)!==0),r){if(n)return Ud(e,t,l);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),P(tt,tt.current),n)break;return null;case 22:return t.lanes=0,_d(e,t,l,t.pendingProps);case 24:Ul(t,rt,e.memoizedState.cache)}return Nl(e,t,l)}function qd(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)ot=!0;else{if(!ro(e,l)&&(t.flags&128)===0)return ot=!1,wm(e,t,l);ot=(e.flags&131072)!==0}else ot=!1,we&&(t.flags&1048576)!==0&&yu(t,wn,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=ga(t.elementType),t.type=e,typeof e=="function")di(e)?(n=Na(e,n),t.tag=1,t=Dd(null,t,e,n,l)):(t.tag=0,t=Pi(null,t,e,n,l));else{if(e!=null){var r=e.$$typeof;if(r===F){t.tag=11,t=wd(null,t,e,n,l);break e}else if(r===q){t.tag=14,t=Ad(null,t,e,n,l);break e}}throw t=he(e)||e,Error(u(306,t,""))}}return t;case 0:return Pi(e,t,t.type,t.pendingProps,l);case 1:return n=t.type,r=Na(n,t.pendingProps),Dd(e,t,n,r,l);case 3:e:{if(Oe(t,t.stateNode.containerInfo),e===null)throw Error(u(387));n=t.pendingProps;var i=t.memoizedState;r=i.element,Ci(e,t),On(t,n,null,l);var d=t.memoizedState;if(n=d.cache,Ul(t,rt,n),n!==i.cache&&bi(t,[rt],l,!0),Dn(),n=d.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:d.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=Od(e,t,n,l);break e}else if(n!==r){r=Wt(Error(u(424)),t),An(r),t=Od(e,t,n,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(Xe=tl(e.firstChild),vt=t,we=!0,Bl=null,Pt=!0,l=_u(t,null,n,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(ma(),n===r){t=Nl(e,t,l);break e}gt(e,t,n,l)}t=t.child}return t;case 26:return Zs(e,t),e===null?(l=If(t.type,null,t.pendingProps,null))?t.memoizedState=l:we||(l=t.type,e=t.pendingProps,n=dr(de.current).createElement(l),n[ht]=t,n[wt]=e,bt(n,l,e),ft(n),t.stateNode=n):t.memoizedState=If(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pt(t),e===null&&we&&(n=t.stateNode=Jf(t.type,t.pendingProps,de.current),vt=t,Pt=!0,r=Xe,Il(t.type)?(qo=r,Xe=tl(n.firstChild)):Xe=r),gt(e,t,t.pendingProps.children,l),Zs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&we&&((r=n=Xe)&&(n=nh(n,t.type,t.pendingProps,Pt),n!==null?(t.stateNode=n,vt=t,Xe=tl(n.firstChild),Pt=!1,r=!0):r=!1),r||Hl(t)),pt(t),r=t.type,i=t.pendingProps,d=e!==null?e.memoizedProps:null,n=i.children,Do(r,i)?n=null:d!==null&&Do(r,d)&&(t.flags|=32),t.memoizedState!==null&&(r=Li(e,t,gm,null,null,l),ls._currentValue=r),Zs(e,t),gt(e,t,n,l),t.child;case 6:return e===null&&we&&((e=l=Xe)&&(l=sh(l,t.pendingProps,Pt),l!==null?(t.stateNode=l,vt=t,Xe=null,e=!0):e=!1),e||Hl(t)),null;case 13:return Bd(e,t,l);case 4:return Oe(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ja(t,null,n,l):gt(e,t,n,l),t.child;case 11:return wd(e,t,t.type,t.pendingProps,l);case 7:return gt(e,t,t.pendingProps,l),t.child;case 8:return gt(e,t,t.pendingProps.children,l),t.child;case 12:return gt(e,t,t.pendingProps.children,l),t.child;case 10:return n=t.pendingProps,Ul(t,t.type,n.value),gt(e,t,n.children,l),t.child;case 9:return r=t.type._context,n=t.pendingProps.children,va(t),r=yt(r),n=n(r),t.flags|=1,gt(e,t,n,l),t.child;case 14:return Ad(e,t,t.type,t.pendingProps,l);case 15:return Rd(e,t,t.type,t.pendingProps,l);case 19:return Ud(e,t,l);case 31:return Tm(e,t,l);case 22:return _d(e,t,l,t.pendingProps);case 24:return va(t),n=yt(rt),e===null?(r=Ni(),r===null&&(r=Ge,i=ji(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=l),r=i),t.memoizedState={parent:n,cache:r},ki(t),Ul(t,rt,r)):((e.lanes&l)!==0&&(Ci(e,t),On(t,null,null,l),Dn()),r=e.memoizedState,i=t.memoizedState,r.parent!==n?(r={parent:n,cache:n},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Ul(t,rt,n)):(n=i.cache,Ul(t,rt,n),n!==r.cache&&bi(t,[rt],l,!0))),gt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function El(e){e.flags|=4}function io(e,t,l,n,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(pf())e.flags|=8192;else throw ba=Ls,Ei}else e.flags&=-16777217}function Vd(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ax(t))if(pf())e.flags|=8192;else throw ba=Ls,Ei}function Ws(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?bc():536870912,e.lanes|=t,an|=t)}function Gn(e,t){if(!we)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 n=null;l!==null;)l.alternate!==null&&(n=l),l=l.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Ke(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,n=0;if(t)for(var r=e.child;r!==null;)l|=r.lanes|r.childLanes,n|=r.subtreeFlags&65011712,n|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)l|=r.lanes|r.childLanes,n|=r.subtreeFlags,n|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=n,e.childLanes=l,t}function Am(e,t,l){var n=t.pendingProps;switch(mi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(t),null;case 1:return Ke(t),null;case 3:return l=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),bl(rt),Re(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Qa(t)?El(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,vi())),Ke(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(El(t),i!==null?(Ke(t),Vd(t,i)):(Ke(t),io(t,r,null,n,l))):i?i!==e.memoizedState?(El(t),Ke(t),Vd(t,i)):(Ke(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&El(t),Ke(t),io(t,r,e,n,l)),null;case 27:if(Dt(t),l=de.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&El(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return Ke(t),null}e=le.current,Qa(t)?bu(t):(e=Jf(r,n,l),t.stateNode=e,El(t))}return Ke(t),null;case 5:if(Dt(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&El(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return Ke(t),null}if(i=le.current,Qa(t))bu(t);else{var d=dr(de.current);switch(i){case 1:i=d.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:i=d.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":i=d.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":i=d.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":i=d.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof n.is=="string"?d.createElement("select",{is:n.is}):d.createElement("select"),n.multiple?i.multiple=!0:n.size&&(i.size=n.size);break;default:i=typeof n.is=="string"?d.createElement(r,{is:n.is}):d.createElement(r)}}i[ht]=t,i[wt]=n;e:for(d=t.child;d!==null;){if(d.tag===5||d.tag===6)i.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}t.stateNode=i;e:switch(bt(i,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&El(t)}}return Ke(t),io(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&El(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(u(166));if(e=de.current,Qa(t)){if(e=t.stateNode,l=t.memoizedProps,n=null,r=vt,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[ht]=t,e=!!(e.nodeValue===l||n!==null&&n.suppressHydrationWarning===!0||Hf(e.nodeValue,l)),e||Hl(t,!0)}else e=dr(e).createTextNode(n),e[ht]=t,t.stateNode=e}return Ke(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(n=Qa(t),l!==null){if(e===null){if(!n)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[ht]=t}else ma(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),e=!1}else l=vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(Vt(t),t):(Vt(t),null);if((t.flags&128)!==0)throw Error(u(558))}return Ke(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Qa(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(u(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(u(317));r[ht]=t}else ma(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),r=!1}else r=vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Vt(t),t):(Vt(t),null)}return Vt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=n!==null,e=e!==null&&e.memoizedState!==null,l&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==r&&(n.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Ws(t,t.updateQueue),Ke(t),null);case 4:return Re(),e===null&&Ro(t.stateNode.containerInfo),Ke(t),null;case 10:return bl(t.type),Ke(t),null;case 19:if(D(tt),n=t.memoizedState,n===null)return Ke(t),null;if(r=(t.flags&128)!==0,i=n.rendering,i===null)if(r)Gn(n,!1);else{if(Pe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=Bs(e),i!==null){for(t.flags|=128,Gn(n,!1),e=i.updateQueue,t.updateQueue=e,Ws(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)mu(l,e),l=l.sibling;return P(tt,tt.current&1|2),we&&yl(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&We()>tr&&(t.flags|=128,r=!0,Gn(n,!1),t.lanes=4194304)}else{if(!r)if(e=Bs(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Ws(t,e),Gn(n,!0),n.tail===null&&n.tailMode==="hidden"&&!i.alternate&&!we)return Ke(t),null}else 2*We()-n.renderingStartTime>tr&&l!==536870912&&(t.flags|=128,r=!0,Gn(n,!1),t.lanes=4194304);n.isBackwards?(i.sibling=t.child,t.child=i):(e=n.last,e!==null?e.sibling=i:t.child=i,n.last=i)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=We(),e.sibling=null,l=tt.current,P(tt,r?l&1|2:l&1),we&&yl(t,n.treeForkCount),e):(Ke(t),null);case 22:case 23:return Vt(t),Ri(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(l&536870912)!==0&&(t.flags&128)===0&&(Ke(t),t.subtreeFlags&6&&(t.flags|=8192)):Ke(t),l=t.updateQueue,l!==null&&Ws(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==l&&(t.flags|=2048),e!==null&&D(ya),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),bl(rt),Ke(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function Rm(e,t){switch(mi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bl(rt),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Dt(t),null;case 31:if(t.memoizedState!==null){if(Vt(t),t.alternate===null)throw Error(u(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Vt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return D(tt),null;case 4:return Re(),null;case 10:return bl(t.type),null;case 22:case 23:return Vt(t),Ri(),e!==null&&D(ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return bl(rt),null;case 25:return null;default:return null}}function Gd(e,t){switch(mi(t),t.tag){case 3:bl(rt),Re();break;case 26:case 27:case 5:Dt(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&Vt(t);break;case 13:Vt(t);break;case 19:D(tt);break;case 10:bl(t.type);break;case 22:case 23:Vt(t),Ri(),e!==null&&D(ya);break;case 24:bl(rt)}}function Yn(e,t){try{var l=t.updateQueue,n=l!==null?l.lastEffect:null;if(n!==null){var r=n.next;l=r;do{if((l.tag&e)===e){n=void 0;var i=l.create,d=l.inst;n=i(),d.destroy=n}l=l.next}while(l!==r)}}catch(h){De(t,t.return,h)}}function $l(e,t,l){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){var d=n.inst,h=d.destroy;if(h!==void 0){d.destroy=void 0,r=t;var E=l,M=h;try{M()}catch(V){De(r,E,V)}}}n=n.next}while(n!==i)}}catch(V){De(t,t.return,V)}}function Yd(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Lu(t,l)}catch(n){De(e,e.return,n)}}}function Qd(e,t,l){l.props=Na(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(n){De(e,t,n)}}function Qn(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof l=="function"?e.refCleanup=l(n):l.current=n}}catch(r){De(e,t,r)}}function fl(e,t){var l=e.ref,n=e.refCleanup;if(l!==null)if(typeof n=="function")try{n()}catch(r){De(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(r){De(e,t,r)}else l.current=null}function $d(e){var t=e.type,l=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break e;case"img":l.src?n.src=l.src:l.srcSet&&(n.srcset=l.srcSet)}}catch(r){De(e,e.return,r)}}function oo(e,t,l){try{var n=e.stateNode;Im(n,e.type,l,t),n[wt]=t}catch(r){De(e,e.return,r)}}function Xd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Il(e.type)||e.tag===4}function co(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xd(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&&Il(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 uo(e,t,l){var n=e.tag;if(n===5||n===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=ml));else if(n!==4&&(n===27&&Il(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(uo(e,t,l),e=e.sibling;e!==null;)uo(e,t,l),e=e.sibling}function Fs(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(n!==4&&(n===27&&Il(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Fs(e,t,l),e=e.sibling;e!==null;)Fs(e,t,l),e=e.sibling}function Kd(e){var t=e.stateNode,l=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);bt(t,n,l),t[ht]=e,t[wt]=l}catch(i){De(e,e.return,i)}}var kl=!1,ct=!1,fo=!1,Zd=typeof WeakSet=="function"?WeakSet:Set,xt=null;function _m(e,t){if(e=e.containerInfo,Lo=yr,e=ru(e),ni(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var n=l.getSelection&&l.getSelection();if(n&&n.rangeCount!==0){l=n.anchorNode;var r=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{l.nodeType,i.nodeType}catch{l=null;break e}var d=0,h=-1,E=-1,M=0,V=0,$=e,z=null;t:for(;;){for(var H;$!==l||r!==0&&$.nodeType!==3||(h=d+r),$!==i||n!==0&&$.nodeType!==3||(E=d+n),$.nodeType===3&&(d+=$.nodeValue.length),(H=$.firstChild)!==null;)z=$,$=H;for(;;){if($===e)break t;if(z===l&&++M===r&&(h=d),z===i&&++V===n&&(E=d),(H=$.nextSibling)!==null)break;$=z,z=$.parentNode}$=H}l=h===-1||E===-1?null:{start:h,end:E}}else l=null}l=l||{start:0,end:0}}else l=null;for(zo={focusedElem:e,selectionRange:l},yr=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,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++)r=e[l],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,l=t,r=i.memoizedProps,i=i.memoizedState,n=l.stateNode;try{var oe=Na(l.type,r);e=n.getSnapshotBeforeUpdate(oe,i),n.__reactInternalSnapshotBeforeUpdate=e}catch(ve){De(l,l.return,ve)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Bo(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Bo(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(u(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function Jd(e,t,l){var n=l.flags;switch(l.tag){case 0:case 11:case 15:Tl(e,l),n&4&&Yn(5,l);break;case 1:if(Tl(e,l),n&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(d){De(l,l.return,d)}else{var r=Na(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(d){De(l,l.return,d)}}n&64&&Yd(l),n&512&&Qn(l,l.return);break;case 3:if(Tl(e,l),n&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{Lu(e,t)}catch(d){De(l,l.return,d)}}break;case 27:t===null&&n&4&&Kd(l);case 26:case 5:Tl(e,l),t===null&&n&4&&$d(l),n&512&&Qn(l,l.return);break;case 12:Tl(e,l);break;case 31:Tl(e,l),n&4&&Id(e,l);break;case 13:Tl(e,l),n&4&&Pd(e,l),n&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=qm.bind(null,l),rh(e,l))));break;case 22:if(n=l.memoizedState!==null||kl,!n){t=t!==null&&t.memoizedState!==null||ct,r=kl;var i=ct;kl=n,(ct=t)&&!i?wl(e,l,(l.subtreeFlags&8772)!==0):Tl(e,l),kl=r,ct=i}break;case 30:break;default:Tl(e,l)}}function Wd(e){var t=e.alternate;t!==null&&(e.alternate=null,Wd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Vr(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 Ze=null,Rt=!1;function Cl(e,t,l){for(l=l.child;l!==null;)Fd(e,t,l),l=l.sibling}function Fd(e,t,l){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Ct,l)}catch{}switch(l.tag){case 26:ct||fl(l,t),Cl(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:ct||fl(l,t);var n=Ze,r=Rt;Il(l.type)&&(Ze=l.stateNode,Rt=!1),Cl(e,t,l),Pn(l.stateNode),Ze=n,Rt=r;break;case 5:ct||fl(l,t);case 6:if(n=Ze,r=Rt,Ze=null,Cl(e,t,l),Ze=n,Rt=r,Ze!==null)if(Rt)try{(Ze.nodeType===9?Ze.body:Ze.nodeName==="HTML"?Ze.ownerDocument.body:Ze).removeChild(l.stateNode)}catch(i){De(l,t,i)}else try{Ze.removeChild(l.stateNode)}catch(i){De(l,t,i)}break;case 18:Ze!==null&&(Rt?(e=Ze,Qf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),fn(e)):Qf(Ze,l.stateNode));break;case 4:n=Ze,r=Rt,Ze=l.stateNode.containerInfo,Rt=!0,Cl(e,t,l),Ze=n,Rt=r;break;case 0:case 11:case 14:case 15:$l(2,l,t),ct||$l(4,l,t),Cl(e,t,l);break;case 1:ct||(fl(l,t),n=l.stateNode,typeof n.componentWillUnmount=="function"&&Qd(l,t,n)),Cl(e,t,l);break;case 21:Cl(e,t,l);break;case 22:ct=(n=ct)||l.memoizedState!==null,Cl(e,t,l),ct=n;break;default:Cl(e,t,l)}}function Id(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{fn(e)}catch(l){De(t,t.return,l)}}}function Pd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{fn(e)}catch(l){De(t,t.return,l)}}function Mm(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zd),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zd),t;default:throw Error(u(435,e.tag))}}function Is(e,t){var l=Mm(e);t.forEach(function(n){if(!l.has(n)){l.add(n);var r=Vm.bind(null,e,n);n.then(r,r)}})}function _t(e,t){var l=t.deletions;if(l!==null)for(var n=0;n<l.length;n++){var r=l[n],i=e,d=t,h=d;e:for(;h!==null;){switch(h.tag){case 27:if(Il(h.type)){Ze=h.stateNode,Rt=!1;break e}break;case 5:Ze=h.stateNode,Rt=!1;break e;case 3:case 4:Ze=h.stateNode.containerInfo,Rt=!0;break e}h=h.return}if(Ze===null)throw Error(u(160));Fd(i,d,r),Ze=null,Rt=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ef(t,e),t=t.sibling}var ol=null;function ef(e,t){var l=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_t(t,e),Mt(e),n&4&&($l(3,e,e.return),Yn(3,e),$l(5,e,e.return));break;case 1:_t(t,e),Mt(e),n&512&&(ct||l===null||fl(l,l.return)),n&64&&kl&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?n:l.concat(n))));break;case 26:var r=ol;if(_t(t,e),Mt(e),n&512&&(ct||l===null||fl(l,l.return)),n&4){var i=l!==null?l.memoizedState:null;if(n=e.memoizedState,l===null)if(n===null)if(e.stateNode===null){e:{n=e.type,l=e.memoizedProps,r=r.ownerDocument||r;t:switch(n){case"title":i=r.getElementsByTagName("title")[0],(!i||i[vn]||i[ht]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(n),r.head.insertBefore(i,r.querySelector("head > title"))),bt(i,n,l),i[ht]=e,ft(i),n=i;break e;case"link":var d=tx("link","href",r).get(n+(l.href||""));if(d){for(var h=0;h<d.length;h++)if(i=d[h],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)){d.splice(h,1);break t}}i=r.createElement(n),bt(i,n,l),r.head.appendChild(i);break;case"meta":if(d=tx("meta","content",r).get(n+(l.content||""))){for(h=0;h<d.length;h++)if(i=d[h],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)){d.splice(h,1);break t}}i=r.createElement(n),bt(i,n,l),r.head.appendChild(i);break;default:throw Error(u(468,n))}i[ht]=e,ft(i),n=i}e.stateNode=n}else lx(r,e.type,e.stateNode);else e.stateNode=ex(r,n,e.memoizedProps);else i!==n?(i===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):i.count--,n===null?lx(r,e.type,e.stateNode):ex(r,n,e.memoizedProps)):n===null&&e.stateNode!==null&&oo(e,e.memoizedProps,l.memoizedProps)}break;case 27:_t(t,e),Mt(e),n&512&&(ct||l===null||fl(l,l.return)),l!==null&&n&4&&oo(e,e.memoizedProps,l.memoizedProps);break;case 5:if(_t(t,e),Mt(e),n&512&&(ct||l===null||fl(l,l.return)),e.flags&32){r=e.stateNode;try{za(r,"")}catch(oe){De(e,e.return,oe)}}n&4&&e.stateNode!=null&&(r=e.memoizedProps,oo(e,r,l!==null?l.memoizedProps:r)),n&1024&&(fo=!0);break;case 6:if(_t(t,e),Mt(e),n&4){if(e.stateNode===null)throw Error(u(162));n=e.memoizedProps,l=e.stateNode;try{l.nodeValue=n}catch(oe){De(e,e.return,oe)}}break;case 3:if(pr=null,r=ol,ol=fr(t.containerInfo),_t(t,e),ol=r,Mt(e),n&4&&l!==null&&l.memoizedState.isDehydrated)try{fn(t.containerInfo)}catch(oe){De(e,e.return,oe)}fo&&(fo=!1,tf(e));break;case 4:n=ol,ol=fr(e.stateNode.containerInfo),_t(t,e),Mt(e),ol=n;break;case 12:_t(t,e),Mt(e);break;case 31:_t(t,e),Mt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Is(e,n)));break;case 13:_t(t,e),Mt(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(er=We()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Is(e,n)));break;case 22:r=e.memoizedState!==null;var E=l!==null&&l.memoizedState!==null,M=kl,V=ct;if(kl=M||r,ct=V||E,_t(t,e),ct=V,kl=M,Mt(e),n&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(l===null||E||kl||ct||Ea(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){E=l=t;try{if(i=E.stateNode,r)d=i.style,typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none";else{h=E.stateNode;var $=E.memoizedProps.style,z=$!=null&&$.hasOwnProperty("display")?$.display:null;h.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(oe){De(E,E.return,oe)}}}else if(t.tag===6){if(l===null){E=t;try{E.stateNode.nodeValue=r?"":E.memoizedProps}catch(oe){De(E,E.return,oe)}}}else if(t.tag===18){if(l===null){E=t;try{var H=E.stateNode;r?$f(H,!0):$f(E.stateNode,!1)}catch(oe){De(E,E.return,oe)}}}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}n&4&&(n=e.updateQueue,n!==null&&(l=n.retryQueue,l!==null&&(n.retryQueue=null,Is(e,l))));break;case 19:_t(t,e),Mt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Is(e,n)));break;case 30:break;case 21:break;default:_t(t,e),Mt(e)}}function Mt(e){var t=e.flags;if(t&2){try{for(var l,n=e.return;n!==null;){if(Xd(n)){l=n;break}n=n.return}if(l==null)throw Error(u(160));switch(l.tag){case 27:var r=l.stateNode,i=co(e);Fs(e,i,r);break;case 5:var d=l.stateNode;l.flags&32&&(za(d,""),l.flags&=-33);var h=co(e);Fs(e,h,d);break;case 3:case 4:var E=l.stateNode.containerInfo,M=co(e);uo(e,M,E);break;default:throw Error(u(161))}}catch(V){De(e,e.return,V)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function tf(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;tf(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Tl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Jd(e,t.alternate,t),t=t.sibling}function Ea(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:$l(4,t,t.return),Ea(t);break;case 1:fl(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Qd(t,t.return,l),Ea(t);break;case 27:Pn(t.stateNode);case 26:case 5:fl(t,t.return),Ea(t);break;case 22:t.memoizedState===null&&Ea(t);break;case 30:Ea(t);break;default:Ea(t)}e=e.sibling}}function wl(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,r=e,i=t,d=i.flags;switch(i.tag){case 0:case 11:case 15:wl(r,i,l),Yn(4,i);break;case 1:if(wl(r,i,l),n=i,r=n.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(M){De(n,n.return,M)}if(n=i,r=n.updateQueue,r!==null){var h=n.stateNode;try{var E=r.shared.hiddenCallbacks;if(E!==null)for(r.shared.hiddenCallbacks=null,r=0;r<E.length;r++)Mu(E[r],h)}catch(M){De(n,n.return,M)}}l&&d&64&&Yd(i),Qn(i,i.return);break;case 27:Kd(i);case 26:case 5:wl(r,i,l),l&&n===null&&d&4&&$d(i),Qn(i,i.return);break;case 12:wl(r,i,l);break;case 31:wl(r,i,l),l&&d&4&&Id(r,i);break;case 13:wl(r,i,l),l&&d&4&&Pd(r,i);break;case 22:i.memoizedState===null&&wl(r,i,l),Qn(i,i.return);break;case 30:break;default:wl(r,i,l)}t=t.sibling}}function xo(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&&Rn(l))}function po(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Rn(e))}function cl(e,t,l,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)lf(e,t,l,n),t=t.sibling}function lf(e,t,l,n){var r=t.flags;switch(t.tag){case 0:case 11:case 15:cl(e,t,l,n),r&2048&&Yn(9,t);break;case 1:cl(e,t,l,n);break;case 3:cl(e,t,l,n),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Rn(e)));break;case 12:if(r&2048){cl(e,t,l,n),e=t.stateNode;try{var i=t.memoizedProps,d=i.id,h=i.onPostCommit;typeof h=="function"&&h(d,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(E){De(t,t.return,E)}}else cl(e,t,l,n);break;case 31:cl(e,t,l,n);break;case 13:cl(e,t,l,n);break;case 23:break;case 22:i=t.stateNode,d=t.alternate,t.memoizedState!==null?i._visibility&2?cl(e,t,l,n):$n(e,t):i._visibility&2?cl(e,t,l,n):(i._visibility|=2,en(e,t,l,n,(t.subtreeFlags&10256)!==0||!1)),r&2048&&xo(d,t);break;case 24:cl(e,t,l,n),r&2048&&po(t.alternate,t);break;default:cl(e,t,l,n)}}function en(e,t,l,n,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,d=t,h=l,E=n,M=d.flags;switch(d.tag){case 0:case 11:case 15:en(i,d,h,E,r),Yn(8,d);break;case 23:break;case 22:var V=d.stateNode;d.memoizedState!==null?V._visibility&2?en(i,d,h,E,r):$n(i,d):(V._visibility|=2,en(i,d,h,E,r)),r&&M&2048&&xo(d.alternate,d);break;case 24:en(i,d,h,E,r),r&&M&2048&&po(d.alternate,d);break;default:en(i,d,h,E,r)}t=t.sibling}}function $n(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,n=t,r=n.flags;switch(n.tag){case 22:$n(l,n),r&2048&&xo(n.alternate,n);break;case 24:$n(l,n),r&2048&&po(n.alternate,n);break;default:$n(l,n)}t=t.sibling}}var Xn=8192;function tn(e,t,l){if(e.subtreeFlags&Xn)for(e=e.child;e!==null;)af(e,t,l),e=e.sibling}function af(e,t,l){switch(e.tag){case 26:tn(e,t,l),e.flags&Xn&&e.memoizedState!==null&&yh(l,ol,e.memoizedState,e.memoizedProps);break;case 5:tn(e,t,l);break;case 3:case 4:var n=ol;ol=fr(e.stateNode.containerInfo),tn(e,t,l),ol=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=Xn,Xn=16777216,tn(e,t,l),Xn=n):tn(e,t,l));break;default:tn(e,t,l)}}function nf(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 Kn(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];xt=n,rf(n,e)}nf(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)sf(e),e=e.sibling}function sf(e){switch(e.tag){case 0:case 11:case 15:Kn(e),e.flags&2048&&$l(9,e,e.return);break;case 3:Kn(e);break;case 12:Kn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ps(e)):Kn(e);break;default:Kn(e)}}function Ps(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];xt=n,rf(n,e)}nf(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:$l(8,t,t.return),Ps(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,Ps(t));break;default:Ps(t)}e=e.sibling}}function rf(e,t){for(;xt!==null;){var l=xt;switch(l.tag){case 0:case 11:case 15:$l(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var n=l.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Rn(l.memoizedState.cache)}if(n=l.child,n!==null)n.return=l,xt=n;else e:for(l=e;xt!==null;){n=xt;var r=n.sibling,i=n.return;if(Wd(n),n===l){xt=null;break e}if(r!==null){r.return=i,xt=r;break e}xt=i}}}var Lm={getCacheForType:function(e){var t=yt(rt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return yt(rt).controller.signal}},zm=typeof WeakMap=="function"?WeakMap:Map,Le=0,Ge=null,Ee=null,Ce=0,ze=0,Gt=null,Xl=!1,ln=!1,mo=!1,Al=0,Pe=0,Kl=0,ka=0,ho=0,Yt=0,an=0,Zn=null,Lt=null,vo=!1,er=0,of=0,tr=1/0,lr=null,Zl=null,dt=0,Jl=null,nn=null,Rl=0,yo=0,go=null,cf=null,Jn=0,bo=null;function Qt(){return(Le&2)!==0&&Ce!==0?Ce&-Ce:N.T!==null?Co():Ec()}function uf(){if(Yt===0)if((Ce&536870912)===0||we){var e=Ve;Ve<<=1,(Ve&3932160)===0&&(Ve=262144),Yt=e}else Yt=536870912;return e=qt.current,e!==null&&(e.flags|=32),Yt}function zt(e,t,l){(e===Ge&&(ze===2||ze===9)||e.cancelPendingCommit!==null)&&(sn(e,0),Wl(e,Ce,Yt,!1)),hn(e,l),((Le&2)===0||e!==Ge)&&(e===Ge&&((Le&2)===0&&(ka|=l),Pe===4&&Wl(e,Ce,Yt,!1)),xl(e))}function df(e,t,l){if((Le&6)!==0)throw Error(u(327));var n=!l&&(t&127)===0&&(t&e.expiredLanes)===0||mn(e,t),r=n?Bm(e,t):So(e,t,!0),i=n;do{if(r===0){ln&&!n&&Wl(e,t,0,!1);break}else{if(l=e.current.alternate,i&&!Dm(l)){r=So(e,t,!1),i=!1;continue}if(r===2){if(i=t,e.errorRecoveryDisabledLanes&i)var d=0;else d=e.pendingLanes&-536870913,d=d!==0?d:d&536870912?536870912:0;if(d!==0){t=d;e:{var h=e;r=Zn;var E=h.current.memoizedState.isDehydrated;if(E&&(sn(h,d).flags|=256),d=So(h,d,!1),d!==2){if(mo&&!E){h.errorRecoveryDisabledLanes|=i,ka|=i,r=4;break e}i=Lt,Lt=r,i!==null&&(Lt===null?Lt=i:Lt.push.apply(Lt,i))}r=d}if(i=!1,r!==2)continue}}if(r===1){sn(e,0),Wl(e,t,0,!0);break}e:{switch(n=e,i=r,i){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t)break;case 6:Wl(n,t,Yt,!Xl);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(r=er+300-We(),10<r)){if(Wl(n,t,Yt,!Xl),Ta(n,0,!0)!==0)break e;Rl=t,n.timeoutHandle=Gf(ff.bind(null,n,l,Lt,lr,vo,t,Yt,ka,an,Xl,i,"Throttled",-0,0),r);break e}ff(n,l,Lt,lr,vo,t,Yt,ka,an,Xl,i,null,-0,0)}}break}while(!0);xl(e)}function ff(e,t,l,n,r,i,d,h,E,M,V,$,z,H){if(e.timeoutHandle=-1,$=t.subtreeFlags,$&8192||($&16785408)===16785408){$={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ml},af(t,i,$);var oe=(i&62914560)===i?er-We():(i&4194048)===i?of-We():0;if(oe=gh($,oe),oe!==null){Rl=i,e.cancelPendingCommit=oe(bf.bind(null,e,t,i,l,n,r,d,h,E,V,$,null,z,H)),Wl(e,i,d,!M);return}}bf(e,t,i,l,n,r,d,h,E)}function Dm(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 n=0;n<l.length;n++){var r=l[n],i=r.getSnapshot;r=r.value;try{if(!Ht(i(),r))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 Wl(e,t,l,n){t&=~ho,t&=~ka,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var r=t;0<r;){var i=31-et(r),d=1<<i;n[i]=-1,r&=~d}l!==0&&jc(e,l,t)}function ar(){return(Le&6)===0?(Wn(0),!1):!0}function jo(){if(Ee!==null){if(ze===0)var e=Ee.return;else e=Ee,gl=ha=null,Oi(e),Ja=null,Mn=0,e=Ee;for(;e!==null;)Gd(e.alternate,e),e=e.return;Ee=null}}function sn(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,th(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Rl=0,jo(),Ge=e,Ee=l=vl(e.current,null),Ce=t,ze=0,Gt=null,Xl=!1,ln=mn(e,t),mo=!1,an=Yt=ho=ka=Kl=Pe=0,Lt=Zn=null,vo=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-et(n),i=1<<r;t|=e[r],n&=~i}return Al=t,Es(),l}function xf(e,t){Se=null,N.H=qn,t===Za||t===Ms?(t=wu(),ze=3):t===Ei?(t=wu(),ze=4):ze=t===Ii?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Gt=t,Ee===null&&(Pe=1,Xs(e,Wt(t,e.current)))}function pf(){var e=qt.current;return e===null?!0:(Ce&4194048)===Ce?el===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===el:!1}function mf(){var e=N.H;return N.H=qn,e===null?qn:e}function hf(){var e=N.A;return N.A=Lm,e}function nr(){Pe=4,Xl||(Ce&4194048)!==Ce&&qt.current!==null||(ln=!0),(Kl&134217727)===0&&(ka&134217727)===0||Ge===null||Wl(Ge,Ce,Yt,!1)}function So(e,t,l){var n=Le;Le|=2;var r=mf(),i=hf();(Ge!==e||Ce!==t)&&(lr=null,sn(e,t)),t=!1;var d=Pe;e:do try{if(ze!==0&&Ee!==null){var h=Ee,E=Gt;switch(ze){case 8:jo(),d=6;break e;case 3:case 2:case 9:case 6:qt.current===null&&(t=!0);var M=ze;if(ze=0,Gt=null,rn(e,h,E,M),l&&ln){d=0;break e}break;default:M=ze,ze=0,Gt=null,rn(e,h,E,M)}}Om(),d=Pe;break}catch(V){xf(e,V)}while(!0);return t&&e.shellSuspendCounter++,gl=ha=null,Le=n,N.H=r,N.A=i,Ee===null&&(Ge=null,Ce=0,Es()),d}function Om(){for(;Ee!==null;)vf(Ee)}function Bm(e,t){var l=Le;Le|=2;var n=mf(),r=hf();Ge!==e||Ce!==t?(lr=null,tr=We()+500,sn(e,t)):ln=mn(e,t);e:do try{if(ze!==0&&Ee!==null){t=Ee;var i=Gt;t:switch(ze){case 1:ze=0,Gt=null,rn(e,t,i,1);break;case 2:case 9:if(Cu(i)){ze=0,Gt=null,yf(t);break}t=function(){ze!==2&&ze!==9||Ge!==e||(ze=7),xl(e)},i.then(t,t);break e;case 3:ze=7;break e;case 4:ze=5;break e;case 7:Cu(i)?(ze=0,Gt=null,yf(t)):(ze=0,Gt=null,rn(e,t,i,7));break;case 5:var d=null;switch(Ee.tag){case 26:d=Ee.memoizedState;case 5:case 27:var h=Ee;if(d?ax(d):h.stateNode.complete){ze=0,Gt=null;var E=h.sibling;if(E!==null)Ee=E;else{var M=h.return;M!==null?(Ee=M,sr(M)):Ee=null}break t}}ze=0,Gt=null,rn(e,t,i,5);break;case 6:ze=0,Gt=null,rn(e,t,i,6);break;case 8:jo(),Pe=6;break e;default:throw Error(u(462))}}Hm();break}catch(V){xf(e,V)}while(!0);return gl=ha=null,N.H=n,N.A=r,Le=l,Ee!==null?0:(Ge=null,Ce=0,Es(),Pe)}function Hm(){for(;Ee!==null&&!nl();)vf(Ee)}function vf(e){var t=qd(e.alternate,e,Al);e.memoizedProps=e.pendingProps,t===null?sr(e):Ee=t}function yf(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=zd(l,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=zd(l,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:Oi(t);default:Gd(l,t),t=Ee=mu(t,Al),t=qd(l,t,Al)}e.memoizedProps=e.pendingProps,t===null?sr(e):Ee=t}function rn(e,t,l,n){gl=ha=null,Oi(t),Ja=null,Mn=0;var r=t.return;try{if(Cm(e,r,t,l,Ce)){Pe=1,Xs(e,Wt(l,e.current)),Ee=null;return}}catch(i){if(r!==null)throw Ee=r,i;Pe=1,Xs(e,Wt(l,e.current)),Ee=null;return}t.flags&32768?(we||n===1?e=!0:ln||(Ce&536870912)!==0?e=!1:(Xl=e=!0,(n===2||n===9||n===3||n===6)&&(n=qt.current,n!==null&&n.tag===13&&(n.flags|=16384))),gf(t,e)):sr(t)}function sr(e){var t=e;do{if((t.flags&32768)!==0){gf(t,Xl);return}e=t.return;var l=Am(t.alternate,t,Al);if(l!==null){Ee=l;return}if(t=t.sibling,t!==null){Ee=t;return}Ee=t=e}while(t!==null);Pe===0&&(Pe=5)}function gf(e,t){do{var l=Rm(e.alternate,e);if(l!==null){l.flags&=32767,Ee=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Ee=e;return}Ee=e=l}while(e!==null);Pe=6,Ee=null}function bf(e,t,l,n,r,i,d,h,E){e.cancelPendingCommit=null;do rr();while(dt!==0);if((Le&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));if(i=t.lanes|t.childLanes,i|=ci,vp(e,l,i,d,h,E),e===Ge&&(Ee=Ge=null,Ce=0),nn=t,Jl=e,Rl=l,yo=i,go=r,cf=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Gm(at,function(){return kf(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=N.T,N.T=null,r=w.p,w.p=2,d=Le,Le|=4;try{_m(e,t,l)}finally{Le=d,w.p=r,N.T=n}}dt=1,jf(),Sf(),Nf()}}function jf(){if(dt===1){dt=0;var e=Jl,t=nn,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=N.T,N.T=null;var n=w.p;w.p=2;var r=Le;Le|=4;try{ef(t,e);var i=zo,d=ru(e.containerInfo),h=i.focusedElem,E=i.selectionRange;if(d!==h&&h&&h.ownerDocument&&su(h.ownerDocument.documentElement,h)){if(E!==null&&ni(h)){var M=E.start,V=E.end;if(V===void 0&&(V=M),"selectionStart"in h)h.selectionStart=M,h.selectionEnd=Math.min(V,h.value.length);else{var $=h.ownerDocument||document,z=$&&$.defaultView||window;if(z.getSelection){var H=z.getSelection(),oe=h.textContent.length,ve=Math.min(E.start,oe),qe=E.end===void 0?ve:Math.min(E.end,oe);!H.extend&&ve>qe&&(d=qe,qe=ve,ve=d);var A=nu(h,ve),C=nu(h,qe);if(A&&C&&(H.rangeCount!==1||H.anchorNode!==A.node||H.anchorOffset!==A.offset||H.focusNode!==C.node||H.focusOffset!==C.offset)){var _=$.createRange();_.setStart(A.node,A.offset),H.removeAllRanges(),ve>qe?(H.addRange(_),H.extend(C.node,C.offset)):(_.setEnd(C.node,C.offset),H.addRange(_))}}}}for($=[],H=h;H=H.parentNode;)H.nodeType===1&&$.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<$.length;h++){var Q=$[h];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}yr=!!Lo,zo=Lo=null}finally{Le=r,w.p=n,N.T=l}}e.current=t,dt=2}}function Sf(){if(dt===2){dt=0;var e=Jl,t=nn,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=N.T,N.T=null;var n=w.p;w.p=2;var r=Le;Le|=4;try{Jd(e,t.alternate,t)}finally{Le=r,w.p=n,N.T=l}}dt=3}}function Nf(){if(dt===4||dt===3){dt=0,Xt();var e=Jl,t=nn,l=Rl,n=cf;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,nn=Jl=null,Ef(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Zl=null),Ur(l),t=t.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(Ct,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=N.T,r=w.p,w.p=2,N.T=null;try{for(var i=e.onRecoverableError,d=0;d<n.length;d++){var h=n[d];i(h.value,{componentStack:h.stack})}}finally{N.T=t,w.p=r}}(Rl&3)!==0&&rr(),xl(e),r=e.pendingLanes,(l&261930)!==0&&(r&42)!==0?e===bo?Jn++:(Jn=0,bo=e):Jn=0,Wn(0)}}function Ef(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Rn(t)))}function rr(){return jf(),Sf(),Nf(),kf()}function kf(){if(dt!==5)return!1;var e=Jl,t=yo;yo=0;var l=Ur(Rl),n=N.T,r=w.p;try{w.p=32>l?32:l,N.T=null,l=go,go=null;var i=Jl,d=Rl;if(dt=0,nn=Jl=null,Rl=0,(Le&6)!==0)throw Error(u(331));var h=Le;if(Le|=4,sf(i.current),lf(i,i.current,d,l),Le=h,Wn(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Ct,i)}catch{}return!0}finally{w.p=r,N.T=n,Ef(e,t)}}function Cf(e,t,l){t=Wt(l,t),t=Fi(e.stateNode,t,2),e=Gl(e,t,2),e!==null&&(hn(e,2),xl(e))}function De(e,t,l){if(e.tag===3)Cf(e,e,l);else for(;t!==null;){if(t.tag===3){Cf(t,e,l);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Zl===null||!Zl.has(n))){e=Wt(l,e),l=Cd(2),n=Gl(t,l,2),n!==null&&(Td(l,n,t,e),hn(n,2),xl(n));break}}t=t.return}}function No(e,t,l){var n=e.pingCache;if(n===null){n=e.pingCache=new zm;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(l)||(mo=!0,r.add(l),e=Um.bind(null,e,t,l),t.then(e,e))}function Um(e,t,l){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Ge===e&&(Ce&l)===l&&(Pe===4||Pe===3&&(Ce&62914560)===Ce&&300>We()-er?(Le&2)===0&&sn(e,0):ho|=l,an===Ce&&(an=0)),xl(e)}function Tf(e,t){t===0&&(t=bc()),e=xa(e,t),e!==null&&(hn(e,t),xl(e))}function qm(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Tf(e,l)}function Vm(e,t){var l=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(l=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(u(314))}n!==null&&n.delete(t),Tf(e,l)}function Gm(e,t){return Ot(e,t)}var ir=null,on=null,Eo=!1,or=!1,ko=!1,Fl=0;function xl(e){e!==on&&e.next===null&&(on===null?ir=on=e:on=on.next=e),or=!0,Eo||(Eo=!0,Qm())}function Wn(e,t){if(!ko&&or){ko=!0;do for(var l=!1,n=ir;n!==null;){if(e!==0){var r=n.pendingLanes;if(r===0)var i=0;else{var d=n.suspendedLanes,h=n.pingedLanes;i=(1<<31-et(42|e)+1)-1,i&=r&~(d&~h),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(l=!0,_f(n,i))}else i=Ce,i=Ta(n,n===Ge?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(i&3)===0||mn(n,i)||(l=!0,_f(n,i));n=n.next}while(l);ko=!1}}function Ym(){wf()}function wf(){or=Eo=!1;var e=0;Fl!==0&&eh()&&(e=Fl);for(var t=We(),l=null,n=ir;n!==null;){var r=n.next,i=Af(n,t);i===0?(n.next=null,l===null?ir=r:l.next=r,r===null&&(on=l)):(l=n,(e!==0||(i&3)!==0)&&(or=!0)),n=r}dt!==0&&dt!==5||Wn(e),Fl!==0&&(Fl=0)}function Af(e,t){for(var l=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var d=31-et(i),h=1<<d,E=r[d];E===-1?((h&l)===0||(h&n)!==0)&&(r[d]=hp(h,t)):E<=t&&(e.expiredLanes|=h),i&=~h}if(t=Ge,l=Ce,l=Ta(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,l===0||e===t&&(ze===2||ze===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&mt(n),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||mn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(n!==null&&mt(n),Ur(l)){case 2:case 8:l=Be;break;case 32:l=at;break;case 268435456:l=Ml;break;default:l=at}return n=Rf.bind(null,e),l=Ot(l,n),e.callbackPriority=t,e.callbackNode=l,t}return n!==null&&n!==null&&mt(n),e.callbackPriority=2,e.callbackNode=null,2}function Rf(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(rr()&&e.callbackNode!==l)return null;var n=Ce;return n=Ta(e,e===Ge?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(df(e,n,t),Af(e,We()),e.callbackNode!=null&&e.callbackNode===l?Rf.bind(null,e):null)}function _f(e,t){if(rr())return null;df(e,t,!0)}function Qm(){lh(function(){(Le&6)!==0?Ot(K,Ym):wf()})}function Co(){if(Fl===0){var e=Xa;e===0&&(e=st,st<<=1,(st&261888)===0&&(st=256)),Fl=e}return Fl}function Mf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:hs(""+e)}function Lf(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 $m(e,t,l,n,r){if(t==="submit"&&l&&l.stateNode===r){var i=Mf((r[wt]||null).action),d=n.submitter;d&&(t=(t=d[wt]||null)?Mf(t.formAction):d.getAttribute("formAction"),t!==null&&(i=t,d=null));var h=new bs("action","action",null,n,r);e.push({event:h,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Fl!==0){var E=d?Lf(r,d):new FormData(r);$i(l,{pending:!0,data:E,method:r.method,action:i},null,E)}}else typeof i=="function"&&(h.preventDefault(),E=d?Lf(r,d):new FormData(r),$i(l,{pending:!0,data:E,method:r.method,action:i},i,E))},currentTarget:r}]})}}for(var To=0;To<oi.length;To++){var wo=oi[To],Xm=wo.toLowerCase(),Km=wo[0].toUpperCase()+wo.slice(1);il(Xm,"on"+Km)}il(cu,"onAnimationEnd"),il(uu,"onAnimationIteration"),il(du,"onAnimationStart"),il("dblclick","onDoubleClick"),il("focusin","onFocus"),il("focusout","onBlur"),il(cm,"onTransitionRun"),il(um,"onTransitionStart"),il(dm,"onTransitionCancel"),il(fu,"onTransitionEnd"),Ma("onMouseEnter",["mouseout","mouseover"]),Ma("onMouseLeave",["mouseout","mouseover"]),Ma("onPointerEnter",["pointerout","pointerover"]),Ma("onPointerLeave",["pointerout","pointerover"]),ca("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ca("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ca("onBeforeInput",["compositionend","keypress","textInput","paste"]),ca("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ca("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ca("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fn="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(" "),Zm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fn));function zf(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var n=e[l],r=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var d=n.length-1;0<=d;d--){var h=n[d],E=h.instance,M=h.currentTarget;if(h=h.listener,E!==i&&r.isPropagationStopped())break e;i=h,r.currentTarget=M;try{i(r)}catch(V){Ns(V)}r.currentTarget=null,i=E}else for(d=0;d<n.length;d++){if(h=n[d],E=h.instance,M=h.currentTarget,h=h.listener,E!==i&&r.isPropagationStopped())break e;i=h,r.currentTarget=M;try{i(r)}catch(V){Ns(V)}r.currentTarget=null,i=E}}}}function ke(e,t){var l=t[qr];l===void 0&&(l=t[qr]=new Set);var n=e+"__bubble";l.has(n)||(Df(t,e,2,!1),l.add(n))}function Ao(e,t,l){var n=0;t&&(n|=4),Df(l,e,n,t)}var cr="_reactListening"+Math.random().toString(36).slice(2);function Ro(e){if(!e[cr]){e[cr]=!0,Tc.forEach(function(l){l!=="selectionchange"&&(Zm.has(l)||Ao(l,!1,e),Ao(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[cr]||(t[cr]=!0,Ao("selectionchange",!1,t))}}function Df(e,t,l,n){switch(ux(t)){case 2:var r=Sh;break;case 8:r=Nh;break;default:r=$o}l=r.bind(null,t,l,e),r=void 0,!Jr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),n?r!==void 0?e.addEventListener(t,l,{capture:!0,passive:r}):e.addEventListener(t,l,!0):r!==void 0?e.addEventListener(t,l,{passive:r}):e.addEventListener(t,l,!1)}function _o(e,t,l,n,r){var i=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var d=n.tag;if(d===3||d===4){var h=n.stateNode.containerInfo;if(h===r)break;if(d===4)for(d=n.return;d!==null;){var E=d.tag;if((E===3||E===4)&&d.stateNode.containerInfo===r)return;d=d.return}for(;h!==null;){if(d=Aa(h),d===null)return;if(E=d.tag,E===5||E===6||E===26||E===27){n=i=d;continue e}h=h.parentNode}}n=n.return}Uc(function(){var M=i,V=Kr(l),$=[];e:{var z=xu.get(e);if(z!==void 0){var H=bs,oe=e;switch(e){case"keypress":if(ys(l)===0)break e;case"keydown":case"keyup":H=Vp;break;case"focusin":oe="focus",H=Pr;break;case"focusout":oe="blur",H=Pr;break;case"beforeblur":case"afterblur":H=Pr;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":H=Gc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":H=Ap;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":H=Qp;break;case cu:case uu:case du:H=Mp;break;case fu:H=Xp;break;case"scroll":case"scrollend":H=Tp;break;case"wheel":H=Zp;break;case"copy":case"cut":case"paste":H=zp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":H=Qc;break;case"toggle":case"beforetoggle":H=Wp}var ve=(t&4)!==0,qe=!ve&&(e==="scroll"||e==="scrollend"),A=ve?z!==null?z+"Capture":null:z;ve=[];for(var C=M,_;C!==null;){var Q=C;if(_=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||_===null||A===null||(Q=gn(C,A),Q!=null&&ve.push(In(C,Q,_))),qe)break;C=C.return}0<ve.length&&(z=new H(z,oe,null,l,V),$.push({event:z,listeners:ve}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",H=e==="mouseout"||e==="pointerout",z&&l!==Xr&&(oe=l.relatedTarget||l.fromElement)&&(Aa(oe)||oe[wa]))break e;if((H||z)&&(z=V.window===V?V:(z=V.ownerDocument)?z.defaultView||z.parentWindow:window,H?(oe=l.relatedTarget||l.toElement,H=M,oe=oe?Aa(oe):null,oe!==null&&(qe=v(oe),ve=oe.tag,oe!==qe||ve!==5&&ve!==27&&ve!==6)&&(oe=null)):(H=null,oe=M),H!==oe)){if(ve=Gc,Q="onMouseLeave",A="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(ve=Qc,Q="onPointerLeave",A="onPointerEnter",C="pointer"),qe=H==null?z:yn(H),_=oe==null?z:yn(oe),z=new ve(Q,C+"leave",H,l,V),z.target=qe,z.relatedTarget=_,Q=null,Aa(V)===M&&(ve=new ve(A,C+"enter",oe,l,V),ve.target=_,ve.relatedTarget=qe,Q=ve),qe=Q,H&&oe)t:{for(ve=Jm,A=H,C=oe,_=0,Q=A;Q;Q=ve(Q))_++;Q=0;for(var pe=C;pe;pe=ve(pe))Q++;for(;0<_-Q;)A=ve(A),_--;for(;0<Q-_;)C=ve(C),Q--;for(;_--;){if(A===C||C!==null&&A===C.alternate){ve=A;break t}A=ve(A),C=ve(C)}ve=null}else ve=null;H!==null&&Of($,z,H,ve,!1),oe!==null&&qe!==null&&Of($,qe,oe,ve,!0)}}e:{if(z=M?yn(M):window,H=z.nodeName&&z.nodeName.toLowerCase(),H==="select"||H==="input"&&z.type==="file")var _e=Ic;else if(Wc(z))if(Pc)_e=rm;else{_e=nm;var fe=am}else H=z.nodeName,!H||H.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?M&&$r(M.elementType)&&(_e=Ic):_e=sm;if(_e&&(_e=_e(e,M))){Fc($,_e,l,V);break e}fe&&fe(e,z,M),e==="focusout"&&M&&z.type==="number"&&M.memoizedProps.value!=null&&Qr(z,"number",z.value)}switch(fe=M?yn(M):window,e){case"focusin":(Wc(fe)||fe.contentEditable==="true")&&(Ha=fe,si=M,Tn=null);break;case"focusout":Tn=si=Ha=null;break;case"mousedown":ri=!0;break;case"contextmenu":case"mouseup":case"dragend":ri=!1,iu($,l,V);break;case"selectionchange":if(om)break;case"keydown":case"keyup":iu($,l,V)}var Ne;if(ti)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else Ba?Zc(e,l)&&(Te="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Te="onCompositionStart");Te&&($c&&l.locale!=="ko"&&(Ba||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&Ba&&(Ne=qc()):(Dl=V,Wr="value"in Dl?Dl.value:Dl.textContent,Ba=!0)),fe=ur(M,Te),0<fe.length&&(Te=new Yc(Te,e,null,l,V),$.push({event:Te,listeners:fe}),Ne?Te.data=Ne:(Ne=Jc(l),Ne!==null&&(Te.data=Ne)))),(Ne=Ip?Pp(e,l):em(e,l))&&(Te=ur(M,"onBeforeInput"),0<Te.length&&(fe=new Yc("onBeforeInput","beforeinput",null,l,V),$.push({event:fe,listeners:Te}),fe.data=Ne)),$m($,e,M,l,V)}zf($,t)})}function In(e,t,l){return{instance:e,listener:t,currentTarget:l}}function ur(e,t){for(var l=t+"Capture",n=[];e!==null;){var r=e,i=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||i===null||(r=gn(e,l),r!=null&&n.unshift(In(e,r,i)),r=gn(e,t),r!=null&&n.push(In(e,r,i))),e.tag===3)return n;e=e.return}return[]}function Jm(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Of(e,t,l,n,r){for(var i=t._reactName,d=[];l!==null&&l!==n;){var h=l,E=h.alternate,M=h.stateNode;if(h=h.tag,E!==null&&E===n)break;h!==5&&h!==26&&h!==27||M===null||(E=M,r?(M=gn(l,i),M!=null&&d.unshift(In(l,M,E))):r||(M=gn(l,i),M!=null&&d.push(In(l,M,E)))),l=l.return}d.length!==0&&e.push({event:t,listeners:d})}var Wm=/\r\n?/g,Fm=/\u0000|\uFFFD/g;function Bf(e){return(typeof e=="string"?e:""+e).replace(Wm,`
49
- `).replace(Fm,"")}function Hf(e,t){return t=Bf(t),Bf(e)===t}function Ue(e,t,l,n,r,i){switch(l){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||za(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&za(e,""+n);break;case"className":ps(e,"class",n);break;case"tabIndex":ps(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":ps(e,l,n);break;case"style":Bc(e,n,i);break;case"data":if(t!=="object"){ps(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=hs(""+n),e.setAttribute(l,n);break;case"action":case"formAction":if(typeof n=="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"&&Ue(e,t,"name",r.name,r,null),Ue(e,t,"formEncType",r.formEncType,r,null),Ue(e,t,"formMethod",r.formMethod,r,null),Ue(e,t,"formTarget",r.formTarget,r,null)):(Ue(e,t,"encType",r.encType,r,null),Ue(e,t,"method",r.method,r,null),Ue(e,t,"target",r.target,r,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=hs(""+n),e.setAttribute(l,n);break;case"onClick":n!=null&&(e.onclick=ml);break;case"onScroll":n!=null&&ke("scroll",e);break;case"onScrollEnd":n!=null&&ke("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(l=n.__html,l!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=l}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}l=hs(""+n),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":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,""+n):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":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":n===!0?e.setAttribute(l,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,n):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(l,n):e.removeAttribute(l);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(l):e.setAttribute(l,n);break;case"popover":ke("beforetoggle",e),ke("toggle",e),xs(e,"popover",n);break;case"xlinkActuate":pl(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":pl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":pl(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":pl(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":pl(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":pl(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":pl(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":pl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":pl(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":xs(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=kp.get(l)||l,xs(e,l,n))}}function Mo(e,t,l,n,r,i){switch(l){case"style":Bc(e,n,i);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(l=n.__html,l!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=l}}break;case"children":typeof n=="string"?za(e,n):(typeof n=="number"||typeof n=="bigint")&&za(e,""+n);break;case"onScroll":n!=null&&ke("scroll",e);break;case"onScrollEnd":n!=null&&ke("scrollend",e);break;case"onClick":n!=null&&(e.onclick=ml);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wc.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(r=l.endsWith("Capture"),t=l.slice(2,r?l.length-7:void 0),i=e[wt]||null,i=i!=null?i[l]:null,typeof i=="function"&&e.removeEventListener(t,i,r),typeof n=="function")){typeof i!="function"&&i!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,n,r);break e}l in e?e[l]=n:n===!0?e.setAttribute(l,""):xs(e,l,n)}}}function bt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ke("error",e),ke("load",e);var n=!1,r=!1,i;for(i in l)if(l.hasOwnProperty(i)){var d=l[i];if(d!=null)switch(i){case"src":n=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ue(e,t,i,d,l,null)}}r&&Ue(e,t,"srcSet",l.srcSet,l,null),n&&Ue(e,t,"src",l.src,l,null);return;case"input":ke("invalid",e);var h=i=d=r=null,E=null,M=null;for(n in l)if(l.hasOwnProperty(n)){var V=l[n];if(V!=null)switch(n){case"name":r=V;break;case"type":d=V;break;case"checked":E=V;break;case"defaultChecked":M=V;break;case"value":i=V;break;case"defaultValue":h=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(u(137,t));break;default:Ue(e,t,n,V,l,null)}}Lc(e,i,h,E,M,d,r,!1);return;case"select":ke("invalid",e),n=d=i=null;for(r in l)if(l.hasOwnProperty(r)&&(h=l[r],h!=null))switch(r){case"value":i=h;break;case"defaultValue":d=h;break;case"multiple":n=h;default:Ue(e,t,r,h,l,null)}t=i,l=d,e.multiple=!!n,t!=null?La(e,!!n,t,!1):l!=null&&La(e,!!n,l,!0);return;case"textarea":ke("invalid",e),i=r=n=null;for(d in l)if(l.hasOwnProperty(d)&&(h=l[d],h!=null))switch(d){case"value":n=h;break;case"defaultValue":r=h;break;case"children":i=h;break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(u(91));break;default:Ue(e,t,d,h,l,null)}Dc(e,n,r,i);return;case"option":for(E in l)if(l.hasOwnProperty(E)&&(n=l[E],n!=null))switch(E){case"selected":e.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:Ue(e,t,E,n,l,null)}return;case"dialog":ke("beforetoggle",e),ke("toggle",e),ke("cancel",e),ke("close",e);break;case"iframe":case"object":ke("load",e);break;case"video":case"audio":for(n=0;n<Fn.length;n++)ke(Fn[n],e);break;case"image":ke("error",e),ke("load",e);break;case"details":ke("toggle",e);break;case"embed":case"source":case"link":ke("error",e),ke("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(M in l)if(l.hasOwnProperty(M)&&(n=l[M],n!=null))switch(M){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ue(e,t,M,n,l,null)}return;default:if($r(t)){for(V in l)l.hasOwnProperty(V)&&(n=l[V],n!==void 0&&Mo(e,t,V,n,l,void 0));return}}for(h in l)l.hasOwnProperty(h)&&(n=l[h],n!=null&&Ue(e,t,h,n,l,null))}function Im(e,t,l,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,i=null,d=null,h=null,E=null,M=null,V=null;for(H in l){var $=l[H];if(l.hasOwnProperty(H)&&$!=null)switch(H){case"checked":break;case"value":break;case"defaultValue":E=$;default:n.hasOwnProperty(H)||Ue(e,t,H,null,n,$)}}for(var z in n){var H=n[z];if($=l[z],n.hasOwnProperty(z)&&(H!=null||$!=null))switch(z){case"type":i=H;break;case"name":r=H;break;case"checked":M=H;break;case"defaultChecked":V=H;break;case"value":d=H;break;case"defaultValue":h=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(u(137,t));break;default:H!==$&&Ue(e,t,z,H,n,$)}}Yr(e,d,h,E,M,V,i,r);return;case"select":H=d=h=z=null;for(i in l)if(E=l[i],l.hasOwnProperty(i)&&E!=null)switch(i){case"value":break;case"multiple":H=E;default:n.hasOwnProperty(i)||Ue(e,t,i,null,n,E)}for(r in n)if(i=n[r],E=l[r],n.hasOwnProperty(r)&&(i!=null||E!=null))switch(r){case"value":z=i;break;case"defaultValue":h=i;break;case"multiple":d=i;default:i!==E&&Ue(e,t,r,i,n,E)}t=h,l=d,n=H,z!=null?La(e,!!l,z,!1):!!n!=!!l&&(t!=null?La(e,!!l,t,!0):La(e,!!l,l?[]:"",!1));return;case"textarea":H=z=null;for(h in l)if(r=l[h],l.hasOwnProperty(h)&&r!=null&&!n.hasOwnProperty(h))switch(h){case"value":break;case"children":break;default:Ue(e,t,h,null,n,r)}for(d in n)if(r=n[d],i=l[d],n.hasOwnProperty(d)&&(r!=null||i!=null))switch(d){case"value":z=r;break;case"defaultValue":H=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(u(91));break;default:r!==i&&Ue(e,t,d,r,n,i)}zc(e,z,H);return;case"option":for(var oe in l)if(z=l[oe],l.hasOwnProperty(oe)&&z!=null&&!n.hasOwnProperty(oe))switch(oe){case"selected":e.selected=!1;break;default:Ue(e,t,oe,null,n,z)}for(E in n)if(z=n[E],H=l[E],n.hasOwnProperty(E)&&z!==H&&(z!=null||H!=null))switch(E){case"selected":e.selected=z&&typeof z!="function"&&typeof z!="symbol";break;default:Ue(e,t,E,z,n,H)}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 ve in l)z=l[ve],l.hasOwnProperty(ve)&&z!=null&&!n.hasOwnProperty(ve)&&Ue(e,t,ve,null,n,z);for(M in n)if(z=n[M],H=l[M],n.hasOwnProperty(M)&&z!==H&&(z!=null||H!=null))switch(M){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(u(137,t));break;default:Ue(e,t,M,z,n,H)}return;default:if($r(t)){for(var qe in l)z=l[qe],l.hasOwnProperty(qe)&&z!==void 0&&!n.hasOwnProperty(qe)&&Mo(e,t,qe,void 0,n,z);for(V in n)z=n[V],H=l[V],!n.hasOwnProperty(V)||z===H||z===void 0&&H===void 0||Mo(e,t,V,z,n,H);return}}for(var A in l)z=l[A],l.hasOwnProperty(A)&&z!=null&&!n.hasOwnProperty(A)&&Ue(e,t,A,null,n,z);for($ in n)z=n[$],H=l[$],!n.hasOwnProperty($)||z===H||z==null&&H==null||Ue(e,t,$,z,n,H)}function Uf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Pm(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),n=0;n<l.length;n++){var r=l[n],i=r.transferSize,d=r.initiatorType,h=r.duration;if(i&&h&&Uf(d)){for(d=0,h=r.responseEnd,n+=1;n<l.length;n++){var E=l[n],M=E.startTime;if(M>h)break;var V=E.transferSize,$=E.initiatorType;V&&Uf($)&&(E=E.responseEnd,d+=V*(E<h?1:(h-M)/(E-M)))}if(--n,t+=8*(i+d)/(r.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 Lo=null,zo=null;function dr(e){return e.nodeType===9?e:e.ownerDocument}function qf(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 Vf(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 Do(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 Oo=null;function eh(){var e=window.event;return e&&e.type==="popstate"?e===Oo?!1:(Oo=e,!0):(Oo=null,!1)}var Gf=typeof setTimeout=="function"?setTimeout:void 0,th=typeof clearTimeout=="function"?clearTimeout:void 0,Yf=typeof Promise=="function"?Promise:void 0,lh=typeof queueMicrotask=="function"?queueMicrotask:typeof Yf<"u"?function(e){return Yf.resolve(null).then(e).catch(ah)}:Gf;function ah(e){setTimeout(function(){throw e})}function Il(e){return e==="head"}function Qf(e,t){var l=t,n=0;do{var r=l.nextSibling;if(e.removeChild(l),r&&r.nodeType===8)if(l=r.data,l==="/$"||l==="/&"){if(n===0){e.removeChild(r),fn(t);return}n--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")n++;else if(l==="html")Pn(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,Pn(l);for(var i=l.firstChild;i;){var d=i.nextSibling,h=i.nodeName;i[vn]||h==="SCRIPT"||h==="STYLE"||h==="LINK"&&i.rel.toLowerCase()==="stylesheet"||l.removeChild(i),i=d}}else l==="body"&&Pn(e.ownerDocument.body);l=r}while(l);fn(t)}function $f(e,t){var l=e;e=0;do{var n=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||""),n&&n.nodeType===8)if(l=n.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=n}while(l)}function Bo(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":Bo(l),Vr(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function nh(e,t,l,n){for(;e.nodeType===1;){var r=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[vn])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!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=tl(e.nextSibling),e===null)break}return null}function sh(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=tl(e.nextSibling),e===null))return null;return e}function Xf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=tl(e.nextSibling),e===null))return null;return e}function Ho(e){return e.data==="$?"||e.data==="$~"}function Uo(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function rh(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var n=function(){t(),l.removeEventListener("DOMContentLoaded",n)};l.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function tl(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 qo=null;function Kf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return tl(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Zf(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 Jf(e,t,l){switch(t=dr(l),e){case"html":if(e=t.documentElement,!e)throw Error(u(452));return e;case"head":if(e=t.head,!e)throw Error(u(453));return e;case"body":if(e=t.body,!e)throw Error(u(454));return e;default:throw Error(u(451))}}function Pn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Vr(e)}var ll=new Map,Wf=new Set;function fr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _l=w.d;w.d={f:ih,r:oh,D:ch,C:uh,L:dh,m:fh,X:ph,S:xh,M:mh};function ih(){var e=_l.f(),t=ar();return e||t}function oh(e){var t=Ra(e);t!==null&&t.tag===5&&t.type==="form"?fd(t):_l.r(e)}var cn=typeof document>"u"?null:document;function Ff(e,t,l){var n=cn;if(n&&typeof t=="string"&&t){var r=Zt(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof l=="string"&&(r+='[crossorigin="'+l+'"]'),Wf.has(r)||(Wf.add(r),e={rel:e,crossOrigin:l,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),bt(t,"link",e),ft(t),n.head.appendChild(t)))}}function ch(e){_l.D(e),Ff("dns-prefetch",e,null)}function uh(e,t){_l.C(e,t),Ff("preconnect",e,t)}function dh(e,t,l){_l.L(e,t,l);var n=cn;if(n&&e&&t){var r='link[rel="preload"][as="'+Zt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(r+='[imagesrcset="'+Zt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(r+='[imagesizes="'+Zt(l.imageSizes)+'"]')):r+='[href="'+Zt(e)+'"]';var i=r;switch(t){case"style":i=un(e);break;case"script":i=dn(e)}ll.has(i)||(e=y({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),ll.set(i,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(es(i))||t==="script"&&n.querySelector(ts(i))||(t=n.createElement("link"),bt(t,"link",e),ft(t),n.head.appendChild(t)))}}function fh(e,t){_l.m(e,t);var l=cn;if(l&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Zt(n)+'"][href="'+Zt(e)+'"]',i=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=dn(e)}if(!ll.has(i)&&(e=y({rel:"modulepreload",href:e},t),ll.set(i,e),l.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ts(i)))return}n=l.createElement("link"),bt(n,"link",e),ft(n),l.head.appendChild(n)}}}function xh(e,t,l){_l.S(e,t,l);var n=cn;if(n&&e){var r=_a(n).hoistableStyles,i=un(e);t=t||"default";var d=r.get(i);if(!d){var h={loading:0,preload:null};if(d=n.querySelector(es(i)))h.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":t},l),(l=ll.get(i))&&Vo(e,l);var E=d=n.createElement("link");ft(E),bt(E,"link",e),E._p=new Promise(function(M,V){E.onload=M,E.onerror=V}),E.addEventListener("load",function(){h.loading|=1}),E.addEventListener("error",function(){h.loading|=2}),h.loading|=4,xr(d,t,n)}d={type:"stylesheet",instance:d,count:1,state:h},r.set(i,d)}}}function ph(e,t){_l.X(e,t);var l=cn;if(l&&e){var n=_a(l).hoistableScripts,r=dn(e),i=n.get(r);i||(i=l.querySelector(ts(r)),i||(e=y({src:e,async:!0},t),(t=ll.get(r))&&Go(e,t),i=l.createElement("script"),ft(i),bt(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function mh(e,t){_l.M(e,t);var l=cn;if(l&&e){var n=_a(l).hoistableScripts,r=dn(e),i=n.get(r);i||(i=l.querySelector(ts(r)),i||(e=y({src:e,async:!0,type:"module"},t),(t=ll.get(r))&&Go(e,t),i=l.createElement("script"),ft(i),bt(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function If(e,t,l,n){var r=(r=de.current)?fr(r):null;if(!r)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=un(l.href),l=_a(r).hoistableStyles,n=l.get(t),n||(n={type:"style",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=un(l.href);var i=_a(r).hoistableStyles,d=i.get(e);if(d||(r=r.ownerDocument||r,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,d),(i=r.querySelector(es(e)))&&!i._p&&(d.instance=i,d.state.loading=5),ll.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},ll.set(e,l),i||hh(r,e,l,d.state))),t&&n===null)throw Error(u(528,""));return d}if(t&&n!==null)throw Error(u(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=dn(l),l=_a(r).hoistableScripts,n=l.get(t),n||(n={type:"script",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function un(e){return'href="'+Zt(e)+'"'}function es(e){return'link[rel="stylesheet"]['+e+"]"}function Pf(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function hh(e,t,l,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),bt(t,"link",l),ft(t),e.head.appendChild(t))}function dn(e){return'[src="'+Zt(e)+'"]'}function ts(e){return"script[async]"+e}function ex(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+Zt(l.href)+'"]');if(n)return t.instance=n,ft(n),n;var r=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),ft(n),bt(n,"style",r),xr(n,l.precedence,e),t.instance=n;case"stylesheet":r=un(l.href);var i=e.querySelector(es(r));if(i)return t.state.loading|=4,t.instance=i,ft(i),i;n=Pf(l),(r=ll.get(r))&&Vo(n,r),i=(e.ownerDocument||e).createElement("link"),ft(i);var d=i;return d._p=new Promise(function(h,E){d.onload=h,d.onerror=E}),bt(i,"link",n),t.state.loading|=4,xr(i,l.precedence,e),t.instance=i;case"script":return i=dn(l.src),(r=e.querySelector(ts(i)))?(t.instance=r,ft(r),r):(n=l,(r=ll.get(i))&&(n=y({},l),Go(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),ft(r),bt(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,xr(n,l.precedence,e));return t.instance}function xr(e,t,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,i=r,d=0;d<n.length;d++){var h=n[d];if(h.dataset.precedence===t)i=h;else if(i!==r)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Vo(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Go(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var pr=null;function tx(e,t,l){if(pr===null){var n=new Map,r=pr=new Map;r.set(l,n)}else r=pr,n=r.get(l),n||(n=new Map,r.set(l,n));if(n.has(e))return n;for(n.set(e,null),l=l.getElementsByTagName(e),r=0;r<l.length;r++){var i=l[r];if(!(i[vn]||i[ht]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var d=i.getAttribute(t)||"";d=e+d;var h=n.get(d);h?h.push(i):n.set(d,[i])}}return n}function lx(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function vh(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 ax(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function yh(e,t,l,n){if(l.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var r=un(n.href),i=t.querySelector(es(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=mr.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=i,ft(i);return}i=t.ownerDocument||t,n=Pf(n),(r=ll.get(r))&&Vo(n,r),i=i.createElement("link"),ft(i);var d=i;d._p=new Promise(function(h,E){d.onload=h,d.onerror=E}),bt(i,"link",n),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=mr.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Yo=0;function gh(e,t){return e.stylesheets&&e.count===0&&vr(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var n=setTimeout(function(){if(e.stylesheets&&vr(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Yo===0&&(Yo=62500*Pm());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&vr(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Yo?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function mr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var hr=null;function vr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hr=new Map,t.forEach(bh,e),hr=null,mr.call(e))}function bh(e,t){if(!(t.state.loading&4)){var l=hr.get(e);if(l)var n=l.get(null);else{l=new Map,hr.set(e,l);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<r.length;i++){var d=r[i];(d.nodeName==="LINK"||d.getAttribute("media")!=="not all")&&(l.set(d.dataset.precedence,d),n=d)}n&&l.set(null,n)}r=t.instance,d=r.getAttribute("data-precedence"),i=l.get(d)||n,i===n&&l.set(null,r),l.set(d,r),this.count++,n=mr.bind(this),r.addEventListener("load",n),r.addEventListener("error",n),i?i.parentNode.insertBefore(r,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var ls={$$typeof:W,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function jh(e,t,l,n,r,i,d,h,E){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=Br(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Br(0),this.hiddenUpdates=Br(null),this.identifierPrefix=n,this.onUncaughtError=r,this.onCaughtError=i,this.onRecoverableError=d,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=E,this.incompleteTransitions=new Map}function nx(e,t,l,n,r,i,d,h,E,M,V,$){return e=new jh(e,t,l,d,E,M,V,$,h),t=1,i===!0&&(t|=24),i=Ut(3,null,null,t),e.current=i,i.stateNode=e,t=ji(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:n,isDehydrated:l,cache:t},ki(i),e}function sx(e){return e?(e=Va,e):Va}function rx(e,t,l,n,r,i){r=sx(r),n.context===null?n.context=r:n.pendingContext=r,n=Vl(t),n.payload={element:l},i=i===void 0?null:i,i!==null&&(n.callback=i),l=Gl(e,n,t),l!==null&&(zt(l,e,t),zn(l,e,t))}function ix(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Qo(e,t){ix(e,t),(e=e.alternate)&&ix(e,t)}function ox(e){if(e.tag===13||e.tag===31){var t=xa(e,67108864);t!==null&&zt(t,e,67108864),Qo(e,67108864)}}function cx(e){if(e.tag===13||e.tag===31){var t=Qt();t=Hr(t);var l=xa(e,t);l!==null&&zt(l,e,t),Qo(e,t)}}var yr=!0;function Sh(e,t,l,n){var r=N.T;N.T=null;var i=w.p;try{w.p=2,$o(e,t,l,n)}finally{w.p=i,N.T=r}}function Nh(e,t,l,n){var r=N.T;N.T=null;var i=w.p;try{w.p=8,$o(e,t,l,n)}finally{w.p=i,N.T=r}}function $o(e,t,l,n){if(yr){var r=Xo(n);if(r===null)_o(e,t,n,gr,l),dx(e,n);else if(kh(r,e,t,l,n))n.stopPropagation();else if(dx(e,n),t&4&&-1<Eh.indexOf(e)){for(;r!==null;){var i=Ra(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var d=Tt(i.pendingLanes);if(d!==0){var h=i;for(h.pendingLanes|=2,h.entangledLanes|=2;d;){var E=1<<31-et(d);h.entanglements[1]|=E,d&=~E}xl(i),(Le&6)===0&&(tr=We()+500,Wn(0))}}break;case 31:case 13:h=xa(i,2),h!==null&&zt(h,i,2),ar(),Qo(i,2)}if(i=Xo(n),i===null&&_o(e,t,n,gr,l),i===r)break;r=i}r!==null&&n.stopPropagation()}else _o(e,t,n,null,l)}}function Xo(e){return e=Kr(e),Ko(e)}var gr=null;function Ko(e){if(gr=null,e=Aa(e),e!==null){var t=v(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=m(t),e!==null)return e;e=null}else if(l===31){if(e=b(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 gr=e,null}function ux(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(kt()){case K:return 2;case Be:return 8;case at:case Je:return 32;case Ml:return 268435456;default:return 32}default:return 32}}var Zo=!1,Pl=null,ea=null,ta=null,as=new Map,ns=new Map,la=[],Eh="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 dx(e,t){switch(e){case"focusin":case"focusout":Pl=null;break;case"dragenter":case"dragleave":ea=null;break;case"mouseover":case"mouseout":ta=null;break;case"pointerover":case"pointerout":as.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ns.delete(t.pointerId)}}function ss(e,t,l,n,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:l,eventSystemFlags:n,nativeEvent:i,targetContainers:[r]},t!==null&&(t=Ra(t),t!==null&&ox(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function kh(e,t,l,n,r){switch(t){case"focusin":return Pl=ss(Pl,e,t,l,n,r),!0;case"dragenter":return ea=ss(ea,e,t,l,n,r),!0;case"mouseover":return ta=ss(ta,e,t,l,n,r),!0;case"pointerover":var i=r.pointerId;return as.set(i,ss(as.get(i)||null,e,t,l,n,r)),!0;case"gotpointercapture":return i=r.pointerId,ns.set(i,ss(ns.get(i)||null,e,t,l,n,r)),!0}return!1}function fx(e){var t=Aa(e.target);if(t!==null){var l=v(t);if(l!==null){if(t=l.tag,t===13){if(t=m(l),t!==null){e.blockedOn=t,kc(e.priority,function(){cx(l)});return}}else if(t===31){if(t=b(l),t!==null){e.blockedOn=t,kc(e.priority,function(){cx(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 br(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Xo(e.nativeEvent);if(l===null){l=e.nativeEvent;var n=new l.constructor(l.type,l);Xr=n,l.target.dispatchEvent(n),Xr=null}else return t=Ra(l),t!==null&&ox(t),e.blockedOn=l,!1;t.shift()}return!0}function xx(e,t,l){br(e)&&l.delete(t)}function Ch(){Zo=!1,Pl!==null&&br(Pl)&&(Pl=null),ea!==null&&br(ea)&&(ea=null),ta!==null&&br(ta)&&(ta=null),as.forEach(xx),ns.forEach(xx)}function jr(e,t){e.blockedOn===t&&(e.blockedOn=null,Zo||(Zo=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Ch)))}var Sr=null;function px(e){Sr!==e&&(Sr=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){Sr===e&&(Sr=null);for(var t=0;t<e.length;t+=3){var l=e[t],n=e[t+1],r=e[t+2];if(typeof n!="function"){if(Ko(n||l)===null)continue;break}var i=Ra(l);i!==null&&(e.splice(t,3),t-=3,$i(i,{pending:!0,data:r,method:l.method,action:n},n,r))}}))}function fn(e){function t(E){return jr(E,e)}Pl!==null&&jr(Pl,e),ea!==null&&jr(ea,e),ta!==null&&jr(ta,e),as.forEach(t),ns.forEach(t);for(var l=0;l<la.length;l++){var n=la[l];n.blockedOn===e&&(n.blockedOn=null)}for(;0<la.length&&(l=la[0],l.blockedOn===null);)fx(l),l.blockedOn===null&&la.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(n=0;n<l.length;n+=3){var r=l[n],i=l[n+1],d=r[wt]||null;if(typeof i=="function")d||px(l);else if(d){var h=null;if(i&&i.hasAttribute("formAction")){if(r=i,d=i[wt]||null)h=d.formAction;else if(Ko(r)!==null)continue}else h=d.action;typeof h=="function"?l[n+1]=h:(l.splice(n,3),n-=3),px(l)}}}function mx(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(d){return r=d})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),n||setTimeout(l,20)}function l(){if(!n&&!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 n=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function Jo(e){this._internalRoot=e}Nr.prototype.render=Jo.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var l=t.current,n=Qt();rx(l,n,e,t,null,null)},Nr.prototype.unmount=Jo.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rx(e.current,2,null,e,null,null),ar(),t[wa]=null}};function Nr(e){this._internalRoot=e}Nr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ec();e={blockedOn:null,target:e,priority:t};for(var l=0;l<la.length&&t!==0&&t<la[l].priority;l++);la.splice(l,0,e),l===0&&fx(e)}};var hx=o.version;if(hx!=="19.2.4")throw Error(u(527,hx,"19.2.4"));w.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=f(t),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var Th={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Er=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Er.isDisabled&&Er.supportsFiber)try{Ct=Er.inject(Th),Fe=Er}catch{}}return is.createRoot=function(e,t){if(!x(e))throw Error(u(299));var l=!1,n="",r=Sd,i=Nd,d=Ed;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(d=t.onRecoverableError)),t=nx(e,1,!1,null,null,l,n,null,r,i,d,mx),e[wa]=t.current,Ro(e),new Jo(t)},is.hydrateRoot=function(e,t,l){if(!x(e))throw Error(u(299));var n=!1,r="",i=Sd,d=Nd,h=Ed,E=null;return l!=null&&(l.unstable_strictMode===!0&&(n=!0),l.identifierPrefix!==void 0&&(r=l.identifierPrefix),l.onUncaughtError!==void 0&&(i=l.onUncaughtError),l.onCaughtError!==void 0&&(d=l.onCaughtError),l.onRecoverableError!==void 0&&(h=l.onRecoverableError),l.formState!==void 0&&(E=l.formState)),t=nx(e,1,!0,t,l??null,n,r,E,i,d,h,mx),t.context=sx(null),l=t.current,n=Qt(),n=Hr(n),r=Vl(n),r.callback=null,Gl(l,r,n),l=n,t.current.lanes=l,hn(t,l),xl(t),e[wa]=t.current,Ro(e),new Nr(t)},is.version="19.2.4",is}var Cx;function Bh(){if(Cx)return Io.exports;Cx=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),Io.exports=Oh(),Io.exports}var Hh=Bh();const fc="";class Jx extends Error{constructor(o,c){super(o),this.name="ApiError",this.status=c}}async function Ae(s,o){const c=await fetch(`${fc}${s}`,o);if(!c.ok){const u=await c.json().catch(()=>({error:c.statusText}));throw new Jx(u.error||`HTTP ${c.status}`,c.status)}return c.json()}const ge={getConfig(){return Ae("/api/config")},setConfig(s,o){return Ae("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,model:o})})},getSkills(){return Ae("/api/skills")},getSkillDetail(s,o){return Ae(`/api/skills/${s}/${o}`)},getEvals(s,o){return Ae(`/api/skills/${s}/${o}/evals`)},saveEvals(s,o,c){return Ae(`/api/skills/${s}/${o}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})},generateEvals(s,o){return Ae(`/api/skills/${s}/${o}/generate-evals`,{method:"POST"})},async getLatestBenchmark(s,o){const c=await fetch(`${fc}/api/skills/${s}/${o}/benchmark/latest`);if(c.status===404)return null;if(!c.ok){const u=await c.json().catch(()=>({error:c.statusText}));throw new Jx(u.error||`HTTP ${c.status}`,c.status)}return c.json()},getHistory(s,o,c){const u=new URLSearchParams;c!=null&&c.model&&u.set("model",c.model),c!=null&&c.type&&u.set("type",c.type),c!=null&&c.from&&u.set("from",c.from),c!=null&&c.to&&u.set("to",c.to);const x=u.toString();return Ae(`/api/skills/${s}/${o}/history${x?"?"+x:""}`)},getHistoryEntry(s,o,c){return Ae(`/api/skills/${s}/${o}/history/${encodeURIComponent(c)}`)},compareRuns(s,o,c,u){return Ae(`/api/skills/${s}/${o}/history-compare?a=${encodeURIComponent(c)}&b=${encodeURIComponent(u)}`)},getCaseHistory(s,o,c,u){const x=new URLSearchParams;u&&x.set("model",u);const v=x.toString();return Ae(`/api/skills/${s}/${o}/history/case/${c}${v?"?"+v:""}`)},deleteHistoryEntry(s,o,c){return Ae(`/api/skills/${s}/${o}/history/${encodeURIComponent(c)}`,{method:"DELETE"})},deleteSkill(s,o){return Ae(`/api/skills/${s}/${o}`,{method:"DELETE"})},improveSkill(s,o,c){return Ae(`/api/skills/${s}/${o}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})},instructEdit(s,o,c){return Ae(`/api/skills/${s}/${o}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...c})})},applyImprovement(s,o,c){return Ae(`/api/skills/${s}/${o}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c})})},getStats(s,o){return Ae(`/api/skills/${s}/${o}/stats`)},getDependencies(s,o){return Ae(`/api/skills/${s}/${o}/dependencies`)},getProjectLayout(){return Ae("/api/project-layout")},createSkill(s){return Ae("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},saveDraft(s){return Ae("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},getSkillCreatorStatus(){return Ae("/api/skill-creator-status")},generateSkill(s){return Ae("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},getSkillFiles(s,o){return Ae(`/api/skills/${s}/${o}/files`)},getSkillFile(s,o,c){return Ae(`/api/skills/${s}/${o}/file?path=${encodeURIComponent(c)}`)},saveSkillFile(s,o,c,u){return Ae(`/api/skills/${s}/${o}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:c,content:u})})},getLeaderboard(s,o){return Ae(`/api/skills/${s}/${o}/leaderboard`)},getLeaderboardEntry(s,o,c){return Ae(`/api/skills/${s}/${o}/leaderboard/${encodeURIComponent(c)}`)},startSweep(s,o,c){const u=`${fc}/api/skills/${s}/${o}/sweep`,x=new EventSource(u);return fetch(u,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(c)}),x},getCredentials(s,o){return Ae(`/api/credentials/${s}/${o}`)},setCredential(s,o,c,u){return Ae(`/api/credentials/${s}/${o}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:c,value:u})})},getParams(s,o){return Ae(`/api/credentials/${s}/${o}/params`)},getParamsRevealed(s,o,c){const u=c?`reveal=true&key=${encodeURIComponent(c)}`:"reveal=true";return Ae(`/api/credentials/${s}/${o}/params?${u}`)},searchModels(){return Ae("/api/openrouter/models")}};function Uh(s){const[o,c]=p.useState(()=>typeof window>"u"?!1:window.matchMedia(s).matches);return p.useEffect(()=>{const u=window.matchMedia(s);c(u.matches);const x=v=>c(v.matches);return u.addEventListener("change",x),()=>u.removeEventListener("change",x)},[s]),o}const qh={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list"};function Vh(s,o){switch(o.type){case"SELECT_SKILL":return{...s,selectedSkill:o.skill,mode:"browse",mobileView:s.isMobile?"detail":s.mobileView};case"CLEAR_SELECTION":return{...s,selectedSkill:null};case"SET_MODE":return{...s,mode:o.mode,selectedSkill:o.mode==="create"?null:s.selectedSkill};case"SET_SEARCH":return{...s,searchQuery:o.query};case"SET_SKILLS":return{...s,skills:o.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...s,skillsError:o.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...s,skillsLoading:o.loading};case"SET_MOBILE":return{...s,isMobile:o.isMobile};case"SET_MOBILE_VIEW":return{...s,mobileView:o.view};default:return s}}const Wx=p.createContext(null);function ra(){const s=p.useContext(Wx);if(!s)throw new Error("useStudio must be used within StudioProvider");return s}function Gh({children:s}){const[o,c]=p.useReducer(Vh,qh),u=Uh("(max-width: 767px)");p.useEffect(()=>{c({type:"SET_MOBILE",isMobile:u})},[u]);const x=p.useCallback(()=>{c({type:"SET_SKILLS_LOADING",loading:!0}),ge.getSkills().then(y=>{c({type:"SET_SKILLS",skills:y});const R=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(R){const[,U,L]=R,Y=y.find(O=>O.plugin===U&&O.skill===L);Y&&c({type:"SELECT_SKILL",skill:{plugin:U,skill:L,origin:Y.origin}})}}).catch(y=>c({type:"SET_SKILLS_ERROR",error:y.message}))},[]);p.useEffect(()=>{x()},[x]);const v=p.useCallback(y=>{c({type:"SELECT_SKILL",skill:y}),window.location.hash=`/skills/${y.plugin}/${y.skill}`},[]),m=p.useCallback(()=>{c({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),b=p.useCallback(y=>{c({type:"SET_MODE",mode:y})},[]),g=p.useCallback(y=>{c({type:"SET_SEARCH",query:y})},[]),f=p.useCallback(y=>{c({type:"SET_MOBILE_VIEW",view:y})},[]),S=p.useMemo(()=>({state:o,selectSkill:v,clearSelection:m,setMode:b,setSearch:g,setMobileView:f,refreshSkills:x}),[o,v,m,b,g,f,x]);return a.jsx(Wx.Provider,{value:S,children:s})}const Yh={config:null,loading:!0};function Qh(s,o){switch(o.type){case"SET_CONFIG":return{config:o.config,loading:!1};case"SET_LOADING":return{...s,loading:!0};default:return s}}const Fx=p.createContext(null);function ia(){const s=p.useContext(Fx);if(!s)throw new Error("useConfig must be used within ConfigProvider");return s}function $h({children:s}){const[o,c]=p.useReducer(Qh,Yh),u=p.useCallback(()=>{ge.getConfig().then(m=>c({type:"SET_CONFIG",config:m})).catch(()=>{})},[]);p.useEffect(()=>{u()},[u]);const x=p.useCallback(async(m,b)=>{const g=await ge.setConfig(m,b);return c({type:"SET_CONFIG",config:g}),g},[]),v=p.useMemo(()=>({config:o.config,loading:o.loading,updateConfig:x,refreshConfig:u}),[o,x,u]);return a.jsx(Fx.Provider,{value:v,children:s})}function Xh({left:s,right:o}){const{state:c}=ra();return c.isMobile?a.jsx("div",{style:{height:"100vh",overflow:"hidden",background:"var(--surface-0)"},children:c.mobileView==="list"?a.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--surface-1)"},children:s}):a.jsx("div",{style:{height:"100%",overflowY:"auto"},children:o})}):a.jsxs("div",{className:"studio-grid",style:{display:"grid",gridTemplateColumns:"280px 1px 1fr",height:"100vh",overflow:"hidden"},children:[a.jsx("div",{style:{overflowY:"auto",background:"var(--surface-1)"},children:s}),a.jsx("div",{style:{background:"var(--border-subtle)"}}),a.jsx("div",{style:{overflowY:"auto",background:"var(--surface-0)"},children:o})]})}function Kh(){const{state:s,setSearch:o}=ra(),[c,u]=p.useState(s.searchQuery),x=p.useRef(null);p.useEffect(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{o(c)},200),()=>{x.current&&clearTimeout(x.current)}),[c,o]),p.useEffect(()=>{s.searchQuery===""&&c!==""&&u("")},[s.searchQuery]);const v=new Set(s.skills.map(m=>m.plugin)).size;return a.jsxs("div",{className:"px-3 py-2",children:[a.jsxs("div",{className:"relative",children:[a.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:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),a.jsx("input",{type:"text",value:c,onChange:m=>u(m.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:m=>{m.currentTarget.style.borderColor="var(--accent)"},onBlur:m=>{m.currentTarget.style.borderColor="var(--border-subtle)"}}),c&&a.jsx("button",{onClick:()=>{u(""),o("")},style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:2},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!s.skillsLoading&&a.jsxs("div",{className:"text-[11px] mt-1.5 px-1",style:{color:"var(--text-tertiary)"},children:[s.skills.length," skill",s.skills.length!==1?"s":""," across ",v," plugin",v!==1?"s":""]})]})}const Tx={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"},stale:{bg:"var(--orange-muted)",text:"var(--orange)",dot:"var(--orange)",label:"Stale"},missing:{bg:"var(--surface-3)",text:"var(--text-tertiary)",dot:"var(--text-tertiary)",label:"No evals"}};function wx({skill:s,isSelected:o,onSelect:c}){const u=Tx[s.benchmarkStatus]||Tx.missing,x=s.origin==="installed";return a.jsxs("button",{onClick:c,className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:o?"var(--surface-2)":"transparent",cursor:"pointer",borderTop:"none",borderRight:"none",borderBottom:"1px solid var(--border-subtle)",borderLeft:o?"2px solid var(--accent)":"2px solid transparent",display:"block",opacity:x?.7:1},onMouseEnter:v=>{o||(v.currentTarget.style.background="var(--surface-2)")},onMouseLeave:v=>{o||(v.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-[13px] font-medium truncate",style:{color:"var(--text-primary)"},children:[x&&a.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),s.skill]}),a.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:u.bg,color:u.text},children:[a.jsx("span",{className:"rounded-full",style:{width:5,height:5,background:u.dot}}),u.label]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:[s.evalCount," eval",s.evalCount!==1?"s":""]}),a.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),a.jsxs("span",{children:[s.assertionCount," assert",s.assertionCount!==1?"s":""]}),s.lastBenchmark&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),a.jsx("span",{children:new Date(s.lastBenchmark).toLocaleDateString()})]})]})]})}function Ax(s){var c;const o={};for(const u of s)(o[c=u.plugin]||(o[c]=[])).push(u);return o}function Zh(){const{state:s,selectSkill:o}=ra(),{skills:c,searchQuery:u,selectedSkill:x}=s,[v,m]=p.useState(!1),[b,g]=p.useState(()=>{try{return sessionStorage.getItem("vskill-origin-banner-dismissed")==="1"}catch{return!1}}),{sourceGroups:f,installedGroups:S}=p.useMemo(()=>{const y=u.toLowerCase(),k=y?c.filter(L=>L.skill.toLowerCase().includes(y)||L.plugin.toLowerCase().includes(y)):c,R=k.filter(L=>L.origin==="source"),U=k.filter(L=>L.origin==="installed");return{sourceGroups:Object.entries(Ax(R)),installedGroups:Object.entries(Ax(U))}},[c,u]);return s.skillsLoading?a.jsx("div",{className:"px-3 py-4 space-y-3",children:[1,2,3].map(y=>a.jsx("div",{className:"skeleton h-14 w-full rounded-lg"},y))}):f.length===0&&S.length===0?a.jsx("div",{className:"px-4 py-8 text-center",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No skills match your search"})}):a.jsxs("div",{className:"flex-1",children:[f.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Jh,{title:"Your Skills",count:f.reduce((y,[,k])=>y+k.length,0)}),f.map(([y,k])=>a.jsxs("div",{children:[a.jsx(Rx,{plugin:y,count:k.length}),k.map(R=>{const U=(x==null?void 0:x.plugin)===R.plugin&&(x==null?void 0:x.skill)===R.skill;return a.jsx(wx,{skill:R,isSelected:U,onSelect:()=>o({plugin:R.plugin,skill:R.skill,origin:R.origin})},`${R.plugin}/${R.skill}`)})]},y))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>m(y=>!y),className:"w-full flex items-center gap-2 px-3 py-2.5 text-left",style:{background:"var(--surface-1)",border:"none",borderTop:"1px solid var(--border-subtle)",borderBottom:v?"1px solid var(--border-subtle)":"none",cursor:"pointer"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:v?"rotate(90deg)":"rotate(0deg)",transition:"transform 150ms ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Installed"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",S.reduce((y,[,k])=>y+k.length,0),")"]}),a.jsx("div",{className:"flex-1"}),a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),v&&a.jsxs(a.Fragment,{children:[!b&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("p",{className:"flex-1 text-[10px] leading-relaxed",style:{color:"var(--text-tertiary)",margin:0},children:"Skills inside agent folders (.claude/, .cursor/, etc.) are installed copies for consuming. Edit skills in your project root instead."}),a.jsx("button",{onClick:()=>{g(!0);try{sessionStorage.setItem("vskill-origin-banner-dismissed","1")}catch{}},className:"flex-shrink-0 mt-0.5",style:{background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),S.map(([y,k])=>a.jsxs("div",{children:[a.jsx(Rx,{plugin:y,count:k.length}),k.map(R=>{const U=(x==null?void 0:x.plugin)===R.plugin&&(x==null?void 0:x.skill)===R.skill;return a.jsx(wx,{skill:R,isSelected:U,onSelect:()=>o({plugin:R.plugin,skill:R.skill,origin:R.origin})},`${R.plugin}/${R.skill}`)})]},y))]})]})]})}function Jh({title:s,count:o}){return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-secondary)"},children:s}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",o,")"]})]})}function Rx({plugin:s,count:o}){const[c,u]=p.useState(!1),x=`/images/icons/${s}.webp`;return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[c?a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}):a.jsx("img",{src:x,width:16,height:16,alt:"",onError:()=>u(!0),style:{objectFit:"contain"}}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:s}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",o,")"]}),a.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border-subtle)"}})]})}function Wh({value:s,onChange:o}){const[c,u]=p.useState([]),[x,v]=p.useState(!1),[m,b]=p.useState(null),[g,f]=p.useState(s),[S,y]=p.useState(!1),k=p.useRef(null),R=p.useRef(void 0);p.useEffect(()=>{v(!0),ge.searchModels().then(O=>u(O.models)).catch(O=>b(O instanceof Error?O.message:String(O))).finally(()=>v(!1))},[]);const U=p.useCallback(O=>{f(O),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>y(!0),300)},[]),L=p.useMemo(()=>{if(!g.trim())return c.slice(0,50);const O=g.toLowerCase();return c.filter(Z=>Z.id.toLowerCase().includes(O)||Z.name.toLowerCase().includes(O)).slice(0,50)},[c,g]);p.useEffect(()=>{function O(Z){k.current&&!k.current.contains(Z.target)&&y(!1)}return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);function Y(O){var F;const Z=(F=O.pricing)==null?void 0:F.prompt;return Z==null||Z===0?"Free":`$${(Z*1e6).toFixed(2)}/1M`}return a.jsxs("div",{ref:k,style:{position:"relative"},children:[a.jsx("input",{type:"text",value:g,onChange:O=>U(O.target.value),onFocus:()=>y(!0),placeholder:x?"Loading models...":"Search OpenRouter models...",className:"input-field w-full",style:{fontSize:12}}),S&&!x&&a.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,maxHeight:280,overflowY:"auto",background:"var(--surface-2)",border:"1px solid var(--border-default)",borderRadius:8,marginTop:4,zIndex:20,boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},children:[m&&a.jsxs("div",{className:"px-3 py-2 text-[11px]",style:{color:"var(--red)"},children:["Failed to load models: ",m]}),L.length===0&&!m&&a.jsx("div",{className:"px-3 py-3 text-[11px]",style:{color:"var(--text-tertiary)"},children:"No models found"}),L.map(O=>a.jsxs("button",{onClick:()=>{o(O.id),f(O.id),y(!1)},className:"w-full text-left px-3 py-2 flex items-center justify-between transition-colors duration-100",style:{background:O.id===s?"var(--accent-muted)":"transparent",border:"none",cursor:"pointer",borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:Z=>{Z.currentTarget.style.background="var(--surface-3)"},onMouseLeave:Z=>{Z.currentTarget.style.background=O.id===s?"var(--accent-muted)":"transparent"},children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:O.name}),a.jsx("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:O.id})]}),a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:Y(O)})]},O.id))]})]})}function Fh(){const{config:s,updateConfig:o,refreshConfig:c}=ia(),[u,x]=p.useState(!1),[v,m]=p.useState(!1),b=p.useRef(null);p.useEffect(()=>{function y(k){b.current&&!b.current.contains(k.target)&&x(!1)}return u&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[u]);async function g(y,k){m(!0);try{await o(y.id,k.id),x(!1)}catch{c()}finally{m(!1)}}if(!s)return null;const f=Ph(s),S=Ih(s);return a.jsxs("div",{ref:b,className:"relative",children:[a.jsxs("button",{onClick:()=>x(!u),className:"w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-[11px] transition-all duration-150",style:{background:u?"var(--surface-3)":"var(--surface-2)",border:`1px solid ${u?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},onMouseEnter:y=>{u||(y.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:y=>{u||(y.currentTarget.style.borderColor="var(--border-subtle)")},children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:S!=null&&S.available?"var(--green)":"var(--text-tertiary)"}}),a.jsx("span",{className:"flex-1 text-left font-medium truncate",style:{color:"var(--text-primary)"},children:f}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",style:{transform:u?"rotate(180deg)":"rotate(0)",transition:"transform 0.15s ease",flexShrink:0},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u&&a.jsxs("div",{className:"absolute top-full mt-1 left-0 right-0 rounded-xl shadow-xl z-50 overflow-hidden animate-fade-in",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",minWidth:"240px"},children:[a.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Select Model"})}),a.jsx("div",{className:"py-1 max-h-72 overflow-y-auto",children:s.providers.map(y=>a.jsxs("div",{children:[a.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:y.available?"var(--green)":"var(--text-tertiary)",opacity:y.available?1:.3}}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",opacity:y.available?1:.5},children:y.label})]}),y.id==="openrouter"&&y.available?a.jsx("div",{className:"px-3 py-1.5",children:a.jsx(Wh,{value:s.provider==="openrouter"?s.model:"",onChange:k=>{v||g(y,{id:k,label:k})}})}):y.models.map(k=>{const R=Ix(s,y.id,k.id),U=!y.available||v;return a.jsxs("button",{onClick:()=>!U&&g(y,k),disabled:U,className:"w-full px-3 py-1.5 flex items-center gap-2.5 text-left transition-all duration-100",style:{background:R?"var(--accent-muted)":"transparent",color:U?"var(--text-tertiary)":"var(--text-primary)",opacity:U?.4:1,cursor:U?"not-allowed":"pointer"},onMouseEnter:L=>{!U&&!R&&(L.currentTarget.style.background="var(--surface-3)")},onMouseLeave:L=>{R||(L.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 flex items-center justify-center",style:{border:`2px solid ${R?"var(--accent)":"var(--border-subtle)"}`},children:R&&a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}})}),a.jsx("span",{className:"text-[12px]",style:{fontWeight:R?600:400},title:k.id,children:k.label})]},`${y.id}-${k.id}`)})]},y.id))})]})]})}function Ix(s,o,c){return s.provider!==o?!1:s.model===c}function Ih(s){return s.providers.find(o=>o.id===s.provider)}function Ph(s){for(const o of s.providers)for(const c of o.models)if(Ix(s,o.id,c.id))return c.label;return s.model}function ev(){const{state:s,setMode:o}=ra(),{config:c}=ia(),[u,x]=p.useState(null),[v,m]=p.useState(!1);return p.useEffect(()=>{ge.getSkillCreatorStatus().then(x).catch(()=>{})},[]),a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"px-4 py-4 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"var(--accent-muted)"},children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-[14px] font-semibold truncate",style:{color:"var(--text-primary)",letterSpacing:"-0.01em"},children:"Skill Studio"}),a.jsx("div",{className:"text-[11px] truncate",style:{color:"var(--text-tertiary)"},children:(c==null?void 0:c.projectName)||"vskill"})]})]}),a.jsx("div",{className:"mt-3",children:a.jsx(Fh,{})})]}),a.jsx(Kh,{}),a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("button",{onClick:()=>o("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:s.mode==="create"?"var(--accent)":"var(--surface-3)",color:s.mode==="create"?"#fff":"var(--text-secondary)",border:"none",cursor:"pointer"},onMouseEnter:b=>{s.mode!=="create"&&(b.currentTarget.style.background="var(--surface-4)",b.currentTarget.style.color="var(--text-primary)")},onMouseLeave:b=>{s.mode!=="create"&&(b.currentTarget.style.background="var(--surface-3)",b.currentTarget.style.color="var(--text-secondary)")},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]})}),u&&(u.installed?a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--green)"}}),"Skill Creator installed"]})}):a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",style:{color:"var(--yellow)"},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--yellow)"}}),a.jsx("span",{className:"font-medium",children:"Skill Creator not installed"})]}),a.jsx("button",{onClick:()=>{navigator.clipboard.writeText(u.installCommand).then(()=>{m(!0),setTimeout(()=>m(!1),2e3)}).catch(()=>{})},className:"w-full text-left px-2 py-1 rounded text-[10px] font-mono cursor-pointer transition-colors duration-150",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},title:"Click to copy",onMouseEnter:b=>{b.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:b=>{b.currentTarget.style.borderColor="var(--border-subtle)"},children:v?"Copied!":u.installCommand})]})})),a.jsx("div",{className:"flex-1 overflow-y-auto",style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Zh,{})})]})}const tv="modulepreload",lv=function(s){return"/"+s},_x={},av=function(o,c,u){let x=Promise.resolve();if(c&&c.length>0){let m=function(f){return Promise.all(f.map(S=>Promise.resolve(S).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const b=document.querySelector("meta[property=csp-nonce]"),g=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));x=m(c.map(f=>{if(f=lv(f),f in _x)return;_x[f]=!0;const S=f.endsWith(".css"),y=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const k=document.createElement("link");if(k.rel=S?"stylesheet":tv,S||(k.as="script"),k.crossOrigin="",k.href=f,g&&k.setAttribute("nonce",g),document.head.appendChild(k),S)return new Promise((R,U)=>{k.addEventListener("load",R),k.addEventListener("error",()=>U(new Error(`Unable to preload CSS for ${f}`)))})}))}function v(m){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=m,window.dispatchEvent(b),!b.defaultPrevented)throw m}return x.then(m=>{for(const b of m||[])b.status==="rejected"&&v(b.reason);return o().catch(v)})};function Px(s){if(s!==void 0)try{return JSON.stringify(s)}catch(o){console.error("Failed to serialize request body:",o);try{const c=new WeakSet;return JSON.stringify(s,(u,x)=>{if(typeof x=="object"&&x!==null){if(c.has(x))return"[Circular]";c.add(x)}return x})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function lc(){const[s,o]=p.useState([]),[c,u]=p.useState(!1),[x,v]=p.useState(!1),[m,b]=p.useState(null),g=p.useRef(null),f=p.useCallback(async(y,k)=>{o([]),u(!0),v(!1),b(null);const R=new AbortController;g.current=R;try{const U=Px(k),L=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:U,signal:R.signal});if(!L.ok||!L.body){let F=`HTTP ${L.status}`;try{const ae=await L.json();ae.error&&(F=ae.error)}catch{}throw new Error(F)}const Y=L.body.getReader(),O=new TextDecoder;let Z="",W="";for(;;){const{done:F,value:ae}=await Y.read();if(F)break;Z+=O.decode(ae,{stream:!0});const re=Z.split(`
50
- `);Z=re.pop()||"";for(const q of re)if(q.startsWith("event: "))W=q.slice(7).trim();else if(q.startsWith("data: ")){try{const I=JSON.parse(q.slice(6)),G={event:W,data:I};W==="done"?(v(!0),o(X=>[...X,G])):o(X=>[...X,G])}catch{}W=""}}}catch(U){U.name!=="AbortError"&&b(U.message)}finally{u(!1),g.current=null}},[]),S=p.useCallback(()=>{var y;(y=g.current)==null||y.abort()},[]);return{events:s,running:c,done:x,error:m,start:f,stop:S}}function nv(s){const o=p.useRef(s);o.current=s;const[c,u]=p.useState(new Set),x=p.useRef(new Map),v=p.useCallback(async(f,S,y)=>{var R;(R=x.current.get(f))==null||R.abort();const k=new AbortController;x.current.set(f,k),u(U=>{const L=new Set(U);return L.add(f),L});try{const U=Px(y),L=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"},body:U,signal:k.signal});if(!L.ok||!L.body){let F=`HTTP ${L.status}`;try{const ae=await L.json();ae.error&&(F=ae.error)}catch{}throw new Error(F)}const Y=L.body.getReader(),O=new TextDecoder;let Z="",W="";for(;;){const{done:F,value:ae}=await Y.read();if(F)break;Z+=O.decode(ae,{stream:!0});const re=Z.split(`
51
- `);Z=re.pop()||"";for(const q of re)if(q.startsWith("event: "))W=q.slice(7).trim();else if(q.startsWith("data: ")){try{const I=JSON.parse(q.slice(6)),G={event:W,data:I};o.current.onEvent(f,G)}catch{}W=""}}o.current.onDone(f)}catch(U){U.name!=="AbortError"&&o.current.onError(f,U.message)}finally{u(U=>{const L=new Set(U);return L.delete(f),L}),x.current.delete(f)}},[]),m=p.useCallback(f=>{var S;(S=x.current.get(f))==null||S.abort()},[]),b=p.useCallback(()=>{for(const f of x.current.values())f.abort()},[]),g=c.size>0;return{runningSet:c,startCase:v,stopCase:m,stopAll:b,isAnyCaseRunning:g}}const sv={plugin:"",skill:"",skillContent:"",savedContent:"",isDirty:!1,evals:null,evalsError:null,activePanel:"tests",selectedCaseId:null,caseRunStates:new Map,bulkRunActive:!1,runMode:null,latestBenchmark:null,inlineResults:new Map,improveTarget:null,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null,generateEvalsLoading:!1,generateEvalsProgress:[],generateEvalsError:null,regressions:[],iterationCount:0,activationPrompts:"",activationResults:[],activationSummary:null,activationRunning:!1,activationError:null,activationTotalPrompts:0,activationStartedAt:null,activationClassifyingStatus:null,generatingPrompts:!1,generatingPromptsError:null,activationHistory:null,activationHistoryLoading:!1,loading:!0,error:null};function rv(s,o){var c,u;switch(o.type){case"SET_LOADING":return{...s,loading:o.loading};case"SET_ERROR":return{...s,error:o.error};case"INIT_DATA":{const x=new Map;if(o.benchmark)for(const m of o.benchmark.cases)x.set(m.eval_id,{status:m.status,passRate:m.pass_rate,errorMessage:m.error_message||void 0,durationMs:m.durationMs,tokens:m.tokens,output:m.output,assertions:m.assertions.map(b=>({assertion_id:b.id,text:b.text,pass:b.pass,reasoning:b.reasoning}))});const v=((u=(c=o.evals)==null?void 0:c.evals[0])==null?void 0:u.id)??null;return{...s,skillContent:o.skillContent,savedContent:o.skillContent,isDirty:!1,evals:o.evals,evalsError:o.evalsError??null,latestBenchmark:o.benchmark,inlineResults:x,selectedCaseId:v,loading:!1,error:null}}case"SET_PANEL":return{...s,activePanel:o.panel};case"SET_CONTENT":return{...s,skillContent:o.content,isDirty:o.content!==s.savedContent};case"CONTENT_SAVED":return{...s,savedContent:s.skillContent,isDirty:!1};case"SET_EVALS":return{...s,evals:o.evals};case"SELECT_CASE":return{...s,selectedCaseId:o.caseId};case"CASE_RUN_START":{const x=new Map(s.caseRunStates);return x.set(o.caseId,{status:"running",startedAt:Date.now(),mode:o.mode}),{...s,caseRunStates:x,runMode:o.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const x=new Map(s.caseRunStates),v=x.get(o.caseId);x.set(o.caseId,{status:"complete",mode:v==null?void 0:v.mode});const m=new Map(s.inlineResults);return m.set(o.caseId,o.result),{...s,caseRunStates:x,inlineResults:m}}case"CASE_RUN_ERROR":{const x=new Map(s.caseRunStates),v=x.get(o.caseId);x.set(o.caseId,{status:"error",mode:v==null?void 0:v.mode});const m=new Map(s.inlineResults);return m.set(o.caseId,{status:"error",errorMessage:o.error,assertions:[]}),{...s,caseRunStates:x,inlineResults:m}}case"CASE_RUN_CANCEL":{const x=new Map(s.caseRunStates),v=x.get(o.caseId);return x.set(o.caseId,{status:"cancelled",mode:v==null?void 0:v.mode}),{...s,caseRunStates:x}}case"BULK_RUN_START":{const x=new Map(s.caseRunStates);for(const v of o.caseIds)x.set(v,{status:"queued",mode:o.mode});return{...s,caseRunStates:x,bulkRunActive:!0,runMode:o.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...s,bulkRunActive:!1,latestBenchmark:o.benchmark??s.latestBenchmark,iterationCount:s.iterationCount+1};case"CANCEL_ALL":{const x=new Map(s.caseRunStates);for(const[v,m]of x)(m.status==="running"||m.status==="queued")&&x.set(v,{status:"cancelled"});return{...s,caseRunStates:x,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const x=new Map(s.inlineResults);return x.set(o.evalId,o.result),{...s,inlineResults:x}}case"OPEN_IMPROVE":return{...s,improveTarget:o.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...s,improveTarget:null};case"OPEN_AI_EDIT":return{...s,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...s,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...s,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...s,aiEditProgress:[...s.aiEditProgress,o.entry]};case"AI_EDIT_RESULT":{const x=o.evalChanges??[],v=new Map;for(let m=0;m<x.length;m++)v.set(m,!0);return{...s,aiEditLoading:!1,aiEditResult:{improved:o.improved,reasoning:o.reasoning,evalChanges:x},aiEditEvalChanges:x,aiEditEvalSelections:v}}case"AI_EDIT_ERROR":return{...s,aiEditLoading:!1,aiEditError:o.message,aiEditClassifiedError:o.classified??null};case"GENERATE_EVALS_START":return{...s,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...s,generateEvalsProgress:[...s.generateEvalsProgress,o.entry]};case"GENERATE_EVALS_DONE":return{...s,generateEvalsLoading:!1,evals:o.evals};case"GENERATE_EVALS_ERROR":return{...s,generateEvalsLoading:!1,generateEvalsError:o.classified};case"TOGGLE_EVAL_CHANGE":{const x=new Map(s.aiEditEvalSelections);return x.set(o.index,!x.get(o.index)),{...s,aiEditEvalSelections:x}}case"SELECT_ALL_EVAL_CHANGES":{const x=new Map(s.aiEditEvalSelections);for(const v of x.keys())x.set(v,!0);return{...s,aiEditEvalSelections:x}}case"DESELECT_ALL_EVAL_CHANGES":{const x=new Map(s.aiEditEvalSelections);for(const v of x.keys())x.set(v,!1);return{...s,aiEditEvalSelections:x}}case"SET_EVALS_RETRY":return{...s,aiEditEvalsRetry:o.evalsFile};case"SET_REGRESSIONS":return{...s,regressions:o.regressions};case"INCREMENT_ITERATION":return{...s,iterationCount:s.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...s,activationPrompts:o.prompts};case"ACTIVATION_START":return{...s,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...s,activationResults:[...s.activationResults,o.result]};case"ACTIVATION_DONE":return{...s,activationRunning:!1,activationSummary:o.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...s,activationClassifyingStatus:`Classifying prompt ${o.index}/${o.total}...`};case"ACTIVATION_ERROR":return{...s,activationRunning:!1,activationError:o.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...s,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...s,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...s,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...s,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...s,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...s,generatingPrompts:!1,generatingPromptsError:o.error};case"ACTIVATION_HISTORY_LOADED":return{...s,activationHistory:o.runs,activationHistoryLoading:!1};default:return s}}function iv(s){if(s==="unit"||s==="integration")return s}function ov(s,o){const c=o.data;if(o.event==="output_ready"&&(s.output=c.output,c.durationMs!=null&&(s.durationMs=c.durationMs),c.tokens!=null&&(s.tokens=c.tokens)),o.event==="outputs_ready"&&(s.output=c.skillOutput,c.skillDurationMs!=null&&(s.durationMs=c.skillDurationMs),c.skillTokens!=null&&(s.tokens=c.skillTokens)),o.event==="assertion_result"){const u={assertion_id:c.assertion_id,text:c.text,pass:c.pass,reasoning:c.reasoning};s.assertions.find(x=>x.assertion_id===u.assertion_id)||s.assertions.push(u)}o.event==="case_complete"&&(s.status=c.status,s.passRate=c.pass_rate,s.errorMessage=c.error_message||void 0,s.classifiedError=c.classified_error||void 0)}const ep=p.createContext(null);function al(){const s=p.useContext(ep);if(!s)throw new Error("useWorkspace must be used within WorkspaceProvider");return s}function cv({plugin:s,skill:o,origin:c,children:u}){const x=c==="installed",[v,m]=p.useReducer(rv,{...sv,plugin:s,skill:o}),b=p.useRef(new Set),g=p.useRef(new Set),f=p.useRef(new Map),S=p.useCallback((J,ie)=>{let se=f.current.get(J);se||(se={assertions:[]},f.current.set(J,se)),ov(se,ie),m({type:"UPDATE_INLINE_RESULT",evalId:J,result:{...se,assertions:[...se.assertions]}})},[]),y=p.useCallback(J=>{if(g.current.has(J))return;g.current.add(J);const ie=f.current.get(J)??{assertions:[]};m({type:"CASE_RUN_COMPLETE",caseId:J,result:{...ie,assertions:[...ie.assertions]}}),b.current.has(J)&&(b.current.delete(J),b.current.size===0&&ge.getLatestBenchmark(s,o).then(se=>m({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>m({type:"BULK_RUN_COMPLETE",benchmark:null})))},[s,o]),k=p.useCallback((J,ie)=>{g.current.has(J)||(g.current.add(J),m({type:"CASE_RUN_ERROR",caseId:J,error:ie}),b.current.has(J)&&(b.current.delete(J),b.current.size===0&&ge.getLatestBenchmark(s,o).then(se=>m({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>m({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[s,o]),{startCase:R,stopCase:U,stopAll:L}=nv({onEvent:S,onDone:y,onError:k});p.useEffect(()=>()=>{L()},[L]);const Y=p.useCallback(async()=>{try{const J=await fetch(`/api/skills/${s}/${o}/activation-history`);if(!J.ok){if(J.status===404){m({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const ie=await J.json();m({type:"ACTIVATION_HISTORY_LOADED",runs:ie.runs||[]})}catch{}},[s,o]);p.useEffect(()=>{let J=!1;async function ie(){try{const[se,xe,ye]=await Promise.allSettled([ge.getSkillDetail(s,o),ge.getEvals(s,o),ge.getLatestBenchmark(s,o)]);if(J)return;let Ye=null,ut=null;if(xe.status==="fulfilled")Ye=xe.value;else{const $e=xe.reason;($e==null?void 0:$e.status)!==404&&(ut=($e==null?void 0:$e.message)??"Failed to load test cases")}m({type:"INIT_DATA",skillContent:se.status==="fulfilled"?se.value.skillContent:"",evals:Ye,evalsError:ut,benchmark:ye.status==="fulfilled"?ye.value:null})}catch(se){J||m({type:"SET_ERROR",error:se.message})}}return ie(),Y(),()=>{J=!0}},[s,o,Y]);const O=p.useCallback(async()=>{if(!x)try{await ge.applyImprovement(s,o,v.skillContent),m({type:"CONTENT_SAVED"})}catch(J){m({type:"SET_ERROR",error:J.message})}},[x,s,o,v.skillContent]),Z=p.useCallback(async J=>{if(!x)try{const ie=await ge.saveEvals(s,o,J);m({type:"SET_EVALS",evals:ie})}catch(ie){m({type:"SET_ERROR",error:ie.message})}},[x,s,o]),W=p.useCallback((J,ie="benchmark")=>{if(x)return;const se=v.caseRunStates.get(J);if((se==null?void 0:se.status)!=="running")if(f.current.delete(J),g.current.delete(J),m({type:"CASE_RUN_START",caseId:J,mode:ie}),ie==="comparison"){const xe=`/api/skills/${s}/${o}/compare`;R(J,xe,{eval_ids:[J]})}else{const xe=`/api/skills/${s}/${o}/benchmark/case/${J}`;R(J,xe,ie==="baseline"?{baseline_only:!0}:void 0)}},[x,s,o,v.caseRunStates,R]),F=p.useCallback((J="benchmark")=>{var xe;if(x)return;const ie=((xe=v.evals)==null?void 0:xe.evals)??[];if(ie.length===0)return;const se=ie.map(ye=>ye.id);for(const ye of se)f.current.delete(ye),g.current.delete(ye);m({type:"BULK_RUN_START",caseIds:se,mode:J}),b.current=new Set(se);for(const ye of se)if(J==="comparison")R(ye,`/api/skills/${s}/${o}/compare`,{eval_ids:[ye]});else{const Ye=`/api/skills/${s}/${o}/benchmark/case/${ye}`;R(ye,Ye,J==="baseline"?{baseline_only:!0}:void 0)}},[x,s,o,v.evals,R]),ae=p.useCallback(J=>{U(J),m({type:"CASE_RUN_CANCEL",caseId:J}),b.current.delete(J),g.current.add(J)},[U]),re=p.useCallback(()=>{L(),m({type:"CANCEL_ALL"}),b.current.clear()},[L]),q=p.useCallback(async(J,ie)=>{m({type:"OPEN_IMPROVE",evalId:J})},[]),I=p.useCallback(async(J,ie)=>{try{await ge.applyImprovement(s,o,ie),m({type:"SET_CONTENT",content:ie}),m({type:"CONTENT_SAVED"}),m({type:"CLOSE_IMPROVE"}),W(J,"benchmark")}catch(se){m({type:"SET_ERROR",error:se.message})}},[s,o,W]),G=lc(),X=p.useRef(null),ne=p.useRef(0);p.useEffect(()=>{const J=G.events;for(let ie=ne.current;ie<J.length;ie++){const se=J[ie],xe=se.data;if(se.event==="progress"&&m({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),se.event==="done"){const ye=xe.improved,Ye=xe.reasoning,ut=xe.evalChanges??[];m({type:"AI_EDIT_RESULT",improved:ye,reasoning:Ye,evalChanges:ut})}if(se.event==="error"){const ye=xe;m({type:"AI_EDIT_ERROR",message:ye.description||"Unknown error",classified:ye})}}ne.current=J.length},[G.events]),p.useEffect(()=>{G.error&&m({type:"AI_EDIT_ERROR",message:G.error})},[G.error]),p.useEffect(()=>()=>{G.stop()},[G.stop]);const te=p.useCallback(async(J,ie,se)=>{x||(ne.current=0,m({type:"AI_EDIT_LOADING"}),X.current=G.stop,G.start(`/api/skills/${s}/${o}/improve?sse`,{mode:"instruct",instruction:J,content:v.skillContent,evals:v.evals??{skill_name:o,evals:[]},provider:ie,model:se}))},[x,s,o,v.skillContent,v.evals,G]),be=p.useCallback(()=>{G.stop(),m({type:"AI_EDIT_ERROR",message:"Cancelled"})},[G]),he=p.useCallback(async()=>{const J=v.aiEditResult;if(J!=null&&J.improved)try{if(await ge.applyImprovement(s,o,J.improved),m({type:"SET_CONTENT",content:J.improved}),m({type:"CONTENT_SAVED"}),v.aiEditEvalChanges.length>0&&Array.from(v.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:se}=await av(async()=>{const{mergeEvalChanges:Ye}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Ye}},[]),xe=v.evals??{skill_name:o,evals:[]},ye=se(xe,v.aiEditEvalChanges,v.aiEditEvalSelections);try{const Ye=await ge.saveEvals(s,o,ye);m({type:"SET_EVALS",evals:Ye})}catch(Ye){m({type:"SET_EVALS_RETRY",evalsFile:ye}),m({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Ye.message}. You can retry from the AI Edit panel.`});return}}m({type:"CLOSE_AI_EDIT"})}catch(ie){m({type:"SET_ERROR",error:ie.message})}},[s,o,v.aiEditResult,v.evals,v.aiEditEvalChanges,v.aiEditEvalSelections]),T=p.useCallback(()=>{m({type:"CLOSE_AI_EDIT"})},[]),N=p.useCallback(J=>{m({type:"TOGGLE_EVAL_CHANGE",index:J})},[]),w=p.useCallback(()=>{m({type:"SELECT_ALL_EVAL_CHANGES"})},[]),ee=p.useCallback(()=>{m({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),B=p.useCallback(async()=>{const J=v.aiEditEvalsRetry;if(J)try{const ie=await ge.saveEvals(s,o,J);m({type:"SET_EVALS",evals:ie}),m({type:"SET_ERROR",error:null}),m({type:"CLOSE_AI_EDIT"})}catch(ie){m({type:"SET_ERROR",error:`Retry failed: ${ie.message}`})}},[s,o,v.aiEditEvalsRetry]),ue=p.useCallback(async()=>{try{const J=await ge.getSkillDetail(s,o);m({type:"SET_CONTENT",content:J.skillContent}),m({type:"CONTENT_SAVED"})}catch{}},[s,o]),{config:j}=ia(),D=lc(),P=p.useRef(0);p.useEffect(()=>{const J=D.events;for(let ie=P.current;ie<J.length;ie++){const se=J[ie],xe=se.data;if(se.event==="progress"&&m({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),se.event==="done"){const ye=xe;ge.saveEvals(s,o,ye).then(Ye=>m({type:"GENERATE_EVALS_DONE",evals:Ye})).catch(Ye=>m({type:"SET_ERROR",error:Ye.message}))}se.event==="error"&&m({type:"GENERATE_EVALS_ERROR",classified:xe})}P.current=J.length},[D.events,s,o]),p.useEffect(()=>{D.error&&m({type:"SET_ERROR",error:D.error})},[D.error]),p.useEffect(()=>()=>{D.stop()},[D.stop]);const le=p.useCallback(async J=>{if(x)return;P.current=0,m({type:"GENERATE_EVALS_START"});const ie={};j!=null&&j.provider&&(ie.provider=j.provider),j!=null&&j.model&&(ie.model=j.model);const se=iv(J==null?void 0:J.testType);se&&(ie.testType=se),D.start(`/api/skills/${s}/${o}/generate-evals?sse`,Object.keys(ie).length>0?ie:void 0)},[x,s,o,D,j]),ce=lc(),de=p.useRef(0);p.useEffect(()=>()=>{ce.stop()},[ce.stop]),p.useEffect(()=>{const J=ce.events;for(let ie=de.current;ie<J.length;ie++){const se=J[ie];if(se.event==="classifying"){const xe=se.data;m({type:"ACTIVATION_CLASSIFYING",index:xe.index,total:xe.total})}if(se.event==="prompt_result"&&m({type:"ACTIVATION_RESULT",result:se.data}),se.event==="done"){me.current&&(clearTimeout(me.current),me.current=null);const xe=se.data;if(xe.error)m({type:"ACTIVATION_ERROR",error:xe.error});else{m({type:"ACTIVATION_DONE",summary:xe});const ye={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(j==null?void 0:j.model)||"unknown",provider:(j==null?void 0:j.provider)||"unknown",promptCount:xe.total,summary:{precision:xe.precision,recall:xe.recall,reliability:xe.reliability,tp:xe.tp,tn:xe.tn,fp:xe.fp,fn:xe.fn}};m({type:"ACTIVATION_HISTORY_LOADED",runs:[ye,...v.activationHistory??[]]})}}}de.current=J.length},[ce.events,j,v.activationHistory]),p.useEffect(()=>{ce.error&&(me.current&&(clearTimeout(me.current),me.current=null),m({type:"ACTIVATION_ERROR",error:ce.error}))},[ce.error]);const me=p.useRef(null),Oe=p.useCallback(()=>{me.current&&(clearTimeout(me.current),me.current=null),ce.stop(),m({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ce]),Re=p.useCallback(J=>{const se=J.trim().split(`
52
- `).filter(Boolean).map(ye=>ye.startsWith("!")?{prompt:ye.slice(1).trim(),expected:"should_not_activate"}:ye.startsWith("+")?{prompt:ye.slice(1).trim(),expected:"should_activate"}:{prompt:ye.trim(),expected:"auto"});de.current=0,m({type:"ACTIVATION_START"}),m({type:"SET_ACTIVATION_PROMPTS",prompts:J});const xe={prompts:se};j!=null&&j.provider&&(xe.provider=j.provider),j!=null&&j.model&&(xe.model=j.model),ce.start(`/api/skills/${s}/${o}/activation-test`,xe),me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{ce.stop(),m({type:"ACTIVATION_TIMEOUT"}),me.current=null},12e4)},[s,o,ce,j]),pt=p.useCallback(async(J=8)=>{m({type:"GENERATE_PROMPTS_START"});try{const ie={count:J};j!=null&&j.provider&&(ie.provider=j.provider),j!=null&&j.model&&(ie.model=j.model);const se=await fetch(`/api/skills/${s}/${o}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(!se.ok){let mt=`HTTP ${se.status}`;try{const nl=await se.json();nl.error&&(mt=nl.error)}catch{}throw new Error(mt)}const xe=se.body.getReader(),ye=new TextDecoder;let Ye="",ut="",$e=[];for(;;){const{done:mt,value:nl}=await xe.read();if(mt)break;Ye+=ye.decode(nl,{stream:!0});const Xt=Ye.split(`
53
- `);Ye=Xt.pop()||"";for(const We of Xt)if(We.startsWith("event: "))ut=We.slice(7).trim();else if(We.startsWith("data: ")){try{const kt=JSON.parse(We.slice(6));if(ut==="done"){if(kt.error)throw new Error(kt.error);$e=kt.prompts||[]}if(ut==="error")throw new Error(kt.message||kt.description||"Generation failed")}catch(kt){if(!(kt instanceof SyntaxError))throw kt}ut=""}}const Ot=$e.map(mt=>`${mt.expected==="should_activate"?"+":"!"}${mt.prompt}`).join(`
54
- `);m({type:"SET_ACTIVATION_PROMPTS",prompts:Ot}),m({type:"GENERATE_PROMPTS_DONE"})}catch(ie){m({type:"GENERATE_PROMPTS_ERROR",error:ie.message})}},[s,o,j]),Dt=p.useMemo(()=>({state:v,dispatch:m,isReadOnly:x,saveContent:O,saveEvals:Z,runCase:W,runAll:F,cancelCase:ae,cancelAll:re,improveForCase:q,applyImproveAndRerun:I,refreshSkillContent:ue,generateEvals:le,runActivationTest:Re,cancelActivation:Oe,generateActivationPrompts:pt,fetchActivationHistory:Y,submitAiEdit:te,cancelAiEdit:be,applyAiEdit:he,discardAiEdit:T,toggleEvalChange:N,selectAllEvalChanges:w,deselectAllEvalChanges:ee,retryEvalsSave:B}),[v,x,O,Z,W,F,ae,re,q,I,ue,le,Re,Oe,pt,Y,te,be,he,T,N,w,ee,B]);return a.jsx(ep.Provider,{value:Dt,children:u})}function uv(s){return s==null?"var(--text-tertiary)":s>=.7?"var(--green)":s>=.4?"var(--yellow)":"var(--red)"}function dv(s){return s==null?"var(--surface-3)":s>=.7?"var(--green-muted)":s>=.4?"var(--yellow-muted)":"var(--red-muted)"}function fv({state:s,isReadOnly:o,onDelete:c}){const{plugin:u,skill:x,evals:v,latestBenchmark:m,isDirty:b,caseRunStates:g,regressions:f,iterationCount:S}=s,y=Array.from(g.values()).some(O=>O.status==="running"||O.status==="queued"),k=m==null?void 0:m.overall_pass_rate,R=(v==null?void 0:v.evals.reduce((O,Z)=>O+Z.assertions.length,0))??0,U=(v==null?void 0:v.evals.length)??0,L=uv(k),Y=dv(k);return a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:u}),a.jsx(xv,{}),a.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:x}),o&&a.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),b&&a.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"}),y&&a.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!o&&c&&a.jsx("button",{disabled:y,onClick:()=>{window.confirm(`Delete skill "${x}"? This cannot be undone.`)&&c()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:y?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:y?.4:1,borderRadius:4},onMouseEnter:O=>{y||(O.currentTarget.style.color="var(--red)")},onMouseLeave:O=>{O.currentTarget.style.color="var(--text-tertiary)"},children:a.jsx(pv,{})}),f.length>0&&a.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),f.length," regression",f.length>1?"s":""]}),S>0&&a.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",S]}),a.jsx("span",{className:"pill",style:{background:Y,color:L},children:k!=null?`${Math.round(k*100)}%`:"--"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[U," case",U!==1?"s":""," / ",R," assert",R!==1?"s":""]})]})]})}function xv(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function pv(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.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"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const mv=[{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:"leaderboard",label:"Leaderboard",shortcut:"6"},{id:"deps",label:"Deps",shortcut:"7"}]}];function hv({id:s}){const o={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(s){case"editor":return a.jsxs("svg",{...o,children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.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 a.jsxs("svg",{...o,children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.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 a.jsx("svg",{...o,children:a.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return a.jsxs("svg",{...o,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return a.jsxs("svg",{...o,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return a.jsxs("svg",{...o,children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]});case"deps":return a.jsxs("svg",{...o,children:[a.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"}),a.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 vv({activePanel:s,onPanelChange:o,isDirty:c,isRunning:u,hasRegressions:x,isActivationRunning:v}){return a.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:mv.map((m,b)=>a.jsxs("div",{className:"flex items-center",children:[b>0&&a.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),m.tabs.map(g=>{const f=s===g.id,S=g.id==="editor"&&c||g.id==="run"&&u||g.id==="activation"&&v||g.id==="history"&&x,y=g.id==="run"||g.id==="activation"?"var(--accent)":g.id==="history"?"var(--red)":"var(--yellow)";return a.jsxs("button",{onClick:()=>o(g.id),title:`${g.label} (Ctrl+${g.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:f?"var(--text-primary)":"var(--text-tertiary)",borderBottom:f?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:f?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:k=>{f||(k.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:k=>{f||(k.currentTarget.style.color="var(--text-tertiary)")},children:[a.jsx(hv,{id:g.id}),g.label,S&&a.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:y}})]},g.id)})]},m.label))})}const Mx={rate_limit:{icon:"⏱",color:"var(--amber, #f59e0b)"},context_window:{icon:"⚠",color:"var(--amber, #f59e0b)"},auth:{icon:"🔒",color:"var(--red, #ef4444)"},timeout:{icon:"⌛",color:"var(--amber, #f59e0b)"},model_not_found:{icon:"🔍",color:"var(--red, #ef4444)"},provider_unavailable:{icon:"⚡",color:"var(--red, #ef4444)"},parse_error:{icon:"❓",color:"var(--amber, #f59e0b)"},unknown:{icon:"❌",color:"var(--red, #ef4444)"}};function ds({error:s,onRetry:o,onDismiss:c}){const[u,x]=p.useState(null),v=p.useRef(null);p.useEffect(()=>(s.category==="rate_limit"&&s.retryAfterMs?x(Math.ceil(s.retryAfterMs/1e3)):x(null),()=>{v.current&&clearInterval(v.current)}),[s]),p.useEffect(()=>{if(!(u==null||u<=0))return v.current=setInterval(()=>{x(g=>g==null||g<=1?(v.current&&clearInterval(v.current),0):g-1)},1e3),()=>{v.current&&clearInterval(v.current)}},[u!=null&&u>0]);const m=Mx[s.category]||Mx.unknown,b=u!=null&&u>0;return a.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${m.color} 30%, transparent)`,background:`color-mix(in srgb, ${m.color} 6%, var(--surface-1))`},children:[a.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{style:{fontSize:14},children:m.icon}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:m.color},children:s.title})]}),c&&a.jsx("button",{onClick:c,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-3.5 pb-3",children:[a.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:s.description}),a.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:s.hint}),(o||u!=null)&&a.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:o&&a.jsx("button",{onClick:o,disabled:b,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:b?.5:1},children:b?`Retry in ${u}s`:"Retry"})})]})]})}class yv extends p.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o,c){console.error("ErrorBoundary caught:",o,c.componentStack)}render(){return this.state.hasError?a.jsxs("div",{style:{padding:24,textAlign:"center"},children:[a.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),a.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),a.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function gv(s){const o=s.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(o)?{category:"rate_limit",title:"Rate Limit",description:s,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(o)?{category:"auth",title:"Authentication Failed",description:s,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(o)?{category:"timeout",title:"Request Timed Out",description:s,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(o)?{category:"model_not_found",title:"Model Not Found",description:s,hint:"The selected model is not available. Try switching to a different model in the dropdown above.",retryable:!1}:/context.?(?:window|length)|token.?(?:limit|count|exceed)|too (?:long|large)|maximum.?context|input.?too.?long|prompt.?too.?(?:long|large)/.test(o)?{category:"context_window",title:"Content Too Large",description:s,hint:"Reduce SKILL.md size or move detailed content to references/ files.",retryable:!1}:/enoent|command not found|502|503|service.?unavailable|connection.?refused|econnrefused|server.?error/.test(o)?{category:"provider_unavailable",title:"Provider Unavailable",description:s,hint:"Check that the provider is installed and running.",retryable:!1}:/syntaxerror|json\.?parse|parse.?error|failed to parse|not valid json|unexpected token/.test(o)?{category:"parse_error",title:"Response Parse Error",description:s,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:s,hint:"",retryable:!1}}function bv(s){const o=s.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!o)return{metadata:{},body:s};const c=o[1],u=o[2].trim(),x={},v=c.split(`
55
- `);let m="",b=!1;for(const g of v){const f=g.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(f&&m&&b){const k=f[1],R=f[2].trim();let U=x[m];if((typeof U!="object"||Array.isArray(U))&&(U={},x[m]=U),!R)U[k]=[];else{const L=R.match(/^\[(.+)\]$/);L?U[k]=L[1].split(",").map(Y=>Y.trim().replace(/^["']|["']$/g,"")).filter(Boolean):U[k]=R.replace(/^["']|["']$/g,"")}continue}const S=g.match(/^\s+-\s+(.+)$/);if(S&&m){b=!1;const k=x[m];Array.isArray(k)?k.push(S[1].trim().replace(/^["']|["']$/g,"")):x[m]=[S[1].trim().replace(/^["']|["']$/g,"")];continue}const y=g.match(/^([\w-]+):\s*(.*)$/);if(y){m=y[1];const k=y[2].trim();if(b=!1,!k){x[m]={},b=!0;continue}const R=k.match(/^\[(.+)\]$/);if(R){x[m]=R[1].split(",").map(U=>U.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}x[m]=k.replace(/^["']|["']$/g,"")}}return{metadata:x,body:u}}function zr(s){if(!s)return"";try{let o=s.replace(/^---\n[\s\S]*?\n---\n?/,""),c=jv(o);return c=c.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>'),c=c.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),c=c.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),c=c.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),c=c.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),c=c.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),c=c.replace(/\*([^*]+)\*/g,"<em>$1</em>"),c=c.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),c=c.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),c=c.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),c=c.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),c=c.replace(/\n/g,"<br/>"),c}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`}}function jv(s){const o=s.split(`
56
- `),c=[];let u=0;for(;u<o.length;)if(o[u].trim().startsWith("|")&&u+1<o.length&&o[u+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(o[u+1])){const x=Lx(o[u]);u+=2;const v=[];for(;u<o.length&&o[u].trim().startsWith("|");)v.push(Lx(o[u])),u++;const m='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)"',b='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let g='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';g+="<thead><tr>";for(const f of x)g+=`<th ${m}>${f}</th>`;g+="</tr></thead><tbody>";for(const f of v){g+="<tr>";for(const S of f)g+=`<td ${b}>${S}</td>`;g+="</tr>"}g+="</tbody></table>",c.push(g)}else c.push(o[u]),u++;return c.join(`
48
+ `+n.stack}}var Qe=Object.prototype.hasOwnProperty,Ot=s.unstable_scheduleCallback,mt=s.unstable_cancelCallback,nl=s.unstable_shouldYield,Xt=s.unstable_requestPaint,We=s.unstable_now,kt=s.unstable_getCurrentPriorityLevel,K=s.unstable_ImmediatePriority,Be=s.unstable_UserBlockingPriority,at=s.unstable_NormalPriority,Je=s.unstable_LowPriority,Ml=s.unstable_IdlePriority,Bt=s.log,oa=s.unstable_setDisableYieldValue,Ct=null,Fe=null;function nt(e){if(typeof Bt=="function"&&oa(e),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Ct,e)}catch{}}var et=Math.clz32?Math.clz32:rl,sl=Math.log,$e=Math.LN2;function rl(e){return e>>>=0,e===0?32:31-(sl(e)/$e|0)|0}var st=256,Ve=262144,Ll=4194304;function Tt(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 Ta(e,t,l){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var h=n&134217727;return h!==0?(n=h&~i,n!==0?r=Tt(n):(d&=h,d!==0?r=Tt(d):l||(l=h&~e,l!==0&&(r=Tt(l))))):(h=n&~i,h!==0?r=Tt(h):d!==0?r=Tt(d):l||(l=n&~e,l!==0&&(r=Tt(l)))),r===0?0:t!==0&&t!==r&&(t&i)===0&&(i=r&-r,l=t&-t,i>=l||i===32&&(l&4194048)!==0)?t:r}function mn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function hp(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 bc(){var e=Ll;return Ll<<=1,(Ll&62914560)===0&&(Ll=4194304),e}function Br(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function hn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function vp(e,t,l,n,r,i){var d=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 h=e.entanglements,E=e.expirationTimes,M=e.hiddenUpdates;for(l=d&~l;0<l;){var V=31-et(l),Q=1<<V;h[V]=0,E[V]=-1;var z=M[V];if(z!==null)for(M[V]=null,V=0;V<z.length;V++){var H=z[V];H!==null&&(H.lane&=-536870913)}l&=~Q}n!==0&&jc(e,n,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(d&~t))}function jc(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-et(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|l&261930}function Sc(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var n=31-et(l),r=1<<n;r&t|e[n]&t&&(e[n]|=t),l&=~r}}function Nc(e,t){var l=t&-t;return l=(l&42)!==0?1:Hr(l),(l&(e.suspendedLanes|t))!==0?0:l}function Hr(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 Ur(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ec(){var e=w.p;return e!==0?e:(e=window.event,e===void 0?32:ux(e.type))}function kc(e,t){var l=w.p;try{return w.p=e,t()}finally{w.p=l}}var zl=Math.random().toString(36).slice(2),ht="__reactFiber$"+zl,wt="__reactProps$"+zl,wa="__reactContainer$"+zl,qr="__reactEvents$"+zl,yp="__reactListeners$"+zl,gp="__reactHandles$"+zl,Cc="__reactResources$"+zl,vn="__reactMarker$"+zl;function Vr(e){delete e[ht],delete e[wt],delete e[qr],delete e[yp],delete e[gp]}function Aa(e){var t=e[ht];if(t)return t;for(var l=e.parentNode;l;){if(t=l[wa]||l[ht]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Zf(e);e!==null;){if(l=e[ht])return l;e=Zf(e)}return t}e=l,l=e.parentNode}return null}function Ra(e){if(e=e[ht]||e[wa]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function yn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function _a(e){var t=e[Cc];return t||(t=e[Cc]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ft(e){e[vn]=!0}var Tc=new Set,wc={};function ca(e,t){Ma(e,t),Ma(e+"Capture",t)}function Ma(e,t){for(wc[e]=t,e=0;e<t.length;e++)Tc.add(t[e])}var bp=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]*$"),Ac={},Rc={};function jp(e){return Qe.call(Rc,e)?!0:Qe.call(Ac,e)?!1:bp.test(e)?Rc[e]=!0:(Ac[e]=!0,!1)}function xs(e,t,l){if(jp(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function ps(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 pl(e,t,l,n){if(n===null)e.removeAttribute(l);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+n)}}function Kt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _c(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Sp(e,t,l){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(d){l=""+d,i.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(d){l=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Gr(e){if(!e._valueTracker){var t=_c(e)?"checked":"value";e._valueTracker=Sp(e,t,""+e[t])}}function Mc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),n="";return e&&(n=_c(e)?e.checked?"true":"false":e.value),e=n,e!==l?(t.setValue(e),!0):!1}function ms(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 Np=/[\n"\\]/g;function Zt(e){return e.replace(Np,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Yr(e,t,l,n,r,i,d,h){e.name="",d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?e.type=d:e.removeAttribute("type"),t!=null?d==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Kt(t)):e.value!==""+Kt(t)&&(e.value=""+Kt(t)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),t!=null?$r(e,d,Kt(t)):l!=null?$r(e,d,Kt(l)):n!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.name=""+Kt(h):e.removeAttribute("name")}function Lc(e,t,l,n,r,i,d,h){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)){Gr(e);return}l=l!=null?""+Kt(l):"",t=t!=null?""+Kt(t):l,h||t===e.value||(e.value=t),e.defaultValue=t}n=n??r,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=h?e.checked:!!n,e.defaultChecked=!!n,d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.name=d),Gr(e)}function $r(e,t,l){t==="number"&&ms(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function La(e,t,l,n){if(e=e.options,t){t={};for(var r=0;r<l.length;r++)t["$"+l[r]]=!0;for(l=0;l<e.length;l++)r=t.hasOwnProperty("$"+e[l].value),e[l].selected!==r&&(e[l].selected=r),r&&n&&(e[l].defaultSelected=!0)}else{for(l=""+Kt(l),t=null,r=0;r<e.length;r++){if(e[r].value===l){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function zc(e,t,l){if(t!=null&&(t=""+Kt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Kt(l):""}function Dc(e,t,l,n){if(t==null){if(n!=null){if(l!=null)throw Error(u(92));if(T(n)){if(1<n.length)throw Error(u(93));n=n[0]}l=n}l==null&&(l=""),t=l}l=Kt(t),e.defaultValue=l,n=e.textContent,n===l&&n!==""&&n!==null&&(e.value=n),Gr(e)}function za(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Ep=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 Oc(e,t,l){var n=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,l):typeof l!="number"||l===0||Ep.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Bc(e,t,l){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,l!=null){for(var n in l)!l.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var r in t)n=t[r],t.hasOwnProperty(r)&&l[r]!==n&&Oc(e,r,n)}else for(var i in t)t.hasOwnProperty(i)&&Oc(e,i,t[i])}function Qr(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 kp=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"]]),Cp=/^[\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 hs(e){return Cp.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ml(){}var Xr=null;function Kr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Da=null,Oa=null;function Hc(e){var t=Ra(e);if(t&&(e=t.stateNode)){var l=e[wt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Yr(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="'+Zt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var n=l[t];if(n!==e&&n.form===e.form){var r=n[wt]||null;if(!r)throw Error(u(90));Yr(n,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<l.length;t++)n=l[t],n.form===e.form&&Mc(n)}break e;case"textarea":zc(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&La(e,!!l.multiple,t,!1)}}}var Zr=!1;function Uc(e,t,l){if(Zr)return e(t,l);Zr=!0;try{var n=e(t);return n}finally{if(Zr=!1,(Da!==null||Oa!==null)&&(ar(),Da&&(t=Da,e=Oa,Oa=Da=null,Hc(t),e)))for(t=0;t<e.length;t++)Hc(e[t])}}function gn(e,t){var l=e.stateNode;if(l===null)return null;var n=l[wt]||null;if(n===null)return null;l=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(u(231,t,typeof l));return l}var hl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jr=!1;if(hl)try{var bn={};Object.defineProperty(bn,"passive",{get:function(){Jr=!0}}),window.addEventListener("test",bn,bn),window.removeEventListener("test",bn,bn)}catch{Jr=!1}var Dl=null,Wr=null,vs=null;function qc(){if(vs)return vs;var e,t=Wr,l=t.length,n,r="value"in Dl?Dl.value:Dl.textContent,i=r.length;for(e=0;e<l&&t[e]===r[e];e++);var d=l-e;for(n=1;n<=d&&t[l-n]===r[i-n];n++);return vs=r.slice(e,1<n?1-n:void 0)}function ys(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 gs(){return!0}function Vc(){return!1}function At(e){function t(l,n,r,i,d){this._reactName=l,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=d,this.currentTarget=null;for(var h in e)e.hasOwnProperty(h)&&(l=e[h],this[h]=l?l(i):i[h]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?gs:Vc,this.isPropagationStopped=Vc,this}return y(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=gs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=gs)},persist:function(){},isPersistent:gs}),t}var ua={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bs=At(ua),jn=y({},ua,{view:0,detail:0}),Tp=At(jn),Fr,Ir,Sn,js=y({},jn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ei,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!==Sn&&(Sn&&e.type==="mousemove"?(Fr=e.screenX-Sn.screenX,Ir=e.screenY-Sn.screenY):Ir=Fr=0,Sn=e),Fr)},movementY:function(e){return"movementY"in e?e.movementY:Ir}}),Gc=At(js),wp=y({},js,{dataTransfer:0}),Ap=At(wp),Rp=y({},jn,{relatedTarget:0}),Pr=At(Rp),_p=y({},ua,{animationName:0,elapsedTime:0,pseudoElement:0}),Mp=At(_p),Lp=y({},ua,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),zp=At(Lp),Dp=y({},ua,{data:0}),Yc=At(Dp),Op={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Bp={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"},Hp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Up(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hp[e])?!!t[e]:!1}function ei(){return Up}var qp=y({},jn,{key:function(e){if(e.key){var t=Op[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ys(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Bp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ei,charCode:function(e){return e.type==="keypress"?ys(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ys(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Vp=At(qp),Gp=y({},js,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$c=At(Gp),Yp=y({},jn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ei}),$p=At(Yp),Qp=y({},ua,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xp=At(Qp),Kp=y({},js,{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}),Zp=At(Kp),Jp=y({},ua,{newState:0,oldState:0}),Wp=At(Jp),Fp=[9,13,27,32],ti=hl&&"CompositionEvent"in window,Nn=null;hl&&"documentMode"in document&&(Nn=document.documentMode);var Ip=hl&&"TextEvent"in window&&!Nn,Qc=hl&&(!ti||Nn&&8<Nn&&11>=Nn),Xc=" ",Kc=!1;function Zc(e,t){switch(e){case"keyup":return Fp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ba=!1;function Pp(e,t){switch(e){case"compositionend":return Jc(t);case"keypress":return t.which!==32?null:(Kc=!0,Xc);case"textInput":return e=t.data,e===Xc&&Kc?null:e;default:return null}}function em(e,t){if(Ba)return e==="compositionend"||!ti&&Zc(e,t)?(e=qc(),vs=Wr=Dl=null,Ba=!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 Qc&&t.locale!=="ko"?null:t.data;default:return null}}var tm={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 Wc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!tm[e.type]:t==="textarea"}function Fc(e,t,l,n){Da?Oa?Oa.push(n):Oa=[n]:Da=n,t=ur(t,"onChange"),0<t.length&&(l=new bs("onChange","change",null,l,n),e.push({event:l,listeners:t}))}var En=null,kn=null;function lm(e){zf(e,0)}function Ss(e){var t=yn(e);if(Mc(t))return e}function Ic(e,t){if(e==="change")return t}var Pc=!1;if(hl){var li;if(hl){var ai="oninput"in document;if(!ai){var eu=document.createElement("div");eu.setAttribute("oninput","return;"),ai=typeof eu.oninput=="function"}li=ai}else li=!1;Pc=li&&(!document.documentMode||9<document.documentMode)}function tu(){En&&(En.detachEvent("onpropertychange",lu),kn=En=null)}function lu(e){if(e.propertyName==="value"&&Ss(kn)){var t=[];Fc(t,kn,e,Kr(e)),Uc(lm,t)}}function am(e,t,l){e==="focusin"?(tu(),En=t,kn=l,En.attachEvent("onpropertychange",lu)):e==="focusout"&&tu()}function nm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ss(kn)}function sm(e,t){if(e==="click")return Ss(t)}function rm(e,t){if(e==="input"||e==="change")return Ss(t)}function im(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ht=typeof Object.is=="function"?Object.is:im;function Cn(e,t){if(Ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),n=Object.keys(t);if(l.length!==n.length)return!1;for(n=0;n<l.length;n++){var r=l[n];if(!Qe.call(t,r)||!Ht(e[r],t[r]))return!1}return!0}function au(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function nu(e,t){var l=au(e);e=0;for(var n;l;){if(l.nodeType===3){if(n=e+l.textContent.length,e<=t&&n>=t)return{node:l,offset:t-e};e=n}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=au(l)}}function su(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?su(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ru(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ms(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=ms(e.document)}return t}function ni(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 om=hl&&"documentMode"in document&&11>=document.documentMode,Ha=null,si=null,Tn=null,ri=!1;function iu(e,t,l){var n=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ri||Ha==null||Ha!==ms(n)||(n=Ha,"selectionStart"in n&&ni(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Tn&&Cn(Tn,n)||(Tn=n,n=ur(si,"onSelect"),0<n.length&&(t=new bs("onSelect","select",null,t,l),e.push({event:t,listeners:n}),t.target=Ha)))}function da(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Ua={animationend:da("Animation","AnimationEnd"),animationiteration:da("Animation","AnimationIteration"),animationstart:da("Animation","AnimationStart"),transitionrun:da("Transition","TransitionRun"),transitionstart:da("Transition","TransitionStart"),transitioncancel:da("Transition","TransitionCancel"),transitionend:da("Transition","TransitionEnd")},ii={},ou={};hl&&(ou=document.createElement("div").style,"AnimationEvent"in window||(delete Ua.animationend.animation,delete Ua.animationiteration.animation,delete Ua.animationstart.animation),"TransitionEvent"in window||delete Ua.transitionend.transition);function fa(e){if(ii[e])return ii[e];if(!Ua[e])return e;var t=Ua[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in ou)return ii[e]=t[l];return e}var cu=fa("animationend"),uu=fa("animationiteration"),du=fa("animationstart"),cm=fa("transitionrun"),um=fa("transitionstart"),dm=fa("transitioncancel"),fu=fa("transitionend"),xu=new Map,oi="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(" ");oi.push("scrollEnd");function il(e,t){xu.set(e,t),ca(t,[e])}var Ns=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)},Jt=[],qa=0,ci=0;function Es(){for(var e=qa,t=ci=qa=0;t<e;){var l=Jt[t];Jt[t++]=null;var n=Jt[t];Jt[t++]=null;var r=Jt[t];Jt[t++]=null;var i=Jt[t];if(Jt[t++]=null,n!==null&&r!==null){var d=n.pending;d===null?r.next=r:(r.next=d.next,d.next=r),n.pending=r}i!==0&&pu(l,r,i)}}function ks(e,t,l,n){Jt[qa++]=e,Jt[qa++]=t,Jt[qa++]=l,Jt[qa++]=n,ci|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function ui(e,t,l,n){return ks(e,t,l,n),Cs(e)}function xa(e,t){return ks(e,null,null,t),Cs(e)}function pu(e,t,l){e.lanes|=l;var n=e.alternate;n!==null&&(n.lanes|=l);for(var r=!1,i=e.return;i!==null;)i.childLanes|=l,n=i.alternate,n!==null&&(n.childLanes|=l),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(r=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,r&&t!==null&&(r=31-et(l),e=i.hiddenUpdates,n=e[r],n===null?e[r]=[t]:n.push(t),t.lane=l|536870912),i):null}function Cs(e){if(50<Jn)throw Jn=0,bo=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Va={};function fm(e,t,l,n){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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ut(e,t,l,n){return new fm(e,t,l,n)}function di(e){return e=e.prototype,!(!e||!e.isReactComponent)}function vl(e,t){var l=e.alternate;return l===null?(l=Ut(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 Ts(e,t,l,n,r,i){var d=0;if(n=e,typeof e=="function")di(e)&&(d=1);else if(typeof e=="string")d=vh(e,l,le.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Ut(31,l,t,r),e.elementType=G,e.lanes=i,e;case L:return pa(l.children,r,i,t);case Y:d=8,r|=24;break;case O:return e=Ut(12,l,t,r|2),e.elementType=O,e.lanes=i,e;case ae:return e=Ut(13,l,t,r),e.elementType=ae,e.lanes=i,e;case re:return e=Ut(19,l,t,r),e.elementType=re,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case W:d=10;break e;case Z:d=9;break e;case F:d=11;break e;case q:d=14;break e;case I:d=16,n=null;break e}d=29,l=Error(u(130,e===null?"null":typeof e,"")),n=null}return t=Ut(d,l,t,r),t.elementType=e,t.type=n,t.lanes=i,t}function pa(e,t,l,n){return e=Ut(7,e,n,t),e.lanes=l,e}function fi(e,t,l){return e=Ut(6,e,null,t),e.lanes=l,e}function hu(e){var t=Ut(18,null,null,0);return t.stateNode=e,t}function xi(e,t,l){return t=Ut(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var vu=new WeakMap;function Wt(e,t){if(typeof e=="object"&&e!==null){var l=vu.get(e);return l!==void 0?l:(t={value:e,source:t,stack:ut(t)},vu.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var Ga=[],Ya=0,ws=null,wn=0,Ft=[],It=0,Ol=null,ul=1,dl="";function yl(e,t){Ga[Ya++]=wn,Ga[Ya++]=ws,ws=e,wn=t}function yu(e,t,l){Ft[It++]=ul,Ft[It++]=dl,Ft[It++]=Ol,Ol=e;var n=ul;e=dl;var r=32-et(n)-1;n&=~(1<<r),l+=1;var i=32-et(t)+r;if(30<i){var d=r-r%5;i=(n&(1<<d)-1).toString(32),n>>=d,r-=d,ul=1<<32-et(t)+r|l<<r|n,dl=i+e}else ul=1<<i|l<<r|n,dl=e}function pi(e){e.return!==null&&(yl(e,1),yu(e,1,0))}function mi(e){for(;e===ws;)ws=Ga[--Ya],Ga[Ya]=null,wn=Ga[--Ya],Ga[Ya]=null;for(;e===Ol;)Ol=Ft[--It],Ft[It]=null,dl=Ft[--It],Ft[It]=null,ul=Ft[--It],Ft[It]=null}function gu(e,t){Ft[It++]=ul,Ft[It++]=dl,Ft[It++]=Ol,ul=t.id,dl=t.overflow,Ol=e}var vt=null,Xe=null,we=!1,Bl=null,Pt=!1,hi=Error(u(519));function Hl(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw An(Wt(t,e)),hi}function bu(e){var t=e.stateNode,l=e.type,n=e.memoizedProps;switch(t[ht]=e,t[wt]=n,l){case"dialog":ke("cancel",t),ke("close",t);break;case"iframe":case"object":case"embed":ke("load",t);break;case"video":case"audio":for(l=0;l<Fn.length;l++)ke(Fn[l],t);break;case"source":ke("error",t);break;case"img":case"image":case"link":ke("error",t),ke("load",t);break;case"details":ke("toggle",t);break;case"input":ke("invalid",t),Lc(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":ke("invalid",t);break;case"textarea":ke("invalid",t),Dc(t,n.value,n.defaultValue,n.children)}l=n.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||n.suppressHydrationWarning===!0||Hf(t.textContent,l)?(n.popover!=null&&(ke("beforetoggle",t),ke("toggle",t)),n.onScroll!=null&&ke("scroll",t),n.onScrollEnd!=null&&ke("scrollend",t),n.onClick!=null&&(t.onclick=ml),t=!0):t=!1,t||Hl(e,!0)}function ju(e){for(vt=e.return;vt;)switch(vt.tag){case 5:case 31:case 13:Pt=!1;return;case 27:case 3:Pt=!0;return;default:vt=vt.return}}function $a(e){if(e!==vt)return!1;if(!we)return ju(e),we=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Do(e.type,e.memoizedProps)),l=!l),l&&Xe&&Hl(e),ju(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Xe=Kf(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));Xe=Kf(e)}else t===27?(t=Xe,Il(e.type)?(e=qo,qo=null,Xe=e):Xe=t):Xe=vt?tl(e.stateNode.nextSibling):null;return!0}function ma(){Xe=vt=null,we=!1}function vi(){var e=Bl;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),Bl=null),e}function An(e){Bl===null?Bl=[e]:Bl.push(e)}var yi=S(null),ha=null,gl=null;function Ul(e,t,l){P(yi,t._currentValue),t._currentValue=l}function bl(e){e._currentValue=yi.current,D(yi)}function gi(e,t,l){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===l)break;e=e.return}}function bi(e,t,l,n){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var i=r.dependencies;if(i!==null){var d=r.child;i=i.firstContext;e:for(;i!==null;){var h=i;i=r;for(var E=0;E<t.length;E++)if(h.context===t[E]){i.lanes|=l,h=i.alternate,h!==null&&(h.lanes|=l),gi(i.return,l,e),n||(d=null);break e}i=h.next}}else if(r.tag===18){if(d=r.return,d===null)throw Error(u(341));d.lanes|=l,i=d.alternate,i!==null&&(i.lanes|=l),gi(d,l,e),d=null}else d=r.child;if(d!==null)d.return=r;else for(d=r;d!==null;){if(d===e){d=null;break}if(r=d.sibling,r!==null){r.return=d.return,d=r;break}d=d.return}r=d}}function Qa(e,t,l,n){e=null;for(var r=t,i=!1;r!==null;){if(!i){if((r.flags&524288)!==0)i=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var d=r.alternate;if(d===null)throw Error(u(387));if(d=d.memoizedProps,d!==null){var h=r.type;Ht(r.pendingProps.value,d.value)||(e!==null?e.push(h):e=[h])}}else if(r===me.current){if(d=r.alternate,d===null)throw Error(u(387));d.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(ls):e=[ls])}r=r.return}e!==null&&bi(t,e,l,n),t.flags|=262144}function As(e){for(e=e.firstContext;e!==null;){if(!Ht(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function va(e){ha=e,gl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return Su(ha,e)}function Rs(e,t){return ha===null&&va(e),Su(e,t)}function Su(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},gl===null){if(e===null)throw Error(u(308));gl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else gl=gl.next=t;return l}var xm=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},pm=s.unstable_scheduleCallback,mm=s.unstable_NormalPriority,rt={$$typeof:W,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ji(){return{controller:new xm,data:new Map,refCount:0}}function Rn(e){e.refCount--,e.refCount===0&&pm(mm,function(){e.controller.abort()})}var _n=null,Si=0,Xa=0,Ka=null;function hm(e,t){if(_n===null){var l=_n=[];Si=0,Xa=Co(),Ka={status:"pending",value:void 0,then:function(n){l.push(n)}}}return Si++,t.then(Nu,Nu),t}function Nu(){if(--Si===0&&_n!==null){Ka!==null&&(Ka.status="fulfilled");var e=_n;_n=null,Xa=0,Ka=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function vm(e,t){var l=[],n={status:"pending",value:null,reason:null,then:function(r){l.push(r)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var r=0;r<l.length;r++)(0,l[r])(t)},function(r){for(n.status="rejected",n.reason=r,r=0;r<l.length;r++)(0,l[r])(void 0)}),n}var Eu=N.S;N.S=function(e,t){of=We(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&hm(e,t),Eu!==null&&Eu(e,t)};var ya=S(null);function Ni(){var e=ya.current;return e!==null?e:Ge.pooledCache}function _s(e,t){t===null?P(ya,ya.current):P(ya,t.pool)}function ku(){var e=Ni();return e===null?null:{parent:rt._currentValue,pool:e}}var Za=Error(u(460)),Ei=Error(u(474)),Ms=Error(u(542)),Ls={then:function(){}};function Cu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Tu(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ml,ml),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Au(e),e;default:if(typeof t.status=="string")t.then(ml,ml);else{if(e=Ge,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=n}},function(n){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Au(e),e}throw ba=t,Za}}function ga(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ba=l,Za):l}}var ba=null;function wu(){if(ba===null)throw Error(u(459));var e=ba;return ba=null,e}function Au(e){if(e===Za||e===Ms)throw Error(u(483))}var Ja=null,Mn=0;function zs(e){var t=Mn;return Mn+=1,Ja===null&&(Ja=[]),Tu(Ja,e,t)}function Ln(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ds(e,t){throw t.$$typeof===k?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Ru(e){function t(A,C){if(e){var _=A.deletions;_===null?(A.deletions=[C],A.flags|=16):_.push(C)}}function l(A,C){if(!e)return null;for(;C!==null;)t(A,C),C=C.sibling;return null}function n(A){for(var C=new Map;A!==null;)A.key!==null?C.set(A.key,A):C.set(A.index,A),A=A.sibling;return C}function r(A,C){return A=vl(A,C),A.index=0,A.sibling=null,A}function i(A,C,_){return A.index=_,e?(_=A.alternate,_!==null?(_=_.index,_<C?(A.flags|=67108866,C):_):(A.flags|=67108866,C)):(A.flags|=1048576,C)}function d(A){return e&&A.alternate===null&&(A.flags|=67108866),A}function h(A,C,_,$){return C===null||C.tag!==6?(C=fi(_,A.mode,$),C.return=A,C):(C=r(C,_),C.return=A,C)}function E(A,C,_,$){var pe=_.type;return pe===L?V(A,C,_.props.children,$,_.key):C!==null&&(C.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===I&&ga(pe)===C.type)?(C=r(C,_.props),Ln(C,_),C.return=A,C):(C=Ts(_.type,_.key,_.props,null,A.mode,$),Ln(C,_),C.return=A,C)}function M(A,C,_,$){return C===null||C.tag!==4||C.stateNode.containerInfo!==_.containerInfo||C.stateNode.implementation!==_.implementation?(C=xi(_,A.mode,$),C.return=A,C):(C=r(C,_.children||[]),C.return=A,C)}function V(A,C,_,$,pe){return C===null||C.tag!==7?(C=pa(_,A.mode,$,pe),C.return=A,C):(C=r(C,_),C.return=A,C)}function Q(A,C,_){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=fi(""+C,A.mode,_),C.return=A,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case R:return _=Ts(C.type,C.key,C.props,null,A.mode,_),Ln(_,C),_.return=A,_;case U:return C=xi(C,A.mode,_),C.return=A,C;case I:return C=ga(C),Q(A,C,_)}if(T(C)||te(C))return C=pa(C,A.mode,_,null),C.return=A,C;if(typeof C.then=="function")return Q(A,zs(C),_);if(C.$$typeof===W)return Q(A,Rs(A,C),_);Ds(A,C)}return null}function z(A,C,_,$){var pe=C!==null?C.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return pe!==null?null:h(A,C,""+_,$);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case R:return _.key===pe?E(A,C,_,$):null;case U:return _.key===pe?M(A,C,_,$):null;case I:return _=ga(_),z(A,C,_,$)}if(T(_)||te(_))return pe!==null?null:V(A,C,_,$,null);if(typeof _.then=="function")return z(A,C,zs(_),$);if(_.$$typeof===W)return z(A,C,Rs(A,_),$);Ds(A,_)}return null}function H(A,C,_,$,pe){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return A=A.get(_)||null,h(C,A,""+$,pe);if(typeof $=="object"&&$!==null){switch($.$$typeof){case R:return A=A.get($.key===null?_:$.key)||null,E(C,A,$,pe);case U:return A=A.get($.key===null?_:$.key)||null,M(C,A,$,pe);case I:return $=ga($),H(A,C,_,$,pe)}if(T($)||te($))return A=A.get(_)||null,V(C,A,$,pe,null);if(typeof $.then=="function")return H(A,C,_,zs($),pe);if($.$$typeof===W)return H(A,C,_,Rs(C,$),pe);Ds(C,$)}return null}function oe(A,C,_,$){for(var pe=null,_e=null,fe=C,Ne=C=0,Te=null;fe!==null&&Ne<_.length;Ne++){fe.index>Ne?(Te=fe,fe=null):Te=fe.sibling;var Me=z(A,fe,_[Ne],$);if(Me===null){fe===null&&(fe=Te);break}e&&fe&&Me.alternate===null&&t(A,fe),C=i(Me,C,Ne),_e===null?pe=Me:_e.sibling=Me,_e=Me,fe=Te}if(Ne===_.length)return l(A,fe),we&&yl(A,Ne),pe;if(fe===null){for(;Ne<_.length;Ne++)fe=Q(A,_[Ne],$),fe!==null&&(C=i(fe,C,Ne),_e===null?pe=fe:_e.sibling=fe,_e=fe);return we&&yl(A,Ne),pe}for(fe=n(fe);Ne<_.length;Ne++)Te=H(fe,A,Ne,_[Ne],$),Te!==null&&(e&&Te.alternate!==null&&fe.delete(Te.key===null?Ne:Te.key),C=i(Te,C,Ne),_e===null?pe=Te:_e.sibling=Te,_e=Te);return e&&fe.forEach(function(aa){return t(A,aa)}),we&&yl(A,Ne),pe}function ve(A,C,_,$){if(_==null)throw Error(u(151));for(var pe=null,_e=null,fe=C,Ne=C=0,Te=null,Me=_.next();fe!==null&&!Me.done;Ne++,Me=_.next()){fe.index>Ne?(Te=fe,fe=null):Te=fe.sibling;var aa=z(A,fe,Me.value,$);if(aa===null){fe===null&&(fe=Te);break}e&&fe&&aa.alternate===null&&t(A,fe),C=i(aa,C,Ne),_e===null?pe=aa:_e.sibling=aa,_e=aa,fe=Te}if(Me.done)return l(A,fe),we&&yl(A,Ne),pe;if(fe===null){for(;!Me.done;Ne++,Me=_.next())Me=Q(A,Me.value,$),Me!==null&&(C=i(Me,C,Ne),_e===null?pe=Me:_e.sibling=Me,_e=Me);return we&&yl(A,Ne),pe}for(fe=n(fe);!Me.done;Ne++,Me=_.next())Me=H(fe,A,Ne,Me.value,$),Me!==null&&(e&&Me.alternate!==null&&fe.delete(Me.key===null?Ne:Me.key),C=i(Me,C,Ne),_e===null?pe=Me:_e.sibling=Me,_e=Me);return e&&fe.forEach(function(wh){return t(A,wh)}),we&&yl(A,Ne),pe}function qe(A,C,_,$){if(typeof _=="object"&&_!==null&&_.type===L&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case R:e:{for(var pe=_.key;C!==null;){if(C.key===pe){if(pe=_.type,pe===L){if(C.tag===7){l(A,C.sibling),$=r(C,_.props.children),$.return=A,A=$;break e}}else if(C.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===I&&ga(pe)===C.type){l(A,C.sibling),$=r(C,_.props),Ln($,_),$.return=A,A=$;break e}l(A,C);break}else t(A,C);C=C.sibling}_.type===L?($=pa(_.props.children,A.mode,$,_.key),$.return=A,A=$):($=Ts(_.type,_.key,_.props,null,A.mode,$),Ln($,_),$.return=A,A=$)}return d(A);case U:e:{for(pe=_.key;C!==null;){if(C.key===pe)if(C.tag===4&&C.stateNode.containerInfo===_.containerInfo&&C.stateNode.implementation===_.implementation){l(A,C.sibling),$=r(C,_.children||[]),$.return=A,A=$;break e}else{l(A,C);break}else t(A,C);C=C.sibling}$=xi(_,A.mode,$),$.return=A,A=$}return d(A);case I:return _=ga(_),qe(A,C,_,$)}if(T(_))return oe(A,C,_,$);if(te(_)){if(pe=te(_),typeof pe!="function")throw Error(u(150));return _=pe.call(_),ve(A,C,_,$)}if(typeof _.then=="function")return qe(A,C,zs(_),$);if(_.$$typeof===W)return qe(A,C,Rs(A,_),$);Ds(A,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,C!==null&&C.tag===6?(l(A,C.sibling),$=r(C,_),$.return=A,A=$):(l(A,C),$=fi(_,A.mode,$),$.return=A,A=$),d(A)):l(A,C)}return function(A,C,_,$){try{Mn=0;var pe=qe(A,C,_,$);return Ja=null,pe}catch(fe){if(fe===Za||fe===Ms)throw fe;var _e=Ut(29,fe,null,A.mode);return _e.lanes=$,_e.return=A,_e}finally{}}}var ja=Ru(!0),_u=Ru(!1),ql=!1;function ki(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ci(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 Vl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Gl(e,t,l){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Le&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Cs(e),pu(e,null,l),t}return ks(e,n,t,l),Cs(e)}function zn(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,Sc(e,l)}}function Ti(e,t){var l=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,l===n)){var r=null,i=null;if(l=l.firstBaseUpdate,l!==null){do{var d={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};i===null?r=i=d:i=i.next=d,l=l.next}while(l!==null);i===null?r=i=t:i=i.next=t}else r=i=t;l={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:n.shared,callbacks:n.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var wi=!1;function Dn(){if(wi){var e=Ka;if(e!==null)throw e}}function On(e,t,l,n){wi=!1;var r=e.updateQueue;ql=!1;var i=r.firstBaseUpdate,d=r.lastBaseUpdate,h=r.shared.pending;if(h!==null){r.shared.pending=null;var E=h,M=E.next;E.next=null,d===null?i=M:d.next=M,d=E;var V=e.alternate;V!==null&&(V=V.updateQueue,h=V.lastBaseUpdate,h!==d&&(h===null?V.firstBaseUpdate=M:h.next=M,V.lastBaseUpdate=E))}if(i!==null){var Q=r.baseState;d=0,V=M=E=null,h=i;do{var z=h.lane&-536870913,H=z!==h.lane;if(H?(Ce&z)===z:(n&z)===z){z!==0&&z===Xa&&(wi=!0),V!==null&&(V=V.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});e:{var oe=e,ve=h;z=t;var qe=l;switch(ve.tag){case 1:if(oe=ve.payload,typeof oe=="function"){Q=oe.call(qe,Q,z);break e}Q=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=ve.payload,z=typeof oe=="function"?oe.call(qe,Q,z):oe,z==null)break e;Q=y({},Q,z);break e;case 2:ql=!0}}z=h.callback,z!==null&&(e.flags|=64,H&&(e.flags|=8192),H=r.callbacks,H===null?r.callbacks=[z]:H.push(z))}else H={lane:z,tag:h.tag,payload:h.payload,callback:h.callback,next:null},V===null?(M=V=H,E=Q):V=V.next=H,d|=z;if(h=h.next,h===null){if(h=r.shared.pending,h===null)break;H=h,h=H.next,H.next=null,r.lastBaseUpdate=H,r.shared.pending=null}}while(!0);V===null&&(E=Q),r.baseState=E,r.firstBaseUpdate=M,r.lastBaseUpdate=V,i===null&&(r.shared.lanes=0),Kl|=d,e.lanes=d,e.memoizedState=Q}}function Mu(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function Lu(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Mu(l[e],t)}var Wa=S(null),Os=S(0);function zu(e,t){e=Al,P(Os,e),P(Wa,t),Al=e|t.baseLanes}function Ai(){P(Os,Al),P(Wa,Wa.current)}function Ri(){Al=Os.current,D(Wa),D(Os)}var qt=S(null),el=null;function Yl(e){var t=e.alternate;P(tt,tt.current&1),P(qt,e),el===null&&(t===null||Wa.current!==null||t.memoizedState!==null)&&(el=e)}function _i(e){P(tt,tt.current),P(qt,e),el===null&&(el=e)}function Du(e){e.tag===22?(P(tt,tt.current),P(qt,e),el===null&&(el=e)):$l()}function $l(){P(tt,tt.current),P(qt,qt.current)}function Vt(e){D(qt),el===e&&(el=null),D(tt)}var tt=S(0);function Bs(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Ho(l)||Uo(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 jl=0,Se=null,He=null,it=null,Hs=!1,Fa=!1,Sa=!1,Us=0,Bn=0,Ia=null,ym=0;function Ie(){throw Error(u(321))}function Mi(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!Ht(e[l],t[l]))return!1;return!0}function Li(e,t,l,n,r,i){return jl=i,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?yd:Zi,Sa=!1,i=l(n,r),Sa=!1,Fa&&(i=Bu(t,l,n,r)),Ou(e),i}function Ou(e){N.H=qn;var t=He!==null&&He.next!==null;if(jl=0,it=He=Se=null,Hs=!1,Bn=0,Ia=null,t)throw Error(u(300));e===null||ot||(e=e.dependencies,e!==null&&As(e)&&(ot=!0))}function Bu(e,t,l,n){Se=e;var r=0;do{if(Fa&&(Ia=null),Bn=0,Fa=!1,25<=r)throw Error(u(301));if(r+=1,it=He=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}N.H=gd,i=t(l,n)}while(Fa);return i}function gm(){var e=N.H,t=e.useState()[0];return t=typeof t.then=="function"?Hn(t):t,e=e.useState()[0],(He!==null?He.memoizedState:null)!==e&&(Se.flags|=1024),t}function zi(){var e=Us!==0;return Us=0,e}function Di(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Oi(e){if(Hs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Hs=!1}jl=0,it=He=Se=null,Fa=!1,Bn=Us=0,Ia=null}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return it===null?Se.memoizedState=it=e:it=it.next=e,it}function lt(){if(He===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=He.next;var t=it===null?Se.memoizedState:it.next;if(t!==null)it=t,He=e;else{if(e===null)throw Se.alternate===null?Error(u(467)):Error(u(310));He=e,e={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},it===null?Se.memoizedState=it=e:it=it.next=e}return it}function qs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Hn(e){var t=Bn;return Bn+=1,Ia===null&&(Ia=[]),e=Tu(Ia,e,t),t=Se,(it===null?t.memoizedState:it.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?yd:Zi),e}function Vs(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Hn(e);if(e.$$typeof===W)return yt(e)}throw Error(u(438,String(e)))}function Bi(e){var t=null,l=Se.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var n=Se.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=qs(),Se.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),n=0;n<e;n++)l[n]=X;return t.index++,l}function Sl(e,t){return typeof t=="function"?t(e):t}function Gs(e){var t=lt();return Hi(t,He,e)}function Hi(e,t,l){var n=e.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=l;var r=e.baseQueue,i=n.pending;if(i!==null){if(r!==null){var d=r.next;r.next=i.next,i.next=d}t.baseQueue=r=i,n.pending=null}if(i=e.baseState,r===null)e.memoizedState=i;else{t=r.next;var h=d=null,E=null,M=t,V=!1;do{var Q=M.lane&-536870913;if(Q!==M.lane?(Ce&Q)===Q:(jl&Q)===Q){var z=M.revertLane;if(z===0)E!==null&&(E=E.next={lane:0,revertLane:0,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null}),Q===Xa&&(V=!0);else if((jl&z)===z){M=M.next,z===Xa&&(V=!0);continue}else Q={lane:0,revertLane:M.revertLane,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},E===null?(h=E=Q,d=i):E=E.next=Q,Se.lanes|=z,Kl|=z;Q=M.action,Sa&&l(i,Q),i=M.hasEagerState?M.eagerState:l(i,Q)}else z={lane:Q,revertLane:M.revertLane,gesture:M.gesture,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},E===null?(h=E=z,d=i):E=E.next=z,Se.lanes|=Q,Kl|=Q;M=M.next}while(M!==null&&M!==t);if(E===null?d=i:E.next=h,!Ht(i,e.memoizedState)&&(ot=!0,V&&(l=Ka,l!==null)))throw l;e.memoizedState=i,e.baseState=d,e.baseQueue=E,n.lastRenderedState=i}return r===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function Ui(e){var t=lt(),l=t.queue;if(l===null)throw Error(u(311));l.lastRenderedReducer=e;var n=l.dispatch,r=l.pending,i=t.memoizedState;if(r!==null){l.pending=null;var d=r=r.next;do i=e(i,d.action),d=d.next;while(d!==r);Ht(i,t.memoizedState)||(ot=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),l.lastRenderedState=i}return[i,n]}function Hu(e,t,l){var n=Se,r=lt(),i=we;if(i){if(l===void 0)throw Error(u(407));l=l()}else l=t();var d=!Ht((He||r).memoizedState,l);if(d&&(r.memoizedState=l,ot=!0),r=r.queue,Gi(Vu.bind(null,n,r,e),[e]),r.getSnapshot!==t||d||it!==null&&it.memoizedState.tag&1){if(n.flags|=2048,Pa(9,{destroy:void 0},qu.bind(null,n,r,l,t),null),Ge===null)throw Error(u(349));i||(jl&127)!==0||Uu(n,t,l)}return l}function Uu(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Se.updateQueue,t===null?(t=qs(),Se.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function qu(e,t,l,n){t.value=l,t.getSnapshot=n,Gu(t)&&Yu(e)}function Vu(e,t,l){return l(function(){Gu(t)&&Yu(e)})}function Gu(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!Ht(e,l)}catch{return!0}}function Yu(e){var t=xa(e,2);t!==null&&zt(t,e,2)}function qi(e){var t=St();if(typeof e=="function"){var l=e;if(e=l(),Sa){nt(!0);try{l()}finally{nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:e},t}function $u(e,t,l,n){return e.baseState=l,Hi(e,He,typeof n=="function"?n:Sl)}function bm(e,t,l,n,r){if(Qs(e))throw Error(u(485));if(e=t.action,e!==null){var i={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(d){i.listeners.push(d)}};N.T!==null?l(!0):i.isTransition=!1,n(i),l=t.pending,l===null?(i.next=t.pending=i,Qu(t,i)):(i.next=l.next,t.pending=l.next=i)}}function Qu(e,t){var l=t.action,n=t.payload,r=e.state;if(t.isTransition){var i=N.T,d={};N.T=d;try{var h=l(r,n),E=N.S;E!==null&&E(d,h),Xu(e,t,h)}catch(M){Vi(e,t,M)}finally{i!==null&&d.types!==null&&(i.types=d.types),N.T=i}}else try{i=l(r,n),Xu(e,t,i)}catch(M){Vi(e,t,M)}}function Xu(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(n){Ku(e,t,n)},function(n){return Vi(e,t,n)}):Ku(e,t,l)}function Ku(e,t,l){t.status="fulfilled",t.value=l,Zu(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Qu(e,l)))}function Vi(e,t,l){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=l,Zu(t),t=t.next;while(t!==n)}e.action=null}function Zu(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ju(e,t){return t}function Wu(e,t){if(we){var l=Ge.formState;if(l!==null){e:{var n=Se;if(we){if(Xe){t:{for(var r=Xe,i=Pt;r.nodeType!==8;){if(!i){r=null;break t}if(r=tl(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){Xe=tl(r.nextSibling),n=r.data==="F!";break e}}Hl(n)}n=!1}n&&(t=l[0])}}return l=St(),l.memoizedState=l.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ju,lastRenderedState:t},l.queue=n,l=md.bind(null,Se,n),n.dispatch=l,n=qi(!1),i=Ki.bind(null,Se,!1,n.queue),n=St(),r={state:t,dispatch:null,action:e,pending:null},n.queue=r,l=bm.bind(null,Se,r,i,l),r.dispatch=l,n.memoizedState=e,[t,l,!1]}function Fu(e){var t=lt();return Iu(t,He,e)}function Iu(e,t,l){if(t=Hi(e,t,Ju)[0],e=Gs(Sl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=Hn(t)}catch(d){throw d===Za?Ms:d}else n=t;t=lt();var r=t.queue,i=r.dispatch;return l!==t.memoizedState&&(Se.flags|=2048,Pa(9,{destroy:void 0},jm.bind(null,r,l),null)),[n,i,e]}function jm(e,t){e.action=t}function Pu(e){var t=lt(),l=He;if(l!==null)return Iu(t,l,e);lt(),t=t.memoizedState,l=lt();var n=l.queue.dispatch;return l.memoizedState=e,[t,n,!1]}function Pa(e,t,l,n){return e={tag:e,create:l,deps:n,inst:t,next:null},t=Se.updateQueue,t===null&&(t=qs(),Se.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(n=l.next,l.next=e,e.next=n,t.lastEffect=e),e}function ed(){return lt().memoizedState}function Ys(e,t,l,n){var r=St();Se.flags|=e,r.memoizedState=Pa(1|t,{destroy:void 0},l,n===void 0?null:n)}function $s(e,t,l,n){var r=lt();n=n===void 0?null:n;var i=r.memoizedState.inst;He!==null&&n!==null&&Mi(n,He.memoizedState.deps)?r.memoizedState=Pa(t,i,l,n):(Se.flags|=e,r.memoizedState=Pa(1|t,i,l,n))}function td(e,t){Ys(8390656,8,e,t)}function Gi(e,t){$s(2048,8,e,t)}function Sm(e){Se.flags|=4;var t=Se.updateQueue;if(t===null)t=qs(),Se.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function ld(e){var t=lt().memoizedState;return Sm({ref:t,nextImpl:e}),function(){if((Le&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function ad(e,t){return $s(4,2,e,t)}function nd(e,t){return $s(4,4,e,t)}function sd(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 rd(e,t,l){l=l!=null?l.concat([e]):null,$s(4,4,sd.bind(null,t,e),l)}function Yi(){}function id(e,t){var l=lt();t=t===void 0?null:t;var n=l.memoizedState;return t!==null&&Mi(t,n[1])?n[0]:(l.memoizedState=[e,t],e)}function od(e,t){var l=lt();t=t===void 0?null:t;var n=l.memoizedState;if(t!==null&&Mi(t,n[1]))return n[0];if(n=e(),Sa){nt(!0);try{e()}finally{nt(!1)}}return l.memoizedState=[n,t],n}function $i(e,t,l){return l===void 0||(jl&1073741824)!==0&&(Ce&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=uf(),Se.lanes|=e,Kl|=e,l)}function cd(e,t,l,n){return Ht(l,t)?l:Wa.current!==null?(e=$i(e,l,n),Ht(e,t)||(ot=!0),e):(jl&42)===0||(jl&1073741824)!==0&&(Ce&261930)===0?(ot=!0,e.memoizedState=l):(e=uf(),Se.lanes|=e,Kl|=e,t)}function ud(e,t,l,n,r){var i=w.p;w.p=i!==0&&8>i?i:8;var d=N.T,h={};N.T=h,Ki(e,!1,t,l);try{var E=r(),M=N.S;if(M!==null&&M(h,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var V=vm(E,n);Un(e,t,V,$t(e))}else Un(e,t,n,$t(e))}catch(Q){Un(e,t,{then:function(){},status:"rejected",reason:Q},$t())}finally{w.p=i,d!==null&&h.types!==null&&(d.types=h.types),N.T=d}}function Nm(){}function Qi(e,t,l,n){if(e.tag!==5)throw Error(u(476));var r=dd(e).queue;ud(e,r,t,ee,l===null?Nm:function(){return fd(e),l(n)})}function dd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:ee},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function fd(e){var t=dd(e);t.next===null&&(t=e.alternate.memoizedState),Un(e,t.next.queue,{},$t())}function Xi(){return yt(ls)}function xd(){return lt().memoizedState}function pd(){return lt().memoizedState}function Em(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=$t();e=Vl(l);var n=Gl(t,e,l);n!==null&&(zt(n,t,l),zn(n,t,l)),t={cache:ji()},e.payload=t;return}t=t.return}}function km(e,t,l){var n=$t();l={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Qs(e)?hd(t,l):(l=ui(e,t,l,n),l!==null&&(zt(l,e,n),vd(l,t,n)))}function md(e,t,l){var n=$t();Un(e,t,l,n)}function Un(e,t,l,n){var r={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Qs(e))hd(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var d=t.lastRenderedState,h=i(d,l);if(r.hasEagerState=!0,r.eagerState=h,Ht(h,d))return ks(e,t,r,0),Ge===null&&Es(),!1}catch{}finally{}if(l=ui(e,t,r,n),l!==null)return zt(l,e,n),vd(l,t,n),!0}return!1}function Ki(e,t,l,n){if(n={lane:2,revertLane:Co(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Qs(e)){if(t)throw Error(u(479))}else t=ui(e,l,n,2),t!==null&&zt(t,e,2)}function Qs(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function hd(e,t){Fa=Hs=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function vd(e,t,l){if((l&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,Sc(e,l)}}var qn={readContext:yt,use:Vs,useCallback:Ie,useContext:Ie,useEffect:Ie,useImperativeHandle:Ie,useLayoutEffect:Ie,useInsertionEffect:Ie,useMemo:Ie,useReducer:Ie,useRef:Ie,useState:Ie,useDebugValue:Ie,useDeferredValue:Ie,useTransition:Ie,useSyncExternalStore:Ie,useId:Ie,useHostTransitionStatus:Ie,useFormState:Ie,useActionState:Ie,useOptimistic:Ie,useMemoCache:Ie,useCacheRefresh:Ie};qn.useEffectEvent=Ie;var yd={readContext:yt,use:Vs,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:td,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Ys(4194308,4,sd.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Ys(4194308,4,e,t)},useInsertionEffect:function(e,t){Ys(4,2,e,t)},useMemo:function(e,t){var l=St();t=t===void 0?null:t;var n=e();if(Sa){nt(!0);try{e()}finally{nt(!1)}}return l.memoizedState=[n,t],n},useReducer:function(e,t,l){var n=St();if(l!==void 0){var r=l(t);if(Sa){nt(!0);try{l(t)}finally{nt(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=km.bind(null,Se,e),[n.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:function(e){e=qi(e);var t=e.queue,l=md.bind(null,Se,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Yi,useDeferredValue:function(e,t){var l=St();return $i(l,e,t)},useTransition:function(){var e=qi(!1);return e=ud.bind(null,Se,e.queue,!0,!1),St().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var n=Se,r=St();if(we){if(l===void 0)throw Error(u(407));l=l()}else{if(l=t(),Ge===null)throw Error(u(349));(Ce&127)!==0||Uu(n,t,l)}r.memoizedState=l;var i={value:l,getSnapshot:t};return r.queue=i,td(Vu.bind(null,n,i,e),[e]),n.flags|=2048,Pa(9,{destroy:void 0},qu.bind(null,n,i,l,t),null),l},useId:function(){var e=St(),t=Ge.identifierPrefix;if(we){var l=dl,n=ul;l=(n&~(1<<32-et(n)-1)).toString(32)+l,t="_"+t+"R_"+l,l=Us++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=ym++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Xi,useFormState:Wu,useActionState:Wu,useOptimistic:function(e){var t=St();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Ki.bind(null,Se,!0,l),l.dispatch=t,[e,t]},useMemoCache:Bi,useCacheRefresh:function(){return St().memoizedState=Em.bind(null,Se)},useEffectEvent:function(e){var t=St(),l={impl:e};return t.memoizedState=l,function(){if((Le&2)!==0)throw Error(u(440));return l.impl.apply(void 0,arguments)}}},Zi={readContext:yt,use:Vs,useCallback:id,useContext:yt,useEffect:Gi,useImperativeHandle:rd,useInsertionEffect:ad,useLayoutEffect:nd,useMemo:od,useReducer:Gs,useRef:ed,useState:function(){return Gs(Sl)},useDebugValue:Yi,useDeferredValue:function(e,t){var l=lt();return cd(l,He.memoizedState,e,t)},useTransition:function(){var e=Gs(Sl)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Hn(e),t]},useSyncExternalStore:Hu,useId:xd,useHostTransitionStatus:Xi,useFormState:Fu,useActionState:Fu,useOptimistic:function(e,t){var l=lt();return $u(l,He,e,t)},useMemoCache:Bi,useCacheRefresh:pd};Zi.useEffectEvent=ld;var gd={readContext:yt,use:Vs,useCallback:id,useContext:yt,useEffect:Gi,useImperativeHandle:rd,useInsertionEffect:ad,useLayoutEffect:nd,useMemo:od,useReducer:Ui,useRef:ed,useState:function(){return Ui(Sl)},useDebugValue:Yi,useDeferredValue:function(e,t){var l=lt();return He===null?$i(l,e,t):cd(l,He.memoizedState,e,t)},useTransition:function(){var e=Ui(Sl)[0],t=lt().memoizedState;return[typeof e=="boolean"?e:Hn(e),t]},useSyncExternalStore:Hu,useId:xd,useHostTransitionStatus:Xi,useFormState:Pu,useActionState:Pu,useOptimistic:function(e,t){var l=lt();return He!==null?$u(l,He,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Bi,useCacheRefresh:pd};gd.useEffectEvent=ld;function Ji(e,t,l,n){t=e.memoizedState,l=l(n,t),l=l==null?t:y({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Wi={enqueueSetState:function(e,t,l){e=e._reactInternals;var n=$t(),r=Vl(n);r.payload=t,l!=null&&(r.callback=l),t=Gl(e,r,n),t!==null&&(zt(t,e,n),zn(t,e,n))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var n=$t(),r=Vl(n);r.tag=1,r.payload=t,l!=null&&(r.callback=l),t=Gl(e,r,n),t!==null&&(zt(t,e,n),zn(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=$t(),n=Vl(l);n.tag=2,t!=null&&(n.callback=t),t=Gl(e,n,l),t!==null&&(zt(t,e,l),zn(t,e,l))}};function bd(e,t,l,n,r,i,d){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,d):t.prototype&&t.prototype.isPureReactComponent?!Cn(l,n)||!Cn(r,i):!0}function jd(e,t,l,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,n),t.state!==e&&Wi.enqueueReplaceState(t,t.state,null)}function Na(e,t){var l=t;if("ref"in t){l={};for(var n in t)n!=="ref"&&(l[n]=t[n])}if(e=e.defaultProps){l===t&&(l=y({},l));for(var r in e)l[r]===void 0&&(l[r]=e[r])}return l}function Sd(e){Ns(e)}function Nd(e){console.error(e)}function Ed(e){Ns(e)}function Xs(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function kd(e,t,l){try{var n=e.onCaughtError;n(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Fi(e,t,l){return l=Vl(l),l.tag=3,l.payload={element:null},l.callback=function(){Xs(e,t)},l}function Cd(e){return e=Vl(e),e.tag=3,e}function Td(e,t,l,n){var r=l.type.getDerivedStateFromError;if(typeof r=="function"){var i=n.value;e.payload=function(){return r(i)},e.callback=function(){kd(t,l,n)}}var d=l.stateNode;d!==null&&typeof d.componentDidCatch=="function"&&(e.callback=function(){kd(t,l,n),typeof r!="function"&&(Zl===null?Zl=new Set([this]):Zl.add(this));var h=n.stack;this.componentDidCatch(n.value,{componentStack:h!==null?h:""})})}function Cm(e,t,l,n,r){if(l.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=l.alternate,t!==null&&Qa(t,l,r,!0),l=qt.current,l!==null){switch(l.tag){case 31:case 13:return el===null?nr():l.alternate===null&&Pe===0&&(Pe=3),l.flags&=-257,l.flags|=65536,l.lanes=r,n===Ls?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([n]):t.add(n),No(e,n,r)),!1;case 22:return l.flags|=65536,n===Ls?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([n]):l.add(n)),No(e,n,r)),!1}throw Error(u(435,l.tag))}return No(e,n,r),nr(),!1}if(we)return t=qt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,n!==hi&&(e=Error(u(422),{cause:n}),An(Wt(e,l)))):(n!==hi&&(t=Error(u(423),{cause:n}),An(Wt(t,l))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,n=Wt(n,l),r=Fi(e.stateNode,n,r),Ti(e,r),Pe!==4&&(Pe=2)),!1;var i=Error(u(520),{cause:n});if(i=Wt(i,l),Zn===null?Zn=[i]:Zn.push(i),Pe!==4&&(Pe=2),t===null)return!0;n=Wt(n,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=r&-r,l.lanes|=e,e=Fi(l.stateNode,n,e),Ti(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"&&(Zl===null||!Zl.has(i))))return l.flags|=65536,r&=-r,l.lanes|=r,r=Cd(r),Td(r,e,l,n),Ti(l,r),!1}l=l.return}while(l!==null);return!1}var Ii=Error(u(461)),ot=!1;function gt(e,t,l,n){t.child=e===null?_u(t,null,l,n):ja(t,e.child,l,n)}function wd(e,t,l,n,r){l=l.render;var i=t.ref;if("ref"in n){var d={};for(var h in n)h!=="ref"&&(d[h]=n[h])}else d=n;return va(t),n=Li(e,t,l,d,i,r),h=zi(),e!==null&&!ot?(Di(e,t,r),Nl(e,t,r)):(we&&h&&pi(t),t.flags|=1,gt(e,t,n,r),t.child)}function Ad(e,t,l,n,r){if(e===null){var i=l.type;return typeof i=="function"&&!di(i)&&i.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=i,Rd(e,t,i,n,r)):(e=Ts(l.type,null,n,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!ro(e,r)){var d=i.memoizedProps;if(l=l.compare,l=l!==null?l:Cn,l(d,n)&&e.ref===t.ref)return Nl(e,t,r)}return t.flags|=1,e=vl(i,n),e.ref=t.ref,e.return=t,t.child=e}function Rd(e,t,l,n,r){if(e!==null){var i=e.memoizedProps;if(Cn(i,n)&&e.ref===t.ref)if(ot=!1,t.pendingProps=n=i,ro(e,r))(e.flags&131072)!==0&&(ot=!0);else return t.lanes=e.lanes,Nl(e,t,r)}return Pi(e,t,l,n,r)}function _d(e,t,l,n){var r=n.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(i=i!==null?i.baseLanes|l:l,e!==null){for(n=t.child=e.child,r=0;n!==null;)r=r|n.lanes|n.childLanes,n=n.sibling;n=r&~i}else n=0,t.child=null;return Md(e,t,i,l,n)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&_s(t,i!==null?i.cachePool:null),i!==null?zu(t,i):Ai(),Du(t);else return n=t.lanes=536870912,Md(e,t,i!==null?i.baseLanes|l:l,l,n)}else i!==null?(_s(t,i.cachePool),zu(t,i),$l(),t.memoizedState=null):(e!==null&&_s(t,null),Ai(),$l());return gt(e,t,r,l),t.child}function Vn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Md(e,t,l,n,r){var i=Ni();return i=i===null?null:{parent:rt._currentValue,pool:i},t.memoizedState={baseLanes:l,cachePool:i},e!==null&&_s(t,null),Ai(),Du(t),e!==null&&Qa(e,t,n,!0),t.childLanes=r,null}function Ks(e,t){return t=Js({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Ld(e,t,l){return ja(t,e.child,null,l),e=Ks(t,t.pendingProps),e.flags|=2,Vt(t),t.memoizedState=null,e}function Tm(e,t,l){var n=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(we){if(n.mode==="hidden")return e=Ks(t,n),t.lanes=536870912,Vn(null,e);if(_i(t),(e=Xe)?(e=Xf(e,Pt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ol!==null?{id:ul,overflow:dl}:null,retryLane:536870912,hydrationErrors:null},l=hu(e),l.return=t,t.child=l,vt=t,Xe=null)):e=null,e===null)throw Hl(t);return t.lanes=536870912,null}return Ks(t,n)}var i=e.memoizedState;if(i!==null){var d=i.dehydrated;if(_i(t),r)if(t.flags&256)t.flags&=-257,t=Ld(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(ot||Qa(e,t,l,!1),r=(l&e.childLanes)!==0,ot||r){if(n=Ge,n!==null&&(d=Nc(n,l),d!==0&&d!==i.retryLane))throw i.retryLane=d,xa(e,d),zt(n,e,d),Ii;nr(),t=Ld(e,t,l)}else e=i.treeContext,Xe=tl(d.nextSibling),vt=t,we=!0,Bl=null,Pt=!1,e!==null&&gu(t,e),t=Ks(t,n),t.flags|=4096;return t}return e=vl(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Zs(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(u(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Pi(e,t,l,n,r){return va(t),l=Li(e,t,l,n,void 0,r),n=zi(),e!==null&&!ot?(Di(e,t,r),Nl(e,t,r)):(we&&n&&pi(t),t.flags|=1,gt(e,t,l,r),t.child)}function zd(e,t,l,n,r,i){return va(t),t.updateQueue=null,l=Bu(t,n,l,r),Ou(e),n=zi(),e!==null&&!ot?(Di(e,t,i),Nl(e,t,i)):(we&&n&&pi(t),t.flags|=1,gt(e,t,l,i),t.child)}function Dd(e,t,l,n,r){if(va(t),t.stateNode===null){var i=Va,d=l.contextType;typeof d=="object"&&d!==null&&(i=yt(d)),i=new l(n,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Wi,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=n,i.state=t.memoizedState,i.refs={},ki(t),d=l.contextType,i.context=typeof d=="object"&&d!==null?yt(d):Va,i.state=t.memoizedState,d=l.getDerivedStateFromProps,typeof d=="function"&&(Ji(t,l,d,n),i.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(d=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),d!==i.state&&Wi.enqueueReplaceState(i,i.state,null),On(t,n,i,r),Dn(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){i=t.stateNode;var h=t.memoizedProps,E=Na(l,h);i.props=E;var M=i.context,V=l.contextType;d=Va,typeof V=="object"&&V!==null&&(d=yt(V));var Q=l.getDerivedStateFromProps;V=typeof Q=="function"||typeof i.getSnapshotBeforeUpdate=="function",h=t.pendingProps!==h,V||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(h||M!==d)&&jd(t,i,n,d),ql=!1;var z=t.memoizedState;i.state=z,On(t,n,i,r),Dn(),M=t.memoizedState,h||z!==M||ql?(typeof Q=="function"&&(Ji(t,l,Q,n),M=t.memoizedState),(E=ql||bd(t,l,E,n,z,M,d))?(V||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=n,t.memoizedState=M),i.props=n,i.state=M,i.context=d,n=E):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{i=t.stateNode,Ci(e,t),d=t.memoizedProps,V=Na(l,d),i.props=V,Q=t.pendingProps,z=i.context,M=l.contextType,E=Va,typeof M=="object"&&M!==null&&(E=yt(M)),h=l.getDerivedStateFromProps,(M=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(d!==Q||z!==E)&&jd(t,i,n,E),ql=!1,z=t.memoizedState,i.state=z,On(t,n,i,r),Dn();var H=t.memoizedState;d!==Q||z!==H||ql||e!==null&&e.dependencies!==null&&As(e.dependencies)?(typeof h=="function"&&(Ji(t,l,h,n),H=t.memoizedState),(V=ql||bd(t,l,V,n,z,H,E)||e!==null&&e.dependencies!==null&&As(e.dependencies))?(M||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(n,H,E),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(n,H,E)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=H),i.props=n,i.state=H,i.context=E,n=V):(typeof i.componentDidUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),n=!1)}return i=n,Zs(e,t),n=(t.flags&128)!==0,i||n?(i=t.stateNode,l=n&&typeof l.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&n?(t.child=ja(t,e.child,null,r),t.child=ja(t,null,l,r)):gt(e,t,l,r),t.memoizedState=i.state,e=t.child):e=Nl(e,t,r),e}function Od(e,t,l,n){return ma(),t.flags|=256,gt(e,t,l,n),t.child}var eo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function to(e){return{baseLanes:e,cachePool:ku()}}function lo(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=Yt),e}function Bd(e,t,l){var n=t.pendingProps,r=!1,i=(t.flags&128)!==0,d;if((d=i)||(d=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),d&&(r=!0,t.flags&=-129),d=(t.flags&32)!==0,t.flags&=-33,e===null){if(we){if(r?Yl(t):$l(),(e=Xe)?(e=Xf(e,Pt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ol!==null?{id:ul,overflow:dl}:null,retryLane:536870912,hydrationErrors:null},l=hu(e),l.return=t,t.child=l,vt=t,Xe=null)):e=null,e===null)throw Hl(t);return Uo(e)?t.lanes=32:t.lanes=536870912,null}var h=n.children;return n=n.fallback,r?($l(),r=t.mode,h=Js({mode:"hidden",children:h},r),n=pa(n,r,l,null),h.return=t,n.return=t,h.sibling=n,t.child=h,n=t.child,n.memoizedState=to(l),n.childLanes=lo(e,d,l),t.memoizedState=eo,Vn(null,n)):(Yl(t),ao(t,h))}var E=e.memoizedState;if(E!==null&&(h=E.dehydrated,h!==null)){if(i)t.flags&256?(Yl(t),t.flags&=-257,t=no(e,t,l)):t.memoizedState!==null?($l(),t.child=e.child,t.flags|=128,t=null):($l(),h=n.fallback,r=t.mode,n=Js({mode:"visible",children:n.children},r),h=pa(h,r,l,null),h.flags|=2,n.return=t,h.return=t,n.sibling=h,t.child=n,ja(t,e.child,null,l),n=t.child,n.memoizedState=to(l),n.childLanes=lo(e,d,l),t.memoizedState=eo,t=Vn(null,n));else if(Yl(t),Uo(h)){if(d=h.nextSibling&&h.nextSibling.dataset,d)var M=d.dgst;d=M,n=Error(u(419)),n.stack="",n.digest=d,An({value:n,source:null,stack:null}),t=no(e,t,l)}else if(ot||Qa(e,t,l,!1),d=(l&e.childLanes)!==0,ot||d){if(d=Ge,d!==null&&(n=Nc(d,l),n!==0&&n!==E.retryLane))throw E.retryLane=n,xa(e,n),zt(d,e,n),Ii;Ho(h)||nr(),t=no(e,t,l)}else Ho(h)?(t.flags|=192,t.child=e.child,t=null):(e=E.treeContext,Xe=tl(h.nextSibling),vt=t,we=!0,Bl=null,Pt=!1,e!==null&&gu(t,e),t=ao(t,n.children),t.flags|=4096);return t}return r?($l(),h=n.fallback,r=t.mode,E=e.child,M=E.sibling,n=vl(E,{mode:"hidden",children:n.children}),n.subtreeFlags=E.subtreeFlags&65011712,M!==null?h=vl(M,h):(h=pa(h,r,l,null),h.flags|=2),h.return=t,n.return=t,n.sibling=h,t.child=n,Vn(null,n),n=t.child,h=e.child.memoizedState,h===null?h=to(l):(r=h.cachePool,r!==null?(E=rt._currentValue,r=r.parent!==E?{parent:E,pool:E}:r):r=ku(),h={baseLanes:h.baseLanes|l,cachePool:r}),n.memoizedState=h,n.childLanes=lo(e,d,l),t.memoizedState=eo,Vn(e.child,n)):(Yl(t),l=e.child,e=l.sibling,l=vl(l,{mode:"visible",children:n.children}),l.return=t,l.sibling=null,e!==null&&(d=t.deletions,d===null?(t.deletions=[e],t.flags|=16):d.push(e)),t.child=l,t.memoizedState=null,l)}function ao(e,t){return t=Js({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Js(e,t){return e=Ut(22,e,null,t),e.lanes=0,e}function no(e,t,l){return ja(t,e.child,null,l),e=ao(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Hd(e,t,l){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),gi(e.return,t,l)}function so(e,t,l,n,r,i){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:l,tailMode:r,treeForkCount:i}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=n,d.tail=l,d.tailMode=r,d.treeForkCount=i)}function Ud(e,t,l){var n=t.pendingProps,r=n.revealOrder,i=n.tail;n=n.children;var d=tt.current,h=(d&2)!==0;if(h?(d=d&1|2,t.flags|=128):d&=1,P(tt,d),gt(e,t,n,l),n=we?wn:0,!h&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hd(e,l,t);else if(e.tag===19)Hd(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(r){case"forwards":for(l=t.child,r=null;l!==null;)e=l.alternate,e!==null&&Bs(e)===null&&(r=l),l=l.sibling;l=r,l===null?(r=t.child,t.child=null):(r=l.sibling,l.sibling=null),so(t,!1,r,l,i,n);break;case"backwards":case"unstable_legacy-backwards":for(l=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Bs(e)===null){t.child=r;break}e=r.sibling,r.sibling=l,l=r,r=e}so(t,!0,l,null,i,n);break;case"together":so(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function Nl(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Qa(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,l=vl(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=vl(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function ro(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&As(e)))}function wm(e,t,l){switch(t.tag){case 3:Oe(t,t.stateNode.containerInfo),Ul(t,rt,e.memoizedState.cache),ma();break;case 27:case 5:pt(t);break;case 4:Oe(t,t.stateNode.containerInfo);break;case 10:Ul(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,_i(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(Yl(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Bd(e,t,l):(Yl(t),e=Nl(e,t,l),e!==null?e.sibling:null);Yl(t);break;case 19:var r=(e.flags&128)!==0;if(n=(l&t.childLanes)!==0,n||(Qa(e,t,l,!1),n=(l&t.childLanes)!==0),r){if(n)return Ud(e,t,l);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),P(tt,tt.current),n)break;return null;case 22:return t.lanes=0,_d(e,t,l,t.pendingProps);case 24:Ul(t,rt,e.memoizedState.cache)}return Nl(e,t,l)}function qd(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)ot=!0;else{if(!ro(e,l)&&(t.flags&128)===0)return ot=!1,wm(e,t,l);ot=(e.flags&131072)!==0}else ot=!1,we&&(t.flags&1048576)!==0&&yu(t,wn,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=ga(t.elementType),t.type=e,typeof e=="function")di(e)?(n=Na(e,n),t.tag=1,t=Dd(null,t,e,n,l)):(t.tag=0,t=Pi(null,t,e,n,l));else{if(e!=null){var r=e.$$typeof;if(r===F){t.tag=11,t=wd(null,t,e,n,l);break e}else if(r===q){t.tag=14,t=Ad(null,t,e,n,l);break e}}throw t=he(e)||e,Error(u(306,t,""))}}return t;case 0:return Pi(e,t,t.type,t.pendingProps,l);case 1:return n=t.type,r=Na(n,t.pendingProps),Dd(e,t,n,r,l);case 3:e:{if(Oe(t,t.stateNode.containerInfo),e===null)throw Error(u(387));n=t.pendingProps;var i=t.memoizedState;r=i.element,Ci(e,t),On(t,n,null,l);var d=t.memoizedState;if(n=d.cache,Ul(t,rt,n),n!==i.cache&&bi(t,[rt],l,!0),Dn(),n=d.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:d.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=Od(e,t,n,l);break e}else if(n!==r){r=Wt(Error(u(424)),t),An(r),t=Od(e,t,n,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(Xe=tl(e.firstChild),vt=t,we=!0,Bl=null,Pt=!0,l=_u(t,null,n,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(ma(),n===r){t=Nl(e,t,l);break e}gt(e,t,n,l)}t=t.child}return t;case 26:return Zs(e,t),e===null?(l=If(t.type,null,t.pendingProps,null))?t.memoizedState=l:we||(l=t.type,e=t.pendingProps,n=dr(de.current).createElement(l),n[ht]=t,n[wt]=e,bt(n,l,e),ft(n),t.stateNode=n):t.memoizedState=If(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pt(t),e===null&&we&&(n=t.stateNode=Jf(t.type,t.pendingProps,de.current),vt=t,Pt=!0,r=Xe,Il(t.type)?(qo=r,Xe=tl(n.firstChild)):Xe=r),gt(e,t,t.pendingProps.children,l),Zs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&we&&((r=n=Xe)&&(n=nh(n,t.type,t.pendingProps,Pt),n!==null?(t.stateNode=n,vt=t,Xe=tl(n.firstChild),Pt=!1,r=!0):r=!1),r||Hl(t)),pt(t),r=t.type,i=t.pendingProps,d=e!==null?e.memoizedProps:null,n=i.children,Do(r,i)?n=null:d!==null&&Do(r,d)&&(t.flags|=32),t.memoizedState!==null&&(r=Li(e,t,gm,null,null,l),ls._currentValue=r),Zs(e,t),gt(e,t,n,l),t.child;case 6:return e===null&&we&&((e=l=Xe)&&(l=sh(l,t.pendingProps,Pt),l!==null?(t.stateNode=l,vt=t,Xe=null,e=!0):e=!1),e||Hl(t)),null;case 13:return Bd(e,t,l);case 4:return Oe(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ja(t,null,n,l):gt(e,t,n,l),t.child;case 11:return wd(e,t,t.type,t.pendingProps,l);case 7:return gt(e,t,t.pendingProps,l),t.child;case 8:return gt(e,t,t.pendingProps.children,l),t.child;case 12:return gt(e,t,t.pendingProps.children,l),t.child;case 10:return n=t.pendingProps,Ul(t,t.type,n.value),gt(e,t,n.children,l),t.child;case 9:return r=t.type._context,n=t.pendingProps.children,va(t),r=yt(r),n=n(r),t.flags|=1,gt(e,t,n,l),t.child;case 14:return Ad(e,t,t.type,t.pendingProps,l);case 15:return Rd(e,t,t.type,t.pendingProps,l);case 19:return Ud(e,t,l);case 31:return Tm(e,t,l);case 22:return _d(e,t,l,t.pendingProps);case 24:return va(t),n=yt(rt),e===null?(r=Ni(),r===null&&(r=Ge,i=ji(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=l),r=i),t.memoizedState={parent:n,cache:r},ki(t),Ul(t,rt,r)):((e.lanes&l)!==0&&(Ci(e,t),On(t,null,null,l),Dn()),r=e.memoizedState,i=t.memoizedState,r.parent!==n?(r={parent:n,cache:n},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Ul(t,rt,n)):(n=i.cache,Ul(t,rt,n),n!==r.cache&&bi(t,[rt],l,!0))),gt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function El(e){e.flags|=4}function io(e,t,l,n,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(pf())e.flags|=8192;else throw ba=Ls,Ei}else e.flags&=-16777217}function Vd(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ax(t))if(pf())e.flags|=8192;else throw ba=Ls,Ei}function Ws(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?bc():536870912,e.lanes|=t,an|=t)}function Gn(e,t){if(!we)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 n=null;l!==null;)l.alternate!==null&&(n=l),l=l.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Ke(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,n=0;if(t)for(var r=e.child;r!==null;)l|=r.lanes|r.childLanes,n|=r.subtreeFlags&65011712,n|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)l|=r.lanes|r.childLanes,n|=r.subtreeFlags,n|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=n,e.childLanes=l,t}function Am(e,t,l){var n=t.pendingProps;switch(mi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(t),null;case 1:return Ke(t),null;case 3:return l=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),bl(rt),Re(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&($a(t)?El(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,vi())),Ke(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(El(t),i!==null?(Ke(t),Vd(t,i)):(Ke(t),io(t,r,null,n,l))):i?i!==e.memoizedState?(El(t),Ke(t),Vd(t,i)):(Ke(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&El(t),Ke(t),io(t,r,e,n,l)),null;case 27:if(Dt(t),l=de.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&El(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return Ke(t),null}e=le.current,$a(t)?bu(t):(e=Jf(r,n,l),t.stateNode=e,El(t))}return Ke(t),null;case 5:if(Dt(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&El(t);else{if(!n){if(t.stateNode===null)throw Error(u(166));return Ke(t),null}if(i=le.current,$a(t))bu(t);else{var d=dr(de.current);switch(i){case 1:i=d.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:i=d.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":i=d.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":i=d.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":i=d.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof n.is=="string"?d.createElement("select",{is:n.is}):d.createElement("select"),n.multiple?i.multiple=!0:n.size&&(i.size=n.size);break;default:i=typeof n.is=="string"?d.createElement(r,{is:n.is}):d.createElement(r)}}i[ht]=t,i[wt]=n;e:for(d=t.child;d!==null;){if(d.tag===5||d.tag===6)i.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}t.stateNode=i;e:switch(bt(i,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&El(t)}}return Ke(t),io(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&El(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(u(166));if(e=de.current,$a(t)){if(e=t.stateNode,l=t.memoizedProps,n=null,r=vt,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[ht]=t,e=!!(e.nodeValue===l||n!==null&&n.suppressHydrationWarning===!0||Hf(e.nodeValue,l)),e||Hl(t,!0)}else e=dr(e).createTextNode(n),e[ht]=t,t.stateNode=e}return Ke(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(n=$a(t),l!==null){if(e===null){if(!n)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[ht]=t}else ma(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),e=!1}else l=vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(Vt(t),t):(Vt(t),null);if((t.flags&128)!==0)throw Error(u(558))}return Ke(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=$a(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(u(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(u(317));r[ht]=t}else ma(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),r=!1}else r=vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Vt(t),t):(Vt(t),null)}return Vt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=n!==null,e=e!==null&&e.memoizedState!==null,l&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==r&&(n.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Ws(t,t.updateQueue),Ke(t),null);case 4:return Re(),e===null&&Ro(t.stateNode.containerInfo),Ke(t),null;case 10:return bl(t.type),Ke(t),null;case 19:if(D(tt),n=t.memoizedState,n===null)return Ke(t),null;if(r=(t.flags&128)!==0,i=n.rendering,i===null)if(r)Gn(n,!1);else{if(Pe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=Bs(e),i!==null){for(t.flags|=128,Gn(n,!1),e=i.updateQueue,t.updateQueue=e,Ws(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)mu(l,e),l=l.sibling;return P(tt,tt.current&1|2),we&&yl(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&We()>tr&&(t.flags|=128,r=!0,Gn(n,!1),t.lanes=4194304)}else{if(!r)if(e=Bs(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Ws(t,e),Gn(n,!0),n.tail===null&&n.tailMode==="hidden"&&!i.alternate&&!we)return Ke(t),null}else 2*We()-n.renderingStartTime>tr&&l!==536870912&&(t.flags|=128,r=!0,Gn(n,!1),t.lanes=4194304);n.isBackwards?(i.sibling=t.child,t.child=i):(e=n.last,e!==null?e.sibling=i:t.child=i,n.last=i)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=We(),e.sibling=null,l=tt.current,P(tt,r?l&1|2:l&1),we&&yl(t,n.treeForkCount),e):(Ke(t),null);case 22:case 23:return Vt(t),Ri(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(l&536870912)!==0&&(t.flags&128)===0&&(Ke(t),t.subtreeFlags&6&&(t.flags|=8192)):Ke(t),l=t.updateQueue,l!==null&&Ws(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==l&&(t.flags|=2048),e!==null&&D(ya),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),bl(rt),Ke(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function Rm(e,t){switch(mi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bl(rt),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Dt(t),null;case 31:if(t.memoizedState!==null){if(Vt(t),t.alternate===null)throw Error(u(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Vt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return D(tt),null;case 4:return Re(),null;case 10:return bl(t.type),null;case 22:case 23:return Vt(t),Ri(),e!==null&&D(ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return bl(rt),null;case 25:return null;default:return null}}function Gd(e,t){switch(mi(t),t.tag){case 3:bl(rt),Re();break;case 26:case 27:case 5:Dt(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&Vt(t);break;case 13:Vt(t);break;case 19:D(tt);break;case 10:bl(t.type);break;case 22:case 23:Vt(t),Ri(),e!==null&&D(ya);break;case 24:bl(rt)}}function Yn(e,t){try{var l=t.updateQueue,n=l!==null?l.lastEffect:null;if(n!==null){var r=n.next;l=r;do{if((l.tag&e)===e){n=void 0;var i=l.create,d=l.inst;n=i(),d.destroy=n}l=l.next}while(l!==r)}}catch(h){De(t,t.return,h)}}function Ql(e,t,l){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){var d=n.inst,h=d.destroy;if(h!==void 0){d.destroy=void 0,r=t;var E=l,M=h;try{M()}catch(V){De(r,E,V)}}}n=n.next}while(n!==i)}}catch(V){De(t,t.return,V)}}function Yd(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Lu(t,l)}catch(n){De(e,e.return,n)}}}function $d(e,t,l){l.props=Na(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(n){De(e,t,n)}}function $n(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof l=="function"?e.refCleanup=l(n):l.current=n}}catch(r){De(e,t,r)}}function fl(e,t){var l=e.ref,n=e.refCleanup;if(l!==null)if(typeof n=="function")try{n()}catch(r){De(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(r){De(e,t,r)}else l.current=null}function Qd(e){var t=e.type,l=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break e;case"img":l.src?n.src=l.src:l.srcSet&&(n.srcset=l.srcSet)}}catch(r){De(e,e.return,r)}}function oo(e,t,l){try{var n=e.stateNode;Im(n,e.type,l,t),n[wt]=t}catch(r){De(e,e.return,r)}}function Xd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Il(e.type)||e.tag===4}function co(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xd(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&&Il(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 uo(e,t,l){var n=e.tag;if(n===5||n===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=ml));else if(n!==4&&(n===27&&Il(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(uo(e,t,l),e=e.sibling;e!==null;)uo(e,t,l),e=e.sibling}function Fs(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(n!==4&&(n===27&&Il(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Fs(e,t,l),e=e.sibling;e!==null;)Fs(e,t,l),e=e.sibling}function Kd(e){var t=e.stateNode,l=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);bt(t,n,l),t[ht]=e,t[wt]=l}catch(i){De(e,e.return,i)}}var kl=!1,ct=!1,fo=!1,Zd=typeof WeakSet=="function"?WeakSet:Set,xt=null;function _m(e,t){if(e=e.containerInfo,Lo=yr,e=ru(e),ni(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var n=l.getSelection&&l.getSelection();if(n&&n.rangeCount!==0){l=n.anchorNode;var r=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{l.nodeType,i.nodeType}catch{l=null;break e}var d=0,h=-1,E=-1,M=0,V=0,Q=e,z=null;t:for(;;){for(var H;Q!==l||r!==0&&Q.nodeType!==3||(h=d+r),Q!==i||n!==0&&Q.nodeType!==3||(E=d+n),Q.nodeType===3&&(d+=Q.nodeValue.length),(H=Q.firstChild)!==null;)z=Q,Q=H;for(;;){if(Q===e)break t;if(z===l&&++M===r&&(h=d),z===i&&++V===n&&(E=d),(H=Q.nextSibling)!==null)break;Q=z,z=Q.parentNode}Q=H}l=h===-1||E===-1?null:{start:h,end:E}}else l=null}l=l||{start:0,end:0}}else l=null;for(zo={focusedElem:e,selectionRange:l},yr=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,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++)r=e[l],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,l=t,r=i.memoizedProps,i=i.memoizedState,n=l.stateNode;try{var oe=Na(l.type,r);e=n.getSnapshotBeforeUpdate(oe,i),n.__reactInternalSnapshotBeforeUpdate=e}catch(ve){De(l,l.return,ve)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Bo(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Bo(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(u(163))}if(e=t.sibling,e!==null){e.return=t.return,xt=e;break}xt=t.return}}function Jd(e,t,l){var n=l.flags;switch(l.tag){case 0:case 11:case 15:Tl(e,l),n&4&&Yn(5,l);break;case 1:if(Tl(e,l),n&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(d){De(l,l.return,d)}else{var r=Na(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(d){De(l,l.return,d)}}n&64&&Yd(l),n&512&&$n(l,l.return);break;case 3:if(Tl(e,l),n&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{Lu(e,t)}catch(d){De(l,l.return,d)}}break;case 27:t===null&&n&4&&Kd(l);case 26:case 5:Tl(e,l),t===null&&n&4&&Qd(l),n&512&&$n(l,l.return);break;case 12:Tl(e,l);break;case 31:Tl(e,l),n&4&&Id(e,l);break;case 13:Tl(e,l),n&4&&Pd(e,l),n&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=qm.bind(null,l),rh(e,l))));break;case 22:if(n=l.memoizedState!==null||kl,!n){t=t!==null&&t.memoizedState!==null||ct,r=kl;var i=ct;kl=n,(ct=t)&&!i?wl(e,l,(l.subtreeFlags&8772)!==0):Tl(e,l),kl=r,ct=i}break;case 30:break;default:Tl(e,l)}}function Wd(e){var t=e.alternate;t!==null&&(e.alternate=null,Wd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Vr(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 Ze=null,Rt=!1;function Cl(e,t,l){for(l=l.child;l!==null;)Fd(e,t,l),l=l.sibling}function Fd(e,t,l){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Ct,l)}catch{}switch(l.tag){case 26:ct||fl(l,t),Cl(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:ct||fl(l,t);var n=Ze,r=Rt;Il(l.type)&&(Ze=l.stateNode,Rt=!1),Cl(e,t,l),Pn(l.stateNode),Ze=n,Rt=r;break;case 5:ct||fl(l,t);case 6:if(n=Ze,r=Rt,Ze=null,Cl(e,t,l),Ze=n,Rt=r,Ze!==null)if(Rt)try{(Ze.nodeType===9?Ze.body:Ze.nodeName==="HTML"?Ze.ownerDocument.body:Ze).removeChild(l.stateNode)}catch(i){De(l,t,i)}else try{Ze.removeChild(l.stateNode)}catch(i){De(l,t,i)}break;case 18:Ze!==null&&(Rt?(e=Ze,$f(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),fn(e)):$f(Ze,l.stateNode));break;case 4:n=Ze,r=Rt,Ze=l.stateNode.containerInfo,Rt=!0,Cl(e,t,l),Ze=n,Rt=r;break;case 0:case 11:case 14:case 15:Ql(2,l,t),ct||Ql(4,l,t),Cl(e,t,l);break;case 1:ct||(fl(l,t),n=l.stateNode,typeof n.componentWillUnmount=="function"&&$d(l,t,n)),Cl(e,t,l);break;case 21:Cl(e,t,l);break;case 22:ct=(n=ct)||l.memoizedState!==null,Cl(e,t,l),ct=n;break;default:Cl(e,t,l)}}function Id(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{fn(e)}catch(l){De(t,t.return,l)}}}function Pd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{fn(e)}catch(l){De(t,t.return,l)}}function Mm(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zd),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zd),t;default:throw Error(u(435,e.tag))}}function Is(e,t){var l=Mm(e);t.forEach(function(n){if(!l.has(n)){l.add(n);var r=Vm.bind(null,e,n);n.then(r,r)}})}function _t(e,t){var l=t.deletions;if(l!==null)for(var n=0;n<l.length;n++){var r=l[n],i=e,d=t,h=d;e:for(;h!==null;){switch(h.tag){case 27:if(Il(h.type)){Ze=h.stateNode,Rt=!1;break e}break;case 5:Ze=h.stateNode,Rt=!1;break e;case 3:case 4:Ze=h.stateNode.containerInfo,Rt=!0;break e}h=h.return}if(Ze===null)throw Error(u(160));Fd(i,d,r),Ze=null,Rt=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ef(t,e),t=t.sibling}var ol=null;function ef(e,t){var l=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_t(t,e),Mt(e),n&4&&(Ql(3,e,e.return),Yn(3,e),Ql(5,e,e.return));break;case 1:_t(t,e),Mt(e),n&512&&(ct||l===null||fl(l,l.return)),n&64&&kl&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?n:l.concat(n))));break;case 26:var r=ol;if(_t(t,e),Mt(e),n&512&&(ct||l===null||fl(l,l.return)),n&4){var i=l!==null?l.memoizedState:null;if(n=e.memoizedState,l===null)if(n===null)if(e.stateNode===null){e:{n=e.type,l=e.memoizedProps,r=r.ownerDocument||r;t:switch(n){case"title":i=r.getElementsByTagName("title")[0],(!i||i[vn]||i[ht]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(n),r.head.insertBefore(i,r.querySelector("head > title"))),bt(i,n,l),i[ht]=e,ft(i),n=i;break e;case"link":var d=tx("link","href",r).get(n+(l.href||""));if(d){for(var h=0;h<d.length;h++)if(i=d[h],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)){d.splice(h,1);break t}}i=r.createElement(n),bt(i,n,l),r.head.appendChild(i);break;case"meta":if(d=tx("meta","content",r).get(n+(l.content||""))){for(h=0;h<d.length;h++)if(i=d[h],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)){d.splice(h,1);break t}}i=r.createElement(n),bt(i,n,l),r.head.appendChild(i);break;default:throw Error(u(468,n))}i[ht]=e,ft(i),n=i}e.stateNode=n}else lx(r,e.type,e.stateNode);else e.stateNode=ex(r,n,e.memoizedProps);else i!==n?(i===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):i.count--,n===null?lx(r,e.type,e.stateNode):ex(r,n,e.memoizedProps)):n===null&&e.stateNode!==null&&oo(e,e.memoizedProps,l.memoizedProps)}break;case 27:_t(t,e),Mt(e),n&512&&(ct||l===null||fl(l,l.return)),l!==null&&n&4&&oo(e,e.memoizedProps,l.memoizedProps);break;case 5:if(_t(t,e),Mt(e),n&512&&(ct||l===null||fl(l,l.return)),e.flags&32){r=e.stateNode;try{za(r,"")}catch(oe){De(e,e.return,oe)}}n&4&&e.stateNode!=null&&(r=e.memoizedProps,oo(e,r,l!==null?l.memoizedProps:r)),n&1024&&(fo=!0);break;case 6:if(_t(t,e),Mt(e),n&4){if(e.stateNode===null)throw Error(u(162));n=e.memoizedProps,l=e.stateNode;try{l.nodeValue=n}catch(oe){De(e,e.return,oe)}}break;case 3:if(pr=null,r=ol,ol=fr(t.containerInfo),_t(t,e),ol=r,Mt(e),n&4&&l!==null&&l.memoizedState.isDehydrated)try{fn(t.containerInfo)}catch(oe){De(e,e.return,oe)}fo&&(fo=!1,tf(e));break;case 4:n=ol,ol=fr(e.stateNode.containerInfo),_t(t,e),Mt(e),ol=n;break;case 12:_t(t,e),Mt(e);break;case 31:_t(t,e),Mt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Is(e,n)));break;case 13:_t(t,e),Mt(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(er=We()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Is(e,n)));break;case 22:r=e.memoizedState!==null;var E=l!==null&&l.memoizedState!==null,M=kl,V=ct;if(kl=M||r,ct=V||E,_t(t,e),ct=V,kl=M,Mt(e),n&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(l===null||E||kl||ct||Ea(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){E=l=t;try{if(i=E.stateNode,r)d=i.style,typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none";else{h=E.stateNode;var Q=E.memoizedProps.style,z=Q!=null&&Q.hasOwnProperty("display")?Q.display:null;h.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(oe){De(E,E.return,oe)}}}else if(t.tag===6){if(l===null){E=t;try{E.stateNode.nodeValue=r?"":E.memoizedProps}catch(oe){De(E,E.return,oe)}}}else if(t.tag===18){if(l===null){E=t;try{var H=E.stateNode;r?Qf(H,!0):Qf(E.stateNode,!1)}catch(oe){De(E,E.return,oe)}}}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}n&4&&(n=e.updateQueue,n!==null&&(l=n.retryQueue,l!==null&&(n.retryQueue=null,Is(e,l))));break;case 19:_t(t,e),Mt(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Is(e,n)));break;case 30:break;case 21:break;default:_t(t,e),Mt(e)}}function Mt(e){var t=e.flags;if(t&2){try{for(var l,n=e.return;n!==null;){if(Xd(n)){l=n;break}n=n.return}if(l==null)throw Error(u(160));switch(l.tag){case 27:var r=l.stateNode,i=co(e);Fs(e,i,r);break;case 5:var d=l.stateNode;l.flags&32&&(za(d,""),l.flags&=-33);var h=co(e);Fs(e,h,d);break;case 3:case 4:var E=l.stateNode.containerInfo,M=co(e);uo(e,M,E);break;default:throw Error(u(161))}}catch(V){De(e,e.return,V)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function tf(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;tf(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Tl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Jd(e,t.alternate,t),t=t.sibling}function Ea(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ql(4,t,t.return),Ea(t);break;case 1:fl(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&$d(t,t.return,l),Ea(t);break;case 27:Pn(t.stateNode);case 26:case 5:fl(t,t.return),Ea(t);break;case 22:t.memoizedState===null&&Ea(t);break;case 30:Ea(t);break;default:Ea(t)}e=e.sibling}}function wl(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,r=e,i=t,d=i.flags;switch(i.tag){case 0:case 11:case 15:wl(r,i,l),Yn(4,i);break;case 1:if(wl(r,i,l),n=i,r=n.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(M){De(n,n.return,M)}if(n=i,r=n.updateQueue,r!==null){var h=n.stateNode;try{var E=r.shared.hiddenCallbacks;if(E!==null)for(r.shared.hiddenCallbacks=null,r=0;r<E.length;r++)Mu(E[r],h)}catch(M){De(n,n.return,M)}}l&&d&64&&Yd(i),$n(i,i.return);break;case 27:Kd(i);case 26:case 5:wl(r,i,l),l&&n===null&&d&4&&Qd(i),$n(i,i.return);break;case 12:wl(r,i,l);break;case 31:wl(r,i,l),l&&d&4&&Id(r,i);break;case 13:wl(r,i,l),l&&d&4&&Pd(r,i);break;case 22:i.memoizedState===null&&wl(r,i,l),$n(i,i.return);break;case 30:break;default:wl(r,i,l)}t=t.sibling}}function xo(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&&Rn(l))}function po(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Rn(e))}function cl(e,t,l,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)lf(e,t,l,n),t=t.sibling}function lf(e,t,l,n){var r=t.flags;switch(t.tag){case 0:case 11:case 15:cl(e,t,l,n),r&2048&&Yn(9,t);break;case 1:cl(e,t,l,n);break;case 3:cl(e,t,l,n),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Rn(e)));break;case 12:if(r&2048){cl(e,t,l,n),e=t.stateNode;try{var i=t.memoizedProps,d=i.id,h=i.onPostCommit;typeof h=="function"&&h(d,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(E){De(t,t.return,E)}}else cl(e,t,l,n);break;case 31:cl(e,t,l,n);break;case 13:cl(e,t,l,n);break;case 23:break;case 22:i=t.stateNode,d=t.alternate,t.memoizedState!==null?i._visibility&2?cl(e,t,l,n):Qn(e,t):i._visibility&2?cl(e,t,l,n):(i._visibility|=2,en(e,t,l,n,(t.subtreeFlags&10256)!==0||!1)),r&2048&&xo(d,t);break;case 24:cl(e,t,l,n),r&2048&&po(t.alternate,t);break;default:cl(e,t,l,n)}}function en(e,t,l,n,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,d=t,h=l,E=n,M=d.flags;switch(d.tag){case 0:case 11:case 15:en(i,d,h,E,r),Yn(8,d);break;case 23:break;case 22:var V=d.stateNode;d.memoizedState!==null?V._visibility&2?en(i,d,h,E,r):Qn(i,d):(V._visibility|=2,en(i,d,h,E,r)),r&&M&2048&&xo(d.alternate,d);break;case 24:en(i,d,h,E,r),r&&M&2048&&po(d.alternate,d);break;default:en(i,d,h,E,r)}t=t.sibling}}function Qn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,n=t,r=n.flags;switch(n.tag){case 22:Qn(l,n),r&2048&&xo(n.alternate,n);break;case 24:Qn(l,n),r&2048&&po(n.alternate,n);break;default:Qn(l,n)}t=t.sibling}}var Xn=8192;function tn(e,t,l){if(e.subtreeFlags&Xn)for(e=e.child;e!==null;)af(e,t,l),e=e.sibling}function af(e,t,l){switch(e.tag){case 26:tn(e,t,l),e.flags&Xn&&e.memoizedState!==null&&yh(l,ol,e.memoizedState,e.memoizedProps);break;case 5:tn(e,t,l);break;case 3:case 4:var n=ol;ol=fr(e.stateNode.containerInfo),tn(e,t,l),ol=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=Xn,Xn=16777216,tn(e,t,l),Xn=n):tn(e,t,l));break;default:tn(e,t,l)}}function nf(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 Kn(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];xt=n,rf(n,e)}nf(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)sf(e),e=e.sibling}function sf(e){switch(e.tag){case 0:case 11:case 15:Kn(e),e.flags&2048&&Ql(9,e,e.return);break;case 3:Kn(e);break;case 12:Kn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ps(e)):Kn(e);break;default:Kn(e)}}function Ps(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var n=t[l];xt=n,rf(n,e)}nf(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ql(8,t,t.return),Ps(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,Ps(t));break;default:Ps(t)}e=e.sibling}}function rf(e,t){for(;xt!==null;){var l=xt;switch(l.tag){case 0:case 11:case 15:Ql(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var n=l.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:Rn(l.memoizedState.cache)}if(n=l.child,n!==null)n.return=l,xt=n;else e:for(l=e;xt!==null;){n=xt;var r=n.sibling,i=n.return;if(Wd(n),n===l){xt=null;break e}if(r!==null){r.return=i,xt=r;break e}xt=i}}}var Lm={getCacheForType:function(e){var t=yt(rt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return yt(rt).controller.signal}},zm=typeof WeakMap=="function"?WeakMap:Map,Le=0,Ge=null,Ee=null,Ce=0,ze=0,Gt=null,Xl=!1,ln=!1,mo=!1,Al=0,Pe=0,Kl=0,ka=0,ho=0,Yt=0,an=0,Zn=null,Lt=null,vo=!1,er=0,of=0,tr=1/0,lr=null,Zl=null,dt=0,Jl=null,nn=null,Rl=0,yo=0,go=null,cf=null,Jn=0,bo=null;function $t(){return(Le&2)!==0&&Ce!==0?Ce&-Ce:N.T!==null?Co():Ec()}function uf(){if(Yt===0)if((Ce&536870912)===0||we){var e=Ve;Ve<<=1,(Ve&3932160)===0&&(Ve=262144),Yt=e}else Yt=536870912;return e=qt.current,e!==null&&(e.flags|=32),Yt}function zt(e,t,l){(e===Ge&&(ze===2||ze===9)||e.cancelPendingCommit!==null)&&(sn(e,0),Wl(e,Ce,Yt,!1)),hn(e,l),((Le&2)===0||e!==Ge)&&(e===Ge&&((Le&2)===0&&(ka|=l),Pe===4&&Wl(e,Ce,Yt,!1)),xl(e))}function df(e,t,l){if((Le&6)!==0)throw Error(u(327));var n=!l&&(t&127)===0&&(t&e.expiredLanes)===0||mn(e,t),r=n?Bm(e,t):So(e,t,!0),i=n;do{if(r===0){ln&&!n&&Wl(e,t,0,!1);break}else{if(l=e.current.alternate,i&&!Dm(l)){r=So(e,t,!1),i=!1;continue}if(r===2){if(i=t,e.errorRecoveryDisabledLanes&i)var d=0;else d=e.pendingLanes&-536870913,d=d!==0?d:d&536870912?536870912:0;if(d!==0){t=d;e:{var h=e;r=Zn;var E=h.current.memoizedState.isDehydrated;if(E&&(sn(h,d).flags|=256),d=So(h,d,!1),d!==2){if(mo&&!E){h.errorRecoveryDisabledLanes|=i,ka|=i,r=4;break e}i=Lt,Lt=r,i!==null&&(Lt===null?Lt=i:Lt.push.apply(Lt,i))}r=d}if(i=!1,r!==2)continue}}if(r===1){sn(e,0),Wl(e,t,0,!0);break}e:{switch(n=e,i=r,i){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t)break;case 6:Wl(n,t,Yt,!Xl);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(r=er+300-We(),10<r)){if(Wl(n,t,Yt,!Xl),Ta(n,0,!0)!==0)break e;Rl=t,n.timeoutHandle=Gf(ff.bind(null,n,l,Lt,lr,vo,t,Yt,ka,an,Xl,i,"Throttled",-0,0),r);break e}ff(n,l,Lt,lr,vo,t,Yt,ka,an,Xl,i,null,-0,0)}}break}while(!0);xl(e)}function ff(e,t,l,n,r,i,d,h,E,M,V,Q,z,H){if(e.timeoutHandle=-1,Q=t.subtreeFlags,Q&8192||(Q&16785408)===16785408){Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ml},af(t,i,Q);var oe=(i&62914560)===i?er-We():(i&4194048)===i?of-We():0;if(oe=gh(Q,oe),oe!==null){Rl=i,e.cancelPendingCommit=oe(bf.bind(null,e,t,i,l,n,r,d,h,E,V,Q,null,z,H)),Wl(e,i,d,!M);return}}bf(e,t,i,l,n,r,d,h,E)}function Dm(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 n=0;n<l.length;n++){var r=l[n],i=r.getSnapshot;r=r.value;try{if(!Ht(i(),r))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 Wl(e,t,l,n){t&=~ho,t&=~ka,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var r=t;0<r;){var i=31-et(r),d=1<<i;n[i]=-1,r&=~d}l!==0&&jc(e,l,t)}function ar(){return(Le&6)===0?(Wn(0),!1):!0}function jo(){if(Ee!==null){if(ze===0)var e=Ee.return;else e=Ee,gl=ha=null,Oi(e),Ja=null,Mn=0,e=Ee;for(;e!==null;)Gd(e.alternate,e),e=e.return;Ee=null}}function sn(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,th(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),Rl=0,jo(),Ge=e,Ee=l=vl(e.current,null),Ce=t,ze=0,Gt=null,Xl=!1,ln=mn(e,t),mo=!1,an=Yt=ho=ka=Kl=Pe=0,Lt=Zn=null,vo=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-et(n),i=1<<r;t|=e[r],n&=~i}return Al=t,Es(),l}function xf(e,t){Se=null,N.H=qn,t===Za||t===Ms?(t=wu(),ze=3):t===Ei?(t=wu(),ze=4):ze=t===Ii?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Gt=t,Ee===null&&(Pe=1,Xs(e,Wt(t,e.current)))}function pf(){var e=qt.current;return e===null?!0:(Ce&4194048)===Ce?el===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?e===el:!1}function mf(){var e=N.H;return N.H=qn,e===null?qn:e}function hf(){var e=N.A;return N.A=Lm,e}function nr(){Pe=4,Xl||(Ce&4194048)!==Ce&&qt.current!==null||(ln=!0),(Kl&134217727)===0&&(ka&134217727)===0||Ge===null||Wl(Ge,Ce,Yt,!1)}function So(e,t,l){var n=Le;Le|=2;var r=mf(),i=hf();(Ge!==e||Ce!==t)&&(lr=null,sn(e,t)),t=!1;var d=Pe;e:do try{if(ze!==0&&Ee!==null){var h=Ee,E=Gt;switch(ze){case 8:jo(),d=6;break e;case 3:case 2:case 9:case 6:qt.current===null&&(t=!0);var M=ze;if(ze=0,Gt=null,rn(e,h,E,M),l&&ln){d=0;break e}break;default:M=ze,ze=0,Gt=null,rn(e,h,E,M)}}Om(),d=Pe;break}catch(V){xf(e,V)}while(!0);return t&&e.shellSuspendCounter++,gl=ha=null,Le=n,N.H=r,N.A=i,Ee===null&&(Ge=null,Ce=0,Es()),d}function Om(){for(;Ee!==null;)vf(Ee)}function Bm(e,t){var l=Le;Le|=2;var n=mf(),r=hf();Ge!==e||Ce!==t?(lr=null,tr=We()+500,sn(e,t)):ln=mn(e,t);e:do try{if(ze!==0&&Ee!==null){t=Ee;var i=Gt;t:switch(ze){case 1:ze=0,Gt=null,rn(e,t,i,1);break;case 2:case 9:if(Cu(i)){ze=0,Gt=null,yf(t);break}t=function(){ze!==2&&ze!==9||Ge!==e||(ze=7),xl(e)},i.then(t,t);break e;case 3:ze=7;break e;case 4:ze=5;break e;case 7:Cu(i)?(ze=0,Gt=null,yf(t)):(ze=0,Gt=null,rn(e,t,i,7));break;case 5:var d=null;switch(Ee.tag){case 26:d=Ee.memoizedState;case 5:case 27:var h=Ee;if(d?ax(d):h.stateNode.complete){ze=0,Gt=null;var E=h.sibling;if(E!==null)Ee=E;else{var M=h.return;M!==null?(Ee=M,sr(M)):Ee=null}break t}}ze=0,Gt=null,rn(e,t,i,5);break;case 6:ze=0,Gt=null,rn(e,t,i,6);break;case 8:jo(),Pe=6;break e;default:throw Error(u(462))}}Hm();break}catch(V){xf(e,V)}while(!0);return gl=ha=null,N.H=n,N.A=r,Le=l,Ee!==null?0:(Ge=null,Ce=0,Es(),Pe)}function Hm(){for(;Ee!==null&&!nl();)vf(Ee)}function vf(e){var t=qd(e.alternate,e,Al);e.memoizedProps=e.pendingProps,t===null?sr(e):Ee=t}function yf(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=zd(l,t,t.pendingProps,t.type,void 0,Ce);break;case 11:t=zd(l,t,t.pendingProps,t.type.render,t.ref,Ce);break;case 5:Oi(t);default:Gd(l,t),t=Ee=mu(t,Al),t=qd(l,t,Al)}e.memoizedProps=e.pendingProps,t===null?sr(e):Ee=t}function rn(e,t,l,n){gl=ha=null,Oi(t),Ja=null,Mn=0;var r=t.return;try{if(Cm(e,r,t,l,Ce)){Pe=1,Xs(e,Wt(l,e.current)),Ee=null;return}}catch(i){if(r!==null)throw Ee=r,i;Pe=1,Xs(e,Wt(l,e.current)),Ee=null;return}t.flags&32768?(we||n===1?e=!0:ln||(Ce&536870912)!==0?e=!1:(Xl=e=!0,(n===2||n===9||n===3||n===6)&&(n=qt.current,n!==null&&n.tag===13&&(n.flags|=16384))),gf(t,e)):sr(t)}function sr(e){var t=e;do{if((t.flags&32768)!==0){gf(t,Xl);return}e=t.return;var l=Am(t.alternate,t,Al);if(l!==null){Ee=l;return}if(t=t.sibling,t!==null){Ee=t;return}Ee=t=e}while(t!==null);Pe===0&&(Pe=5)}function gf(e,t){do{var l=Rm(e.alternate,e);if(l!==null){l.flags&=32767,Ee=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Ee=e;return}Ee=e=l}while(e!==null);Pe=6,Ee=null}function bf(e,t,l,n,r,i,d,h,E){e.cancelPendingCommit=null;do rr();while(dt!==0);if((Le&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));if(i=t.lanes|t.childLanes,i|=ci,vp(e,l,i,d,h,E),e===Ge&&(Ee=Ge=null,Ce=0),nn=t,Jl=e,Rl=l,yo=i,go=r,cf=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Gm(at,function(){return kf(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=N.T,N.T=null,r=w.p,w.p=2,d=Le,Le|=4;try{_m(e,t,l)}finally{Le=d,w.p=r,N.T=n}}dt=1,jf(),Sf(),Nf()}}function jf(){if(dt===1){dt=0;var e=Jl,t=nn,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=N.T,N.T=null;var n=w.p;w.p=2;var r=Le;Le|=4;try{ef(t,e);var i=zo,d=ru(e.containerInfo),h=i.focusedElem,E=i.selectionRange;if(d!==h&&h&&h.ownerDocument&&su(h.ownerDocument.documentElement,h)){if(E!==null&&ni(h)){var M=E.start,V=E.end;if(V===void 0&&(V=M),"selectionStart"in h)h.selectionStart=M,h.selectionEnd=Math.min(V,h.value.length);else{var Q=h.ownerDocument||document,z=Q&&Q.defaultView||window;if(z.getSelection){var H=z.getSelection(),oe=h.textContent.length,ve=Math.min(E.start,oe),qe=E.end===void 0?ve:Math.min(E.end,oe);!H.extend&&ve>qe&&(d=qe,qe=ve,ve=d);var A=nu(h,ve),C=nu(h,qe);if(A&&C&&(H.rangeCount!==1||H.anchorNode!==A.node||H.anchorOffset!==A.offset||H.focusNode!==C.node||H.focusOffset!==C.offset)){var _=Q.createRange();_.setStart(A.node,A.offset),H.removeAllRanges(),ve>qe?(H.addRange(_),H.extend(C.node,C.offset)):(_.setEnd(C.node,C.offset),H.addRange(_))}}}}for(Q=[],H=h;H=H.parentNode;)H.nodeType===1&&Q.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<Q.length;h++){var $=Q[h];$.element.scrollLeft=$.left,$.element.scrollTop=$.top}}yr=!!Lo,zo=Lo=null}finally{Le=r,w.p=n,N.T=l}}e.current=t,dt=2}}function Sf(){if(dt===2){dt=0;var e=Jl,t=nn,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=N.T,N.T=null;var n=w.p;w.p=2;var r=Le;Le|=4;try{Jd(e,t.alternate,t)}finally{Le=r,w.p=n,N.T=l}}dt=3}}function Nf(){if(dt===4||dt===3){dt=0,Xt();var e=Jl,t=nn,l=Rl,n=cf;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,nn=Jl=null,Ef(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Zl=null),Ur(l),t=t.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(Ct,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=N.T,r=w.p,w.p=2,N.T=null;try{for(var i=e.onRecoverableError,d=0;d<n.length;d++){var h=n[d];i(h.value,{componentStack:h.stack})}}finally{N.T=t,w.p=r}}(Rl&3)!==0&&rr(),xl(e),r=e.pendingLanes,(l&261930)!==0&&(r&42)!==0?e===bo?Jn++:(Jn=0,bo=e):Jn=0,Wn(0)}}function Ef(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Rn(t)))}function rr(){return jf(),Sf(),Nf(),kf()}function kf(){if(dt!==5)return!1;var e=Jl,t=yo;yo=0;var l=Ur(Rl),n=N.T,r=w.p;try{w.p=32>l?32:l,N.T=null,l=go,go=null;var i=Jl,d=Rl;if(dt=0,nn=Jl=null,Rl=0,(Le&6)!==0)throw Error(u(331));var h=Le;if(Le|=4,sf(i.current),lf(i,i.current,d,l),Le=h,Wn(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Ct,i)}catch{}return!0}finally{w.p=r,N.T=n,Ef(e,t)}}function Cf(e,t,l){t=Wt(l,t),t=Fi(e.stateNode,t,2),e=Gl(e,t,2),e!==null&&(hn(e,2),xl(e))}function De(e,t,l){if(e.tag===3)Cf(e,e,l);else for(;t!==null;){if(t.tag===3){Cf(t,e,l);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Zl===null||!Zl.has(n))){e=Wt(l,e),l=Cd(2),n=Gl(t,l,2),n!==null&&(Td(l,n,t,e),hn(n,2),xl(n));break}}t=t.return}}function No(e,t,l){var n=e.pingCache;if(n===null){n=e.pingCache=new zm;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(l)||(mo=!0,r.add(l),e=Um.bind(null,e,t,l),t.then(e,e))}function Um(e,t,l){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Ge===e&&(Ce&l)===l&&(Pe===4||Pe===3&&(Ce&62914560)===Ce&&300>We()-er?(Le&2)===0&&sn(e,0):ho|=l,an===Ce&&(an=0)),xl(e)}function Tf(e,t){t===0&&(t=bc()),e=xa(e,t),e!==null&&(hn(e,t),xl(e))}function qm(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Tf(e,l)}function Vm(e,t){var l=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(l=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(u(314))}n!==null&&n.delete(t),Tf(e,l)}function Gm(e,t){return Ot(e,t)}var ir=null,on=null,Eo=!1,or=!1,ko=!1,Fl=0;function xl(e){e!==on&&e.next===null&&(on===null?ir=on=e:on=on.next=e),or=!0,Eo||(Eo=!0,$m())}function Wn(e,t){if(!ko&&or){ko=!0;do for(var l=!1,n=ir;n!==null;){if(e!==0){var r=n.pendingLanes;if(r===0)var i=0;else{var d=n.suspendedLanes,h=n.pingedLanes;i=(1<<31-et(42|e)+1)-1,i&=r&~(d&~h),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(l=!0,_f(n,i))}else i=Ce,i=Ta(n,n===Ge?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(i&3)===0||mn(n,i)||(l=!0,_f(n,i));n=n.next}while(l);ko=!1}}function Ym(){wf()}function wf(){or=Eo=!1;var e=0;Fl!==0&&eh()&&(e=Fl);for(var t=We(),l=null,n=ir;n!==null;){var r=n.next,i=Af(n,t);i===0?(n.next=null,l===null?ir=r:l.next=r,r===null&&(on=l)):(l=n,(e!==0||(i&3)!==0)&&(or=!0)),n=r}dt!==0&&dt!==5||Wn(e),Fl!==0&&(Fl=0)}function Af(e,t){for(var l=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var d=31-et(i),h=1<<d,E=r[d];E===-1?((h&l)===0||(h&n)!==0)&&(r[d]=hp(h,t)):E<=t&&(e.expiredLanes|=h),i&=~h}if(t=Ge,l=Ce,l=Ta(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,l===0||e===t&&(ze===2||ze===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&mt(n),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||mn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(n!==null&&mt(n),Ur(l)){case 2:case 8:l=Be;break;case 32:l=at;break;case 268435456:l=Ml;break;default:l=at}return n=Rf.bind(null,e),l=Ot(l,n),e.callbackPriority=t,e.callbackNode=l,t}return n!==null&&n!==null&&mt(n),e.callbackPriority=2,e.callbackNode=null,2}function Rf(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(rr()&&e.callbackNode!==l)return null;var n=Ce;return n=Ta(e,e===Ge?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(df(e,n,t),Af(e,We()),e.callbackNode!=null&&e.callbackNode===l?Rf.bind(null,e):null)}function _f(e,t){if(rr())return null;df(e,t,!0)}function $m(){lh(function(){(Le&6)!==0?Ot(K,Ym):wf()})}function Co(){if(Fl===0){var e=Xa;e===0&&(e=st,st<<=1,(st&261888)===0&&(st=256)),Fl=e}return Fl}function Mf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:hs(""+e)}function Lf(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 Qm(e,t,l,n,r){if(t==="submit"&&l&&l.stateNode===r){var i=Mf((r[wt]||null).action),d=n.submitter;d&&(t=(t=d[wt]||null)?Mf(t.formAction):d.getAttribute("formAction"),t!==null&&(i=t,d=null));var h=new bs("action","action",null,n,r);e.push({event:h,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Fl!==0){var E=d?Lf(r,d):new FormData(r);Qi(l,{pending:!0,data:E,method:r.method,action:i},null,E)}}else typeof i=="function"&&(h.preventDefault(),E=d?Lf(r,d):new FormData(r),Qi(l,{pending:!0,data:E,method:r.method,action:i},i,E))},currentTarget:r}]})}}for(var To=0;To<oi.length;To++){var wo=oi[To],Xm=wo.toLowerCase(),Km=wo[0].toUpperCase()+wo.slice(1);il(Xm,"on"+Km)}il(cu,"onAnimationEnd"),il(uu,"onAnimationIteration"),il(du,"onAnimationStart"),il("dblclick","onDoubleClick"),il("focusin","onFocus"),il("focusout","onBlur"),il(cm,"onTransitionRun"),il(um,"onTransitionStart"),il(dm,"onTransitionCancel"),il(fu,"onTransitionEnd"),Ma("onMouseEnter",["mouseout","mouseover"]),Ma("onMouseLeave",["mouseout","mouseover"]),Ma("onPointerEnter",["pointerout","pointerover"]),Ma("onPointerLeave",["pointerout","pointerover"]),ca("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ca("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ca("onBeforeInput",["compositionend","keypress","textInput","paste"]),ca("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ca("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ca("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fn="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(" "),Zm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fn));function zf(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var n=e[l],r=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var d=n.length-1;0<=d;d--){var h=n[d],E=h.instance,M=h.currentTarget;if(h=h.listener,E!==i&&r.isPropagationStopped())break e;i=h,r.currentTarget=M;try{i(r)}catch(V){Ns(V)}r.currentTarget=null,i=E}else for(d=0;d<n.length;d++){if(h=n[d],E=h.instance,M=h.currentTarget,h=h.listener,E!==i&&r.isPropagationStopped())break e;i=h,r.currentTarget=M;try{i(r)}catch(V){Ns(V)}r.currentTarget=null,i=E}}}}function ke(e,t){var l=t[qr];l===void 0&&(l=t[qr]=new Set);var n=e+"__bubble";l.has(n)||(Df(t,e,2,!1),l.add(n))}function Ao(e,t,l){var n=0;t&&(n|=4),Df(l,e,n,t)}var cr="_reactListening"+Math.random().toString(36).slice(2);function Ro(e){if(!e[cr]){e[cr]=!0,Tc.forEach(function(l){l!=="selectionchange"&&(Zm.has(l)||Ao(l,!1,e),Ao(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[cr]||(t[cr]=!0,Ao("selectionchange",!1,t))}}function Df(e,t,l,n){switch(ux(t)){case 2:var r=Sh;break;case 8:r=Nh;break;default:r=Qo}l=r.bind(null,t,l,e),r=void 0,!Jr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),n?r!==void 0?e.addEventListener(t,l,{capture:!0,passive:r}):e.addEventListener(t,l,!0):r!==void 0?e.addEventListener(t,l,{passive:r}):e.addEventListener(t,l,!1)}function _o(e,t,l,n,r){var i=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var d=n.tag;if(d===3||d===4){var h=n.stateNode.containerInfo;if(h===r)break;if(d===4)for(d=n.return;d!==null;){var E=d.tag;if((E===3||E===4)&&d.stateNode.containerInfo===r)return;d=d.return}for(;h!==null;){if(d=Aa(h),d===null)return;if(E=d.tag,E===5||E===6||E===26||E===27){n=i=d;continue e}h=h.parentNode}}n=n.return}Uc(function(){var M=i,V=Kr(l),Q=[];e:{var z=xu.get(e);if(z!==void 0){var H=bs,oe=e;switch(e){case"keypress":if(ys(l)===0)break e;case"keydown":case"keyup":H=Vp;break;case"focusin":oe="focus",H=Pr;break;case"focusout":oe="blur",H=Pr;break;case"beforeblur":case"afterblur":H=Pr;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":H=Gc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":H=Ap;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":H=$p;break;case cu:case uu:case du:H=Mp;break;case fu:H=Xp;break;case"scroll":case"scrollend":H=Tp;break;case"wheel":H=Zp;break;case"copy":case"cut":case"paste":H=zp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":H=$c;break;case"toggle":case"beforetoggle":H=Wp}var ve=(t&4)!==0,qe=!ve&&(e==="scroll"||e==="scrollend"),A=ve?z!==null?z+"Capture":null:z;ve=[];for(var C=M,_;C!==null;){var $=C;if(_=$.stateNode,$=$.tag,$!==5&&$!==26&&$!==27||_===null||A===null||($=gn(C,A),$!=null&&ve.push(In(C,$,_))),qe)break;C=C.return}0<ve.length&&(z=new H(z,oe,null,l,V),Q.push({event:z,listeners:ve}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",H=e==="mouseout"||e==="pointerout",z&&l!==Xr&&(oe=l.relatedTarget||l.fromElement)&&(Aa(oe)||oe[wa]))break e;if((H||z)&&(z=V.window===V?V:(z=V.ownerDocument)?z.defaultView||z.parentWindow:window,H?(oe=l.relatedTarget||l.toElement,H=M,oe=oe?Aa(oe):null,oe!==null&&(qe=v(oe),ve=oe.tag,oe!==qe||ve!==5&&ve!==27&&ve!==6)&&(oe=null)):(H=null,oe=M),H!==oe)){if(ve=Gc,$="onMouseLeave",A="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(ve=$c,$="onPointerLeave",A="onPointerEnter",C="pointer"),qe=H==null?z:yn(H),_=oe==null?z:yn(oe),z=new ve($,C+"leave",H,l,V),z.target=qe,z.relatedTarget=_,$=null,Aa(V)===M&&(ve=new ve(A,C+"enter",oe,l,V),ve.target=_,ve.relatedTarget=qe,$=ve),qe=$,H&&oe)t:{for(ve=Jm,A=H,C=oe,_=0,$=A;$;$=ve($))_++;$=0;for(var pe=C;pe;pe=ve(pe))$++;for(;0<_-$;)A=ve(A),_--;for(;0<$-_;)C=ve(C),$--;for(;_--;){if(A===C||C!==null&&A===C.alternate){ve=A;break t}A=ve(A),C=ve(C)}ve=null}else ve=null;H!==null&&Of(Q,z,H,ve,!1),oe!==null&&qe!==null&&Of(Q,qe,oe,ve,!0)}}e:{if(z=M?yn(M):window,H=z.nodeName&&z.nodeName.toLowerCase(),H==="select"||H==="input"&&z.type==="file")var _e=Ic;else if(Wc(z))if(Pc)_e=rm;else{_e=nm;var fe=am}else H=z.nodeName,!H||H.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?M&&Qr(M.elementType)&&(_e=Ic):_e=sm;if(_e&&(_e=_e(e,M))){Fc(Q,_e,l,V);break e}fe&&fe(e,z,M),e==="focusout"&&M&&z.type==="number"&&M.memoizedProps.value!=null&&$r(z,"number",z.value)}switch(fe=M?yn(M):window,e){case"focusin":(Wc(fe)||fe.contentEditable==="true")&&(Ha=fe,si=M,Tn=null);break;case"focusout":Tn=si=Ha=null;break;case"mousedown":ri=!0;break;case"contextmenu":case"mouseup":case"dragend":ri=!1,iu(Q,l,V);break;case"selectionchange":if(om)break;case"keydown":case"keyup":iu(Q,l,V)}var Ne;if(ti)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else Ba?Zc(e,l)&&(Te="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Te="onCompositionStart");Te&&(Qc&&l.locale!=="ko"&&(Ba||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&Ba&&(Ne=qc()):(Dl=V,Wr="value"in Dl?Dl.value:Dl.textContent,Ba=!0)),fe=ur(M,Te),0<fe.length&&(Te=new Yc(Te,e,null,l,V),Q.push({event:Te,listeners:fe}),Ne?Te.data=Ne:(Ne=Jc(l),Ne!==null&&(Te.data=Ne)))),(Ne=Ip?Pp(e,l):em(e,l))&&(Te=ur(M,"onBeforeInput"),0<Te.length&&(fe=new Yc("onBeforeInput","beforeinput",null,l,V),Q.push({event:fe,listeners:Te}),fe.data=Ne)),Qm(Q,e,M,l,V)}zf(Q,t)})}function In(e,t,l){return{instance:e,listener:t,currentTarget:l}}function ur(e,t){for(var l=t+"Capture",n=[];e!==null;){var r=e,i=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||i===null||(r=gn(e,l),r!=null&&n.unshift(In(e,r,i)),r=gn(e,t),r!=null&&n.push(In(e,r,i))),e.tag===3)return n;e=e.return}return[]}function Jm(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Of(e,t,l,n,r){for(var i=t._reactName,d=[];l!==null&&l!==n;){var h=l,E=h.alternate,M=h.stateNode;if(h=h.tag,E!==null&&E===n)break;h!==5&&h!==26&&h!==27||M===null||(E=M,r?(M=gn(l,i),M!=null&&d.unshift(In(l,M,E))):r||(M=gn(l,i),M!=null&&d.push(In(l,M,E)))),l=l.return}d.length!==0&&e.push({event:t,listeners:d})}var Wm=/\r\n?/g,Fm=/\u0000|\uFFFD/g;function Bf(e){return(typeof e=="string"?e:""+e).replace(Wm,`
49
+ `).replace(Fm,"")}function Hf(e,t){return t=Bf(t),Bf(e)===t}function Ue(e,t,l,n,r,i){switch(l){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||za(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&za(e,""+n);break;case"className":ps(e,"class",n);break;case"tabIndex":ps(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":ps(e,l,n);break;case"style":Bc(e,n,i);break;case"data":if(t!=="object"){ps(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=hs(""+n),e.setAttribute(l,n);break;case"action":case"formAction":if(typeof n=="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"&&Ue(e,t,"name",r.name,r,null),Ue(e,t,"formEncType",r.formEncType,r,null),Ue(e,t,"formMethod",r.formMethod,r,null),Ue(e,t,"formTarget",r.formTarget,r,null)):(Ue(e,t,"encType",r.encType,r,null),Ue(e,t,"method",r.method,r,null),Ue(e,t,"target",r.target,r,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(l);break}n=hs(""+n),e.setAttribute(l,n);break;case"onClick":n!=null&&(e.onclick=ml);break;case"onScroll":n!=null&&ke("scroll",e);break;case"onScrollEnd":n!=null&&ke("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(l=n.__html,l!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=l}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}l=hs(""+n),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":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,""+n):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":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":n===!0?e.setAttribute(l,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(l,n):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(l,n):e.removeAttribute(l);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(l):e.setAttribute(l,n);break;case"popover":ke("beforetoggle",e),ke("toggle",e),xs(e,"popover",n);break;case"xlinkActuate":pl(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":pl(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":pl(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":pl(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":pl(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":pl(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":pl(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":pl(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":pl(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":xs(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=kp.get(l)||l,xs(e,l,n))}}function Mo(e,t,l,n,r,i){switch(l){case"style":Bc(e,n,i);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(u(61));if(l=n.__html,l!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=l}}break;case"children":typeof n=="string"?za(e,n):(typeof n=="number"||typeof n=="bigint")&&za(e,""+n);break;case"onScroll":n!=null&&ke("scroll",e);break;case"onScrollEnd":n!=null&&ke("scrollend",e);break;case"onClick":n!=null&&(e.onclick=ml);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wc.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(r=l.endsWith("Capture"),t=l.slice(2,r?l.length-7:void 0),i=e[wt]||null,i=i!=null?i[l]:null,typeof i=="function"&&e.removeEventListener(t,i,r),typeof n=="function")){typeof i!="function"&&i!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,n,r);break e}l in e?e[l]=n:n===!0?e.setAttribute(l,""):xs(e,l,n)}}}function bt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ke("error",e),ke("load",e);var n=!1,r=!1,i;for(i in l)if(l.hasOwnProperty(i)){var d=l[i];if(d!=null)switch(i){case"src":n=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ue(e,t,i,d,l,null)}}r&&Ue(e,t,"srcSet",l.srcSet,l,null),n&&Ue(e,t,"src",l.src,l,null);return;case"input":ke("invalid",e);var h=i=d=r=null,E=null,M=null;for(n in l)if(l.hasOwnProperty(n)){var V=l[n];if(V!=null)switch(n){case"name":r=V;break;case"type":d=V;break;case"checked":E=V;break;case"defaultChecked":M=V;break;case"value":i=V;break;case"defaultValue":h=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(u(137,t));break;default:Ue(e,t,n,V,l,null)}}Lc(e,i,h,E,M,d,r,!1);return;case"select":ke("invalid",e),n=d=i=null;for(r in l)if(l.hasOwnProperty(r)&&(h=l[r],h!=null))switch(r){case"value":i=h;break;case"defaultValue":d=h;break;case"multiple":n=h;default:Ue(e,t,r,h,l,null)}t=i,l=d,e.multiple=!!n,t!=null?La(e,!!n,t,!1):l!=null&&La(e,!!n,l,!0);return;case"textarea":ke("invalid",e),i=r=n=null;for(d in l)if(l.hasOwnProperty(d)&&(h=l[d],h!=null))switch(d){case"value":n=h;break;case"defaultValue":r=h;break;case"children":i=h;break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(u(91));break;default:Ue(e,t,d,h,l,null)}Dc(e,n,r,i);return;case"option":for(E in l)if(l.hasOwnProperty(E)&&(n=l[E],n!=null))switch(E){case"selected":e.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:Ue(e,t,E,n,l,null)}return;case"dialog":ke("beforetoggle",e),ke("toggle",e),ke("cancel",e),ke("close",e);break;case"iframe":case"object":ke("load",e);break;case"video":case"audio":for(n=0;n<Fn.length;n++)ke(Fn[n],e);break;case"image":ke("error",e),ke("load",e);break;case"details":ke("toggle",e);break;case"embed":case"source":case"link":ke("error",e),ke("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(M in l)if(l.hasOwnProperty(M)&&(n=l[M],n!=null))switch(M){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:Ue(e,t,M,n,l,null)}return;default:if(Qr(t)){for(V in l)l.hasOwnProperty(V)&&(n=l[V],n!==void 0&&Mo(e,t,V,n,l,void 0));return}}for(h in l)l.hasOwnProperty(h)&&(n=l[h],n!=null&&Ue(e,t,h,n,l,null))}function Im(e,t,l,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,i=null,d=null,h=null,E=null,M=null,V=null;for(H in l){var Q=l[H];if(l.hasOwnProperty(H)&&Q!=null)switch(H){case"checked":break;case"value":break;case"defaultValue":E=Q;default:n.hasOwnProperty(H)||Ue(e,t,H,null,n,Q)}}for(var z in n){var H=n[z];if(Q=l[z],n.hasOwnProperty(z)&&(H!=null||Q!=null))switch(z){case"type":i=H;break;case"name":r=H;break;case"checked":M=H;break;case"defaultChecked":V=H;break;case"value":d=H;break;case"defaultValue":h=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(u(137,t));break;default:H!==Q&&Ue(e,t,z,H,n,Q)}}Yr(e,d,h,E,M,V,i,r);return;case"select":H=d=h=z=null;for(i in l)if(E=l[i],l.hasOwnProperty(i)&&E!=null)switch(i){case"value":break;case"multiple":H=E;default:n.hasOwnProperty(i)||Ue(e,t,i,null,n,E)}for(r in n)if(i=n[r],E=l[r],n.hasOwnProperty(r)&&(i!=null||E!=null))switch(r){case"value":z=i;break;case"defaultValue":h=i;break;case"multiple":d=i;default:i!==E&&Ue(e,t,r,i,n,E)}t=h,l=d,n=H,z!=null?La(e,!!l,z,!1):!!n!=!!l&&(t!=null?La(e,!!l,t,!0):La(e,!!l,l?[]:"",!1));return;case"textarea":H=z=null;for(h in l)if(r=l[h],l.hasOwnProperty(h)&&r!=null&&!n.hasOwnProperty(h))switch(h){case"value":break;case"children":break;default:Ue(e,t,h,null,n,r)}for(d in n)if(r=n[d],i=l[d],n.hasOwnProperty(d)&&(r!=null||i!=null))switch(d){case"value":z=r;break;case"defaultValue":H=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(u(91));break;default:r!==i&&Ue(e,t,d,r,n,i)}zc(e,z,H);return;case"option":for(var oe in l)if(z=l[oe],l.hasOwnProperty(oe)&&z!=null&&!n.hasOwnProperty(oe))switch(oe){case"selected":e.selected=!1;break;default:Ue(e,t,oe,null,n,z)}for(E in n)if(z=n[E],H=l[E],n.hasOwnProperty(E)&&z!==H&&(z!=null||H!=null))switch(E){case"selected":e.selected=z&&typeof z!="function"&&typeof z!="symbol";break;default:Ue(e,t,E,z,n,H)}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 ve in l)z=l[ve],l.hasOwnProperty(ve)&&z!=null&&!n.hasOwnProperty(ve)&&Ue(e,t,ve,null,n,z);for(M in n)if(z=n[M],H=l[M],n.hasOwnProperty(M)&&z!==H&&(z!=null||H!=null))switch(M){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(u(137,t));break;default:Ue(e,t,M,z,n,H)}return;default:if(Qr(t)){for(var qe in l)z=l[qe],l.hasOwnProperty(qe)&&z!==void 0&&!n.hasOwnProperty(qe)&&Mo(e,t,qe,void 0,n,z);for(V in n)z=n[V],H=l[V],!n.hasOwnProperty(V)||z===H||z===void 0&&H===void 0||Mo(e,t,V,z,n,H);return}}for(var A in l)z=l[A],l.hasOwnProperty(A)&&z!=null&&!n.hasOwnProperty(A)&&Ue(e,t,A,null,n,z);for(Q in n)z=n[Q],H=l[Q],!n.hasOwnProperty(Q)||z===H||z==null&&H==null||Ue(e,t,Q,z,n,H)}function Uf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Pm(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),n=0;n<l.length;n++){var r=l[n],i=r.transferSize,d=r.initiatorType,h=r.duration;if(i&&h&&Uf(d)){for(d=0,h=r.responseEnd,n+=1;n<l.length;n++){var E=l[n],M=E.startTime;if(M>h)break;var V=E.transferSize,Q=E.initiatorType;V&&Uf(Q)&&(E=E.responseEnd,d+=V*(E<h?1:(h-M)/(E-M)))}if(--n,t+=8*(i+d)/(r.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 Lo=null,zo=null;function dr(e){return e.nodeType===9?e:e.ownerDocument}function qf(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 Vf(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 Do(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 Oo=null;function eh(){var e=window.event;return e&&e.type==="popstate"?e===Oo?!1:(Oo=e,!0):(Oo=null,!1)}var Gf=typeof setTimeout=="function"?setTimeout:void 0,th=typeof clearTimeout=="function"?clearTimeout:void 0,Yf=typeof Promise=="function"?Promise:void 0,lh=typeof queueMicrotask=="function"?queueMicrotask:typeof Yf<"u"?function(e){return Yf.resolve(null).then(e).catch(ah)}:Gf;function ah(e){setTimeout(function(){throw e})}function Il(e){return e==="head"}function $f(e,t){var l=t,n=0;do{var r=l.nextSibling;if(e.removeChild(l),r&&r.nodeType===8)if(l=r.data,l==="/$"||l==="/&"){if(n===0){e.removeChild(r),fn(t);return}n--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")n++;else if(l==="html")Pn(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,Pn(l);for(var i=l.firstChild;i;){var d=i.nextSibling,h=i.nodeName;i[vn]||h==="SCRIPT"||h==="STYLE"||h==="LINK"&&i.rel.toLowerCase()==="stylesheet"||l.removeChild(i),i=d}}else l==="body"&&Pn(e.ownerDocument.body);l=r}while(l);fn(t)}function Qf(e,t){var l=e;e=0;do{var n=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||""),n&&n.nodeType===8)if(l=n.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=n}while(l)}function Bo(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":Bo(l),Vr(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function nh(e,t,l,n){for(;e.nodeType===1;){var r=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[vn])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!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=tl(e.nextSibling),e===null)break}return null}function sh(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=tl(e.nextSibling),e===null))return null;return e}function Xf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=tl(e.nextSibling),e===null))return null;return e}function Ho(e){return e.data==="$?"||e.data==="$~"}function Uo(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function rh(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var n=function(){t(),l.removeEventListener("DOMContentLoaded",n)};l.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function tl(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 qo=null;function Kf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return tl(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Zf(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 Jf(e,t,l){switch(t=dr(l),e){case"html":if(e=t.documentElement,!e)throw Error(u(452));return e;case"head":if(e=t.head,!e)throw Error(u(453));return e;case"body":if(e=t.body,!e)throw Error(u(454));return e;default:throw Error(u(451))}}function Pn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Vr(e)}var ll=new Map,Wf=new Set;function fr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _l=w.d;w.d={f:ih,r:oh,D:ch,C:uh,L:dh,m:fh,X:ph,S:xh,M:mh};function ih(){var e=_l.f(),t=ar();return e||t}function oh(e){var t=Ra(e);t!==null&&t.tag===5&&t.type==="form"?fd(t):_l.r(e)}var cn=typeof document>"u"?null:document;function Ff(e,t,l){var n=cn;if(n&&typeof t=="string"&&t){var r=Zt(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof l=="string"&&(r+='[crossorigin="'+l+'"]'),Wf.has(r)||(Wf.add(r),e={rel:e,crossOrigin:l,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),bt(t,"link",e),ft(t),n.head.appendChild(t)))}}function ch(e){_l.D(e),Ff("dns-prefetch",e,null)}function uh(e,t){_l.C(e,t),Ff("preconnect",e,t)}function dh(e,t,l){_l.L(e,t,l);var n=cn;if(n&&e&&t){var r='link[rel="preload"][as="'+Zt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(r+='[imagesrcset="'+Zt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(r+='[imagesizes="'+Zt(l.imageSizes)+'"]')):r+='[href="'+Zt(e)+'"]';var i=r;switch(t){case"style":i=un(e);break;case"script":i=dn(e)}ll.has(i)||(e=y({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),ll.set(i,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(es(i))||t==="script"&&n.querySelector(ts(i))||(t=n.createElement("link"),bt(t,"link",e),ft(t),n.head.appendChild(t)))}}function fh(e,t){_l.m(e,t);var l=cn;if(l&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Zt(n)+'"][href="'+Zt(e)+'"]',i=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=dn(e)}if(!ll.has(i)&&(e=y({rel:"modulepreload",href:e},t),ll.set(i,e),l.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ts(i)))return}n=l.createElement("link"),bt(n,"link",e),ft(n),l.head.appendChild(n)}}}function xh(e,t,l){_l.S(e,t,l);var n=cn;if(n&&e){var r=_a(n).hoistableStyles,i=un(e);t=t||"default";var d=r.get(i);if(!d){var h={loading:0,preload:null};if(d=n.querySelector(es(i)))h.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":t},l),(l=ll.get(i))&&Vo(e,l);var E=d=n.createElement("link");ft(E),bt(E,"link",e),E._p=new Promise(function(M,V){E.onload=M,E.onerror=V}),E.addEventListener("load",function(){h.loading|=1}),E.addEventListener("error",function(){h.loading|=2}),h.loading|=4,xr(d,t,n)}d={type:"stylesheet",instance:d,count:1,state:h},r.set(i,d)}}}function ph(e,t){_l.X(e,t);var l=cn;if(l&&e){var n=_a(l).hoistableScripts,r=dn(e),i=n.get(r);i||(i=l.querySelector(ts(r)),i||(e=y({src:e,async:!0},t),(t=ll.get(r))&&Go(e,t),i=l.createElement("script"),ft(i),bt(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function mh(e,t){_l.M(e,t);var l=cn;if(l&&e){var n=_a(l).hoistableScripts,r=dn(e),i=n.get(r);i||(i=l.querySelector(ts(r)),i||(e=y({src:e,async:!0,type:"module"},t),(t=ll.get(r))&&Go(e,t),i=l.createElement("script"),ft(i),bt(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function If(e,t,l,n){var r=(r=de.current)?fr(r):null;if(!r)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=un(l.href),l=_a(r).hoistableStyles,n=l.get(t),n||(n={type:"style",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=un(l.href);var i=_a(r).hoistableStyles,d=i.get(e);if(d||(r=r.ownerDocument||r,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,d),(i=r.querySelector(es(e)))&&!i._p&&(d.instance=i,d.state.loading=5),ll.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},ll.set(e,l),i||hh(r,e,l,d.state))),t&&n===null)throw Error(u(528,""));return d}if(t&&n!==null)throw Error(u(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=dn(l),l=_a(r).hoistableScripts,n=l.get(t),n||(n={type:"script",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function un(e){return'href="'+Zt(e)+'"'}function es(e){return'link[rel="stylesheet"]['+e+"]"}function Pf(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function hh(e,t,l,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),bt(t,"link",l),ft(t),e.head.appendChild(t))}function dn(e){return'[src="'+Zt(e)+'"]'}function ts(e){return"script[async]"+e}function ex(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+Zt(l.href)+'"]');if(n)return t.instance=n,ft(n),n;var r=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),ft(n),bt(n,"style",r),xr(n,l.precedence,e),t.instance=n;case"stylesheet":r=un(l.href);var i=e.querySelector(es(r));if(i)return t.state.loading|=4,t.instance=i,ft(i),i;n=Pf(l),(r=ll.get(r))&&Vo(n,r),i=(e.ownerDocument||e).createElement("link"),ft(i);var d=i;return d._p=new Promise(function(h,E){d.onload=h,d.onerror=E}),bt(i,"link",n),t.state.loading|=4,xr(i,l.precedence,e),t.instance=i;case"script":return i=dn(l.src),(r=e.querySelector(ts(i)))?(t.instance=r,ft(r),r):(n=l,(r=ll.get(i))&&(n=y({},l),Go(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),ft(r),bt(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,xr(n,l.precedence,e));return t.instance}function xr(e,t,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,i=r,d=0;d<n.length;d++){var h=n[d];if(h.dataset.precedence===t)i=h;else if(i!==r)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Vo(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Go(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var pr=null;function tx(e,t,l){if(pr===null){var n=new Map,r=pr=new Map;r.set(l,n)}else r=pr,n=r.get(l),n||(n=new Map,r.set(l,n));if(n.has(e))return n;for(n.set(e,null),l=l.getElementsByTagName(e),r=0;r<l.length;r++){var i=l[r];if(!(i[vn]||i[ht]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var d=i.getAttribute(t)||"";d=e+d;var h=n.get(d);h?h.push(i):n.set(d,[i])}}return n}function lx(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function vh(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 ax(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function yh(e,t,l,n){if(l.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var r=un(n.href),i=t.querySelector(es(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=mr.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=i,ft(i);return}i=t.ownerDocument||t,n=Pf(n),(r=ll.get(r))&&Vo(n,r),i=i.createElement("link"),ft(i);var d=i;d._p=new Promise(function(h,E){d.onload=h,d.onerror=E}),bt(i,"link",n),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=mr.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Yo=0;function gh(e,t){return e.stylesheets&&e.count===0&&vr(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var n=setTimeout(function(){if(e.stylesheets&&vr(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Yo===0&&(Yo=62500*Pm());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&vr(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Yo?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function mr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var hr=null;function vr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hr=new Map,t.forEach(bh,e),hr=null,mr.call(e))}function bh(e,t){if(!(t.state.loading&4)){var l=hr.get(e);if(l)var n=l.get(null);else{l=new Map,hr.set(e,l);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<r.length;i++){var d=r[i];(d.nodeName==="LINK"||d.getAttribute("media")!=="not all")&&(l.set(d.dataset.precedence,d),n=d)}n&&l.set(null,n)}r=t.instance,d=r.getAttribute("data-precedence"),i=l.get(d)||n,i===n&&l.set(null,r),l.set(d,r),this.count++,n=mr.bind(this),r.addEventListener("load",n),r.addEventListener("error",n),i?i.parentNode.insertBefore(r,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var ls={$$typeof:W,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function jh(e,t,l,n,r,i,d,h,E){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=Br(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Br(0),this.hiddenUpdates=Br(null),this.identifierPrefix=n,this.onUncaughtError=r,this.onCaughtError=i,this.onRecoverableError=d,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=E,this.incompleteTransitions=new Map}function nx(e,t,l,n,r,i,d,h,E,M,V,Q){return e=new jh(e,t,l,d,E,M,V,Q,h),t=1,i===!0&&(t|=24),i=Ut(3,null,null,t),e.current=i,i.stateNode=e,t=ji(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:n,isDehydrated:l,cache:t},ki(i),e}function sx(e){return e?(e=Va,e):Va}function rx(e,t,l,n,r,i){r=sx(r),n.context===null?n.context=r:n.pendingContext=r,n=Vl(t),n.payload={element:l},i=i===void 0?null:i,i!==null&&(n.callback=i),l=Gl(e,n,t),l!==null&&(zt(l,e,t),zn(l,e,t))}function ix(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function $o(e,t){ix(e,t),(e=e.alternate)&&ix(e,t)}function ox(e){if(e.tag===13||e.tag===31){var t=xa(e,67108864);t!==null&&zt(t,e,67108864),$o(e,67108864)}}function cx(e){if(e.tag===13||e.tag===31){var t=$t();t=Hr(t);var l=xa(e,t);l!==null&&zt(l,e,t),$o(e,t)}}var yr=!0;function Sh(e,t,l,n){var r=N.T;N.T=null;var i=w.p;try{w.p=2,Qo(e,t,l,n)}finally{w.p=i,N.T=r}}function Nh(e,t,l,n){var r=N.T;N.T=null;var i=w.p;try{w.p=8,Qo(e,t,l,n)}finally{w.p=i,N.T=r}}function Qo(e,t,l,n){if(yr){var r=Xo(n);if(r===null)_o(e,t,n,gr,l),dx(e,n);else if(kh(r,e,t,l,n))n.stopPropagation();else if(dx(e,n),t&4&&-1<Eh.indexOf(e)){for(;r!==null;){var i=Ra(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var d=Tt(i.pendingLanes);if(d!==0){var h=i;for(h.pendingLanes|=2,h.entangledLanes|=2;d;){var E=1<<31-et(d);h.entanglements[1]|=E,d&=~E}xl(i),(Le&6)===0&&(tr=We()+500,Wn(0))}}break;case 31:case 13:h=xa(i,2),h!==null&&zt(h,i,2),ar(),$o(i,2)}if(i=Xo(n),i===null&&_o(e,t,n,gr,l),i===r)break;r=i}r!==null&&n.stopPropagation()}else _o(e,t,n,null,l)}}function Xo(e){return e=Kr(e),Ko(e)}var gr=null;function Ko(e){if(gr=null,e=Aa(e),e!==null){var t=v(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=b(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 gr=e,null}function ux(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(kt()){case K:return 2;case Be:return 8;case at:case Je:return 32;case Ml:return 268435456;default:return 32}default:return 32}}var Zo=!1,Pl=null,ea=null,ta=null,as=new Map,ns=new Map,la=[],Eh="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 dx(e,t){switch(e){case"focusin":case"focusout":Pl=null;break;case"dragenter":case"dragleave":ea=null;break;case"mouseover":case"mouseout":ta=null;break;case"pointerover":case"pointerout":as.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ns.delete(t.pointerId)}}function ss(e,t,l,n,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:l,eventSystemFlags:n,nativeEvent:i,targetContainers:[r]},t!==null&&(t=Ra(t),t!==null&&ox(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function kh(e,t,l,n,r){switch(t){case"focusin":return Pl=ss(Pl,e,t,l,n,r),!0;case"dragenter":return ea=ss(ea,e,t,l,n,r),!0;case"mouseover":return ta=ss(ta,e,t,l,n,r),!0;case"pointerover":var i=r.pointerId;return as.set(i,ss(as.get(i)||null,e,t,l,n,r)),!0;case"gotpointercapture":return i=r.pointerId,ns.set(i,ss(ns.get(i)||null,e,t,l,n,r)),!0}return!1}function fx(e){var t=Aa(e.target);if(t!==null){var l=v(t);if(l!==null){if(t=l.tag,t===13){if(t=p(l),t!==null){e.blockedOn=t,kc(e.priority,function(){cx(l)});return}}else if(t===31){if(t=b(l),t!==null){e.blockedOn=t,kc(e.priority,function(){cx(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 br(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Xo(e.nativeEvent);if(l===null){l=e.nativeEvent;var n=new l.constructor(l.type,l);Xr=n,l.target.dispatchEvent(n),Xr=null}else return t=Ra(l),t!==null&&ox(t),e.blockedOn=l,!1;t.shift()}return!0}function xx(e,t,l){br(e)&&l.delete(t)}function Ch(){Zo=!1,Pl!==null&&br(Pl)&&(Pl=null),ea!==null&&br(ea)&&(ea=null),ta!==null&&br(ta)&&(ta=null),as.forEach(xx),ns.forEach(xx)}function jr(e,t){e.blockedOn===t&&(e.blockedOn=null,Zo||(Zo=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Ch)))}var Sr=null;function px(e){Sr!==e&&(Sr=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){Sr===e&&(Sr=null);for(var t=0;t<e.length;t+=3){var l=e[t],n=e[t+1],r=e[t+2];if(typeof n!="function"){if(Ko(n||l)===null)continue;break}var i=Ra(l);i!==null&&(e.splice(t,3),t-=3,Qi(i,{pending:!0,data:r,method:l.method,action:n},n,r))}}))}function fn(e){function t(E){return jr(E,e)}Pl!==null&&jr(Pl,e),ea!==null&&jr(ea,e),ta!==null&&jr(ta,e),as.forEach(t),ns.forEach(t);for(var l=0;l<la.length;l++){var n=la[l];n.blockedOn===e&&(n.blockedOn=null)}for(;0<la.length&&(l=la[0],l.blockedOn===null);)fx(l),l.blockedOn===null&&la.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(n=0;n<l.length;n+=3){var r=l[n],i=l[n+1],d=r[wt]||null;if(typeof i=="function")d||px(l);else if(d){var h=null;if(i&&i.hasAttribute("formAction")){if(r=i,d=i[wt]||null)h=d.formAction;else if(Ko(r)!==null)continue}else h=d.action;typeof h=="function"?l[n+1]=h:(l.splice(n,3),n-=3),px(l)}}}function mx(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(d){return r=d})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),n||setTimeout(l,20)}function l(){if(!n&&!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 n=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function Jo(e){this._internalRoot=e}Nr.prototype.render=Jo.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var l=t.current,n=$t();rx(l,n,e,t,null,null)},Nr.prototype.unmount=Jo.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rx(e.current,2,null,e,null,null),ar(),t[wa]=null}};function Nr(e){this._internalRoot=e}Nr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ec();e={blockedOn:null,target:e,priority:t};for(var l=0;l<la.length&&t!==0&&t<la[l].priority;l++);la.splice(l,0,e),l===0&&fx(e)}};var hx=o.version;if(hx!=="19.2.4")throw Error(u(527,hx,"19.2.4"));w.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=f(t),e=e!==null?j(e):null,e=e===null?null:e.stateNode,e};var Th={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Er=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Er.isDisabled&&Er.supportsFiber)try{Ct=Er.inject(Th),Fe=Er}catch{}}return is.createRoot=function(e,t){if(!x(e))throw Error(u(299));var l=!1,n="",r=Sd,i=Nd,d=Ed;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(d=t.onRecoverableError)),t=nx(e,1,!1,null,null,l,n,null,r,i,d,mx),e[wa]=t.current,Ro(e),new Jo(t)},is.hydrateRoot=function(e,t,l){if(!x(e))throw Error(u(299));var n=!1,r="",i=Sd,d=Nd,h=Ed,E=null;return l!=null&&(l.unstable_strictMode===!0&&(n=!0),l.identifierPrefix!==void 0&&(r=l.identifierPrefix),l.onUncaughtError!==void 0&&(i=l.onUncaughtError),l.onCaughtError!==void 0&&(d=l.onCaughtError),l.onRecoverableError!==void 0&&(h=l.onRecoverableError),l.formState!==void 0&&(E=l.formState)),t=nx(e,1,!0,t,l??null,n,r,E,i,d,h,mx),t.context=sx(null),l=t.current,n=$t(),n=Hr(n),r=Vl(n),r.callback=null,Gl(l,r,n),l=n,t.current.lanes=l,hn(t,l),xl(t),e[wa]=t.current,Ro(e),new Nr(t)},is.version="19.2.4",is}var Cx;function Bh(){if(Cx)return Io.exports;Cx=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),Io.exports=Oh(),Io.exports}var Hh=Bh();const fc="";class Jx extends Error{constructor(o,c){super(o),this.name="ApiError",this.status=c}}async function Ae(s,o){const c=await fetch(`${fc}${s}`,o);if(!c.ok){const u=await c.json().catch(()=>({error:c.statusText}));throw new Jx(u.error||`HTTP ${c.status}`,c.status)}return c.json()}const ge={getConfig(){return Ae("/api/config")},setConfig(s,o){return Ae("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,model:o})})},getSkills(){return Ae("/api/skills")},getSkillDetail(s,o){return Ae(`/api/skills/${s}/${o}`)},getEvals(s,o){return Ae(`/api/skills/${s}/${o}/evals`)},saveEvals(s,o,c){return Ae(`/api/skills/${s}/${o}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})},generateEvals(s,o){return Ae(`/api/skills/${s}/${o}/generate-evals`,{method:"POST"})},async getLatestBenchmark(s,o){const c=await fetch(`${fc}/api/skills/${s}/${o}/benchmark/latest`);if(c.status===404)return null;if(!c.ok){const u=await c.json().catch(()=>({error:c.statusText}));throw new Jx(u.error||`HTTP ${c.status}`,c.status)}return c.json()},getHistory(s,o,c){const u=new URLSearchParams;c!=null&&c.model&&u.set("model",c.model),c!=null&&c.type&&u.set("type",c.type),c!=null&&c.from&&u.set("from",c.from),c!=null&&c.to&&u.set("to",c.to);const x=u.toString();return Ae(`/api/skills/${s}/${o}/history${x?"?"+x:""}`)},getHistoryEntry(s,o,c){return Ae(`/api/skills/${s}/${o}/history/${encodeURIComponent(c)}`)},compareRuns(s,o,c,u){return Ae(`/api/skills/${s}/${o}/history-compare?a=${encodeURIComponent(c)}&b=${encodeURIComponent(u)}`)},getCaseHistory(s,o,c,u){const x=new URLSearchParams;u&&x.set("model",u);const v=x.toString();return Ae(`/api/skills/${s}/${o}/history/case/${c}${v?"?"+v:""}`)},deleteHistoryEntry(s,o,c){return Ae(`/api/skills/${s}/${o}/history/${encodeURIComponent(c)}`,{method:"DELETE"})},deleteSkill(s,o){return Ae(`/api/skills/${s}/${o}`,{method:"DELETE"})},improveSkill(s,o,c){return Ae(`/api/skills/${s}/${o}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})},instructEdit(s,o,c){return Ae(`/api/skills/${s}/${o}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...c})})},applyImprovement(s,o,c){return Ae(`/api/skills/${s}/${o}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c})})},getStats(s,o){return Ae(`/api/skills/${s}/${o}/stats`)},getDependencies(s,o){return Ae(`/api/skills/${s}/${o}/dependencies`)},getProjectLayout(){return Ae("/api/project-layout")},createSkill(s){return Ae("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},saveDraft(s){return Ae("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},getSkillCreatorStatus(){return Ae("/api/skill-creator-status")},generateSkill(s){return Ae("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},getSkillFiles(s,o){return Ae(`/api/skills/${s}/${o}/files`)},getSkillFile(s,o,c){return Ae(`/api/skills/${s}/${o}/file?path=${encodeURIComponent(c)}`)},saveSkillFile(s,o,c,u){return Ae(`/api/skills/${s}/${o}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:c,content:u})})},getLeaderboard(s,o){return Ae(`/api/skills/${s}/${o}/leaderboard`)},getLeaderboardEntry(s,o,c){return Ae(`/api/skills/${s}/${o}/leaderboard/${encodeURIComponent(c)}`)},startSweep(s,o,c){const u=`${fc}/api/skills/${s}/${o}/sweep`,x=new EventSource(u);return fetch(u,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(c)}),x},getCredentials(s,o){return Ae(`/api/credentials/${s}/${o}`)},setCredential(s,o,c,u){return Ae(`/api/credentials/${s}/${o}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:c,value:u})})},getParams(s,o){return Ae(`/api/credentials/${s}/${o}/params`)},getParamsRevealed(s,o,c){const u=c?`reveal=true&key=${encodeURIComponent(c)}`:"reveal=true";return Ae(`/api/credentials/${s}/${o}/params?${u}`)},searchModels(){return Ae("/api/openrouter/models")}};function Uh(s){const[o,c]=m.useState(()=>typeof window>"u"?!1:window.matchMedia(s).matches);return m.useEffect(()=>{const u=window.matchMedia(s);c(u.matches);const x=v=>c(v.matches);return u.addEventListener("change",x),()=>u.removeEventListener("change",x)},[s]),o}const qh={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list"};function Vh(s,o){switch(o.type){case"SELECT_SKILL":return{...s,selectedSkill:o.skill,mode:"browse",mobileView:s.isMobile?"detail":s.mobileView};case"CLEAR_SELECTION":return{...s,selectedSkill:null};case"SET_MODE":return{...s,mode:o.mode,selectedSkill:o.mode==="create"?null:s.selectedSkill};case"SET_SEARCH":return{...s,searchQuery:o.query};case"SET_SKILLS":return{...s,skills:o.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...s,skillsError:o.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...s,skillsLoading:o.loading};case"SET_MOBILE":return{...s,isMobile:o.isMobile};case"SET_MOBILE_VIEW":return{...s,mobileView:o.view};default:return s}}const Wx=m.createContext(null);function ra(){const s=m.useContext(Wx);if(!s)throw new Error("useStudio must be used within StudioProvider");return s}function Gh({children:s}){const[o,c]=m.useReducer(Vh,qh),u=Uh("(max-width: 767px)");m.useEffect(()=>{c({type:"SET_MOBILE",isMobile:u})},[u]);const x=m.useCallback(()=>{c({type:"SET_SKILLS_LOADING",loading:!0}),ge.getSkills().then(y=>{c({type:"SET_SKILLS",skills:y});const R=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(R){const[,U,L]=R,Y=y.find(O=>O.plugin===U&&O.skill===L);Y&&c({type:"SELECT_SKILL",skill:{plugin:U,skill:L,origin:Y.origin}})}}).catch(y=>c({type:"SET_SKILLS_ERROR",error:y.message}))},[]);m.useEffect(()=>{x()},[x]);const v=m.useCallback(y=>{c({type:"SELECT_SKILL",skill:y}),window.location.hash=`/skills/${y.plugin}/${y.skill}`},[]),p=m.useCallback(()=>{c({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),b=m.useCallback(y=>{c({type:"SET_MODE",mode:y})},[]),g=m.useCallback(y=>{c({type:"SET_SEARCH",query:y})},[]),f=m.useCallback(y=>{c({type:"SET_MOBILE_VIEW",view:y})},[]),j=m.useMemo(()=>({state:o,selectSkill:v,clearSelection:p,setMode:b,setSearch:g,setMobileView:f,refreshSkills:x}),[o,v,p,b,g,f,x]);return a.jsx(Wx.Provider,{value:j,children:s})}const Yh={config:null,loading:!0};function $h(s,o){switch(o.type){case"SET_CONFIG":return{config:o.config,loading:!1};case"SET_LOADING":return{...s,loading:!0};default:return s}}const Fx=m.createContext(null);function ia(){const s=m.useContext(Fx);if(!s)throw new Error("useConfig must be used within ConfigProvider");return s}function Qh({children:s}){const[o,c]=m.useReducer($h,Yh),u=m.useCallback(()=>{ge.getConfig().then(p=>c({type:"SET_CONFIG",config:p})).catch(()=>{})},[]);m.useEffect(()=>{u()},[u]);const x=m.useCallback(async(p,b)=>{const g=await ge.setConfig(p,b);return c({type:"SET_CONFIG",config:g}),g},[]),v=m.useMemo(()=>({config:o.config,loading:o.loading,updateConfig:x,refreshConfig:u}),[o,x,u]);return a.jsx(Fx.Provider,{value:v,children:s})}function Xh({left:s,right:o}){const{state:c}=ra();return c.isMobile?a.jsx("div",{style:{height:"100vh",overflow:"hidden",background:"var(--surface-0)"},children:c.mobileView==="list"?a.jsx("div",{style:{height:"100%",overflowY:"auto",background:"var(--surface-1)"},children:s}):a.jsx("div",{style:{height:"100%",overflowY:"auto"},children:o})}):a.jsxs("div",{className:"studio-grid",style:{display:"grid",gridTemplateColumns:"280px 1px 1fr",height:"100vh",overflow:"hidden"},children:[a.jsx("div",{style:{overflowY:"auto",background:"var(--surface-1)"},children:s}),a.jsx("div",{style:{background:"var(--border-subtle)"}}),a.jsx("div",{style:{overflowY:"auto",background:"var(--surface-0)"},children:o})]})}function Kh(){const{state:s,setSearch:o}=ra(),[c,u]=m.useState(s.searchQuery),x=m.useRef(null);m.useEffect(()=>(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{o(c)},200),()=>{x.current&&clearTimeout(x.current)}),[c,o]),m.useEffect(()=>{s.searchQuery===""&&c!==""&&u("")},[s.searchQuery]);const v=new Set(s.skills.map(p=>p.plugin)).size;return a.jsxs("div",{className:"px-3 py-2",children:[a.jsxs("div",{className:"relative",children:[a.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:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),a.jsx("input",{type:"text",value:c,onChange:p=>u(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)"}}),c&&a.jsx("button",{onClick:()=>{u(""),o("")},style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:2},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!s.skillsLoading&&a.jsxs("div",{className:"text-[11px] mt-1.5 px-1",style:{color:"var(--text-tertiary)"},children:[s.skills.length," skill",s.skills.length!==1?"s":""," across ",v," plugin",v!==1?"s":""]})]})}const Tx={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"},stale:{bg:"var(--orange-muted)",text:"var(--orange)",dot:"var(--orange)",label:"Stale"},missing:{bg:"var(--surface-3)",text:"var(--text-tertiary)",dot:"var(--text-tertiary)",label:"No evals"}};function wx({skill:s,isSelected:o,onSelect:c}){const u=Tx[s.benchmarkStatus]||Tx.missing,x=s.origin==="installed";return a.jsxs("button",{onClick:c,className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:o?"var(--surface-2)":"transparent",cursor:"pointer",borderTop:"none",borderRight:"none",borderBottom:"1px solid var(--border-subtle)",borderLeft:o?"2px solid var(--accent)":"2px solid transparent",display:"block",opacity:x?.7:1},onMouseEnter:v=>{o||(v.currentTarget.style.background="var(--surface-2)")},onMouseLeave:v=>{o||(v.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-[13px] font-medium truncate",style:{color:"var(--text-primary)"},children:[x&&a.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),s.skill]}),a.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:u.bg,color:u.text},children:[a.jsx("span",{className:"rounded-full",style:{width:5,height:5,background:u.dot}}),u.label]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:[s.evalCount," eval",s.evalCount!==1?"s":""]}),a.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),a.jsxs("span",{children:[s.assertionCount," assert",s.assertionCount!==1?"s":""]}),s.lastBenchmark&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--border-subtle)"},children:"|"}),a.jsx("span",{children:new Date(s.lastBenchmark).toLocaleDateString()})]})]})]})}function Ax(s){var c;const o={};for(const u of s)(o[c=u.plugin]||(o[c]=[])).push(u);return o}function Zh(){const{state:s,selectSkill:o}=ra(),{skills:c,searchQuery:u,selectedSkill:x}=s,[v,p]=m.useState(!1),[b,g]=m.useState(()=>{try{return sessionStorage.getItem("vskill-origin-banner-dismissed")==="1"}catch{return!1}}),{sourceGroups:f,installedGroups:j}=m.useMemo(()=>{const y=u.toLowerCase(),k=y?c.filter(L=>L.skill.toLowerCase().includes(y)||L.plugin.toLowerCase().includes(y)):c,R=k.filter(L=>L.origin==="source"),U=k.filter(L=>L.origin==="installed");return{sourceGroups:Object.entries(Ax(R)),installedGroups:Object.entries(Ax(U))}},[c,u]);return s.skillsLoading?a.jsx("div",{className:"px-3 py-4 space-y-3",children:[1,2,3].map(y=>a.jsx("div",{className:"skeleton h-14 w-full rounded-lg"},y))}):f.length===0&&j.length===0?a.jsx("div",{className:"px-4 py-8 text-center",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No skills match your search"})}):a.jsxs("div",{className:"flex-1",children:[f.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Jh,{title:"Your Skills",count:f.reduce((y,[,k])=>y+k.length,0)}),f.map(([y,k])=>a.jsxs("div",{children:[a.jsx(Rx,{plugin:y,count:k.length}),k.map(R=>{const U=(x==null?void 0:x.plugin)===R.plugin&&(x==null?void 0:x.skill)===R.skill;return a.jsx(wx,{skill:R,isSelected:U,onSelect:()=>o({plugin:R.plugin,skill:R.skill,origin:R.origin})},`${R.plugin}/${R.skill}`)})]},y))]}),j.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>p(y=>!y),className:"w-full flex items-center gap-2 px-3 py-2.5 text-left",style:{background:"var(--surface-1)",border:"none",borderTop:"1px solid var(--border-subtle)",borderBottom:v?"1px solid var(--border-subtle)":"none",cursor:"pointer"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:v?"rotate(90deg)":"rotate(0deg)",transition:"transform 150ms ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Installed"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",j.reduce((y,[,k])=>y+k.length,0),")"]}),a.jsx("div",{className:"flex-1"}),a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),v&&a.jsxs(a.Fragment,{children:[!b&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("p",{className:"flex-1 text-[10px] leading-relaxed",style:{color:"var(--text-tertiary)",margin:0},children:"Skills inside agent folders (.claude/, .cursor/, etc.) are installed copies for consuming. Edit skills in your project root instead."}),a.jsx("button",{onClick:()=>{g(!0);try{sessionStorage.setItem("vskill-origin-banner-dismissed","1")}catch{}},className:"flex-shrink-0 mt-0.5",style:{background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),j.map(([y,k])=>a.jsxs("div",{children:[a.jsx(Rx,{plugin:y,count:k.length}),k.map(R=>{const U=(x==null?void 0:x.plugin)===R.plugin&&(x==null?void 0:x.skill)===R.skill;return a.jsx(wx,{skill:R,isSelected:U,onSelect:()=>o({plugin:R.plugin,skill:R.skill,origin:R.origin})},`${R.plugin}/${R.skill}`)})]},y))]})]})]})}function Jh({title:s,count:o}){return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--surface-1)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-secondary)"},children:s}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",o,")"]})]})}function Rx({plugin:s,count:o}){const[c,u]=m.useState(!1),x=`/images/icons/${s}.webp`;return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[c?a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}):a.jsx("img",{src:x,width:16,height:16,alt:"",onError:()=>u(!0),style:{objectFit:"contain"}}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:s}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",o,")"]}),a.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border-subtle)"}})]})}function Wh({value:s,onChange:o}){const[c,u]=m.useState([]),[x,v]=m.useState(!1),[p,b]=m.useState(null),[g,f]=m.useState(s),[j,y]=m.useState(!1),k=m.useRef(null),R=m.useRef(void 0);m.useEffect(()=>{v(!0),ge.searchModels().then(O=>u(O.models)).catch(O=>b(O instanceof Error?O.message:String(O))).finally(()=>v(!1))},[]);const U=m.useCallback(O=>{f(O),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>y(!0),300)},[]),L=m.useMemo(()=>{if(!g.trim())return c.slice(0,50);const O=g.toLowerCase();return c.filter(Z=>Z.id.toLowerCase().includes(O)||Z.name.toLowerCase().includes(O)).slice(0,50)},[c,g]);m.useEffect(()=>{function O(Z){k.current&&!k.current.contains(Z.target)&&y(!1)}return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);function Y(O){var F;const Z=(F=O.pricing)==null?void 0:F.prompt;return Z==null||Z===0?"Free":`$${(Z*1e6).toFixed(2)}/1M`}return a.jsxs("div",{ref:k,style:{position:"relative"},children:[a.jsx("input",{type:"text",value:g,onChange:O=>U(O.target.value),onFocus:()=>y(!0),placeholder:x?"Loading models...":"Search OpenRouter models...",className:"input-field w-full",style:{fontSize:12}}),j&&!x&&a.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,maxHeight:280,overflowY:"auto",background:"var(--surface-2)",border:"1px solid var(--border-default)",borderRadius:8,marginTop:4,zIndex:20,boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},children:[p&&a.jsxs("div",{className:"px-3 py-2 text-[11px]",style:{color:"var(--red)"},children:["Failed to load models: ",p]}),L.length===0&&!p&&a.jsx("div",{className:"px-3 py-3 text-[11px]",style:{color:"var(--text-tertiary)"},children:"No models found"}),L.map(O=>a.jsxs("button",{onClick:()=>{o(O.id),f(O.id),y(!1)},className:"w-full text-left px-3 py-2 flex items-center justify-between transition-colors duration-100",style:{background:O.id===s?"var(--accent-muted)":"transparent",border:"none",cursor:"pointer",borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:Z=>{Z.currentTarget.style.background="var(--surface-3)"},onMouseLeave:Z=>{Z.currentTarget.style.background=O.id===s?"var(--accent-muted)":"transparent"},children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:O.name}),a.jsx("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:O.id})]}),a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:Y(O)})]},O.id))]})]})}function Fh(){const{config:s,updateConfig:o,refreshConfig:c}=ia(),[u,x]=m.useState(!1),[v,p]=m.useState(!1),b=m.useRef(null);m.useEffect(()=>{function y(k){b.current&&!b.current.contains(k.target)&&x(!1)}return u&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[u]);async function g(y,k){p(!0);try{await o(y.id,k.id),x(!1)}catch{c()}finally{p(!1)}}if(!s)return null;const f=Ph(s),j=Ih(s);return a.jsxs("div",{ref:b,className:"relative",children:[a.jsxs("button",{onClick:()=>x(!u),className:"w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-[11px] transition-all duration-150",style:{background:u?"var(--surface-3)":"var(--surface-2)",border:`1px solid ${u?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},onMouseEnter:y=>{u||(y.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:y=>{u||(y.currentTarget.style.borderColor="var(--border-subtle)")},children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:j!=null&&j.available?"var(--green)":"var(--text-tertiary)"}}),a.jsx("span",{className:"flex-1 text-left font-medium truncate",style:{color:"var(--text-primary)"},children:f}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",style:{transform:u?"rotate(180deg)":"rotate(0)",transition:"transform 0.15s ease",flexShrink:0},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),u&&a.jsxs("div",{className:"absolute top-full mt-1 left-0 right-0 rounded-xl shadow-xl z-50 overflow-hidden animate-fade-in",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",minWidth:"240px"},children:[a.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Select Model"})}),a.jsx("div",{className:"py-1 max-h-72 overflow-y-auto",children:s.providers.map(y=>a.jsxs("div",{children:[a.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:y.available?"var(--green)":"var(--text-tertiary)",opacity:y.available?1:.3}}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",opacity:y.available?1:.5},children:y.label})]}),y.id==="openrouter"&&y.available?a.jsx("div",{className:"px-3 py-1.5",children:a.jsx(Wh,{value:s.provider==="openrouter"?s.model:"",onChange:k=>{v||g(y,{id:k,label:k})}})}):y.models.map(k=>{const R=Ix(s,y.id,k.id),U=!y.available||v;return a.jsxs("button",{onClick:()=>!U&&g(y,k),disabled:U,className:"w-full px-3 py-1.5 flex items-center gap-2.5 text-left transition-all duration-100",style:{background:R?"var(--accent-muted)":"transparent",color:U?"var(--text-tertiary)":"var(--text-primary)",opacity:U?.4:1,cursor:U?"not-allowed":"pointer"},onMouseEnter:L=>{!U&&!R&&(L.currentTarget.style.background="var(--surface-3)")},onMouseLeave:L=>{R||(L.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 flex items-center justify-center",style:{border:`2px solid ${R?"var(--accent)":"var(--border-subtle)"}`},children:R&&a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}})}),a.jsx("span",{className:"text-[12px]",style:{fontWeight:R?600:400},title:k.id,children:k.label})]},`${y.id}-${k.id}`)})]},y.id))})]})]})}function Ix(s,o,c){return s.provider!==o?!1:s.model===c}function Ih(s){return s.providers.find(o=>o.id===s.provider)}function Ph(s){for(const o of s.providers)for(const c of o.models)if(Ix(s,o.id,c.id))return c.label;return s.model}function ev(){const{state:s,setMode:o}=ra(),{config:c}=ia(),[u,x]=m.useState(null),[v,p]=m.useState(!1);return m.useEffect(()=>{ge.getSkillCreatorStatus().then(x).catch(()=>{})},[]),a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"px-4 py-4 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"var(--accent-muted)"},children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-[14px] font-semibold truncate",style:{color:"var(--text-primary)",letterSpacing:"-0.01em"},children:"Skill Studio"}),a.jsx("div",{className:"text-[11px] truncate",style:{color:"var(--text-tertiary)"},children:(c==null?void 0:c.projectName)||"vskill"})]})]}),a.jsx("div",{className:"mt-3",children:a.jsx(Fh,{})})]}),a.jsx(Kh,{}),a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("button",{onClick:()=>o("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:s.mode==="create"?"var(--accent)":"var(--surface-3)",color:s.mode==="create"?"#fff":"var(--text-secondary)",border:"none",cursor:"pointer"},onMouseEnter:b=>{s.mode!=="create"&&(b.currentTarget.style.background="var(--surface-4)",b.currentTarget.style.color="var(--text-primary)")},onMouseLeave:b=>{s.mode!=="create"&&(b.currentTarget.style.background="var(--surface-3)",b.currentTarget.style.color="var(--text-secondary)")},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]})}),u&&(u.installed?a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--green)"}}),"Skill Creator installed"]})}):a.jsx("div",{className:"px-3 pb-2 flex-shrink-0",children:a.jsxs("div",{className:"px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",style:{color:"var(--yellow)"},children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--yellow)"}}),a.jsx("span",{className:"font-medium",children:"Skill Creator not installed"})]}),a.jsx("button",{onClick:()=>{navigator.clipboard.writeText(u.installCommand).then(()=>{p(!0),setTimeout(()=>p(!1),2e3)}).catch(()=>{})},className:"w-full text-left px-2 py-1 rounded text-[10px] font-mono cursor-pointer transition-colors duration-150",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},title:"Click to copy",onMouseEnter:b=>{b.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:b=>{b.currentTarget.style.borderColor="var(--border-subtle)"},children:v?"Copied!":u.installCommand})]})})),a.jsx("div",{className:"flex-1 overflow-y-auto",style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Zh,{})})]})}const tv="modulepreload",lv=function(s){return"/"+s},_x={},av=function(o,c,u){let x=Promise.resolve();if(c&&c.length>0){let p=function(f){return Promise.all(f.map(j=>Promise.resolve(j).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const b=document.querySelector("meta[property=csp-nonce]"),g=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));x=p(c.map(f=>{if(f=lv(f),f in _x)return;_x[f]=!0;const j=f.endsWith(".css"),y=j?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const k=document.createElement("link");if(k.rel=j?"stylesheet":tv,j||(k.as="script"),k.crossOrigin="",k.href=f,g&&k.setAttribute("nonce",g),document.head.appendChild(k),j)return new Promise((R,U)=>{k.addEventListener("load",R),k.addEventListener("error",()=>U(new Error(`Unable to preload CSS for ${f}`)))})}))}function v(p){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=p,window.dispatchEvent(b),!b.defaultPrevented)throw p}return x.then(p=>{for(const b of p||[])b.status==="rejected"&&v(b.reason);return o().catch(v)})};function Px(s){if(s!==void 0)try{return JSON.stringify(s)}catch(o){console.error("Failed to serialize request body:",o);try{const c=new WeakSet;return JSON.stringify(s,(u,x)=>{if(typeof x=="object"&&x!==null){if(c.has(x))return"[Circular]";c.add(x)}return x})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function lc(){const[s,o]=m.useState([]),[c,u]=m.useState(!1),[x,v]=m.useState(!1),[p,b]=m.useState(null),g=m.useRef(null),f=m.useCallback(async(y,k)=>{o([]),u(!0),v(!1),b(null);const R=new AbortController;g.current=R;try{const U=Px(k),L=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:U,signal:R.signal});if(!L.ok||!L.body){let F=`HTTP ${L.status}`;try{const ae=await L.json();ae.error&&(F=ae.error)}catch{}throw new Error(F)}const Y=L.body.getReader(),O=new TextDecoder;let Z="",W="";for(;;){const{done:F,value:ae}=await Y.read();if(F)break;Z+=O.decode(ae,{stream:!0});const re=Z.split(`
50
+ `);Z=re.pop()||"";for(const q of re)if(q.startsWith("event: "))W=q.slice(7).trim();else if(q.startsWith("data: ")){try{const I=JSON.parse(q.slice(6)),G={event:W,data:I};W==="done"?(v(!0),o(X=>[...X,G])):o(X=>[...X,G])}catch{}W=""}}}catch(U){U.name!=="AbortError"&&b(U.message)}finally{u(!1),g.current=null}},[]),j=m.useCallback(()=>{var y;(y=g.current)==null||y.abort()},[]);return{events:s,running:c,done:x,error:p,start:f,stop:j}}function nv(s){const o=m.useRef(s);o.current=s;const[c,u]=m.useState(new Set),x=m.useRef(new Map),v=m.useCallback(async(f,j,y)=>{var R;(R=x.current.get(f))==null||R.abort();const k=new AbortController;x.current.set(f,k),u(U=>{const L=new Set(U);return L.add(f),L});try{const U=Px(y),L=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:U,signal:k.signal});if(!L.ok||!L.body){let F=`HTTP ${L.status}`;try{const ae=await L.json();ae.error&&(F=ae.error)}catch{}throw new Error(F)}const Y=L.body.getReader(),O=new TextDecoder;let Z="",W="";for(;;){const{done:F,value:ae}=await Y.read();if(F)break;Z+=O.decode(ae,{stream:!0});const re=Z.split(`
51
+ `);Z=re.pop()||"";for(const q of re)if(q.startsWith("event: "))W=q.slice(7).trim();else if(q.startsWith("data: ")){try{const I=JSON.parse(q.slice(6)),G={event:W,data:I};o.current.onEvent(f,G)}catch{}W=""}}o.current.onDone(f)}catch(U){U.name!=="AbortError"&&o.current.onError(f,U.message)}finally{u(U=>{const L=new Set(U);return L.delete(f),L}),x.current.delete(f)}},[]),p=m.useCallback(f=>{var j;(j=x.current.get(f))==null||j.abort()},[]),b=m.useCallback(()=>{for(const f of x.current.values())f.abort()},[]),g=c.size>0;return{runningSet:c,startCase:v,stopCase:p,stopAll:b,isAnyCaseRunning:g}}const sv={plugin:"",skill:"",skillContent:"",savedContent:"",isDirty:!1,evals:null,evalsError:null,activePanel:"tests",selectedCaseId:null,caseRunStates:new Map,bulkRunActive:!1,runMode:null,latestBenchmark:null,inlineResults:new Map,improveTarget:null,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null,generateEvalsLoading:!1,generateEvalsProgress:[],generateEvalsError:null,regressions:[],iterationCount:0,activationPrompts:"",activationResults:[],activationSummary:null,activationRunning:!1,activationError:null,activationTotalPrompts:0,activationStartedAt:null,activationClassifyingStatus:null,generatingPrompts:!1,generatingPromptsError:null,activationHistory:null,activationHistoryLoading:!1,loading:!0,error:null};function rv(s,o){var c,u;switch(o.type){case"SET_LOADING":return{...s,loading:o.loading};case"SET_ERROR":return{...s,error:o.error};case"INIT_DATA":{const x=new Map;if(o.benchmark)for(const p of o.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(b=>({assertion_id:b.id,text:b.text,pass:b.pass,reasoning:b.reasoning}))});const v=((u=(c=o.evals)==null?void 0:c.evals[0])==null?void 0:u.id)??null;return{...s,skillContent:o.skillContent,savedContent:o.skillContent,isDirty:!1,evals:o.evals,evalsError:o.evalsError??null,latestBenchmark:o.benchmark,inlineResults:x,selectedCaseId:v,loading:!1,error:null}}case"SET_PANEL":return{...s,activePanel:o.panel};case"SET_CONTENT":return{...s,skillContent:o.content,isDirty:o.content!==s.savedContent};case"CONTENT_SAVED":return{...s,savedContent:s.skillContent,isDirty:!1};case"SET_EVALS":return{...s,evals:o.evals};case"SELECT_CASE":return{...s,selectedCaseId:o.caseId};case"CASE_RUN_START":{const x=new Map(s.caseRunStates);return x.set(o.caseId,{status:"running",startedAt:Date.now(),mode:o.mode}),{...s,caseRunStates:x,runMode:o.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const x=new Map(s.caseRunStates),v=x.get(o.caseId);x.set(o.caseId,{status:"complete",mode:v==null?void 0:v.mode});const p=new Map(s.inlineResults);return p.set(o.caseId,o.result),{...s,caseRunStates:x,inlineResults:p}}case"CASE_RUN_ERROR":{const x=new Map(s.caseRunStates),v=x.get(o.caseId);x.set(o.caseId,{status:"error",mode:v==null?void 0:v.mode});const p=new Map(s.inlineResults);return p.set(o.caseId,{status:"error",errorMessage:o.error,assertions:[]}),{...s,caseRunStates:x,inlineResults:p}}case"CASE_RUN_CANCEL":{const x=new Map(s.caseRunStates),v=x.get(o.caseId);return x.set(o.caseId,{status:"cancelled",mode:v==null?void 0:v.mode}),{...s,caseRunStates:x}}case"BULK_RUN_START":{const x=new Map(s.caseRunStates);for(const v of o.caseIds)x.set(v,{status:"queued",mode:o.mode});return{...s,caseRunStates:x,bulkRunActive:!0,runMode:o.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...s,bulkRunActive:!1,latestBenchmark:o.benchmark??s.latestBenchmark,iterationCount:s.iterationCount+1};case"CANCEL_ALL":{const x=new Map(s.caseRunStates);for(const[v,p]of x)(p.status==="running"||p.status==="queued")&&x.set(v,{status:"cancelled"});return{...s,caseRunStates:x,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const x=new Map(s.inlineResults);return x.set(o.evalId,o.result),{...s,inlineResults:x}}case"OPEN_IMPROVE":return{...s,improveTarget:o.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...s,improveTarget:null};case"OPEN_AI_EDIT":return{...s,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...s,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...s,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...s,aiEditProgress:[...s.aiEditProgress,o.entry]};case"AI_EDIT_RESULT":{const x=o.evalChanges??[],v=new Map;for(let p=0;p<x.length;p++)v.set(p,!0);return{...s,aiEditLoading:!1,aiEditResult:{improved:o.improved,reasoning:o.reasoning,evalChanges:x},aiEditEvalChanges:x,aiEditEvalSelections:v}}case"AI_EDIT_ERROR":return{...s,aiEditLoading:!1,aiEditError:o.message,aiEditClassifiedError:o.classified??null};case"GENERATE_EVALS_START":return{...s,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...s,generateEvalsProgress:[...s.generateEvalsProgress,o.entry]};case"GENERATE_EVALS_DONE":return{...s,generateEvalsLoading:!1,evals:o.evals};case"GENERATE_EVALS_ERROR":return{...s,generateEvalsLoading:!1,generateEvalsError:o.classified};case"TOGGLE_EVAL_CHANGE":{const x=new Map(s.aiEditEvalSelections);return x.set(o.index,!x.get(o.index)),{...s,aiEditEvalSelections:x}}case"SELECT_ALL_EVAL_CHANGES":{const x=new Map(s.aiEditEvalSelections);for(const v of x.keys())x.set(v,!0);return{...s,aiEditEvalSelections:x}}case"DESELECT_ALL_EVAL_CHANGES":{const x=new Map(s.aiEditEvalSelections);for(const v of x.keys())x.set(v,!1);return{...s,aiEditEvalSelections:x}}case"SET_EVALS_RETRY":return{...s,aiEditEvalsRetry:o.evalsFile};case"SET_REGRESSIONS":return{...s,regressions:o.regressions};case"INCREMENT_ITERATION":return{...s,iterationCount:s.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...s,activationPrompts:o.prompts};case"ACTIVATION_START":return{...s,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...s,activationResults:[...s.activationResults,o.result]};case"ACTIVATION_DONE":return{...s,activationRunning:!1,activationSummary:o.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...s,activationClassifyingStatus:`Classifying prompt ${o.index}/${o.total}...`};case"ACTIVATION_ERROR":return{...s,activationRunning:!1,activationError:o.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...s,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...s,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...s,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...s,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...s,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...s,generatingPrompts:!1,generatingPromptsError:o.error};case"ACTIVATION_HISTORY_LOADED":return{...s,activationHistory:o.runs,activationHistoryLoading:!1};default:return s}}function iv(s){if(s==="unit"||s==="integration")return s}function ov(s,o){const c=o.data;if(o.event==="output_ready"&&(s.output=c.output,c.durationMs!=null&&(s.durationMs=c.durationMs),c.tokens!=null&&(s.tokens=c.tokens)),o.event==="outputs_ready"&&(s.output=c.skillOutput,c.skillDurationMs!=null&&(s.durationMs=c.skillDurationMs),c.skillTokens!=null&&(s.tokens=c.skillTokens)),o.event==="assertion_result"){const u={assertion_id:c.assertion_id,text:c.text,pass:c.pass,reasoning:c.reasoning};s.assertions.find(x=>x.assertion_id===u.assertion_id)||s.assertions.push(u)}o.event==="case_complete"&&(s.status=c.status,s.passRate=c.pass_rate,s.errorMessage=c.error_message||void 0,s.classifiedError=c.classified_error||void 0)}const ep=m.createContext(null);function al(){const s=m.useContext(ep);if(!s)throw new Error("useWorkspace must be used within WorkspaceProvider");return s}function cv({plugin:s,skill:o,origin:c,children:u}){const x=c==="installed",[v,p]=m.useReducer(rv,{...sv,plugin:s,skill:o}),b=m.useRef(new Set),g=m.useRef(new Set),f=m.useRef(new Map),j=m.useCallback((J,ie)=>{let se=f.current.get(J);se||(se={assertions:[]},f.current.set(J,se)),ov(se,ie),p({type:"UPDATE_INLINE_RESULT",evalId:J,result:{...se,assertions:[...se.assertions]}})},[]),y=m.useCallback(J=>{if(g.current.has(J))return;g.current.add(J);const ie=f.current.get(J)??{assertions:[]};p({type:"CASE_RUN_COMPLETE",caseId:J,result:{...ie,assertions:[...ie.assertions]}}),b.current.has(J)&&(b.current.delete(J),b.current.size===0&&ge.getLatestBenchmark(s,o).then(se=>p({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>p({type:"BULK_RUN_COMPLETE",benchmark:null})))},[s,o]),k=m.useCallback((J,ie)=>{g.current.has(J)||(g.current.add(J),p({type:"CASE_RUN_ERROR",caseId:J,error:ie}),b.current.has(J)&&(b.current.delete(J),b.current.size===0&&ge.getLatestBenchmark(s,o).then(se=>p({type:"BULK_RUN_COMPLETE",benchmark:se})).catch(()=>p({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[s,o]),{startCase:R,stopCase:U,stopAll:L}=nv({onEvent:j,onDone:y,onError:k});m.useEffect(()=>()=>{L()},[L]);const Y=m.useCallback(async()=>{try{const J=await fetch(`/api/skills/${s}/${o}/activation-history`);if(!J.ok){if(J.status===404){p({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const ie=await J.json();p({type:"ACTIVATION_HISTORY_LOADED",runs:ie.runs||[]})}catch{}},[s,o]);m.useEffect(()=>{let J=!1;async function ie(){try{const[se,xe,ye]=await Promise.allSettled([ge.getSkillDetail(s,o),ge.getEvals(s,o),ge.getLatestBenchmark(s,o)]);if(J)return;let Ye=null,ut=null;if(xe.status==="fulfilled")Ye=xe.value;else{const Qe=xe.reason;(Qe==null?void 0:Qe.status)!==404&&(ut=(Qe==null?void 0:Qe.message)??"Failed to load test cases")}p({type:"INIT_DATA",skillContent:se.status==="fulfilled"?se.value.skillContent:"",evals:Ye,evalsError:ut,benchmark:ye.status==="fulfilled"?ye.value:null})}catch(se){J||p({type:"SET_ERROR",error:se.message})}}return ie(),Y(),()=>{J=!0}},[s,o,Y]);const O=m.useCallback(async()=>{if(!x)try{await ge.applyImprovement(s,o,v.skillContent),p({type:"CONTENT_SAVED"})}catch(J){p({type:"SET_ERROR",error:J.message})}},[x,s,o,v.skillContent]),Z=m.useCallback(async J=>{if(!x)try{const ie=await ge.saveEvals(s,o,J);p({type:"SET_EVALS",evals:ie})}catch(ie){p({type:"SET_ERROR",error:ie.message})}},[x,s,o]),W=m.useCallback((J,ie="benchmark")=>{if(x)return;const se=v.caseRunStates.get(J);if((se==null?void 0:se.status)!=="running")if(f.current.delete(J),g.current.delete(J),p({type:"CASE_RUN_START",caseId:J,mode:ie}),ie==="comparison"){const xe=`/api/skills/${s}/${o}/compare`;R(J,xe,{eval_ids:[J]})}else{const xe=`/api/skills/${s}/${o}/benchmark/case/${J}`;R(J,xe,ie==="baseline"?{baseline_only:!0}:void 0)}},[x,s,o,v.caseRunStates,R]),F=m.useCallback((J="benchmark")=>{var xe;if(x)return;const ie=((xe=v.evals)==null?void 0:xe.evals)??[];if(ie.length===0)return;const se=ie.map(ye=>ye.id);for(const ye of se)f.current.delete(ye),g.current.delete(ye);p({type:"BULK_RUN_START",caseIds:se,mode:J}),b.current=new Set(se);for(const ye of se)if(J==="comparison")R(ye,`/api/skills/${s}/${o}/compare`,{eval_ids:[ye]});else{const Ye=`/api/skills/${s}/${o}/benchmark/case/${ye}`;R(ye,Ye,J==="baseline"?{baseline_only:!0}:void 0)}},[x,s,o,v.evals,R]),ae=m.useCallback(J=>{U(J),p({type:"CASE_RUN_CANCEL",caseId:J}),b.current.delete(J),g.current.add(J)},[U]),re=m.useCallback(()=>{L(),p({type:"CANCEL_ALL"}),b.current.clear()},[L]),q=m.useCallback(async(J,ie)=>{p({type:"OPEN_IMPROVE",evalId:J})},[]),I=m.useCallback(async(J,ie)=>{try{await ge.applyImprovement(s,o,ie),p({type:"SET_CONTENT",content:ie}),p({type:"CONTENT_SAVED"}),p({type:"CLOSE_IMPROVE"}),W(J,"benchmark")}catch(se){p({type:"SET_ERROR",error:se.message})}},[s,o,W]),G=lc(),X=m.useRef(null),ne=m.useRef(0);m.useEffect(()=>{const J=G.events;for(let ie=ne.current;ie<J.length;ie++){const se=J[ie],xe=se.data;if(se.event==="progress"&&p({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),se.event==="done"){const ye=xe.improved,Ye=xe.reasoning,ut=xe.evalChanges??[];p({type:"AI_EDIT_RESULT",improved:ye,reasoning:Ye,evalChanges:ut})}if(se.event==="error"){const ye=xe;p({type:"AI_EDIT_ERROR",message:ye.description||"Unknown error",classified:ye})}}ne.current=J.length},[G.events]),m.useEffect(()=>{G.error&&p({type:"AI_EDIT_ERROR",message:G.error})},[G.error]),m.useEffect(()=>()=>{G.stop()},[G.stop]);const te=m.useCallback(async(J,ie,se)=>{x||(ne.current=0,p({type:"AI_EDIT_LOADING"}),X.current=G.stop,G.start(`/api/skills/${s}/${o}/improve?sse`,{mode:"instruct",instruction:J,content:v.skillContent,evals:v.evals??{skill_name:o,evals:[]},provider:ie,model:se}))},[x,s,o,v.skillContent,v.evals,G]),be=m.useCallback(()=>{G.stop(),p({type:"AI_EDIT_ERROR",message:"Cancelled"})},[G]),he=m.useCallback(async()=>{const J=v.aiEditResult;if(J!=null&&J.improved)try{if(await ge.applyImprovement(s,o,J.improved),p({type:"SET_CONTENT",content:J.improved}),p({type:"CONTENT_SAVED"}),v.aiEditEvalChanges.length>0&&Array.from(v.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:se}=await av(async()=>{const{mergeEvalChanges:Ye}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Ye}},[]),xe=v.evals??{skill_name:o,evals:[]},ye=se(xe,v.aiEditEvalChanges,v.aiEditEvalSelections);try{const Ye=await ge.saveEvals(s,o,ye);p({type:"SET_EVALS",evals:Ye})}catch(Ye){p({type:"SET_EVALS_RETRY",evalsFile:ye}),p({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Ye.message}. You can retry from the AI Edit panel.`});return}}p({type:"CLOSE_AI_EDIT"})}catch(ie){p({type:"SET_ERROR",error:ie.message})}},[s,o,v.aiEditResult,v.evals,v.aiEditEvalChanges,v.aiEditEvalSelections]),T=m.useCallback(()=>{p({type:"CLOSE_AI_EDIT"})},[]),N=m.useCallback(J=>{p({type:"TOGGLE_EVAL_CHANGE",index:J})},[]),w=m.useCallback(()=>{p({type:"SELECT_ALL_EVAL_CHANGES"})},[]),ee=m.useCallback(()=>{p({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),B=m.useCallback(async()=>{const J=v.aiEditEvalsRetry;if(J)try{const ie=await ge.saveEvals(s,o,J);p({type:"SET_EVALS",evals:ie}),p({type:"SET_ERROR",error:null}),p({type:"CLOSE_AI_EDIT"})}catch(ie){p({type:"SET_ERROR",error:`Retry failed: ${ie.message}`})}},[s,o,v.aiEditEvalsRetry]),ue=m.useCallback(async()=>{try{const J=await ge.getSkillDetail(s,o);p({type:"SET_CONTENT",content:J.skillContent}),p({type:"CONTENT_SAVED"})}catch{}},[s,o]),{config:S}=ia(),D=lc(),P=m.useRef(0);m.useEffect(()=>{const J=D.events;for(let ie=P.current;ie<J.length;ie++){const se=J[ie],xe=se.data;if(se.event==="progress"&&p({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:xe.phase,message:xe.message}}),se.event==="done"){const ye=xe;ge.saveEvals(s,o,ye).then(Ye=>p({type:"GENERATE_EVALS_DONE",evals:Ye})).catch(Ye=>p({type:"SET_ERROR",error:Ye.message}))}se.event==="error"&&p({type:"GENERATE_EVALS_ERROR",classified:xe})}P.current=J.length},[D.events,s,o]),m.useEffect(()=>{D.error&&p({type:"SET_ERROR",error:D.error})},[D.error]),m.useEffect(()=>()=>{D.stop()},[D.stop]);const le=m.useCallback(async J=>{if(x)return;P.current=0,p({type:"GENERATE_EVALS_START"});const ie={};S!=null&&S.provider&&(ie.provider=S.provider),S!=null&&S.model&&(ie.model=S.model);const se=iv(J==null?void 0:J.testType);se&&(ie.testType=se),D.start(`/api/skills/${s}/${o}/generate-evals?sse`,Object.keys(ie).length>0?ie:void 0)},[x,s,o,D,S]),ce=lc(),de=m.useRef(0);m.useEffect(()=>()=>{ce.stop()},[ce.stop]),m.useEffect(()=>{const J=ce.events;for(let ie=de.current;ie<J.length;ie++){const se=J[ie];if(se.event==="classifying"){const xe=se.data;p({type:"ACTIVATION_CLASSIFYING",index:xe.index,total:xe.total})}if(se.event==="prompt_result"&&p({type:"ACTIVATION_RESULT",result:se.data}),se.event==="done"){me.current&&(clearTimeout(me.current),me.current=null);const xe=se.data;if(xe.error)p({type:"ACTIVATION_ERROR",error:xe.error});else{p({type:"ACTIVATION_DONE",summary:xe});const ye={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(S==null?void 0:S.model)||"unknown",provider:(S==null?void 0:S.provider)||"unknown",promptCount:xe.total,summary:{precision:xe.precision,recall:xe.recall,reliability:xe.reliability,tp:xe.tp,tn:xe.tn,fp:xe.fp,fn:xe.fn}};p({type:"ACTIVATION_HISTORY_LOADED",runs:[ye,...v.activationHistory??[]]})}}}de.current=J.length},[ce.events,S,v.activationHistory]),m.useEffect(()=>{ce.error&&(me.current&&(clearTimeout(me.current),me.current=null),p({type:"ACTIVATION_ERROR",error:ce.error}))},[ce.error]);const me=m.useRef(null),Oe=m.useCallback(()=>{me.current&&(clearTimeout(me.current),me.current=null),ce.stop(),p({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ce]),Re=m.useCallback(J=>{const se=J.trim().split(`
52
+ `).filter(Boolean).map(ye=>ye.startsWith("!")?{prompt:ye.slice(1).trim(),expected:"should_not_activate"}:ye.startsWith("+")?{prompt:ye.slice(1).trim(),expected:"should_activate"}:{prompt:ye.trim(),expected:"auto"});de.current=0,p({type:"ACTIVATION_START"}),p({type:"SET_ACTIVATION_PROMPTS",prompts:J});const xe={prompts:se};S!=null&&S.provider&&(xe.provider=S.provider),S!=null&&S.model&&(xe.model=S.model),ce.start(`/api/skills/${s}/${o}/activation-test`,xe),me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{ce.stop(),p({type:"ACTIVATION_TIMEOUT"}),me.current=null},12e4)},[s,o,ce,S]),pt=m.useCallback(async(J=8)=>{p({type:"GENERATE_PROMPTS_START"});try{const ie={count:J};S!=null&&S.provider&&(ie.provider=S.provider),S!=null&&S.model&&(ie.model=S.model);const se=await fetch(`/api/skills/${s}/${o}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(!se.ok){let mt=`HTTP ${se.status}`;try{const nl=await se.json();nl.error&&(mt=nl.error)}catch{}throw new Error(mt)}const xe=se.body.getReader(),ye=new TextDecoder;let Ye="",ut="",Qe=[];for(;;){const{done:mt,value:nl}=await xe.read();if(mt)break;Ye+=ye.decode(nl,{stream:!0});const Xt=Ye.split(`
53
+ `);Ye=Xt.pop()||"";for(const We of Xt)if(We.startsWith("event: "))ut=We.slice(7).trim();else if(We.startsWith("data: ")){try{const kt=JSON.parse(We.slice(6));if(ut==="done"){if(kt.error)throw new Error(kt.error);Qe=kt.prompts||[]}if(ut==="error")throw new Error(kt.message||kt.description||"Generation failed")}catch(kt){if(!(kt instanceof SyntaxError))throw kt}ut=""}}const Ot=Qe.map(mt=>`${mt.expected==="should_activate"?"+":"!"}${mt.prompt}`).join(`
54
+ `);p({type:"SET_ACTIVATION_PROMPTS",prompts:Ot}),p({type:"GENERATE_PROMPTS_DONE"})}catch(ie){p({type:"GENERATE_PROMPTS_ERROR",error:ie.message})}},[s,o,S]),Dt=m.useMemo(()=>({state:v,dispatch:p,isReadOnly:x,saveContent:O,saveEvals:Z,runCase:W,runAll:F,cancelCase:ae,cancelAll:re,improveForCase:q,applyImproveAndRerun:I,refreshSkillContent:ue,generateEvals:le,runActivationTest:Re,cancelActivation:Oe,generateActivationPrompts:pt,fetchActivationHistory:Y,submitAiEdit:te,cancelAiEdit:be,applyAiEdit:he,discardAiEdit:T,toggleEvalChange:N,selectAllEvalChanges:w,deselectAllEvalChanges:ee,retryEvalsSave:B}),[v,x,O,Z,W,F,ae,re,q,I,ue,le,Re,Oe,pt,Y,te,be,he,T,N,w,ee,B]);return a.jsx(ep.Provider,{value:Dt,children:u})}function uv(s){return s==null?"var(--text-tertiary)":s>=.7?"var(--green)":s>=.4?"var(--yellow)":"var(--red)"}function dv(s){return s==null?"var(--surface-3)":s>=.7?"var(--green-muted)":s>=.4?"var(--yellow-muted)":"var(--red-muted)"}function fv({state:s,isReadOnly:o,onDelete:c}){const{plugin:u,skill:x,evals:v,latestBenchmark:p,isDirty:b,caseRunStates:g,regressions:f,iterationCount:j}=s,y=Array.from(g.values()).some(O=>O.status==="running"||O.status==="queued"),k=p==null?void 0:p.overall_pass_rate,R=(v==null?void 0:v.evals.reduce((O,Z)=>O+Z.assertions.length,0))??0,U=(v==null?void 0:v.evals.length)??0,L=uv(k),Y=dv(k);return a.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:[a.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:u}),a.jsx(xv,{}),a.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:x}),o&&a.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),b&&a.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"}),y&&a.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!o&&c&&a.jsx("button",{disabled:y,onClick:()=>{window.confirm(`Delete skill "${x}"? This cannot be undone.`)&&c()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:y?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:y?.4:1,borderRadius:4},onMouseEnter:O=>{y||(O.currentTarget.style.color="var(--red)")},onMouseLeave:O=>{O.currentTarget.style.color="var(--text-tertiary)"},children:a.jsx(pv,{})}),f.length>0&&a.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),f.length," regression",f.length>1?"s":""]}),j>0&&a.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",j]}),a.jsx("span",{className:"pill",style:{background:Y,color:L},children:k!=null?`${Math.round(k*100)}%`:"--"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[U," case",U!==1?"s":""," / ",R," assert",R!==1?"s":""]})]})]})}function xv(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function pv(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.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"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const mv=[{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:"leaderboard",label:"Leaderboard",shortcut:"6"},{id:"deps",label:"Deps",shortcut:"7"}]}];function hv({id:s}){const o={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(s){case"editor":return a.jsxs("svg",{...o,children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.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 a.jsxs("svg",{...o,children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.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 a.jsx("svg",{...o,children:a.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return a.jsxs("svg",{...o,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return a.jsxs("svg",{...o,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return a.jsxs("svg",{...o,children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]});case"deps":return a.jsxs("svg",{...o,children:[a.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"}),a.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 vv({activePanel:s,onPanelChange:o,isDirty:c,isRunning:u,hasRegressions:x,isActivationRunning:v}){return a.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:mv.map((p,b)=>a.jsxs("div",{className:"flex items-center",children:[b>0&&a.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),p.tabs.map(g=>{const f=s===g.id,j=g.id==="editor"&&c||g.id==="run"&&u||g.id==="activation"&&v||g.id==="history"&&x,y=g.id==="run"||g.id==="activation"?"var(--accent)":g.id==="history"?"var(--red)":"var(--yellow)";return a.jsxs("button",{onClick:()=>o(g.id),title:`${g.label} (Ctrl+${g.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:f?"var(--text-primary)":"var(--text-tertiary)",borderBottom:f?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:f?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:k=>{f||(k.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:k=>{f||(k.currentTarget.style.color="var(--text-tertiary)")},children:[a.jsx(hv,{id:g.id}),g.label,j&&a.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:y}})]},g.id)})]},p.label))})}const Mx={rate_limit:{icon:"⏱",color:"var(--amber, #f59e0b)"},context_window:{icon:"⚠",color:"var(--amber, #f59e0b)"},auth:{icon:"🔒",color:"var(--red, #ef4444)"},timeout:{icon:"⌛",color:"var(--amber, #f59e0b)"},model_not_found:{icon:"🔍",color:"var(--red, #ef4444)"},provider_unavailable:{icon:"⚡",color:"var(--red, #ef4444)"},parse_error:{icon:"❓",color:"var(--amber, #f59e0b)"},unknown:{icon:"❌",color:"var(--red, #ef4444)"}};function ds({error:s,onRetry:o,onDismiss:c}){const[u,x]=m.useState(null),v=m.useRef(null);m.useEffect(()=>(s.category==="rate_limit"&&s.retryAfterMs?x(Math.ceil(s.retryAfterMs/1e3)):x(null),()=>{v.current&&clearInterval(v.current)}),[s]),m.useEffect(()=>{if(!(u==null||u<=0))return v.current=setInterval(()=>{x(g=>g==null||g<=1?(v.current&&clearInterval(v.current),0):g-1)},1e3),()=>{v.current&&clearInterval(v.current)}},[u!=null&&u>0]);const p=Mx[s.category]||Mx.unknown,b=u!=null&&u>0;return a.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${p.color} 30%, transparent)`,background:`color-mix(in srgb, ${p.color} 6%, var(--surface-1))`},children:[a.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{style:{fontSize:14},children:p.icon}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:p.color},children:s.title})]}),c&&a.jsx("button",{onClick:c,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-3.5 pb-3",children:[a.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:s.description}),a.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:s.hint}),(o||u!=null)&&a.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:o&&a.jsx("button",{onClick:o,disabled:b,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:b?.5:1},children:b?`Retry in ${u}s`:"Retry"})})]})]})}class yv extends m.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o,c){console.error("ErrorBoundary caught:",o,c.componentStack)}render(){return this.state.hasError?a.jsxs("div",{style:{padding:24,textAlign:"center"},children:[a.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),a.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),a.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function gv(s){const o=s.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(o)?{category:"rate_limit",title:"Rate Limit",description:s,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(o)?{category:"auth",title:"Authentication Failed",description:s,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(o)?{category:"timeout",title:"Request Timed Out",description:s,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(o)?{category:"model_not_found",title:"Model Not Found",description:s,hint:"The selected model is not available. Try switching to a different model in the dropdown above.",retryable:!1}:/context.?(?:window|length)|token.?(?:limit|count|exceed)|too (?:long|large)|maximum.?context|input.?too.?long|prompt.?too.?(?:long|large)/.test(o)?{category:"context_window",title:"Content Too Large",description:s,hint:"Reduce SKILL.md size or move detailed content to references/ files.",retryable:!1}:/enoent|command not found|502|503|service.?unavailable|connection.?refused|econnrefused|server.?error/.test(o)?{category:"provider_unavailable",title:"Provider Unavailable",description:s,hint:"Check that the provider is installed and running.",retryable:!1}:/syntaxerror|json\.?parse|parse.?error|failed to parse|not valid json|unexpected token/.test(o)?{category:"parse_error",title:"Response Parse Error",description:s,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:s,hint:"",retryable:!1}}function bv(s){const o=s.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!o)return{metadata:{},body:s};const c=o[1],u=o[2].trim(),x={},v=c.split(`
55
+ `);let p="",b=!1;for(const g of v){const f=g.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(f&&p&&b){const k=f[1],R=f[2].trim();let U=x[p];if((typeof U!="object"||Array.isArray(U))&&(U={},x[p]=U),!R)U[k]=[];else{const L=R.match(/^\[(.+)\]$/);L?U[k]=L[1].split(",").map(Y=>Y.trim().replace(/^["']|["']$/g,"")).filter(Boolean):U[k]=R.replace(/^["']|["']$/g,"")}continue}const j=g.match(/^\s+-\s+(.+)$/);if(j&&p){b=!1;const k=x[p];Array.isArray(k)?k.push(j[1].trim().replace(/^["']|["']$/g,"")):x[p]=[j[1].trim().replace(/^["']|["']$/g,"")];continue}const y=g.match(/^([\w-]+):\s*(.*)$/);if(y){p=y[1];const k=y[2].trim();if(b=!1,!k){x[p]={},b=!0;continue}const R=k.match(/^\[(.+)\]$/);if(R){x[p]=R[1].split(",").map(U=>U.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}x[p]=k.replace(/^["']|["']$/g,"")}}return{metadata:x,body:u}}function zr(s){if(!s)return"";try{let o=s.replace(/^---\n[\s\S]*?\n---\n?/,""),c=jv(o);return c=c.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>'),c=c.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),c=c.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),c=c.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),c=c.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),c=c.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),c=c.replace(/\*([^*]+)\*/g,"<em>$1</em>"),c=c.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),c=c.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),c=c.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),c=c.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),c=c.replace(/\n/g,"<br/>"),c}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`}}function jv(s){const o=s.split(`
56
+ `),c=[];let u=0;for(;u<o.length;)if(o[u].trim().startsWith("|")&&u+1<o.length&&o[u+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(o[u+1])){const x=Lx(o[u]);u+=2;const v=[];for(;u<o.length&&o[u].trim().startsWith("|");)v.push(Lx(o[u])),u++;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)"',b='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let g='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';g+="<thead><tr>";for(const f of x)g+=`<th ${p}>${f}</th>`;g+="</tr></thead><tbody>";for(const f of v){g+="<tr>";for(const j of f)g+=`<td ${b}>${j}</td>`;g+="</tr>"}g+="</tbody></table>",c.push(g)}else c.push(o[u]),u++;return c.join(`
57
57
  `)}function Lx(s){return s.split("|").map(o=>o.trim()).filter(o=>o.length>0)}function Dr(s,o){const c=s.split(`
58
58
  `),u=o.split(`
59
- `);if(c.length>1e3||u.length>1e3)return[...c.map(S=>({type:"unchanged",content:S}))];const x=c.length,v=u.length,m=Array.from({length:x+1},()=>new Array(v+1).fill(0));for(let S=1;S<=x;S++)for(let y=1;y<=v;y++)c[S-1]===u[y-1]?m[S][y]=m[S-1][y-1]+1:m[S][y]=Math.max(m[S-1][y],m[S][y-1]);const b=[];let g=x,f=v;for(;g>0||f>0;)g>0&&f>0&&c[g-1]===u[f-1]?(b.push({type:"unchanged",content:c[g-1]}),g--,f--):f>0&&(g===0||m[g][f-1]>=m[g-1][f])?(b.push({type:"added",content:u[f-1]}),f--):(b.push({type:"removed",content:c[g-1]}),g--);return b.reverse()}function Sv(s,o){if(o&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(s))return a.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const u=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return a.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:u.has(s)?"var(--accent)":"var(--green)"}})}function fs({entries:s,isRunning:o}){const[c,u]=p.useState(!1),x=p.useRef(null);return p.useEffect(()=>{x.current&&!c&&(x.current.scrollTop=x.current.scrollHeight)},[s,c]),s.length===0&&!o?null:a.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("button",{onClick:()=>u(!c),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)"},children:[a.jsxs("span",{className:"flex items-center gap-2",children:[o&&a.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",s.length,")"]}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:c?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!c&&a.jsx("div",{ref:x,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:s.map((v,m)=>{const b=m===s.length-1&&o,g=m===0?"0s":`+${((v.timestamp-s[0].timestamp)/1e3).toFixed(1)}s`;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:b?1:.7},children:[Sv(v.phase,b),a.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:g}),a.jsx("span",{style:{color:b?"var(--text-primary)":"var(--text-secondary)"},children:v.message}),v.current!=null&&v.total!=null&&a.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",v.current,"/",v.total,"]"]})]},m)})})]})}function Nv({plugin:s,skill:o,skillContent:c,onApplied:u}){const[x,v]=p.useState("closed"),{config:m}=ia(),[b,g]=p.useState("claude-cli"),[f,S]=p.useState("opus"),[y,k]=p.useState([]),[R,U]=p.useState(""),[L,Y]=p.useState(""),[O,Z]=p.useState(null),[W,F]=p.useState(null),[ae,re]=p.useState([]),[q,I]=p.useState(!1),G=p.useRef(null);p.useEffect(()=>{if(!m)return;m.providers.find(w=>w.id==="claude-cli"&&w.available)&&(g("claude-cli"),S("opus"))},[m]),p.useEffect(()=>()=>{var N;(N=G.current)==null||N.abort()},[]);function X(){return m==null?void 0:m.providers.find(N=>N.id===b&&N.available)}const ne=p.useCallback(()=>{var N;(N=G.current)==null||N.abort(),v("open")},[]);async function te(){v("loading"),Z(null),F(null),re([]);const N=new AbortController;G.current=N;try{const w=await fetch(`/api/skills/${encodeURIComponent(s)}/${encodeURIComponent(o)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,model:f}),signal:N.signal});if(!w.ok||!w.body){let D=`HTTP ${w.status}`;try{const P=await w.json();P.error&&(D=P.error)}catch{}throw new Error(D)}const ee=w.body.getReader(),B=new TextDecoder;let ue="",j="";for(;;){const{done:D,value:P}=await ee.read();if(D)break;ue+=B.decode(P,{stream:!0});const le=ue.split(`
60
- `);ue=le.pop()||"";for(const ce of le)if(ce.startsWith("event: "))j=ce.slice(7).trim();else if(ce.startsWith("data: ")){try{const de=JSON.parse(ce.slice(6));j==="progress"?re(me=>[...me,{phase:de.phase,message:de.message,timestamp:Date.now()}]):j==="done"||j==="complete"?(U(de.improved),Y(de.reasoning||""),k(Dr(de.original||c,de.improved)),v("diff_shown")):j==="error"&&(Z(de.message||de.description||"Unknown error"),de.category&&F(de),v("open"))}catch{}j=""}}}catch(w){w.name!=="AbortError"&&(Z(w.message),v("open"))}finally{G.current=null}}async function be(){I(!0);try{await ge.applyImprovement(s,o,R),u(R),v("closed")}catch(N){Z(N.message)}finally{I(!1)}}function he(){v("closed"),k([]),U(""),Y(""),Z(null)}if(x==="closed")return a.jsxs("button",{onClick:()=>v("open"),className:"btn btn-secondary mb-5",disabled:!c,children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const T=X();return a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),a.jsx("button",{onClick:he,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface-3)"},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-5 py-4",children:[(x==="open"||x==="loading")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:b,onChange:N=>{g(N.target.value);const w=m==null?void 0:m.providers.find(ee=>ee.id===N.target.value);w!=null&&w.models[0]&&S(w.models[0].id)},disabled:x==="loading",children:m==null?void 0:m.providers.filter(N=>N.available).map(N=>a.jsx("option",{value:N.id,children:N.label},N.id))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:f,onChange:N=>S(N.target.value),disabled:x==="loading",children:T==null?void 0:T.models.map(N=>a.jsx("option",{value:N.id,children:N.label},N.id))})]}),x==="loading"?a.jsx("button",{onClick:ne,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:te,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),x==="loading"&&ae.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(fs,{entries:ae,isRunning:!0})})]}),O&&a.jsx("div",{className:"mb-4",children:W?a.jsx(ds,{error:W,onRetry:te,onDismiss:()=>{Z(null),F(null)}}):a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:O})}),x==="diff_shown"&&a.jsxs(a.Fragment,{children:[L&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),L]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:y.map((N,w)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:N.type==="added"?"rgba(34,197,94,0.1)":N.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:N.type==="added"?"var(--green)":N.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:N.type==="added"?"3px solid var(--green)":N.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:N.type==="added"?"+":N.type==="removed"?"-":" "}),N.content]},w))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:be,disabled:q,className:"btn btn-primary",children:q?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),a.jsx("button",{onClick:he,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const zx={remove:{bg:"var(--red-muted)",color:"var(--red)",label:"REMOVE"},modify:{bg:"rgba(251,191,36,0.15)",color:"#fbbf24",label:"MODIFY"},add:{bg:"var(--green-muted)",color:"var(--green)",label:"ADD"}},Ev={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function kv({change:s,index:o,selected:c,onToggle:u,originalEval:x}){var y;const[v,m]=p.useState(!1),b=zx[s.action]??zx.add,g=Ev[s.action]??"var(--border-subtle)",f=s.action==="remove"?(x==null?void 0:x.name)??`Eval #${s.evalId}`:((y=s.eval)==null?void 0:y.name)??"Unnamed",S=p.useCallback(()=>u(o),[u,o]);return a.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${g}`,opacity:c?1:.5},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("input",{type:"checkbox",checked:c,onChange:S,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),a.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:b.bg,color:b.color,padding:"1px 6px"},children:b.label}),a.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:f}),a.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:s.reason}),a.jsx("button",{onClick:()=>m(!v),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:k=>{k.currentTarget.style.background="var(--surface-3)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),v&&a.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[s.action==="add"&&s.eval&&a.jsx(Cv,{evalCase:s.eval}),s.action==="modify"&&s.eval&&x&&a.jsx(Tv,{original:x,proposed:s.eval}),s.action==="remove"&&x&&a.jsx(wv,{evalCase:x})]})]})}function Cv({evalCase:s}){var o;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(xc,{label:"Prompt",value:s.prompt}),a.jsx(xc,{label:"Expected",value:s.expected_output}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((o=s.assertions)==null?void 0:o.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-1",children:(s.assertions??[]).map(c=>a.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",c.text]},c.id))})]})]})}function Tv({original:s,proposed:o}){const c=[];s.name!==o.name&&c.push({label:"Name",old:s.name,new:o.name}),s.prompt!==o.prompt&&c.push({label:"Prompt",old:s.prompt,new:o.prompt}),s.expected_output!==o.expected_output&&c.push({label:"Expected",old:s.expected_output,new:o.expected_output});const u=s.assertions??[],x=o.assertions??[],v=new Set(u.map(f=>f.text)),m=new Set(x.map(f=>f.text)),b=x.filter(f=>!v.has(f.text)),g=u.filter(f=>!m.has(f.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[c.map(f=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:f.label}),a.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[a.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",pc(f.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",pc(f.new,120)]})]})]},f.label)),(b.length>0||g.length>0)&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),a.jsxs("div",{className:"mt-1 space-y-0.5",children:[g.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",f.text]},f.id)),b.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",f.text]},f.id))]})]}),c.length===0&&b.length===0&&g.length===0&&a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function wv({evalCase:s}){var o;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(xc,{label:"Prompt",value:s.prompt}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((o=s.assertions)==null?void 0:o.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:(s.assertions??[]).map(c=>a.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:c.text},c.id))})]})]})}function xc({label:s,value:o}){return a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:s}),a.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:pc(o,300)})]})}function pc(s,o){return s.length>o?s.slice(0,o)+"...":s}const Dx={remove:0,modify:1,add:2};function Av({changes:s,selections:o,currentEvals:c,onToggle:u,onSelectAll:x,onDeselectAll:v}){if(s.length===0)return null;const m=s.map((g,f)=>({change:g,originalIndex:f}));m.sort((g,f)=>(Dx[g.change.action]??2)-(Dx[f.change.action]??2));const b=Array.from(o.values()).filter(Boolean).length;return a.jsxs("div",{className:"mt-3 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",b,"/",s.length," selected)"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("button",{onClick:x,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Select All"}),a.jsx("button",{onClick:v,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-3)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),a.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:m.map(({change:g,originalIndex:f})=>a.jsx(kv,{change:g,index:f,selected:o.get(f)??!1,onToggle:u,originalEval:g.evalId!=null?c.find(S=>S.id===g.evalId):void 0},f))})]})}function Rv(){var N;const{state:s,dispatch:o,submitAiEdit:c,applyAiEdit:u,discardAiEdit:x,cancelAiEdit:v,toggleEvalChange:m,selectAllEvalChanges:b,deselectAllEvalChanges:g,retryEvalsSave:f}=al(),{aiEditLoading:S,aiEditResult:y,aiEditError:k,aiEditClassifiedError:R,aiEditProgress:U,aiEditEvalChanges:L,aiEditEvalSelections:Y,aiEditEvalsRetry:O}=s,[Z,W]=p.useState(""),{config:F}=ia(),[ae,re]=p.useState("claude-cli"),[q,I]=p.useState("opus"),G=p.useRef(null);p.useEffect(()=>{var w;(w=G.current)==null||w.focus()},[]),p.useEffect(()=>{if(!F)return;F.providers.find(ee=>ee.id==="claude-cli"&&ee.available)&&(re("claude-cli"),I("opus"))},[F]);const X=F==null?void 0:F.providers.find(w=>w.id===ae&&w.available),ne=p.useCallback(()=>{const w=Z.trim();!w||S||c(w,ae,q)},[Z,S,c,ae,q]),te=p.useCallback(w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),ne()),w.key==="Escape"&&(w.preventDefault(),S?v():x())},[ne,S,v,x]),be=p.useCallback(()=>{o({type:"CLOSE_AI_EDIT"}),o({type:"OPEN_AI_EDIT"})},[o]),he=y?Dr(s.skillContent,y.improved):[],T=((N=s.evals)==null?void 0:N.evals)??[];return a.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),a.jsx("button",{onClick:x,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:w=>{w.currentTarget.style.background="var(--surface-3)"},onMouseLeave:w=>{w.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-4 py-3",children:[!y&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-2.5",children:[a.jsx("div",{className:"flex-1",children:a.jsx("textarea",{ref:G,value:Z,onChange:w=>W(w.target.value),onKeyDown:te,placeholder:"e.g., Add an error handling section...",disabled:S,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:w=>{const ee=w.currentTarget;ee.style.height="auto",ee.style.height=Math.min(ee.scrollHeight,96)+"px"}})}),a.jsxs("div",{style:{minWidth:100},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:ae,onChange:w=>{re(w.target.value);const ee=F==null?void 0:F.providers.find(B=>B.id===w.target.value);ee!=null&&ee.models[0]&&I(ee.models[0].id)},disabled:S,style:{width:"100%"},children:F==null?void 0:F.providers.filter(w=>w.available).map(w=>a.jsx("option",{value:w.id,children:w.label},w.id))})]}),a.jsxs("div",{style:{minWidth:80},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:q,onChange:w=>I(w.target.value),disabled:S,style:{width:"100%"},children:X==null?void 0:X.models.map(w=>a.jsx("option",{value:w.id,children:w.label},w.id))})]}),S?a.jsx("button",{onClick:v,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):a.jsx("button",{onClick:ne,disabled:!Z.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),S&&U.length>0&&a.jsx("div",{className:"mt-2.5",children:a.jsx(fs,{entries:U,isRunning:!0})})]}),k&&a.jsx("div",{className:"mt-3",children:R?a.jsx(ds,{error:R,onRetry:be,onDismiss:x}):a.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:k})}),y&&a.jsxs("div",{className:"animate-fade-in",children:[y.reasoning&&a.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),y.reasoning]}),a.jsx("div",{className:"mb-1",children:a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:he.map((w,ee)=>a.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:w.type==="added"?"rgba(34,197,94,0.1)":w.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:w.type==="added"?"var(--green)":w.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:w.type==="added"?"3px solid var(--green)":w.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:w.type==="added"?"+":w.type==="removed"?"-":" "}),w.content]},ee))}),a.jsx(Av,{changes:L,selections:Y,currentEvals:T,onToggle:m,onSelectAll:b,onDeselectAll:g}),O&&a.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[a.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),a.jsx("button",{onClick:f,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsxs("button",{onClick:u,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:x,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),a.jsx("button",{onClick:be,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function _v(s,o){const[c,u]=p.useState([]),[x,v]=p.useState("SKILL.md"),[m,b]=p.useState(null),[g,f]=p.useState(!1),[S,y]=p.useState(null),k=p.useCallback(async()=>{try{const L=await ge.getSkillFiles(s,o);u(L.files)}catch{u([])}},[s,o]);p.useEffect(()=>{v("SKILL.md"),b(null),y(null),k()},[s,o,k]);const R=p.useCallback(async L=>{if(v(L),L==="SKILL.md"){b(null),y(null);return}f(!0),y(null);try{const Y=await ge.getSkillFile(s,o,L);b(Y)}catch(Y){y(`Unable to open file: ${Y.message}`),b(null)}finally{f(!1)}},[s,o]),U=p.useCallback(()=>{k()},[k]);return{files:c,activeFile:x,secondaryContent:m,loading:g,error:S,selectFile:R,refresh:U,isSkillMd:x==="SKILL.md"}}function Mv(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Lv(s){const o=[],c=new Map;for(const u of s){const x=u.path.split("/"),m={name:x[x.length-1],path:u.path,type:u.type,size:u.size,children:[]};c.set(u.path,m)}for(const u of s){const x=u.path.split("/");if(x.length===1){const v=c.get(u.path);v&&o.push(v)}else{const v=x.slice(0,-1).join("/"),m=c.get(v),b=c.get(u.path);m&&b&&m.children.push(b)}}return o}function tp({expanded:s}){return a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:s?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function lp(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function zv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Dv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"23 4 23 10 17 10"}),a.jsx("polyline",{points:"1 20 1 14 7 14"}),a.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function ap({node:s,depth:o,activeFile:c,onSelect:u}){const[x,v]=p.useState(!0),m=s.path===c;return s.type==="dir"?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>v(!x),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+o*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[a.jsx(tp,{expanded:x}),a.jsx(lp,{}),a.jsxs("span",{children:[s.name,"/"]})]}),x&&s.children.map(b=>a.jsx(ap,{node:b,depth:o+1,activeFile:c,onSelect:u},b.path))]}):a.jsxs("button",{onClick:()=>u(s.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+o*14}px`,paddingTop:2,paddingBottom:2,background:m?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:m?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[a.jsx("span",{style:{width:10}}),a.jsx(zv,{}),a.jsx("span",{style:{flex:1},children:s.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:Mv(s.size)})]})}function Ov({files:s,activeFile:o,onSelect:c,onRefresh:u}){const[x,v]=p.useState(!1),m=p.useMemo(()=>Lv(s),[s]);return a.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>v(!x),children:[a.jsx(tp,{expanded:x}),a.jsx(lp,{}),a.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),a.jsx("button",{onClick:b=>{b.stopPropagation(),u()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:a.jsx(Dv,{})})]}),x&&a.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:m.length===0?a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):m.map(b=>a.jsx(ap,{node:b,depth:0,activeFile:o,onSelect:c},b.path))})]})}function kr(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Bv(s){try{return JSON.stringify(JSON.parse(s),null,2)}catch{return s}}function Hv(s){const o=s.toLowerCase();return o.endsWith(".json")?"json":o.endsWith(".md")?"md":"other"}function Ox({content:s}){return a.jsx("textarea",{readOnly:!0,value:s,style:{flex:1,width:"100%",resize:"none",background:"var(--surface-1)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}})}function Bx({content:s,fileType:o}){if(o==="json"){const c=Bv(s);return a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:c})}return o==="md"?a.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:zr(s)}}):a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})}function Hx(s){try{return JSON.stringify(JSON.parse(s),null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"([^"\\]|\\.)*"\s*:/g,c=>`<span style="color:#6383ff">${c}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,c=>`<span style="color:#22c55e">${c.slice(0,2)}<span style="color:#22c55e">${c.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(c,u)=>`: <span style="color:#fb923c">${u}</span>`).replace(/:\s*(true|false|null)/g,(c,u)=>`: <span style="color:#a855f7">${u}</span>`)}catch{return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function Uv({file:s,loading:o,error:c,viewMode:u,plugin:x,skill:v,onSaved:m,onDirtyChange:b}){const[g,f]=p.useState(u),[S,y]=p.useState(!1),[k,R]=p.useState(""),[U,L]=p.useState(!1),[Y,O]=p.useState(null),Z=u!==g?u:g;p.useEffect(()=>{b==null||b(S)},[S,b]);const W=p.useCallback(()=>{(s==null?void 0:s.content)!=null&&(R(s.content),y(!0))},[s]),F=p.useCallback(()=>{y(!1)},[]),ae=p.useCallback(async()=>{if(!(!x||!v||!s)){L(!0);try{await ge.saveSkillFile(x,v,s.path,k),O("Saved"),y(!1),m==null||m(),setTimeout(()=>O(null),2e3)}catch(I){O(`Save failed: ${I.message}`),setTimeout(()=>O(null),3e3)}finally{L(!1)}}},[x,v,s,k,m]);if(p.useEffect(()=>{if(!S)return;const I=G=>{(G.ctrlKey||G.metaKey)&&G.key==="s"&&(G.preventDefault(),ae())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[S,ae]),o)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(c)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:a.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[a.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),a.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:c})]})});if(!s)return null;if(s.binary)return a.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",kr(s.size),") — cannot be displayed"]});const re=s.content??"",q=Hv(s.path);return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[s.truncated&&a.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",kr(512*1024)," — ",kr(s.size)," total"]}),a.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(q==="md"||q==="json")&&["raw","split","preview"].map(I=>a.jsx("button",{onClick:()=>f(I),style:{padding:"2px 8px",fontSize:11,background:Z===I?"var(--accent-muted)":"none",color:Z===I?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:I},I)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[kr(s.size),x&&v&&!s.binary&&!S&&a.jsx("button",{onClick:W,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),S&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:ae,disabled:U,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:U?.6:1},children:U?"Saving...":"Save"}),a.jsx("button",{onClick:F,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),Y&&a.jsx("div",{style:{padding:"4px 12px",background:Y.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:Y.startsWith("Save failed")?"var(--red)":"var(--green)"},children:Y}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:S?a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[a.jsx("textarea",{value:k,onChange:I=>R(I.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),a.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),a.jsx("button",{onClick:ae,disabled:U,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:U?.6:1},children:U?"Saving...":"Save"}),a.jsx("button",{onClick:F,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):Z==="split"&&q!=="other"?a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:a.jsx(Ox,{content:re})}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:q==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Hx(re)}}):a.jsx(Bx,{content:re,fileType:q})})]}):Z==="preview"&&q!=="other"?q==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Hx(re)}}):a.jsx(Bx,{content:re,fileType:q}):a.jsx(Ox,{content:re})})]})}function qv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function Vv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),a.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function Gv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Yv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}function ac({size:s=15}){return a.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function Qv(){const{state:s,dispatch:o,saveContent:c,isReadOnly:u}=al(),{plugin:x,skill:v,skillContent:m,isDirty:b,improveTarget:g,aiEditOpen:f}=s,[S,y]=p.useState("split"),[k,R]=p.useState(!1),U=p.useRef(null),[L,Y]=p.useState(!1),[O,Z]=p.useState(""),[W,F]=p.useState(!1),[ae,re]=p.useState(null),[q,I]=p.useState([]),[G,X]=p.useState([]),[ne,te]=p.useState(null),be=p.useRef(null),{config:he}=ia(),{files:T,activeFile:N,secondaryContent:w,loading:ee,error:B,selectFile:ue,refresh:j,isSkillMd:D}=_v(x??"",v??""),[P,le]=p.useState(!1),ce=p.useCallback(K=>{P&&!window.confirm("You have unsaved changes. Discard?")||ue(K)},[P,ue]);p.useEffect(()=>()=>{var K;(K=be.current)==null||K.abort()},[]);const{metadata:de,body:me}=bv(m),Oe=de["allowed-tools"],Re=Array.isArray(Oe)?Oe:typeof Oe=="string"?[Oe]:[],pt=de.name,Dt=de.description,J=de.metadata,ie=typeof J=="object"&&!Array.isArray(J)?J:null,se=de.version||(ie==null?void 0:ie.version),xe=de.tags||(ie==null?void 0:ie.tags),ye=Array.isArray(xe)?xe:typeof xe=="string"?xe.split(",").map(K=>K.trim()).filter(Boolean):[],Ye=new Set(["name","description","metadata","allowed-tools","version","tags"]),ut=Object.entries(de).filter(([K])=>!Ye.has(K)),$e=p.useCallback(async()=>{R(!0),await c(),R(!1)},[c]),Ot=p.useCallback(K=>{(K.ctrlKey||K.metaKey)&&K.key==="s"&&(K.preventDefault(),K.stopPropagation(),b&&$e()),(K.ctrlKey||K.metaKey)&&K.key==="k"&&(K.preventDefault(),K.stopPropagation(),o({type:f?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[b,$e,f,o]),mt=p.useCallback(async()=>{var Be,at;if(!O.trim())return;(Be=be.current)==null||Be.abort();const K=new AbortController;be.current=K,F(!0),te(null),X([]),re(null),I([]);try{const Je=(he==null?void 0:he.provider)||"claude-cli",Ml=(he==null?void 0:he.model)||"sonnet",Bt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:O,provider:Je,model:Ml}),signal:K.signal});if(!Bt.ok||!Bt.body){let et=`HTTP ${Bt.status}`;try{const sl=await Bt.json();sl.error&&(et=sl.error)}catch{}throw new Error(et)}const oa=Bt.body.getReader(),Ct=new TextDecoder;let Fe="",nt="";for(;;){const{done:et,value:sl}=await oa.read();if(et)break;Fe+=Ct.decode(sl,{stream:!0});const Qe=Fe.split(`
61
- `);Fe=Qe.pop()||"";for(const rl of Qe)if(rl.startsWith("event: "))nt=rl.slice(7).trim();else if(rl.startsWith("data: ")){try{const st=JSON.parse(rl.slice(6));if(nt==="progress")X(Ve=>[...Ve,{phase:st.phase,message:st.message,timestamp:Date.now()}]);else if(nt==="done"||nt==="complete"){const Ve=["---"];st.name&&Ve.push(`name: ${st.name}`),st.description&&Ve.push(`description: "${st.description.replace(/"/g,'\\"')}"`),st.model&&Ve.push(`model: ${st.model}`),(at=st.allowedTools)!=null&&at.trim()&&Ve.push(`allowed-tools: ${st.allowedTools.trim()}`),Ve.push("---","",st.body||"");const Ll=Ve.join(`
62
- `);re(Ll),I(Dr(m,Ll)),F(!1)}else nt==="error"&&(te(st.message||st.description||"Generation failed"),F(!1))}catch{}nt=""}}}catch(Je){Je.name!=="AbortError"&&te(Je.message)}finally{F(!1),be.current=null}},[O,he,m]),nl=p.useCallback(()=>{ae&&o({type:"SET_CONTENT",content:ae}),Y(!1),re(null),I([]),Z(""),X([])},[ae,o]),Xt=p.useCallback(()=>{Y(!1),re(null),I([]),Z(""),X([]),te(null)},[]),We=p.useCallback(()=>{var K;L?((K=be.current)==null||K.abort(),Xt()):(f&&o({type:"CLOSE_AI_EDIT"}),Y(!0))},[L,f,o,Xt]),kt=[{mode:"raw",icon:a.jsx(qv,{}),label:"Editor"},{mode:"split",icon:a.jsx(Vv,{}),label:"Split"},{mode:"preview",icon:a.jsx(Gv,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Ot,tabIndex:-1,children:[a.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:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:kt.map(({mode:K,icon:Be,label:at})=>a.jsxs("button",{onClick:()=>y(K),title:at,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:S===K?"var(--surface-4)":"transparent",color:S===K?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:S===K?600:400,border:"none",cursor:"pointer"},children:[Be,a.jsx("span",{style:{letterSpacing:"0.01em"},children:at})]},K))}),D?u?a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>{f?o({type:"CLOSE_AI_EDIT"}):(L&&Xt(),o({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:f?600:400,border:"none",cursor:"pointer",color:f?"#a855f7":"var(--text-tertiary)",background:f?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(Yv,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:We,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:L?600:400,border:"none",cursor:"pointer",color:L?"#a855f7":"var(--text-tertiary)",background:L?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(ac,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),b&&a.jsx("button",{onClick:()=>o({type:"SET_CONTENT",content:s.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:$e,disabled:!b||k,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:k?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),x&&v&&a.jsx(Ov,{files:T,activeFile:N,onSelect:ce,onRefresh:j}),!D&&a.jsx(Uv,{file:w,loading:ee,error:B,viewMode:S,plugin:x??void 0,skill:v??void 0,onSaved:()=>{ue(N),j()},onDirtyChange:le}),D&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:S==="raw"||S==="preview"?"1fr":"1fr 1fr"},children:[S!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:S==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:U,value:m,onChange:K=>{u||o({type:"SET_CONTENT",content:K.target.value})},onKeyDown:Ot,spellCheck:!1,readOnly:u,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",opacity:u?.7:1}})}),S!=="raw"&&a.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(pt||se||Dt)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[pt&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:pt}),se&&a.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]})]}),Dt&&a.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:Dt})]}),ye.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ye.map(K=>a.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:K},K))}),Re.length>0&&a.jsx("div",{style:{marginBottom:16},children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Re.map(K=>a.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:K},K))]})}),ut.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:ut.map(([K,Be],at)=>{const Je=Array.isArray(Be)?Be.join(", "):typeof Be=="object"?Object.entries(Be).map(([Ml,Bt])=>`${Ml}: ${Array.isArray(Bt)?Bt.join(", "):Bt}`).join(" | "):Be;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:at>0?"1px solid var(--border-subtle)":"none"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:K}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:Je})]},K)})}),(pt||Dt||ye.length>0||Re.length>0||ut.length>0)&&me&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),me&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:zr(me)}})]})})]}),D&&f&&a.jsx(Rv,{}),D&&L&&a.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:a.jsxs("div",{className:"px-4 py-3",children:[!ae&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ac,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),a.jsx("div",{className:"flex gap-2 mb-2",children:a.jsx("textarea",{value:O,onChange:K=>Z(K.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:W,className:"flex-1 px-3 py-2 rounded-lg text-[12px] resize-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none",opacity:W?.5:1},onKeyDown:K=>{K.key==="Enter"&&(K.ctrlKey||K.metaKey)&&O.trim()&&!W&&(K.preventDefault(),mt())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[W?a.jsx("button",{onClick:()=>{var K;(K=be.current)==null||K.abort(),F(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:mt,disabled:!O.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:Xt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),W&&G.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(fs,{entries:G,isRunning:!0})}),ne&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[ne,a.jsx("button",{onClick:mt,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),ae&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ac,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:q.map((K,Be)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:K.type==="added"?"rgba(34,197,94,0.1)":K.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:K.type==="added"?"var(--green)":K.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:K.type==="added"?"3px solid var(--green)":K.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:K.type==="added"?"+":K.type==="removed"?"-":" "}),K.content]},Be))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:nl,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:Xt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),D&&g!==null&&x&&v&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Nv,{plugin:x,skill:v,skillContent:m,onApplied:K=>{o({type:"SET_CONTENT",content:K}),o({type:"CONTENT_SAVED"}),o({type:"CLOSE_IMPROVE"})}})})]})}function xn(s){return s.testType==="integration"?"integration":"unit"}function pn(s){return s>=.8?"var(--green)":s>=.5?"var(--yellow)":"var(--red)"}function np(s){const o=new Date(s);return o.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function sp(s){return s==null?"--":s>=1e3?`${(s/1e3).toFixed(1)}s`:`${s}ms`}const $v=new Set(["benchmark","comparison","baseline"]);function Ux(s,o,c,u){return s.map(({rate:x,idx:v,total:m})=>{const b=u+v/(m-1)*(o-u*2),g=u+(c-u*2)-x*(c-u*2);return`${b},${g}`})}function rp({entries:s}){const o=s.filter(y=>$v.has(y.type)).slice().reverse(),c=o.map((y,k,R)=>({rate:y.pass_rate,idx:k,total:R.length})).filter((y,k)=>{const R=o[k].type;return R==="benchmark"||R==="comparison"}),u=o.flatMap((y,k)=>y.type==="baseline"?[{rate:y.pass_rate,idx:k,total:o.length}]:y.type==="comparison"&&y.baselinePassRate!=null?[{rate:y.baselinePassRate,idx:k,total:o.length}]:[]);if(c.length<2&&u.length<2)return null;const x=80,v=24,m=2,b=c.length>=2?Ux(c,x,v,m):[],g=u.length>=2?Ux(u,x,v,m):[],f=b[b.length-1],S=g[g.length-1];return a.jsxs("svg",{width:x,height:v,style:{display:"block",flexShrink:0},children:[g.length>0&&a.jsx("polyline",{points:g.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),b.length>0&&a.jsx("polyline",{points:b.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),S&&a.jsx("circle",{cx:parseFloat(S.split(",")[0]),cy:parseFloat(S.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),f&&a.jsx("circle",{cx:parseFloat(f.split(",")[0]),cy:parseFloat(f.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function ip(s,o,c){const u=[],x=[],v=[];if((s==="PASS"||s==="EFFECTIVE")&&o>=.7){const g=u.length>0?` Met criteria: ${u.map(f=>f.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${o.toFixed(2)}): evaluation met expectations.${g}`}}if((s==="FAIL"||s==="DEGRADING")&&o<.7){const g=x.length>0?` Failed criteria: ${x.map(S=>S.criterion).join(", ")}.`:"",f=[...x.map(S=>`Improve "${S.criterion}" (score: ${S.score.toFixed(2)})`),...v.map(S=>`Strengthen "${S.criterion}" (score: ${S.score.toFixed(2)})`)];return f.length===0&&f.push("Review prompt instructions and add more specific guidance"),{explanation:`${s} (score ${o.toFixed(2)}): evaluation did not meet expectations.${g}`,recommendations:f}}if(s==="INEFFECTIVE"&&o<.2){const g=[...x.map(f=>`Rework "${f.criterion}" — currently at ${f.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${s} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:g}}const m=u.length>0?` Passing: ${u.map(g=>g.criterion).join(", ")}.`:"",b=v.length>0?` Needs improvement: ${v.map(g=>g.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${o.toFixed(2)}): mixed results.${m}${b}`}}const op={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function Xv(s){return Object.hasOwn(op,s)}function Kv(s){return Xv(s)?op[s]:s}function Zv(){const{state:s}=al(),{plugin:o,skill:c}=s,[u,x]=p.useState([]),[v,m]=p.useState([]),[b,g]=p.useState(!0),[f,S]=p.useState(null),[y,k]=p.useState(new Set),[R,U]=p.useState({}),[L,Y]=p.useState(null),[O,Z]=p.useState(""),[W,F]=p.useState(!1),[ae,re]=p.useState(""),[q,I]=p.useState(""),G=p.useCallback(async()=>{g(!0),S(null);try{const[T,N]=await Promise.all([ge.getCredentials(o,c),ge.getParams(o,c)]);x(T.credentials),m(N.params)}catch(T){S(T instanceof Error?T.message:"Failed to load parameters"),x([]),m([])}finally{g(!1)}},[o,c]);p.useEffect(()=>{G()},[G]);const X=p.useCallback(async(T,N)=>{F(!0),S(null);try{await ge.setCredential(o,c,T,N),Y(null),Z(""),await G()}catch(w){S(w instanceof Error?w.message:`Failed to save ${T}`)}finally{F(!1)}},[o,c,G]),ne=p.useCallback(async()=>{const T=ae.trim().toUpperCase(),N=q.trim();if(!(!T||!N)){F(!0),S(null);try{await ge.setCredential(o,c,T,N),re(""),I(""),await G()}catch(w){S(w instanceof Error?w.message:`Failed to add ${T}`)}finally{F(!1)}}},[o,c,ae,q,G]),te=p.useCallback(async T=>{if(y.has(T)){k(N=>{const w=new Set(N);return w.delete(T),w}),U(N=>{const w={...N};return delete w[T],w});return}try{const w=(await ge.getParamsRevealed(o,c,T)).params.find(ee=>ee.name===T);w!=null&&w.value&&(U(ee=>({...ee,[T]:w.value})),k(ee=>new Set(ee).add(T)))}catch{}},[o,c,y]),be=new Set(u.map(T=>T.name)),he=[...u.map(T=>{const N=v.find(w=>w.name===T.name);return{name:T.name,status:T.status,maskedValue:(N==null?void 0:N.maskedValue)??""}}),...v.filter(T=>!be.has(T.name)).map(T=>({name:T.name,status:T.status,maskedValue:T.maskedValue}))];return a.jsxs("div",{className:"py-2 px-3",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),f&&a.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"rgba(239,68,68,0.1)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.2)"},role:"alert",children:f}),b&&he.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!b&&he.length===0&&!f&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),he.map(T=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:T.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:T.status==="ready"?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.15)",color:T.status==="ready"?"#22c55e":"#ef4444"},children:T.status}),(T.maskedValue||T.status==="ready")&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[y.has(T.name)?R[T.name]??T.maskedValue:T.maskedValue||"***",a.jsx("button",{onClick:()=>te(T.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${y.has(T.name)?"Hide":"Reveal"} value for ${T.name}`,children:y.has(T.name)?"hide":"show"})]}),L===T.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:O,onChange:N=>Z(N.target.value),onKeyDown:N=>{N.key==="Enter"&&O.trim()&&X(T.name,O)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${T.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>X(T.name,O),disabled:W||!O.trim(),className:"text-[10px] font-medium",style:{color:"#22c55e",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{Y(null),Z("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{Y(T.name),Z("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},T.name)),a.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:ae,onChange:T=>re(T.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:q,onChange:T=>I(T.target.value),onKeyDown:T=>{T.key==="Enter"&&ae.trim()&&q.trim()&&ne()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:ne,disabled:W||!ae.trim()||!q.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:W?"not-allowed":"pointer"},children:"Add"})]})]})]})}function Jv(s,o,c){const[u,x]=p.useState(null),[v,m]=p.useState(!1),b=p.useRef("");p.useEffect(()=>{const f=`${s}/${o}/${c}`;b.current!==f&&(b.current=f,m(!0),ge.getCaseHistory(s,o,c).then(S=>x(S)).catch(()=>x([])).finally(()=>m(!1)))},[s,o,c]);const g=p.useCallback(()=>{m(!0),b.current="",ge.getCaseHistory(s,o,c).then(f=>x(f)).catch(()=>x([])).finally(()=>m(!1))},[s,o,c]);return{entries:u,loading:v,refetch:g}}function Wv(s,o,c){const u={flaky:!1,nonDiscriminating:!1,regression:!1};if(!c||c.length===0)return u;const v=c.slice(0,10).map(g=>g.assertions.find(f=>f.id===s)).filter(Boolean);if(v.length>=2){const f=v.filter(S=>S.pass).length/v.length;f>=.3&&f<=.7&&(u.flaky=!0)}const m=c.find(g=>g.type==="benchmark"),b=c.find(g=>g.type==="baseline");if(m&&b){const g=m.assertions.find(S=>S.id===s),f=b.assertions.find(S=>S.id===s);g!=null&&g.pass&&(f!=null&&f.pass)&&(u.nonDiscriminating=!0)}if(o&&!o.pass&&c.length>=1){const f=c[0].assertions.find(S=>S.id===s);f!=null&&f.pass&&(u.regression=!0)}return u}function Fv(){var ee;const{state:s,dispatch:o,saveEvals:c,runCase:u,runAll:x,cancelCase:v,cancelAll:m,generateEvals:b,isReadOnly:g}=al(),{evals:f,evalsError:S,selectedCaseId:y,inlineResults:k,caseRunStates:R,generateEvalsLoading:U,generateEvalsProgress:L,generateEvalsError:Y}=s,O=p.useMemo(()=>{for(const B of R.values())if(B.status==="running"||B.status==="queued")return!0;return!1},[R]),[Z,W]=p.useState(!1),[F,ae]=p.useState("all"),re={skill_name:s.skill,evals:[]},q=f??re,I=q.evals,G=p.useMemo(()=>F==="all"?I:I.filter(B=>xn(B)===F),[F,I]),X=G.find(B=>B.id===y)??null;p.useEffect(()=>{y!==null&&!G.find(B=>B.id===y)&&o({type:"SELECT_CASE",caseId:G.length>0?G[0].id:null})},[G,y,o]);const[ne,te]=p.useState([]),be=p.useMemo(()=>I.some(B=>xn(B)==="integration"),[I]);p.useEffect(()=>{be&&ge.getCredentials(s.plugin,s.skill).then(B=>te(B.credentials)).catch(()=>te([]))},[s.plugin,s.skill,be]);const he=p.useMemo(()=>new Set(ne.filter(B=>B.status==="missing").map(B=>B.name)),[ne]),[T,N]=p.useState(!1),w=p.useCallback(B=>{N(!1),b(B?{testType:B}:void 0)},[b]);return!f||I.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:S?"var(--error-muted, #3f1a1a)":"var(--accent-muted)"},children:S?a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--error, #f87171)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),a.jsx("div",{className:"text-center",children:S?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--error, #f87171)"},children:"Invalid evals.json"}),a.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:S}),a.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>W(!0),disabled:g,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("div",{className:"flex",children:[a.jsx("button",{onClick:()=>w("unit"),disabled:U||g,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:U?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),a.jsx("button",{onClick:()=>N(!T),disabled:U||g,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),T&&a.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:a.jsx("button",{onClick:()=>w("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-2)"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),U&&L.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(fs,{entries:L,isRunning:!0})}),Y&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(ds,{error:Y,onRetry:()=>w()})}),Z&&a.jsx(qx,{evals:q,onSave:B=>{c(B),W(!1)},onCancel:()=>W(!1)})]}):a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[a.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",G.length,")"]}),a.jsx("div",{className:"flex items-center gap-1.5",children:O?a.jsx("button",{onClick:m,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel All"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>x("benchmark"),disabled:G.length===0||g,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),a.jsx("button",{onClick:()=>x("comparison"),disabled:G.length===0||g,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),a.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(B=>a.jsx("button",{onClick:()=>ae(B),style:{padding:"2px 8px",fontSize:10,fontWeight:F===B?600:400,background:F===B?"var(--accent-muted)":"transparent",color:F===B?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:B==="all"?`All (${I.length})`:B==="unit"?`Unit (${I.filter(ue=>xn(ue)==="unit").length})`:`Integration (${I.filter(ue=>xn(ue)==="integration").length})`},B))}),a.jsxs("div",{className:"py-1",children:[G.length===0&&I.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",F==="all"?"":F+" ","tests yet"]}),G.map(B=>{var P;const ue=k.get(B.id),j=y===B.id,D=xn(B);return a.jsxs("button",{onClick:()=>o({type:"SELECT_CASE",caseId:B.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:j?"var(--accent-muted)":"transparent",borderLeft:j?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:le=>{j||(le.currentTarget.style.background="var(--surface-2)")},onMouseLeave:le=>{j||(le.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[a.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:j?"var(--text-primary)":"var(--text-secondary)"},children:["#",B.id," ",B.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:D==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:D==="unit"?"#6383ff":"#fb923c",whiteSpace:"nowrap"},children:D==="unit"?"U":"I"}),D==="integration"&&((P=B.requiredCredentials)==null?void 0:P.some(le=>he.has(le)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),a.jsx(cp,{result:ue})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[B.assertions.length," assertion",B.assertions.length!==1?"s":"",(ue==null?void 0:ue.passRate)!=null&&a.jsx(e1,{passRate:ue.passRate})]})]},B.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!g&&a.jsx("button",{onClick:()=>W(!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:B=>{B.currentTarget.style.borderColor="var(--accent)",B.currentTarget.style.color="var(--accent)"},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-default)",B.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),be&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Zv,{})})]}),a.jsx("div",{className:"overflow-auto",children:X?a.jsx(Iv,{evalCase:X,result:k.get(X.id),evals:f,caseStatus:((ee=R.get(X.id))==null?void 0:ee.status)??"idle",onSaveEvals:c,onRun:B=>u(B,"benchmark"),onCompare:B=>u(B,"comparison"),onCancel:B=>v(B),onImprove:B=>o({type:"OPEN_IMPROVE",evalId:B})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),Z&&a.jsx(qx,{evals:q,onSave:B=>{c(B),W(!1)},onCancel:()=>W(!1)})]})}function Iv({evalCase:s,result:o,evals:c,caseStatus:u,onSaveEvals:x,onRun:v,onCompare:m,onCancel:b,onImprove:g}){const{state:f,isReadOnly:S}=al(),{plugin:y,skill:k}=f,{entries:R,loading:U}=Jv(y,k,s.id),[L,Y]=p.useState(!1),[O,Z]=p.useState(s.prompt),[W,F]=p.useState(!1),[ae,re]=p.useState(s.expected_output);p.useState(()=>{Z(s.prompt),re(s.expected_output)});const q=p.useCallback(B=>{x({...c,evals:c.evals.map(ue=>ue.id===B.id?B:ue)})},[c,x]),I=p.useCallback(()=>{q({...s,prompt:O}),Y(!1)},[s,O,q]),G=p.useCallback(()=>{q({...s,expected_output:ae}),F(!1)},[s,ae,q]),X=p.useCallback(()=>{q({...s,assertions:[...s.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[s,q]),ne=p.useCallback((B,ue)=>{q({...s,assertions:s.assertions.map(j=>j.id===B?{...j,text:ue}:j)})},[s,q]),te=p.useCallback(B=>{q({...s,assertions:s.assertions.filter(ue=>ue.id!==B)})},[s,q]),be=p.useCallback(()=>{confirm("Delete this test case?")&&x({...c,evals:c.evals.filter(B=>B.id!==s.id)})},[c,s.id,x]),he=o&&o.assertions.length>0&&o.assertions.every(B=>B.pass),T=o&&o.assertions.some(B=>!B.pass),N=xn(s),w=s.requiredCredentials??[],ee=N==="integration"&&w.length>0;return a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",s.id," ",s.name]}),S?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:N==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:N==="unit"?"#6383ff":"#fb923c"},children:N==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((N==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ue,requirements:j,cleanup:D,...P}=s;q({...P,testType:"unit"})}else q({...s,testType:"integration"})},title:`Click to switch to ${N==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:N==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:N==="unit"?"#6383ff":"#fb923c",border:"none",cursor:"pointer"},children:N==="unit"?"Unit":"Integration"}),a.jsx(cp,{result:o})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[u==="running"||u==="queued"?a.jsxs("button",{onClick:()=>b(s.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>v(s.id),disabled:S,className:"btn btn-primary text-[12px]",children:"Run"}),a.jsx("button",{onClick:()=>m(s.id),disabled:S,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),T&&!S&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:()=>g(s.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!S&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:be,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.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"})]})})]})]}),S&&N==="integration"&&a.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid rgba(99,131,255,0.2)"},children:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),a.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),a.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),he&&a.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:[a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),ee&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"rgba(251,146,60,0.1)",border:"1px solid rgba(251,146,60,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"Required Credentials"})]}),a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:w.map(B=>a.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:B},B))})]}),!S&&N==="integration"&&a.jsx(a1,{evalCase:s,onUpdate:q}),a.jsx(Cr,{title:"Prompt",children:L?a.jsxs("div",{children:[a.jsx("textarea",{value:O,onChange:B=>Z(B.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:I,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{Z(s.prompt),Y(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] 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)",maxHeight:200,overflowY:"auto",cursor:S?"default":"pointer"},onClick:()=>{S||Y(!0)},onMouseEnter:B=>{S||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:s.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:S?"No prompt":"Click to edit prompt..."})})}),a.jsx(Cr,{title:"Expected Output",children:W?a.jsxs("div",{children:[a.jsx("textarea",{value:ae,onChange:B=>re(B.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:G,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{re(s.expected_output),F(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] 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)",maxHeight:200,overflowY:"auto",cursor:S?"default":"pointer"},onClick:()=>{S||F(!0)},onMouseEnter:B=>{S||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:s.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:S?"No expected output":"Click to edit expected output..."})})}),a.jsx(Cr,{title:`Assertions (${s.assertions.length})`,action:S?void 0:a.jsx("button",{onClick:X,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:s.assertions.length===0?a.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):a.jsx("div",{className:"space-y-2",children:s.assertions.map(B=>{const ue=o==null?void 0:o.assertions.find(D=>D.assertion_id===B.id),j=Wv(B.id,ue,R);return a.jsx(Pv,{assertion:B,result:ue,badges:j,isReadOnly:S,onUpdate:D=>ne(B.id,D),onDelete:()=>te(B.id)},B.id)})})}),(o==null?void 0:o.output)&&a.jsx(t1,{output:o.output,durationMs:o.durationMs,tokens:o.tokens}),o&&o.passRate!=null&&o.passRate<.2&&(()=>{const B=ip("INEFFECTIVE",o.passRate);return B.recommendations&&B.recommendations.length>0?a.jsx(Cr,{title:"Recommendations",children:a.jsxs("div",{className:"rounded-xl p-4",style:{background:"rgba(251,146,60,0.08)",border:"1px solid rgba(251,146,60,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:B.recommendations.map((ue,j)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"#fb923c",fontWeight:600,flexShrink:0},children:"•"}),ue]},j))})]})}):null})(),a.jsx(l1,{evalId:s.id,sharedEntries:R,sharedLoading:U})]},s.id)}function Pv({assertion:s,result:o,badges:c,isReadOnly:u,onUpdate:x,onDelete:v}){const[m,b]=p.useState(!1),[g,f]=p.useState(s.text),[S,y]=p.useState(!1),k=()=>{x(g),b(!1)};return a.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:a.jsxs("div",{className:"flex items-start gap-2",children:[o?a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(c==null?void 0:c.regression)&&a.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:s.id}),(c==null?void 0:c.flaky)&&a.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"rgba(234, 179, 8, 0.15)",color:"#ca8a04",whiteSpace:"nowrap"},children:"Flaky"}),(c==null?void 0:c.nonDiscriminating)&&a.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),m?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:g,onChange:R=>f(R.target.value),onKeyDown:R=>{R.key==="Enter"&&k(),R.key==="Escape"&&b(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),a.jsx("button",{onClick:k,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:u?"default":"pointer"},onClick:()=>{u||(f(s.text),b(!0))},children:s.text}),(o==null?void 0:o.reasoning)&&a.jsx("button",{onClick:()=>y(!S),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:S?"Hide reasoning":"Show reasoning"}),S&&(o==null?void 0:o.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:o.reasoning})]}),!u&&a.jsx("button",{onClick:v,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:R=>{R.currentTarget.style.color="var(--red)",R.currentTarget.style.opacity="1"},onMouseLeave:R=>{R.currentTarget.style.color="var(--text-tertiary)",R.currentTarget.style.opacity=""},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Cr({title:s,action:o,children:c}){return a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:s}),o]}),c]})}function cp({result:s}){const[o,c]=p.useState(!1);if(!s||s.status==null)return a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const u=s.status==="pass",x=s.passRate??0,m=ip(u?"PASS":"FAIL",x);return a.jsxs("span",{className:"pill text-[10px]",style:{background:u?"var(--green-muted)":"var(--red-muted)",color:u?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),"aria-describedby":o?"verdict-tooltip":void 0,children:[s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status,o&&a.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:m.explanation})]})}function e1({passRate:s}){const o=Math.round(s*100);return a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${o}%`,background:o>=80?"var(--green)":o>=50?"var(--yellow)":"var(--red)"}})})})}function t1({output:s,durationMs:o,tokens:c}){const[u,x]=p.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:()=>x(!u),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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:u?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",o!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(o/1e3).toFixed(1),"s)"]}),c!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",c," tokens)"]})]}),u&&a.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:s})]})}function nc(s){return s==="baseline"?"right":s==="comparison"?"full":"left"}function sc({entry:s}){return a.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:np(s.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:s.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:s.type==="benchmark"?"rgba(99,131,255,0.15)":s.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:s.type==="benchmark"?"#6383ff":s.type==="comparison"?"var(--purple)":"#fb923c"},children:s.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:pn(s.pass_rate)},children:[Math.round(s.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[s.durationMs!=null&&a.jsx("span",{children:sp(s.durationMs)}),s.tokens!=null&&a.jsxs("span",{children:[s.tokens>=1e3?`${(s.tokens/1e3).toFixed(1)}k`:s.tokens," tok"]})]}),s.type==="comparison"&&s.baselinePassRate!=null&&(()=>{const o=s.pass_rate-s.baselinePassRate,c=o>.001?"skill":o<-.001?"baseline":"tie",u=o>0?"+":"",x=c==="skill"?"var(--green)":c==="baseline"?"var(--red)":"var(--text-tertiary)";return a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:o>=0?"var(--green)":"var(--red)"},children:[u,(o*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"rgba(0,0,0,0.2)",color:x},children:c})]})})(),a.jsx("div",{className:"space-y-0.5",children:s.assertions.map(o=>a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:o.text})]},o.id))})]})}function l1({evalId:s,sharedEntries:o,sharedLoading:c}){const{state:u,dispatch:x}=al(),{plugin:v,skill:m}=u,[b,g]=p.useState(!0),f=o??null,S=c??!1,y=p.useCallback(()=>{g(L=>!L)},[]),k=f?f.slice(0,10):[],R=k.some(L=>{const Y=nc(L.type);return Y==="left"||Y==="full"}),U=k.some(L=>{const Y=nc(L.type);return Y==="right"||Y==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:y,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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",f&&f.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",f.length," run",f.length!==1?"s":"",")"]})]}),b&&a.jsx("div",{className:"animate-fade-in",children:S?a.jsxs("div",{className:"flex items-center gap-2 py-3",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!f||f.length===0?a.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):a.jsxs("div",{children:[k.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx(rp,{entries:k})}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!R&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!U&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),k.map((L,Y)=>{const O=nc(L.type);return O==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(sc,{entry:L})},Y):O==="left"?a.jsxs(p.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(sc,{entry:L})}),a.jsx("div",{style:{gridColumn:"2"}})]},Y):a.jsxs(p.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(sc,{entry:L})})]},Y)})]}),a.jsx("button",{onClick:()=>x({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:L=>{L.currentTarget.style.textDecoration="underline"},onMouseLeave:L=>{L.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function qx({evals:s,onSave:o,onCancel:c}){const[u,x]=p.useState(""),[v,m]=p.useState(""),[b,g]=p.useState(""),[f,S]=p.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[y,k]=p.useState("unit"),[R,U]=p.useState(""),[L,Y]=p.useState([]),[O,Z]=p.useState(""),[W,F]=p.useState(""),ae=Math.max(0,...s.evals.map(G=>G.id))+1,re=G=>{k(G),G==="unit"&&(Y([]),U(""),Z(""),F(""))},q=()=>{const G=R.trim().toUpperCase();G&&!L.includes(G)&&Y([...L,G]),U("")},I=()=>{if(!u.trim()||!v.trim())return;const G={id:ae,name:u.trim(),prompt:v.trim(),expected_output:b.trim(),files:[],assertions:f.filter(X=>X.text.trim()),...y==="integration"?{testType:"integration",...L.length>0?{requiredCredentials:L}:{},...O||W?{requirements:{...O?{platform:O}:{},...W?{chromeProfile:W}:{}}}:{}}:{}};o({...s,evals:[...s.evals,G]})};return a.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:a.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)",maxHeight:"85vh",overflowY:"auto"},children:[a.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),a.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(G=>a.jsx("button",{onClick:()=>re(G),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:y===G?G==="unit"?"rgba(99,131,255,0.2)":"rgba(251,146,60,0.2)":"transparent",color:y===G?G==="unit"?"#6383ff":"#fb923c":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:G},G))})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),a.jsx("input",{value:u,onChange:G=>x(G.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),a.jsx("textarea",{value:v,onChange:G=>m(G.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),a.jsx("textarea",{value:b,onChange:G=>g(G.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),f.map((G,X)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:G.text,onChange:ne=>S(f.map((te,be)=>be===X?{...te,text:ne.target.value}:te)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),f.length>1&&a.jsx("button",{onClick:()=>S(f.filter((ne,te)=>te!==X)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},G.id)),a.jsx("button",{onClick:()=>S([...f,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),y==="integration"&&a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:L.map(G=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[G,a.jsx("button",{onClick:()=>Y(L.filter(X=>X!==G)),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},G))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:R,onChange:G=>U(G.target.value),onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),q())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:q,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:O,onChange:G=>Z(G.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:W,onChange:G=>F(G.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:c,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:I,disabled:!u.trim()||!v.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function a1({evalCase:s,onUpdate:o}){var m,b;const[c,u]=p.useState(""),x=()=>{const g=c.trim().toUpperCase();g&&!(s.requiredCredentials??[]).includes(g)&&o({...s,requiredCredentials:[...s.requiredCredentials??[],g]}),u("")},v=g=>{const f=(s.requiredCredentials??[]).filter(S=>S!==g);o({...s,requiredCredentials:f.length>0?f:void 0})};return a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(s.requiredCredentials??[]).map(g=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[g,a.jsx("button",{onClick:()=>v(g),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:c,onChange:g=>u(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),x())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:x,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:((m=s.requirements)==null?void 0:m.platform)??"",onChange:g=>o({...s,requirements:{...s.requirements,platform:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:((b=s.requirements)==null?void 0:b.chromeProfile)??"",onChange:g=>o({...s,requirements:{...s.requirements,chromeProfile:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function $t(s,o){return o==="free"?"Free":o==="subscription"&&s==null?"Subscription":s==null?"N/A":s>=1?`$${s.toFixed(2)}`:s===0?"$0.00":s>=.001?`$${s.toFixed(4)}`:`$${s.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function up(s,o){return s==null||o==null?"N/A":`${s.toLocaleString("en-US")} in / ${o.toLocaleString("en-US")} out`}function n1(s){return s==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function s1(s,o){let c="";if(o){const x=new Date(o);isNaN(x.getTime())||(c=x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[s,c].filter(Boolean).join(" · ")}function r1(s,o,c){const u=c===1?"test case":"test cases";if(s===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const x=Math.round(Math.abs(s)*o);if(x===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const v=s>0?"more":"fewer";return`Your skill passes ${x} ${v} assertions across ${c} ${u}`}function Vx(s,o){const c=u=>Math.round(Math.min(100,Math.max(0,u/5*100)));return{skill:c(s),baseline:c(o)}}function i1(s){return s==="skill"?{text:"Skill wins",isSkill:!0}:s==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function o1(s,o){const c=s+o,u=c*10,x=c*25,v=m=>m>=60?`${Math.round(m/60)}m`:`${m}s`;return`${v(u)}–${v(x)}`}const c1={anthropic:.01,openrouter:.01,ollama:0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function u1(s,o){if(!s)return null;const c=c1[s];if(c==null||c===0)return null;const u=c*o*.5,x=c*o*2;return`${$t(u)}–${$t(x)}`}function d1(){const{state:s,runCase:o,runAll:c,cancelCase:u,cancelAll:x,isReadOnly:v}=al(),{evals:m,caseRunStates:b,bulkRunActive:g,latestBenchmark:f,inlineResults:S}=s,{config:y}=ia(),k=(m==null?void 0:m.evals)??[],R=p.useMemo(()=>{for(const q of b.values())if(q.status==="running"||q.status==="queued")return!0;return!1},[b]),U=k.filter(q=>{const I=b.get(q.id);return I&&(I.status==="complete"||I.status==="error"||I.status==="cancelled")}).length,L=k.filter(q=>{const I=b.get(q.id);return I&&(I.status==="running"||I.status==="queued")}).length,Y=p.useRef(null),[O,Z]=p.useState(0);p.useEffect(()=>{if(R&&!Y.current&&(Y.current=Date.now()),!R){Y.current=null,Z(0);return}const q=setInterval(()=>{Y.current&&Z(Math.round((Date.now()-Y.current)/1e3))},1e3);return()=>clearInterval(q)},[R]);const W=k.reduce((q,I)=>q+I.assertions.length,0),F=k.length+W,ae=p.useMemo(()=>o1(k.length,W),[k.length,W]),re=p.useMemo(()=>u1((y==null?void 0:y.provider)??null,F),[y==null?void 0:y.provider,F]);return a.jsxs("div",{className:"p-5",children:[v&&a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),a.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),R&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[L," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[R&&a.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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),a.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||R||v,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),a.jsx("button",{onClick:()=>c("benchmark"),disabled:k.length===0||R||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),a.jsx("button",{onClick:()=>c("baseline"),disabled:k.length===0||R||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!R&&k.length>0&&a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Est. duration: ",ae]}),re&&a.jsxs("span",{children:["Est. cost: ",re]}),!re&&(y==null?void 0:y.provider)&&(y.provider==="claude-cli"||y.provider==="codex-cli")&&a.jsx("span",{children:"Cost: Subscription"}),!re&&(y==null?void 0:y.provider)&&(y.provider==="ollama"||y.provider==="gemini-cli")&&a.jsx("span",{children:"Cost: Free"})]})]}),R&&k.length>0&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",U,"/",k.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(U/k.length*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${U/k.length*100}%`,background:"var(--accent)"}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",O>=60?`${Math.floor(O/60)}m ${O%60}s`:`${O}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",ae]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:k.map(q=>{const I=S.get(q.id),G=b.get(q.id),X=(G==null?void 0:G.status)??"idle",ne=f==null?void 0:f.cases.find(te=>te.eval_id===q.id);return a.jsx(x1,{name:q.name,evalId:q.id,result:I,caseCost:ne==null?void 0:ne.cost,caseBillingMode:ne==null?void 0:ne.billingMode,caseInputTokens:ne==null?void 0:ne.inputTokens,caseOutputTokens:ne==null?void 0:ne.outputTokens,caseStatus:X,runMode:(G==null?void 0:G.mode)??null,comparisonDetail:ne==null?void 0:ne.comparisonDetail,isReadOnly:v,onRun:te=>o(te,"benchmark"),onBaseline:te=>o(te,"baseline"),onCompare:te=>o(te,"comparison"),onCancel:te=>u(te)},q.id)})}),!R&&f&&f.cases.length>0&&a.jsxs("div",{className:"mt-5",children:[a.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:n1(f.type)}),a.jsx("span",{className:"text-[20px] font-bold",style:{color:(f.overall_pass_rate??0)>=.8?"var(--green)":(f.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:f.overall_pass_rate!=null?`${Math.round(f.overall_pass_rate*100)}%`:"--"})]}),f.totalDurationMs!=null&&a.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(f.totalDurationMs/1e3).toFixed(1),"s",f.model&&` | Model: ${f.model}`,f.totalInputTokens!=null&&f.totalOutputTokens!=null&&` | Tokens: ${up(f.totalInputTokens,f.totalOutputTokens)}`,f.totalCost!=null&&` | Cost: ${$t(f.totalCost)}`]}),f.overall_pass_rate>=.9999&&!f.comparison&&a.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||v,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green, #22c55e)",color:"#fff",border:"none",cursor:"pointer",opacity:k.length===0?.5:1},children:"Run Final A/B Comparison"})]}),f.comparison&&a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const q=s1(f.model,f.timestamp);return q?a.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:q}):a.jsx("div",{className:"mb-3"})})(),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Gx,{label:"Skill",value:f.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(Gx,{label:"Baseline",value:f.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:f.comparison.delta>0?"var(--green)":f.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",f.comparison.delta>0?"+":"",(f.comparison.delta*100).toFixed(1),"%",f.verdict&&` | ${Kv(f.verdict)}`]}),(()=>{const q=f.cases.reduce((G,X)=>G+X.assertions.length,0),I=r1(f.comparison.delta,q,f.cases.length);return a.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:I})})()]})]})]})}const f1={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 x1({name:s,evalId:o,result:c,caseCost:u,caseBillingMode:x,caseInputTokens:v,caseOutputTokens:m,caseStatus:b,runMode:g,comparisonDetail:f,isReadOnly:S,onRun:y,onBaseline:k,onCompare:R,onCancel:U}){const[L,Y]=p.useState(!1),O=b==="running"||b==="queued",Z=b==="complete"||b==="error";return a.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:O?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:O?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[b==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),b==="queued"&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),a.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",o," ",s]}),g&&(O||Z)&&(()=>{const W=f1[g];return W?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:W.bg,color:W.color,padding:"1px 6px"},children:W.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[O?a.jsx("button",{onClick:()=>U(o),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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>R(o),disabled:S,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>y(o),disabled:S,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>k(o),disabled:S,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),c&&c.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:c.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.passRate!=null?`${Math.round(c.passRate*100)}%`:c.status}),v!=null&&m!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:up(v,m)}),u!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:$t(u,x)}),b==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),c&&c.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:c.assertions.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:W.pass?"var(--green)":"var(--red)"},children:W.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:W.text})]},W.assertion_id))}),c.output&&a.jsx("button",{onClick:()=>Y(!L),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:L?"Hide output":"Show output"}),L&&c.output&&a.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:c.output})]}),f&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const W=Vx(f.skillContentScore,f.baselineContentScore),F=Vx(f.skillStructureScore,f.baselineStructureScore),ae=i1(f.winner);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",W.skill,"% / Baseline ",W.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",F.skill,"% / Baseline ",F.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsx("span",{style:{color:ae.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:ae.text})]})})()})})}),c&&c.errorMessage&&a.jsx(p1,{errorMessage:c.errorMessage,classifiedError:c.classifiedError})]})}const rc={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function p1({errorMessage:s,classifiedError:o}){const[c,u]=p.useState(!1),x=(o==null?void 0:o.title)??"Error",v=o==null?void 0:o.hint,m=o?rc[o.category]??rc.unknown:rc.unknown;return a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid rgba(239,68,68,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:m}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:x}),a.jsx("button",{onClick:()=>u(!c),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:c?"Hide details":"Details"})]}),v&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:v}),c&&a.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:s})]})})}function Gx({label:s,value:o,color:c}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:s}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:c},children:[Math.round(o*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${o*100}%`,background:c}})})]})}const Yx={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)"}};function m1(){const{state:s,dispatch:o,runActivationTest:c,cancelActivation:u,generateActivationPrompts:x}=al(),{plugin:v,skill:m,activationPrompts:b,activationResults:g,activationSummary:f,activationRunning:S,activationError:y,activationStartedAt:k,activationClassifyingStatus:R,generatingPrompts:U,generatingPromptsError:L,activationHistory:Y}=s,[O,Z]=p.useState(b),[W,F]=p.useState(null),[ae,re]=p.useState(!1);p.useEffect(()=>{b&&b!==O&&Z(b)},[b]),p.useEffect(()=>{o({type:"SET_ACTIVATION_PROMPTS",prompts:O})},[O,o]),p.useEffect(()=>{fetch(`/api/skills/${v}/${m}/description`).then(T=>T.json()).then(T=>F(T.rawContent||T.description||null)).catch(()=>F(null))},[v,m]);function q(){c(O)}function I(){x(8)}const G=O.trim().split(`
63
- `).filter(Boolean).length,X=g.filter(T=>T.classification==="TP"||T.classification==="TN"),ne=g.filter(T=>T.classification==="FP"||T.classification==="FN"),te=(W==null?void 0:W.replace(/^---[\s\S]*?---\s*/,"").trim())??null,be=O.trim().length>0,he=te?zr(te):"";return a.jsxs("div",{className:"p-5 space-y-5",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),a.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),a.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[a.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),a.jsx("div",{className:"flex gap-1.5",children:a.jsx("button",{onClick:I,disabled:U||!te||S,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:U?"var(--surface-3)":"var(--surface-2)",color:te?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:te?1:.5,cursor:te?"pointer":"not-allowed"},title:te?void 0:"No skill description available",onMouseEnter:T=>{te&&!U&&(T.currentTarget.style.background="var(--surface-3)")},onMouseLeave:T=>{U||(T.currentTarget.style.background="var(--surface-2)")},children:U?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3v3m6.36.64l-2.12 2.12M21 12h-3m-.64 6.36l-2.12-2.12M12 21v-3m-4.24.64l2.12-2.12M3 12h3m.64-6.36l2.12 2.12"})}),be?"Regenerate":"Generate"," Test Prompts"]})})})]}),!te&&!S&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),L&&a.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:L}),a.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:O,onChange:T=>Z(T.target.value),placeholder:`How do I write a unit test?
59
+ `);if(c.length>1e3||u.length>1e3)return[...c.map(j=>({type:"unchanged",content:j}))];const x=c.length,v=u.length,p=Array.from({length:x+1},()=>new Array(v+1).fill(0));for(let j=1;j<=x;j++)for(let y=1;y<=v;y++)c[j-1]===u[y-1]?p[j][y]=p[j-1][y-1]+1:p[j][y]=Math.max(p[j-1][y],p[j][y-1]);const b=[];let g=x,f=v;for(;g>0||f>0;)g>0&&f>0&&c[g-1]===u[f-1]?(b.push({type:"unchanged",content:c[g-1]}),g--,f--):f>0&&(g===0||p[g][f-1]>=p[g-1][f])?(b.push({type:"added",content:u[f-1]}),f--):(b.push({type:"removed",content:c[g-1]}),g--);return b.reverse()}function Sv(s,o){if(o&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(s))return a.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const u=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return a.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:u.has(s)?"var(--accent)":"var(--green)"}})}function fs({entries:s,isRunning:o}){const[c,u]=m.useState(!1),x=m.useRef(null);return m.useEffect(()=>{x.current&&!c&&(x.current.scrollTop=x.current.scrollHeight)},[s,c]),s.length===0&&!o?null:a.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("button",{onClick:()=>u(!c),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)"},children:[a.jsxs("span",{className:"flex items-center gap-2",children:[o&&a.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",s.length,")"]}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:c?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!c&&a.jsx("div",{ref:x,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:s.map((v,p)=>{const b=p===s.length-1&&o,g=p===0?"0s":`+${((v.timestamp-s[0].timestamp)/1e3).toFixed(1)}s`;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:b?1:.7},children:[Sv(v.phase,b),a.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:g}),a.jsx("span",{style:{color:b?"var(--text-primary)":"var(--text-secondary)"},children:v.message}),v.current!=null&&v.total!=null&&a.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",v.current,"/",v.total,"]"]})]},p)})})]})}function Nv({plugin:s,skill:o,skillContent:c,onApplied:u}){const[x,v]=m.useState("closed"),{config:p}=ia(),[b,g]=m.useState("claude-cli"),[f,j]=m.useState("opus"),[y,k]=m.useState([]),[R,U]=m.useState(""),[L,Y]=m.useState(""),[O,Z]=m.useState(null),[W,F]=m.useState(null),[ae,re]=m.useState([]),[q,I]=m.useState(!1),G=m.useRef(null);m.useEffect(()=>{if(!p)return;p.providers.find(w=>w.id==="claude-cli"&&w.available)&&(g("claude-cli"),j("opus"))},[p]),m.useEffect(()=>()=>{var N;(N=G.current)==null||N.abort()},[]);function X(){return p==null?void 0:p.providers.find(N=>N.id===b&&N.available)}const ne=m.useCallback(()=>{var N;(N=G.current)==null||N.abort(),v("open")},[]);async function te(){v("loading"),Z(null),F(null),re([]);const N=new AbortController;G.current=N;try{const w=await fetch(`/api/skills/${encodeURIComponent(s)}/${encodeURIComponent(o)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,model:f}),signal:N.signal});if(!w.ok||!w.body){let D=`HTTP ${w.status}`;try{const P=await w.json();P.error&&(D=P.error)}catch{}throw new Error(D)}const ee=w.body.getReader(),B=new TextDecoder;let ue="",S="";for(;;){const{done:D,value:P}=await ee.read();if(D)break;ue+=B.decode(P,{stream:!0});const le=ue.split(`
60
+ `);ue=le.pop()||"";for(const ce of le)if(ce.startsWith("event: "))S=ce.slice(7).trim();else if(ce.startsWith("data: ")){try{const de=JSON.parse(ce.slice(6));S==="progress"?re(me=>[...me,{phase:de.phase,message:de.message,timestamp:Date.now()}]):S==="done"||S==="complete"?(U(de.improved),Y(de.reasoning||""),k(Dr(de.original||c,de.improved)),v("diff_shown")):S==="error"&&(Z(de.message||de.description||"Unknown error"),de.category&&F(de),v("open"))}catch{}S=""}}}catch(w){w.name!=="AbortError"&&(Z(w.message),v("open"))}finally{G.current=null}}async function be(){I(!0);try{await ge.applyImprovement(s,o,R),u(R),v("closed")}catch(N){Z(N.message)}finally{I(!1)}}function he(){v("closed"),k([]),U(""),Y(""),Z(null)}if(x==="closed")return a.jsxs("button",{onClick:()=>v("open"),className:"btn btn-secondary mb-5",disabled:!c,children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const T=X();return a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),a.jsx("button",{onClick:he,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:N=>{N.currentTarget.style.background="var(--surface-3)"},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-5 py-4",children:[(x==="open"||x==="loading")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:b,onChange:N=>{g(N.target.value);const w=p==null?void 0:p.providers.find(ee=>ee.id===N.target.value);w!=null&&w.models[0]&&j(w.models[0].id)},disabled:x==="loading",children:p==null?void 0:p.providers.filter(N=>N.available).map(N=>a.jsx("option",{value:N.id,children:N.label},N.id))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:f,onChange:N=>j(N.target.value),disabled:x==="loading",children:T==null?void 0:T.models.map(N=>a.jsx("option",{value:N.id,children:N.label},N.id))})]}),x==="loading"?a.jsx("button",{onClick:ne,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:te,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),x==="loading"&&ae.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(fs,{entries:ae,isRunning:!0})})]}),O&&a.jsx("div",{className:"mb-4",children:W?a.jsx(ds,{error:W,onRetry:te,onDismiss:()=>{Z(null),F(null)}}):a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:O})}),x==="diff_shown"&&a.jsxs(a.Fragment,{children:[L&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),L]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:y.map((N,w)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:N.type==="added"?"rgba(34,197,94,0.1)":N.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:N.type==="added"?"var(--green)":N.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:N.type==="added"?"3px solid var(--green)":N.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:N.type==="added"?"+":N.type==="removed"?"-":" "}),N.content]},w))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:be,disabled:q,className:"btn btn-primary",children:q?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),a.jsx("button",{onClick:he,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const zx={remove:{bg:"var(--red-muted)",color:"var(--red)",label:"REMOVE"},modify:{bg:"rgba(251,191,36,0.15)",color:"#fbbf24",label:"MODIFY"},add:{bg:"var(--green-muted)",color:"var(--green)",label:"ADD"}},Ev={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function kv({change:s,index:o,selected:c,onToggle:u,originalEval:x}){var y;const[v,p]=m.useState(!1),b=zx[s.action]??zx.add,g=Ev[s.action]??"var(--border-subtle)",f=s.action==="remove"?(x==null?void 0:x.name)??`Eval #${s.evalId}`:((y=s.eval)==null?void 0:y.name)??"Unnamed",j=m.useCallback(()=>u(o),[u,o]);return a.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${g}`,opacity:c?1:.5},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("input",{type:"checkbox",checked:c,onChange:j,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),a.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:b.bg,color:b.color,padding:"1px 6px"},children:b.label}),a.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:f}),a.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:s.reason}),a.jsx("button",{onClick:()=>p(!v),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:k=>{k.currentTarget.style.background="var(--surface-3)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),v&&a.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[s.action==="add"&&s.eval&&a.jsx(Cv,{evalCase:s.eval}),s.action==="modify"&&s.eval&&x&&a.jsx(Tv,{original:x,proposed:s.eval}),s.action==="remove"&&x&&a.jsx(wv,{evalCase:x})]})]})}function Cv({evalCase:s}){var o;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(xc,{label:"Prompt",value:s.prompt}),a.jsx(xc,{label:"Expected",value:s.expected_output}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((o=s.assertions)==null?void 0:o.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-1",children:(s.assertions??[]).map(c=>a.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",c.text]},c.id))})]})]})}function Tv({original:s,proposed:o}){const c=[];s.name!==o.name&&c.push({label:"Name",old:s.name,new:o.name}),s.prompt!==o.prompt&&c.push({label:"Prompt",old:s.prompt,new:o.prompt}),s.expected_output!==o.expected_output&&c.push({label:"Expected",old:s.expected_output,new:o.expected_output});const u=s.assertions??[],x=o.assertions??[],v=new Set(u.map(f=>f.text)),p=new Set(x.map(f=>f.text)),b=x.filter(f=>!v.has(f.text)),g=u.filter(f=>!p.has(f.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[c.map(f=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:f.label}),a.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[a.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",pc(f.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",pc(f.new,120)]})]})]},f.label)),(b.length>0||g.length>0)&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),a.jsxs("div",{className:"mt-1 space-y-0.5",children:[g.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",f.text]},f.id)),b.map(f=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",f.text]},f.id))]})]}),c.length===0&&b.length===0&&g.length===0&&a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function wv({evalCase:s}){var o;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(xc,{label:"Prompt",value:s.prompt}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((o=s.assertions)==null?void 0:o.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:(s.assertions??[]).map(c=>a.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:c.text},c.id))})]})]})}function xc({label:s,value:o}){return a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:s}),a.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:pc(o,300)})]})}function pc(s,o){return s.length>o?s.slice(0,o)+"...":s}const Dx={remove:0,modify:1,add:2};function Av({changes:s,selections:o,currentEvals:c,onToggle:u,onSelectAll:x,onDeselectAll:v}){if(s.length===0)return null;const p=s.map((g,f)=>({change:g,originalIndex:f}));p.sort((g,f)=>(Dx[g.change.action]??2)-(Dx[f.change.action]??2));const b=Array.from(o.values()).filter(Boolean).length;return a.jsxs("div",{className:"mt-3 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",b,"/",s.length," selected)"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("button",{onClick:x,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Select All"}),a.jsx("button",{onClick:v,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--surface-3)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),a.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:p.map(({change:g,originalIndex:f})=>a.jsx(kv,{change:g,index:f,selected:o.get(f)??!1,onToggle:u,originalEval:g.evalId!=null?c.find(j=>j.id===g.evalId):void 0},f))})]})}function Rv(){var N;const{state:s,dispatch:o,submitAiEdit:c,applyAiEdit:u,discardAiEdit:x,cancelAiEdit:v,toggleEvalChange:p,selectAllEvalChanges:b,deselectAllEvalChanges:g,retryEvalsSave:f}=al(),{aiEditLoading:j,aiEditResult:y,aiEditError:k,aiEditClassifiedError:R,aiEditProgress:U,aiEditEvalChanges:L,aiEditEvalSelections:Y,aiEditEvalsRetry:O}=s,[Z,W]=m.useState(""),{config:F}=ia(),[ae,re]=m.useState("claude-cli"),[q,I]=m.useState("opus"),G=m.useRef(null);m.useEffect(()=>{var w;(w=G.current)==null||w.focus()},[]),m.useEffect(()=>{if(!F)return;F.providers.find(ee=>ee.id==="claude-cli"&&ee.available)&&(re("claude-cli"),I("opus"))},[F]);const X=F==null?void 0:F.providers.find(w=>w.id===ae&&w.available),ne=m.useCallback(()=>{const w=Z.trim();!w||j||c(w,ae,q)},[Z,j,c,ae,q]),te=m.useCallback(w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),ne()),w.key==="Escape"&&(w.preventDefault(),j?v():x())},[ne,j,v,x]),be=m.useCallback(()=>{o({type:"CLOSE_AI_EDIT"}),o({type:"OPEN_AI_EDIT"})},[o]),he=y?Dr(s.skillContent,y.improved):[],T=((N=s.evals)==null?void 0:N.evals)??[];return a.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),a.jsx("button",{onClick:x,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:w=>{w.currentTarget.style.background="var(--surface-3)"},onMouseLeave:w=>{w.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-4 py-3",children:[!y&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-2.5",children:[a.jsx("div",{className:"flex-1",children:a.jsx("textarea",{ref:G,value:Z,onChange:w=>W(w.target.value),onKeyDown:te,placeholder:"e.g., Add an error handling section...",disabled:j,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:w=>{const ee=w.currentTarget;ee.style.height="auto",ee.style.height=Math.min(ee.scrollHeight,96)+"px"}})}),a.jsxs("div",{style:{minWidth:100},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:ae,onChange:w=>{re(w.target.value);const ee=F==null?void 0:F.providers.find(B=>B.id===w.target.value);ee!=null&&ee.models[0]&&I(ee.models[0].id)},disabled:j,style:{width:"100%"},children:F==null?void 0:F.providers.filter(w=>w.available).map(w=>a.jsx("option",{value:w.id,children:w.label},w.id))})]}),a.jsxs("div",{style:{minWidth:80},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:q,onChange:w=>I(w.target.value),disabled:j,style:{width:"100%"},children:X==null?void 0:X.models.map(w=>a.jsx("option",{value:w.id,children:w.label},w.id))})]}),j?a.jsx("button",{onClick:v,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):a.jsx("button",{onClick:ne,disabled:!Z.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),j&&U.length>0&&a.jsx("div",{className:"mt-2.5",children:a.jsx(fs,{entries:U,isRunning:!0})})]}),k&&a.jsx("div",{className:"mt-3",children:R?a.jsx(ds,{error:R,onRetry:be,onDismiss:x}):a.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:k})}),y&&a.jsxs("div",{className:"animate-fade-in",children:[y.reasoning&&a.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),y.reasoning]}),a.jsx("div",{className:"mb-1",children:a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:he.map((w,ee)=>a.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:w.type==="added"?"rgba(34,197,94,0.1)":w.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:w.type==="added"?"var(--green)":w.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:w.type==="added"?"3px solid var(--green)":w.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:w.type==="added"?"+":w.type==="removed"?"-":" "}),w.content]},ee))}),a.jsx(Av,{changes:L,selections:Y,currentEvals:T,onToggle:p,onSelectAll:b,onDeselectAll:g}),O&&a.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[a.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),a.jsx("button",{onClick:f,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsxs("button",{onClick:u,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:x,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),a.jsx("button",{onClick:be,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function _v(s,o){const[c,u]=m.useState([]),[x,v]=m.useState("SKILL.md"),[p,b]=m.useState(null),[g,f]=m.useState(!1),[j,y]=m.useState(null),k=m.useCallback(async()=>{try{const L=await ge.getSkillFiles(s,o);u(L.files)}catch{u([])}},[s,o]);m.useEffect(()=>{v("SKILL.md"),b(null),y(null),k()},[s,o,k]);const R=m.useCallback(async L=>{if(v(L),L==="SKILL.md"){b(null),y(null);return}f(!0),y(null);try{const Y=await ge.getSkillFile(s,o,L);b(Y)}catch(Y){y(`Unable to open file: ${Y.message}`),b(null)}finally{f(!1)}},[s,o]),U=m.useCallback(()=>{k()},[k]);return{files:c,activeFile:x,secondaryContent:p,loading:g,error:j,selectFile:R,refresh:U,isSkillMd:x==="SKILL.md"}}function Mv(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Lv(s){const o=[],c=new Map;for(const u of s){const x=u.path.split("/"),p={name:x[x.length-1],path:u.path,type:u.type,size:u.size,children:[]};c.set(u.path,p)}for(const u of s){const x=u.path.split("/");if(x.length===1){const v=c.get(u.path);v&&o.push(v)}else{const v=x.slice(0,-1).join("/"),p=c.get(v),b=c.get(u.path);p&&b&&p.children.push(b)}}return o}function tp({expanded:s}){return a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:s?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function lp(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function zv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Dv(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"23 4 23 10 17 10"}),a.jsx("polyline",{points:"1 20 1 14 7 14"}),a.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function ap({node:s,depth:o,activeFile:c,onSelect:u}){const[x,v]=m.useState(!0),p=s.path===c;return s.type==="dir"?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>v(!x),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+o*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[a.jsx(tp,{expanded:x}),a.jsx(lp,{}),a.jsxs("span",{children:[s.name,"/"]})]}),x&&s.children.map(b=>a.jsx(ap,{node:b,depth:o+1,activeFile:c,onSelect:u},b.path))]}):a.jsxs("button",{onClick:()=>u(s.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+o*14}px`,paddingTop:2,paddingBottom:2,background:p?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:p?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[a.jsx("span",{style:{width:10}}),a.jsx(zv,{}),a.jsx("span",{style:{flex:1},children:s.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:Mv(s.size)})]})}function Ov({files:s,activeFile:o,onSelect:c,onRefresh:u}){const[x,v]=m.useState(!1),p=m.useMemo(()=>Lv(s),[s]);return a.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>v(!x),children:[a.jsx(tp,{expanded:x}),a.jsx(lp,{}),a.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),a.jsx("button",{onClick:b=>{b.stopPropagation(),u()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:a.jsx(Dv,{})})]}),x&&a.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:p.length===0?a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):p.map(b=>a.jsx(ap,{node:b,depth:0,activeFile:o,onSelect:c},b.path))})]})}function kr(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Bv(s){try{return JSON.stringify(JSON.parse(s),null,2)}catch{return s}}function Hv(s){const o=s.toLowerCase();return o.endsWith(".json")?"json":o.endsWith(".md")?"md":"other"}function Ox({content:s}){return a.jsx("textarea",{readOnly:!0,value:s,style:{flex:1,width:"100%",resize:"none",background:"var(--surface-1)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}})}function Bx({content:s,fileType:o}){if(o==="json"){const c=Bv(s);return a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:c})}return o==="md"?a.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:zr(s)}}):a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})}function Hx(s){try{return JSON.stringify(JSON.parse(s),null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"([^"\\]|\\.)*"\s*:/g,c=>`<span style="color:#6383ff">${c}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,c=>`<span style="color:#22c55e">${c.slice(0,2)}<span style="color:#22c55e">${c.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(c,u)=>`: <span style="color:#fb923c">${u}</span>`).replace(/:\s*(true|false|null)/g,(c,u)=>`: <span style="color:#a855f7">${u}</span>`)}catch{return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function Uv({file:s,loading:o,error:c,viewMode:u,plugin:x,skill:v,onSaved:p,onDirtyChange:b}){const[g,f]=m.useState(u),[j,y]=m.useState(!1),[k,R]=m.useState(""),[U,L]=m.useState(!1),[Y,O]=m.useState(null),Z=u!==g?u:g;m.useEffect(()=>{b==null||b(j)},[j,b]);const W=m.useCallback(()=>{(s==null?void 0:s.content)!=null&&(R(s.content),y(!0))},[s]),F=m.useCallback(()=>{y(!1)},[]),ae=m.useCallback(async()=>{if(!(!x||!v||!s)){L(!0);try{await ge.saveSkillFile(x,v,s.path,k),O("Saved"),y(!1),p==null||p(),setTimeout(()=>O(null),2e3)}catch(I){O(`Save failed: ${I.message}`),setTimeout(()=>O(null),3e3)}finally{L(!1)}}},[x,v,s,k,p]);if(m.useEffect(()=>{if(!j)return;const I=G=>{(G.ctrlKey||G.metaKey)&&G.key==="s"&&(G.preventDefault(),ae())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[j,ae]),o)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(c)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:a.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[a.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),a.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:c})]})});if(!s)return null;if(s.binary)return a.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",kr(s.size),") — cannot be displayed"]});const re=s.content??"",q=Hv(s.path);return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[s.truncated&&a.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",kr(512*1024)," — ",kr(s.size)," total"]}),a.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(q==="md"||q==="json")&&["raw","split","preview"].map(I=>a.jsx("button",{onClick:()=>f(I),style:{padding:"2px 8px",fontSize:11,background:Z===I?"var(--accent-muted)":"none",color:Z===I?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:I},I)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[kr(s.size),x&&v&&!s.binary&&!j&&a.jsx("button",{onClick:W,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),j&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:ae,disabled:U,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:U?.6:1},children:U?"Saving...":"Save"}),a.jsx("button",{onClick:F,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),Y&&a.jsx("div",{style:{padding:"4px 12px",background:Y.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:Y.startsWith("Save failed")?"var(--red)":"var(--green)"},children:Y}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:j?a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[a.jsx("textarea",{value:k,onChange:I=>R(I.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),a.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),a.jsx("button",{onClick:ae,disabled:U,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:U?.6:1},children:U?"Saving...":"Save"}),a.jsx("button",{onClick:F,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):Z==="split"&&q!=="other"?a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:a.jsx(Ox,{content:re})}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:q==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Hx(re)}}):a.jsx(Bx,{content:re,fileType:q})})]}):Z==="preview"&&q!=="other"?q==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Hx(re)}}):a.jsx(Bx,{content:re,fileType:q}):a.jsx(Ox,{content:re})})]})}function qv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function Vv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),a.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function Gv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Yv({size:s=15}){return a.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}function ac({size:s=15}){return a.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function $v(){const{state:s,dispatch:o,saveContent:c,isReadOnly:u}=al(),{plugin:x,skill:v,skillContent:p,isDirty:b,improveTarget:g,aiEditOpen:f}=s,[j,y]=m.useState("split"),[k,R]=m.useState(!1),U=m.useRef(null),[L,Y]=m.useState(!1),[O,Z]=m.useState(""),[W,F]=m.useState(!1),[ae,re]=m.useState(null),[q,I]=m.useState([]),[G,X]=m.useState([]),[ne,te]=m.useState(null),be=m.useRef(null),{config:he}=ia(),{files:T,activeFile:N,secondaryContent:w,loading:ee,error:B,selectFile:ue,refresh:S,isSkillMd:D}=_v(x??"",v??""),[P,le]=m.useState(!1),ce=m.useCallback(K=>{P&&!window.confirm("You have unsaved changes. Discard?")||ue(K)},[P,ue]);m.useEffect(()=>()=>{var K;(K=be.current)==null||K.abort()},[]);const{metadata:de,body:me}=bv(p),Oe=de["allowed-tools"],Re=Array.isArray(Oe)?Oe:typeof Oe=="string"?[Oe]:[],pt=de.name,Dt=de.description,J=de.metadata,ie=typeof J=="object"&&!Array.isArray(J)?J:null,se=de.version||(ie==null?void 0:ie.version),xe=de.tags||(ie==null?void 0:ie.tags),ye=Array.isArray(xe)?xe:typeof xe=="string"?xe.split(",").map(K=>K.trim()).filter(Boolean):[],Ye=new Set(["name","description","metadata","allowed-tools","version","tags"]),ut=Object.entries(de).filter(([K])=>!Ye.has(K)),Qe=m.useCallback(async()=>{R(!0),await c(),R(!1)},[c]),Ot=m.useCallback(K=>{(K.ctrlKey||K.metaKey)&&K.key==="s"&&(K.preventDefault(),K.stopPropagation(),b&&Qe()),(K.ctrlKey||K.metaKey)&&K.key==="k"&&(K.preventDefault(),K.stopPropagation(),o({type:f?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[b,Qe,f,o]),mt=m.useCallback(async()=>{var Be,at;if(!O.trim())return;(Be=be.current)==null||Be.abort();const K=new AbortController;be.current=K,F(!0),te(null),X([]),re(null),I([]);try{const Je=(he==null?void 0:he.provider)||"claude-cli",Ml=(he==null?void 0:he.model)||"sonnet",Bt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:O,provider:Je,model:Ml}),signal:K.signal});if(!Bt.ok||!Bt.body){let et=`HTTP ${Bt.status}`;try{const sl=await Bt.json();sl.error&&(et=sl.error)}catch{}throw new Error(et)}const oa=Bt.body.getReader(),Ct=new TextDecoder;let Fe="",nt="";for(;;){const{done:et,value:sl}=await oa.read();if(et)break;Fe+=Ct.decode(sl,{stream:!0});const $e=Fe.split(`
61
+ `);Fe=$e.pop()||"";for(const rl of $e)if(rl.startsWith("event: "))nt=rl.slice(7).trim();else if(rl.startsWith("data: ")){try{const st=JSON.parse(rl.slice(6));if(nt==="progress")X(Ve=>[...Ve,{phase:st.phase,message:st.message,timestamp:Date.now()}]);else if(nt==="done"||nt==="complete"){const Ve=["---"];st.name&&Ve.push(`name: ${st.name}`),st.description&&Ve.push(`description: "${st.description.replace(/"/g,'\\"')}"`),st.model&&Ve.push(`model: ${st.model}`),(at=st.allowedTools)!=null&&at.trim()&&Ve.push(`allowed-tools: ${st.allowedTools.trim()}`),Ve.push("---","",st.body||"");const Ll=Ve.join(`
62
+ `);re(Ll),I(Dr(p,Ll)),F(!1)}else nt==="error"&&(te(st.message||st.description||"Generation failed"),F(!1))}catch{}nt=""}}}catch(Je){Je.name!=="AbortError"&&te(Je.message)}finally{F(!1),be.current=null}},[O,he,p]),nl=m.useCallback(()=>{ae&&o({type:"SET_CONTENT",content:ae}),Y(!1),re(null),I([]),Z(""),X([])},[ae,o]),Xt=m.useCallback(()=>{Y(!1),re(null),I([]),Z(""),X([]),te(null)},[]),We=m.useCallback(()=>{var K;L?((K=be.current)==null||K.abort(),Xt()):(f&&o({type:"CLOSE_AI_EDIT"}),Y(!0))},[L,f,o,Xt]),kt=[{mode:"raw",icon:a.jsx(qv,{}),label:"Editor"},{mode:"split",icon:a.jsx(Vv,{}),label:"Split"},{mode:"preview",icon:a.jsx(Gv,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Ot,tabIndex:-1,children:[a.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:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:kt.map(({mode:K,icon:Be,label:at})=>a.jsxs("button",{onClick:()=>y(K),title:at,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:j===K?"var(--surface-4)":"transparent",color:j===K?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:j===K?600:400,border:"none",cursor:"pointer"},children:[Be,a.jsx("span",{style:{letterSpacing:"0.01em"},children:at})]},K))}),D?u?a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>{f?o({type:"CLOSE_AI_EDIT"}):(L&&Xt(),o({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:f?600:400,border:"none",cursor:"pointer",color:f?"#a855f7":"var(--text-tertiary)",background:f?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(Yv,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:We,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:L?600:400,border:"none",cursor:"pointer",color:L?"#a855f7":"var(--text-tertiary)",background:L?"rgba(168,85,247,0.12)":"transparent"},children:[a.jsx(ac,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),b&&a.jsx("button",{onClick:()=>o({type:"SET_CONTENT",content:s.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:Qe,disabled:!b||k,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:k?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),x&&v&&a.jsx(Ov,{files:T,activeFile:N,onSelect:ce,onRefresh:S}),!D&&a.jsx(Uv,{file:w,loading:ee,error:B,viewMode:j,plugin:x??void 0,skill:v??void 0,onSaved:()=>{ue(N),S()},onDirtyChange:le}),D&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:j==="raw"||j==="preview"?"1fr":"1fr 1fr"},children:[j!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:j==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:U,value:p,onChange:K=>{u||o({type:"SET_CONTENT",content:K.target.value})},onKeyDown:Ot,spellCheck:!1,readOnly:u,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",opacity:u?.7:1}})}),j!=="raw"&&a.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(pt||se||Dt)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[pt&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:pt}),se&&a.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]})]}),Dt&&a.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:Dt})]}),ye.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ye.map(K=>a.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:K},K))}),Re.length>0&&a.jsx("div",{style:{marginBottom:16},children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Re.map(K=>a.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:K},K))]})}),ut.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:ut.map(([K,Be],at)=>{const Je=Array.isArray(Be)?Be.join(", "):typeof Be=="object"?Object.entries(Be).map(([Ml,Bt])=>`${Ml}: ${Array.isArray(Bt)?Bt.join(", "):Bt}`).join(" | "):Be;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:at>0?"1px solid var(--border-subtle)":"none"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:K}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:Je})]},K)})}),(pt||Dt||ye.length>0||Re.length>0||ut.length>0)&&me&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),me&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:zr(me)}})]})})]}),D&&f&&a.jsx(Rv,{}),D&&L&&a.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:a.jsxs("div",{className:"px-4 py-3",children:[!ae&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ac,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),a.jsx("div",{className:"flex gap-2 mb-2",children:a.jsx("textarea",{value:O,onChange:K=>Z(K.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:W,className:"flex-1 px-3 py-2 rounded-lg text-[12px] resize-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",outline:"none",opacity:W?.5:1},onKeyDown:K=>{K.key==="Enter"&&(K.ctrlKey||K.metaKey)&&O.trim()&&!W&&(K.preventDefault(),mt())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[W?a.jsx("button",{onClick:()=>{var K;(K=be.current)==null||K.abort(),F(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:mt,disabled:!O.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:Xt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),W&&G.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(fs,{entries:G,isRunning:!0})}),ne&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[ne,a.jsx("button",{onClick:mt,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),ae&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ac,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:q.map((K,Be)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:K.type==="added"?"rgba(34,197,94,0.1)":K.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:K.type==="added"?"var(--green)":K.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:K.type==="added"?"3px solid var(--green)":K.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:K.type==="added"?"+":K.type==="removed"?"-":" "}),K.content]},Be))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:nl,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:Xt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),D&&g!==null&&x&&v&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Nv,{plugin:x,skill:v,skillContent:p,onApplied:K=>{o({type:"SET_CONTENT",content:K}),o({type:"CONTENT_SAVED"}),o({type:"CLOSE_IMPROVE"})}})})]})}function xn(s){return s.testType==="integration"?"integration":"unit"}function pn(s){return s>=.8?"var(--green)":s>=.5?"var(--yellow)":"var(--red)"}function np(s){const o=new Date(s);return o.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function sp(s){return s==null?"--":s>=1e3?`${(s/1e3).toFixed(1)}s`:`${s}ms`}const Qv=new Set(["benchmark","comparison","baseline"]);function Ux(s,o,c,u){return s.map(({rate:x,idx:v,total:p})=>{const b=u+v/(p-1)*(o-u*2),g=u+(c-u*2)-x*(c-u*2);return`${b},${g}`})}function rp({entries:s}){const o=s.filter(y=>Qv.has(y.type)).slice().reverse(),c=o.map((y,k,R)=>({rate:y.pass_rate,idx:k,total:R.length})).filter((y,k)=>{const R=o[k].type;return R==="benchmark"||R==="comparison"}),u=o.flatMap((y,k)=>y.type==="baseline"?[{rate:y.pass_rate,idx:k,total:o.length}]:y.type==="comparison"&&y.baselinePassRate!=null?[{rate:y.baselinePassRate,idx:k,total:o.length}]:[]);if(c.length<2&&u.length<2)return null;const x=80,v=24,p=2,b=c.length>=2?Ux(c,x,v,p):[],g=u.length>=2?Ux(u,x,v,p):[],f=b[b.length-1],j=g[g.length-1];return a.jsxs("svg",{width:x,height:v,style:{display:"block",flexShrink:0},children:[g.length>0&&a.jsx("polyline",{points:g.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),b.length>0&&a.jsx("polyline",{points:b.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),j&&a.jsx("circle",{cx:parseFloat(j.split(",")[0]),cy:parseFloat(j.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),f&&a.jsx("circle",{cx:parseFloat(f.split(",")[0]),cy:parseFloat(f.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function ip(s,o,c){const u=isNaN(o)?0:o,x=[],v=[],p=[];if((s==="PASS"||s==="EFFECTIVE")&&u>=.7){const f=x.length>0?` Met criteria: ${x.map(j=>j.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${u.toFixed(2)}): evaluation met expectations.${f}`}}if(s==="FAIL"||s==="DEGRADING"){const f=v.length>0?` Failed criteria: ${v.map(y=>y.criterion).join(", ")}.`:"",j=[...v.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...p.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return j.length===0&&j.push("Review prompt instructions and add more specific guidance"),{explanation:`${s} (score ${u.toFixed(2)}): evaluation did not meet expectations.${f}`,recommendations:j}}if(s==="INEFFECTIVE"){if(u<.2){const j=[...v.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${s} (score ${u.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:j}}const f=[...v.map(j=>`Rework "${j.criterion}" — currently at ${j.score.toFixed(2)}`),...p.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push("Consider restructuring your prompt approach"),{explanation:`${s} (score ${u.toFixed(2)}): below expectations but showing some capability.`,recommendations:f}}if(s==="MARGINAL"){const f=[...p.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`),...v.map(j=>`Improve "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push(x.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${s} (score ${u.toFixed(2)}): moderate improvement detected.`,recommendations:f}}if(s==="EMERGING"){const f=[...v.map(j=>`Improve "${j.criterion}" (score: ${j.score.toFixed(2)})`),...p.map(j=>`Strengthen "${j.criterion}" (score: ${j.score.toFixed(2)})`)];return f.length===0&&f.push(x.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${s} (score ${u.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:f}}const b=x.length>0?` Passing: ${x.map(f=>f.criterion).join(", ")}.`:"",g=p.length>0?` Needs improvement: ${p.map(f=>f.criterion).join(", ")}.`:"";return{explanation:`${s} (score ${u.toFixed(2)}): mixed results.${b}${g}`}}const op={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function Xv(s){return Object.hasOwn(op,s)}function Kv(s){return Xv(s)?op[s]:s}function Zv(){const{state:s}=al(),{plugin:o,skill:c}=s,[u,x]=m.useState([]),[v,p]=m.useState([]),[b,g]=m.useState(!0),[f,j]=m.useState(null),[y,k]=m.useState(new Set),[R,U]=m.useState({}),[L,Y]=m.useState(null),[O,Z]=m.useState(""),[W,F]=m.useState(!1),[ae,re]=m.useState(""),[q,I]=m.useState(""),G=m.useCallback(async()=>{g(!0),j(null);try{const[T,N]=await Promise.all([ge.getCredentials(o,c),ge.getParams(o,c)]);x(T.credentials),p(N.params)}catch(T){j(T instanceof Error?T.message:"Failed to load parameters"),x([]),p([])}finally{g(!1)}},[o,c]);m.useEffect(()=>{G()},[G]);const X=m.useCallback(async(T,N)=>{F(!0),j(null);try{await ge.setCredential(o,c,T,N),Y(null),Z(""),await G()}catch(w){j(w instanceof Error?w.message:`Failed to save ${T}`)}finally{F(!1)}},[o,c,G]),ne=m.useCallback(async()=>{const T=ae.trim().toUpperCase(),N=q.trim();if(!(!T||!N)){F(!0),j(null);try{await ge.setCredential(o,c,T,N),re(""),I(""),await G()}catch(w){j(w instanceof Error?w.message:`Failed to add ${T}`)}finally{F(!1)}}},[o,c,ae,q,G]),te=m.useCallback(async T=>{if(y.has(T)){k(N=>{const w=new Set(N);return w.delete(T),w}),U(N=>{const w={...N};return delete w[T],w});return}try{const w=(await ge.getParamsRevealed(o,c,T)).params.find(ee=>ee.name===T);w!=null&&w.value&&(U(ee=>({...ee,[T]:w.value})),k(ee=>new Set(ee).add(T)))}catch{}},[o,c,y]),be=new Set(u.map(T=>T.name)),he=[...u.map(T=>{const N=v.find(w=>w.name===T.name);return{name:T.name,status:T.status,maskedValue:(N==null?void 0:N.maskedValue)??""}}),...v.filter(T=>!be.has(T.name)).map(T=>({name:T.name,status:T.status,maskedValue:T.maskedValue}))];return a.jsxs("div",{className:"py-2 px-3",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),f&&a.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"rgba(239,68,68,0.1)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.2)"},role:"alert",children:f}),b&&he.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!b&&he.length===0&&!f&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),he.map(T=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:T.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:T.status==="ready"?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.15)",color:T.status==="ready"?"#22c55e":"#ef4444"},children:T.status}),(T.maskedValue||T.status==="ready")&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[y.has(T.name)?R[T.name]??T.maskedValue:T.maskedValue||"***",a.jsx("button",{onClick:()=>te(T.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${y.has(T.name)?"Hide":"Reveal"} value for ${T.name}`,children:y.has(T.name)?"hide":"show"})]}),L===T.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:O,onChange:N=>Z(N.target.value),onKeyDown:N=>{N.key==="Enter"&&O.trim()&&X(T.name,O)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${T.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>X(T.name,O),disabled:W||!O.trim(),className:"text-[10px] font-medium",style:{color:"#22c55e",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{Y(null),Z("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{Y(T.name),Z("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},T.name)),a.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:ae,onChange:T=>re(T.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:q,onChange:T=>I(T.target.value),onKeyDown:T=>{T.key==="Enter"&&ae.trim()&&q.trim()&&ne()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:ne,disabled:W||!ae.trim()||!q.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:W?"not-allowed":"pointer"},children:"Add"})]})]})]})}function Jv(s,o,c){const[u,x]=m.useState(null),[v,p]=m.useState(!1),b=m.useRef("");m.useEffect(()=>{const f=`${s}/${o}/${c}`;b.current!==f&&(b.current=f,p(!0),ge.getCaseHistory(s,o,c).then(j=>x(j)).catch(()=>x([])).finally(()=>p(!1)))},[s,o,c]);const g=m.useCallback(()=>{p(!0),b.current="",ge.getCaseHistory(s,o,c).then(f=>x(f)).catch(()=>x([])).finally(()=>p(!1))},[s,o,c]);return{entries:u,loading:v,refetch:g}}function Wv(s,o,c){const u={flaky:!1,nonDiscriminating:!1,regression:!1};if(!c||c.length===0)return u;const v=c.slice(0,10).map(g=>g.assertions.find(f=>f.id===s)).filter(Boolean);if(v.length>=2){const f=v.filter(j=>j.pass).length/v.length;f>=.3&&f<=.7&&(u.flaky=!0)}const p=c.find(g=>g.type==="benchmark"),b=c.find(g=>g.type==="baseline");if(p&&b){const g=p.assertions.find(j=>j.id===s),f=b.assertions.find(j=>j.id===s);g!=null&&g.pass&&(f!=null&&f.pass)&&(u.nonDiscriminating=!0)}if(o&&!o.pass&&c.length>=1){const f=c[0].assertions.find(j=>j.id===s);f!=null&&f.pass&&(u.regression=!0)}return u}function Fv(){var ee;const{state:s,dispatch:o,saveEvals:c,runCase:u,runAll:x,cancelCase:v,cancelAll:p,generateEvals:b,isReadOnly:g}=al(),{evals:f,evalsError:j,selectedCaseId:y,inlineResults:k,caseRunStates:R,generateEvalsLoading:U,generateEvalsProgress:L,generateEvalsError:Y}=s,O=m.useMemo(()=>{for(const B of R.values())if(B.status==="running"||B.status==="queued")return!0;return!1},[R]),[Z,W]=m.useState(!1),[F,ae]=m.useState("all"),re={skill_name:s.skill,evals:[]},q=f??re,I=q.evals,G=m.useMemo(()=>F==="all"?I:I.filter(B=>xn(B)===F),[F,I]),X=G.find(B=>B.id===y)??null;m.useEffect(()=>{y!==null&&!G.find(B=>B.id===y)&&o({type:"SELECT_CASE",caseId:G.length>0?G[0].id:null})},[G,y,o]);const[ne,te]=m.useState([]),be=m.useMemo(()=>I.some(B=>xn(B)==="integration"),[I]);m.useEffect(()=>{be&&ge.getCredentials(s.plugin,s.skill).then(B=>te(B.credentials)).catch(()=>te([]))},[s.plugin,s.skill,be]);const he=m.useMemo(()=>new Set(ne.filter(B=>B.status==="missing").map(B=>B.name)),[ne]),[T,N]=m.useState(!1),w=m.useCallback(B=>{N(!1),b(B?{testType:B}:void 0)},[b]);return!f||I.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:j?"var(--error-muted, #3f1a1a)":"var(--accent-muted)"},children:j?a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--error, #f87171)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),a.jsx("div",{className:"text-center",children:j?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--error, #f87171)"},children:"Invalid evals.json"}),a.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:j}),a.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>W(!0),disabled:g,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("div",{className:"flex",children:[a.jsx("button",{onClick:()=>w("unit"),disabled:U||g,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:U?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),a.jsx("button",{onClick:()=>N(!T),disabled:U||g,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),T&&a.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:a.jsx("button",{onClick:()=>w("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--surface-2)"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),U&&L.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(fs,{entries:L,isRunning:!0})}),Y&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(ds,{error:Y,onRetry:()=>w()})}),Z&&a.jsx(qx,{evals:q,onSave:B=>{c(B),W(!1)},onCancel:()=>W(!1)})]}):a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[a.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",G.length,")"]}),a.jsx("div",{className:"flex items-center gap-1.5",children:O?a.jsx("button",{onClick:p,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:"Cancel All"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>x("benchmark"),disabled:G.length===0||g,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),a.jsx("button",{onClick:()=>x("comparison"),disabled:G.length===0||g,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),a.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(B=>a.jsx("button",{onClick:()=>ae(B),style:{padding:"2px 8px",fontSize:10,fontWeight:F===B?600:400,background:F===B?"var(--accent-muted)":"transparent",color:F===B?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:B==="all"?`All (${I.length})`:B==="unit"?`Unit (${I.filter(ue=>xn(ue)==="unit").length})`:`Integration (${I.filter(ue=>xn(ue)==="integration").length})`},B))}),a.jsxs("div",{className:"py-1",children:[G.length===0&&I.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",F==="all"?"":F+" ","tests yet"]}),G.map(B=>{var P;const ue=k.get(B.id),S=y===B.id,D=xn(B);return a.jsxs("button",{onClick:()=>o({type:"SELECT_CASE",caseId:B.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:S?"var(--accent-muted)":"transparent",borderLeft:S?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:le=>{S||(le.currentTarget.style.background="var(--surface-2)")},onMouseLeave:le=>{S||(le.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[a.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:S?"var(--text-primary)":"var(--text-secondary)"},children:["#",B.id," ",B.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:D==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:D==="unit"?"#6383ff":"#fb923c",whiteSpace:"nowrap"},children:D==="unit"?"U":"I"}),D==="integration"&&((P=B.requiredCredentials)==null?void 0:P.some(le=>he.has(le)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),a.jsx(cp,{result:ue})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[B.assertions.length," assertion",B.assertions.length!==1?"s":"",(ue==null?void 0:ue.passRate)!=null&&a.jsx(ey,{passRate:ue.passRate})]})]},B.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!g&&a.jsx("button",{onClick:()=>W(!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:B=>{B.currentTarget.style.borderColor="var(--accent)",B.currentTarget.style.color="var(--accent)"},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-default)",B.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),be&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Zv,{})})]}),a.jsx("div",{className:"overflow-auto",children:X?a.jsx(Iv,{evalCase:X,result:k.get(X.id),evals:f,caseStatus:((ee=R.get(X.id))==null?void 0:ee.status)??"idle",onSaveEvals:c,onRun:B=>u(B,"benchmark"),onCompare:B=>u(B,"comparison"),onCancel:B=>v(B),onImprove:B=>o({type:"OPEN_IMPROVE",evalId:B})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),Z&&a.jsx(qx,{evals:q,onSave:B=>{c(B),W(!1)},onCancel:()=>W(!1)})]})}function Iv({evalCase:s,result:o,evals:c,caseStatus:u,onSaveEvals:x,onRun:v,onCompare:p,onCancel:b,onImprove:g}){const{state:f,isReadOnly:j}=al(),{plugin:y,skill:k}=f,{entries:R,loading:U}=Jv(y,k,s.id),[L,Y]=m.useState(!1),[O,Z]=m.useState(s.prompt),[W,F]=m.useState(!1),[ae,re]=m.useState(s.expected_output);m.useState(()=>{Z(s.prompt),re(s.expected_output)});const q=m.useCallback(B=>{x({...c,evals:c.evals.map(ue=>ue.id===B.id?B:ue)})},[c,x]),I=m.useCallback(()=>{q({...s,prompt:O}),Y(!1)},[s,O,q]),G=m.useCallback(()=>{q({...s,expected_output:ae}),F(!1)},[s,ae,q]),X=m.useCallback(()=>{q({...s,assertions:[...s.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[s,q]),ne=m.useCallback((B,ue)=>{q({...s,assertions:s.assertions.map(S=>S.id===B?{...S,text:ue}:S)})},[s,q]),te=m.useCallback(B=>{q({...s,assertions:s.assertions.filter(ue=>ue.id!==B)})},[s,q]),be=m.useCallback(()=>{confirm("Delete this test case?")&&x({...c,evals:c.evals.filter(B=>B.id!==s.id)})},[c,s.id,x]),he=o&&o.assertions.length>0&&o.assertions.every(B=>B.pass),T=o&&o.assertions.some(B=>!B.pass),N=xn(s),w=s.requiredCredentials??[],ee=N==="integration"&&w.length>0;return a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",s.id," ",s.name]}),j?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:N==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:N==="unit"?"#6383ff":"#fb923c"},children:N==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((N==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ue,requirements:S,cleanup:D,...P}=s;q({...P,testType:"unit"})}else q({...s,testType:"integration"})},title:`Click to switch to ${N==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:N==="unit"?"rgba(99,131,255,0.15)":"rgba(251,146,60,0.15)",color:N==="unit"?"#6383ff":"#fb923c",border:"none",cursor:"pointer"},children:N==="unit"?"Unit":"Integration"}),a.jsx(cp,{result:o})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[u==="running"||u==="queued"?a.jsxs("button",{onClick:()=>b(s.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(239,68,68,0.3)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>v(s.id),disabled:j,className:"btn btn-primary text-[12px]",children:"Run"}),a.jsx("button",{onClick:()=>p(s.id),disabled:j,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),T&&!j&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:()=>g(s.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!j&&u!=="running"&&u!=="queued"&&a.jsx("button",{onClick:be,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.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"})]})})]})]}),j&&N==="integration"&&a.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid rgba(99,131,255,0.2)"},children:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),a.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),a.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),he&&a.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:[a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),ee&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"rgba(251,146,60,0.1)",border:"1px solid rgba(251,146,60,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"Required Credentials"})]}),a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:w.map(B=>a.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:B},B))})]}),!j&&N==="integration"&&a.jsx(ay,{evalCase:s,onUpdate:q}),a.jsx(Cr,{title:"Prompt",children:L?a.jsxs("div",{children:[a.jsx("textarea",{value:O,onChange:B=>Z(B.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:I,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{Z(s.prompt),Y(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] 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)",maxHeight:200,overflowY:"auto",cursor:j?"default":"pointer"},onClick:()=>{j||Y(!0)},onMouseEnter:B=>{j||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:s.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:j?"No prompt":"Click to edit prompt..."})})}),a.jsx(Cr,{title:"Expected Output",children:W?a.jsxs("div",{children:[a.jsx("textarea",{value:ae,onChange:B=>re(B.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:G,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{re(s.expected_output),F(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] 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)",maxHeight:200,overflowY:"auto",cursor:j?"default":"pointer"},onClick:()=>{j||F(!0)},onMouseEnter:B=>{j||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{B.currentTarget.style.borderColor="var(--border-subtle)"},children:s.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:j?"No expected output":"Click to edit expected output..."})})}),a.jsx(Cr,{title:`Assertions (${s.assertions.length})`,action:j?void 0:a.jsx("button",{onClick:X,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:s.assertions.length===0?a.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):a.jsx("div",{className:"space-y-2",children:s.assertions.map(B=>{const ue=o==null?void 0:o.assertions.find(D=>D.assertion_id===B.id),S=Wv(B.id,ue,R);return a.jsx(Pv,{assertion:B,result:ue,badges:S,isReadOnly:j,onUpdate:D=>ne(B.id,D),onDelete:()=>te(B.id)},B.id)})})}),(o==null?void 0:o.output)&&a.jsx(ty,{output:o.output,durationMs:o.durationMs,tokens:o.tokens}),o&&o.passRate!=null&&o.passRate<.2&&(()=>{const B=ip("INEFFECTIVE",o.passRate);return B.recommendations&&B.recommendations.length>0?a.jsx(Cr,{title:"Recommendations",children:a.jsxs("div",{className:"rounded-xl p-4",style:{background:"rgba(251,146,60,0.08)",border:"1px solid rgba(251,146,60,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"#fb923c"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:B.recommendations.map((ue,S)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"#fb923c",fontWeight:600,flexShrink:0},children:"•"}),ue]},S))})]})}):null})(),a.jsx(ly,{evalId:s.id,sharedEntries:R,sharedLoading:U})]},s.id)}function Pv({assertion:s,result:o,badges:c,isReadOnly:u,onUpdate:x,onDelete:v}){const[p,b]=m.useState(!1),[g,f]=m.useState(s.text),[j,y]=m.useState(!1),k=()=>{x(g),b(!1)};return a.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:a.jsxs("div",{className:"flex items-start gap-2",children:[o?a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(c==null?void 0:c.regression)&&a.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:s.id}),(c==null?void 0:c.flaky)&&a.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"rgba(234, 179, 8, 0.15)",color:"#ca8a04",whiteSpace:"nowrap"},children:"Flaky"}),(c==null?void 0:c.nonDiscriminating)&&a.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),p?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:g,onChange:R=>f(R.target.value),onKeyDown:R=>{R.key==="Enter"&&k(),R.key==="Escape"&&b(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),a.jsx("button",{onClick:k,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:u?"default":"pointer"},onClick:()=>{u||(f(s.text),b(!0))},children:s.text}),(o==null?void 0:o.reasoning)&&a.jsx("button",{onClick:()=>y(!j),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:j?"Hide reasoning":"Show reasoning"}),j&&(o==null?void 0:o.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:o.reasoning})]}),!u&&a.jsx("button",{onClick:v,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:R=>{R.currentTarget.style.color="var(--red)",R.currentTarget.style.opacity="1"},onMouseLeave:R=>{R.currentTarget.style.color="var(--text-tertiary)",R.currentTarget.style.opacity=""},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Cr({title:s,action:o,children:c}){return a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:s}),o]}),c]})}function cp({result:s}){const[o,c]=m.useState(!1);if(!s||s.status==null)return a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const u=s.status==="pass",x=s.passRate??0,p=ip(u?"PASS":"FAIL",x);return a.jsxs("span",{className:"pill text-[10px]",style:{background:u?"var(--green-muted)":"var(--red-muted)",color:u?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),"aria-describedby":o?"verdict-tooltip":void 0,children:[s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status,o&&a.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:p.explanation})]})}function ey({passRate:s}){const o=Math.round(s*100);return a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${o}%`,background:o>=80?"var(--green)":o>=50?"var(--yellow)":"var(--red)"}})})})}function ty({output:s,durationMs:o,tokens:c}){const[u,x]=m.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:()=>x(!u),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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:u?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",o!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(o/1e3).toFixed(1),"s)"]}),c!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",c," tokens)"]})]}),u&&a.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:s})]})}function nc(s){return s==="baseline"?"right":s==="comparison"?"full":"left"}function sc({entry:s}){return a.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:np(s.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:s.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:s.type==="benchmark"?"rgba(99,131,255,0.15)":s.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:s.type==="benchmark"?"#6383ff":s.type==="comparison"?"var(--purple)":"#fb923c"},children:s.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:pn(s.pass_rate)},children:[Math.round(s.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[s.durationMs!=null&&a.jsx("span",{children:sp(s.durationMs)}),s.tokens!=null&&a.jsxs("span",{children:[s.tokens>=1e3?`${(s.tokens/1e3).toFixed(1)}k`:s.tokens," tok"]})]}),s.type==="comparison"&&s.baselinePassRate!=null&&(()=>{const o=s.pass_rate-s.baselinePassRate,c=o>.001?"skill":o<-.001?"baseline":"tie",u=o>0?"+":"",x=c==="skill"?"var(--green)":c==="baseline"?"var(--red)":"var(--text-tertiary)";return a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:o>=0?"var(--green)":"var(--red)"},children:[u,(o*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"rgba(0,0,0,0.2)",color:x},children:c})]})})(),a.jsx("div",{className:"space-y-0.5",children:s.assertions.map(o=>a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:o.pass?"var(--green-muted)":"var(--red-muted)"},children:o.pass?a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:o.text})]},o.id))})]})}function ly({evalId:s,sharedEntries:o,sharedLoading:c}){const{state:u,dispatch:x}=al(),{plugin:v,skill:p}=u,[b,g]=m.useState(!0),f=o??null,j=c??!1,y=m.useCallback(()=>{g(L=>!L)},[]),k=f?f.slice(0,10):[],R=k.some(L=>{const Y=nc(L.type);return Y==="left"||Y==="full"}),U=k.some(L=>{const Y=nc(L.type);return Y==="right"||Y==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:y,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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",f&&f.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",f.length," run",f.length!==1?"s":"",")"]})]}),b&&a.jsx("div",{className:"animate-fade-in",children:j?a.jsxs("div",{className:"flex items-center gap-2 py-3",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!f||f.length===0?a.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):a.jsxs("div",{children:[k.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx(rp,{entries:k})}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!R&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!U&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),k.map((L,Y)=>{const O=nc(L.type);return O==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(sc,{entry:L})},Y):O==="left"?a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(sc,{entry:L})}),a.jsx("div",{style:{gridColumn:"2"}})]},Y):a.jsxs(m.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(sc,{entry:L})})]},Y)})]}),a.jsx("button",{onClick:()=>x({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:L=>{L.currentTarget.style.textDecoration="underline"},onMouseLeave:L=>{L.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function qx({evals:s,onSave:o,onCancel:c}){const[u,x]=m.useState(""),[v,p]=m.useState(""),[b,g]=m.useState(""),[f,j]=m.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[y,k]=m.useState("unit"),[R,U]=m.useState(""),[L,Y]=m.useState([]),[O,Z]=m.useState(""),[W,F]=m.useState(""),ae=Math.max(0,...s.evals.map(G=>G.id))+1,re=G=>{k(G),G==="unit"&&(Y([]),U(""),Z(""),F(""))},q=()=>{const G=R.trim().toUpperCase();G&&!L.includes(G)&&Y([...L,G]),U("")},I=()=>{if(!u.trim()||!v.trim())return;const G={id:ae,name:u.trim(),prompt:v.trim(),expected_output:b.trim(),files:[],assertions:f.filter(X=>X.text.trim()),...y==="integration"?{testType:"integration",...L.length>0?{requiredCredentials:L}:{},...O||W?{requirements:{...O?{platform:O}:{},...W?{chromeProfile:W}:{}}}:{}}:{}};o({...s,evals:[...s.evals,G]})};return a.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:a.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)",maxHeight:"85vh",overflowY:"auto"},children:[a.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),a.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(G=>a.jsx("button",{onClick:()=>re(G),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:y===G?G==="unit"?"rgba(99,131,255,0.2)":"rgba(251,146,60,0.2)":"transparent",color:y===G?G==="unit"?"#6383ff":"#fb923c":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:G},G))})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),a.jsx("input",{value:u,onChange:G=>x(G.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),a.jsx("textarea",{value:v,onChange:G=>p(G.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),a.jsx("textarea",{value:b,onChange:G=>g(G.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),f.map((G,X)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:G.text,onChange:ne=>j(f.map((te,be)=>be===X?{...te,text:ne.target.value}:te)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),f.length>1&&a.jsx("button",{onClick:()=>j(f.filter((ne,te)=>te!==X)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},G.id)),a.jsx("button",{onClick:()=>j([...f,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),y==="integration"&&a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:L.map(G=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[G,a.jsx("button",{onClick:()=>Y(L.filter(X=>X!==G)),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},G))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:R,onChange:G=>U(G.target.value),onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),q())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:q,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:O,onChange:G=>Z(G.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:W,onChange:G=>F(G.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:c,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:I,disabled:!u.trim()||!v.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function ay({evalCase:s,onUpdate:o}){var p,b;const[c,u]=m.useState(""),x=()=>{const g=c.trim().toUpperCase();g&&!(s.requiredCredentials??[]).includes(g)&&o({...s,requiredCredentials:[...s.requiredCredentials??[],g]}),u("")},v=g=>{const f=(s.requiredCredentials??[]).filter(j=>j!==g);o({...s,requiredCredentials:f.length>0?f:void 0})};return a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"rgba(251,146,60,0.06)",border:"1px solid rgba(251,146,60,0.15)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"#fb923c"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(s.requiredCredentials??[]).map(g=>a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"rgba(251,146,60,0.15)",color:"#fb923c"},children:[g,a.jsx("button",{onClick:()=>v(g),style:{color:"#fb923c",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:c,onChange:g=>u(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),x())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:x,className:"btn btn-ghost text-[11px]",style:{color:"#fb923c"},children:"Add"})]})]}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:((p=s.requirements)==null?void 0:p.platform)??"",onChange:g=>o({...s,requirements:{...s.requirements,platform:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:((b=s.requirements)==null?void 0:b.chromeProfile)??"",onChange:g=>o({...s,requirements:{...s.requirements,chromeProfile:g.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Qt(s,o){return o==="free"?"Free":o==="subscription"&&s==null?"Subscription":s==null?"N/A":s>=1?`$${s.toFixed(2)}`:s===0?"$0.00":s>=.001?`$${s.toFixed(4)}`:`$${s.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function up(s,o){return s==null||o==null?"N/A":`${s.toLocaleString("en-US")} in / ${o.toLocaleString("en-US")} out`}function ny(s){return s==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function sy(s,o){let c="";if(o){const x=new Date(o);isNaN(x.getTime())||(c=x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[s,c].filter(Boolean).join(" · ")}function ry(s,o,c){const u=c===1?"test case":"test cases";if(s===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const x=Math.round(Math.abs(s)*o);if(x===0)return`Your skill performs the same as the baseline across ${c} ${u}`;const v=s>0?"more":"fewer";return`Your skill passes ${x} ${v} assertions across ${c} ${u}`}function Vx(s,o){const c=u=>{const x=u/5*100;return isFinite(x)?Math.round(Math.min(100,Math.max(0,x))):0};return{skill:c(s),baseline:c(o)}}function iy(s){return s==="skill"?{text:"Skill wins",isSkill:!0}:s==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function oy(s,o){const c=s+o,u=c*10,x=c*25,v=p=>p>=60?`${Math.round(p/60)}m`:`${p}s`;return`${v(u)}–${v(x)}`}const cy={anthropic:.01,openrouter:.01,ollama:0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function uy(s,o){if(!s)return null;const c=cy[s];if(c==null||c===0)return null;const u=c*o*.5,x=c*o*2;return`${Qt(u)}–${Qt(x)}`}function dy(){const{state:s,runCase:o,runAll:c,cancelCase:u,cancelAll:x,isReadOnly:v}=al(),{evals:p,caseRunStates:b,bulkRunActive:g,latestBenchmark:f,inlineResults:j}=s,{config:y}=ia(),k=(p==null?void 0:p.evals)??[],R=m.useMemo(()=>{for(const q of b.values())if(q.status==="running"||q.status==="queued")return!0;return!1},[b]),U=k.filter(q=>{const I=b.get(q.id);return I&&(I.status==="complete"||I.status==="error"||I.status==="cancelled")}).length,L=k.filter(q=>{const I=b.get(q.id);return I&&(I.status==="running"||I.status==="queued")}).length,Y=m.useRef(null),[O,Z]=m.useState(0);m.useEffect(()=>{if(R&&!Y.current&&(Y.current=Date.now()),!R){Y.current=null,Z(0);return}const q=setInterval(()=>{Y.current&&Z(Math.round((Date.now()-Y.current)/1e3))},1e3);return()=>clearInterval(q)},[R]);const W=k.reduce((q,I)=>q+I.assertions.length,0),F=k.length+W,ae=m.useMemo(()=>oy(k.length,W),[k.length,W]),re=m.useMemo(()=>uy((y==null?void 0:y.provider)??null,F),[y==null?void 0:y.provider,F]);return a.jsxs("div",{className:"p-5",children:[v&&a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),a.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),R&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[L," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[R&&a.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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),a.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||R||v,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),a.jsx("button",{onClick:()=>c("benchmark"),disabled:k.length===0||R||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),a.jsx("button",{onClick:()=>c("baseline"),disabled:k.length===0||R||v,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!R&&k.length>0&&a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Est. duration: ",ae]}),re&&a.jsxs("span",{children:["Est. cost: ",re]}),!re&&(y==null?void 0:y.provider)&&(y.provider==="claude-cli"||y.provider==="codex-cli")&&a.jsx("span",{children:"Cost: Subscription"}),!re&&(y==null?void 0:y.provider)&&(y.provider==="ollama"||y.provider==="gemini-cli")&&a.jsx("span",{children:"Cost: Free"})]})]}),R&&k.length>0&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",U,"/",k.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(U/k.length*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${U/k.length*100}%`,background:"var(--accent)"}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",O>=60?`${Math.floor(O/60)}m ${O%60}s`:`${O}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",ae]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:k.map(q=>{const I=j.get(q.id),G=b.get(q.id),X=(G==null?void 0:G.status)??"idle",ne=f==null?void 0:f.cases.find(te=>te.eval_id===q.id);return a.jsx(xy,{name:q.name,evalId:q.id,result:I,caseCost:ne==null?void 0:ne.cost,caseBillingMode:ne==null?void 0:ne.billingMode,caseInputTokens:ne==null?void 0:ne.inputTokens,caseOutputTokens:ne==null?void 0:ne.outputTokens,caseStatus:X,runMode:(G==null?void 0:G.mode)??null,comparisonDetail:ne==null?void 0:ne.comparisonDetail,isReadOnly:v,onRun:te=>o(te,"benchmark"),onBaseline:te=>o(te,"baseline"),onCompare:te=>o(te,"comparison"),onCancel:te=>u(te)},q.id)})}),!R&&f&&f.cases.length>0&&a.jsxs("div",{className:"mt-5",children:[a.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:ny(f.type)}),a.jsx("span",{className:"text-[20px] font-bold",style:{color:(f.overall_pass_rate??0)>=.8?"var(--green)":(f.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:f.overall_pass_rate!=null?`${Math.round(f.overall_pass_rate*100)}%`:"--"})]}),f.totalDurationMs!=null&&a.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(f.totalDurationMs/1e3).toFixed(1),"s",f.model&&` | Model: ${f.model}`,f.totalInputTokens!=null&&f.totalOutputTokens!=null&&` | Tokens: ${up(f.totalInputTokens,f.totalOutputTokens)}`,f.totalCost!=null&&` | Cost: ${Qt(f.totalCost)}`]}),f.overall_pass_rate>=.9999&&!f.comparison&&a.jsx("button",{onClick:()=>c("comparison"),disabled:k.length===0||v,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green, #22c55e)",color:"#fff",border:"none",cursor:"pointer",opacity:k.length===0?.5:1},children:"Run Final A/B Comparison"})]}),f.comparison&&a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const q=sy(f.model,f.timestamp);return q?a.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:q}):a.jsx("div",{className:"mb-3"})})(),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Gx,{label:"Skill",value:f.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(Gx,{label:"Baseline",value:f.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:f.comparison.delta>0?"var(--green)":f.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",f.comparison.delta>0?"+":"",(f.comparison.delta*100).toFixed(1),"%",f.verdict&&` | ${Kv(f.verdict)}`]}),(()=>{const q=f.cases.reduce((G,X)=>G+X.assertions.length,0),I=ry(f.comparison.delta,q,f.cases.length);return a.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:I})})()]})]})]})}const fy={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 xy({name:s,evalId:o,result:c,caseCost:u,caseBillingMode:x,caseInputTokens:v,caseOutputTokens:p,caseStatus:b,runMode:g,comparisonDetail:f,isReadOnly:j,onRun:y,onBaseline:k,onCompare:R,onCancel:U}){const[L,Y]=m.useState(!1),O=b==="running"||b==="queued",Z=b==="complete"||b==="error";return a.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:O?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:O?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[b==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),b==="queued"&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),a.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",o," ",s]}),g&&(O||Z)&&(()=>{const W=fy[g];return W?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:W.bg,color:W.color,padding:"1px 6px"},children:W.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[O?a.jsx("button",{onClick:()=>U(o),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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>R(o),disabled:j,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>y(o),disabled:j,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>k(o),disabled:j,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),c&&c.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:c.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.passRate!=null?`${Math.round(c.passRate*100)}%`:c.status}),v!=null&&p!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:up(v,p)}),u!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Qt(u,x)}),b==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),c&&c.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:c.assertions.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:W.pass?"var(--green)":"var(--red)"},children:W.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:W.text})]},W.assertion_id))}),c.output&&a.jsx("button",{onClick:()=>Y(!L),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:L?"Hide output":"Show output"}),L&&c.output&&a.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:c.output})]}),f&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const W=Vx(f.skillContentScore,f.baselineContentScore),F=Vx(f.skillStructureScore,f.baselineStructureScore),ae=iy(f.winner);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",W.skill,"% / Baseline ",W.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",F.skill,"% / Baseline ",F.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsx("span",{style:{color:ae.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:ae.text})]})})()})})}),c&&c.errorMessage&&a.jsx(py,{errorMessage:c.errorMessage,classifiedError:c.classifiedError})]})}const rc={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function py({errorMessage:s,classifiedError:o}){const[c,u]=m.useState(!1),x=(o==null?void 0:o.title)??"Error",v=o==null?void 0:o.hint,p=o?rc[o.category]??rc.unknown:rc.unknown;return a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid rgba(239,68,68,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:p}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:x}),a.jsx("button",{onClick:()=>u(!c),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:c?"Hide details":"Details"})]}),v&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:v}),c&&a.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:s})]})})}function Gx({label:s,value:o,color:c}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:s}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:c},children:[Math.round(o*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${o*100}%`,background:c}})})]})}const Yx={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)"}};function my(){const{state:s,dispatch:o,runActivationTest:c,cancelActivation:u,generateActivationPrompts:x}=al(),{plugin:v,skill:p,activationPrompts:b,activationResults:g,activationSummary:f,activationRunning:j,activationError:y,activationStartedAt:k,activationClassifyingStatus:R,generatingPrompts:U,generatingPromptsError:L,activationHistory:Y}=s,[O,Z]=m.useState(b),[W,F]=m.useState(null),[ae,re]=m.useState(!1);m.useEffect(()=>{b&&b!==O&&Z(b)},[b]),m.useEffect(()=>{o({type:"SET_ACTIVATION_PROMPTS",prompts:O})},[O,o]),m.useEffect(()=>{fetch(`/api/skills/${v}/${p}/description`).then(T=>T.json()).then(T=>F(T.rawContent||T.description||null)).catch(()=>F(null))},[v,p]);function q(){c(O)}function I(){x(8)}const G=O.trim().split(`
63
+ `).filter(Boolean).length,X=g.filter(T=>T.classification==="TP"||T.classification==="TN"),ne=g.filter(T=>T.classification==="FP"||T.classification==="FN"),te=(W==null?void 0:W.replace(/^---[\s\S]*?---\s*/,"").trim())??null,be=O.trim().length>0,he=te?zr(te):"";return a.jsxs("div",{className:"p-5 space-y-5",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),a.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),a.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[a.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),a.jsx("div",{className:"flex gap-1.5",children:a.jsx("button",{onClick:I,disabled:U||!te||j,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:U?"var(--surface-3)":"var(--surface-2)",color:te?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:te?1:.5,cursor:te?"pointer":"not-allowed"},title:te?void 0:"No skill description available",onMouseEnter:T=>{te&&!U&&(T.currentTarget.style.background="var(--surface-3)")},onMouseLeave:T=>{U||(T.currentTarget.style.background="var(--surface-2)")},children:U?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3v3m6.36.64l-2.12 2.12M21 12h-3m-.64 6.36l-2.12-2.12M12 21v-3m-4.24.64l2.12-2.12M3 12h3m.64-6.36l2.12 2.12"})}),be?"Regenerate":"Generate"," Test Prompts"]})})})]}),!te&&!j&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),L&&a.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:L}),a.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:O,onChange:T=>Z(T.target.value),placeholder:`How do I write a unit test?
64
64
  What edge cases should I test?
65
65
  +Deploy this to production
66
66
  !What's the weather like today?
67
- !Write me a poem about flowers`}),a.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:"One prompt per line"}),a.jsx(Tr,{}),a.jsx("span",{children:"No prefix = auto-classify"}),a.jsx(Tr,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),a.jsx(Tr,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),a.jsx(Tr,{}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[G," prompt",G!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:q,disabled:S||!O.trim(),className:"btn btn-primary",children:S?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"#fff",borderColor:"rgba(255,255,255,0.2)",width:14,height:14}}),"Testing..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),S&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:u,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[R||`${g.length} / ${G} prompts tested`,k&&a.jsx(g1,{startedAt:k})]})]})]})]}),a.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[a.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),a.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:te?a.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:he}}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),y&&a.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:y}),S&&g.length===0&&a.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[a.jsx("div",{className:"spinner-lg mx-auto mb-4"}),a.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),g.length>0&&a.jsxs("div",{className:"space-y-5",children:[ne.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),a.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",ne.length,")"]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:ne.map((T,N)=>a.jsx(Qx,{result:T},`incorrect-${N}`))})]}),X.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"16 10 11 15 8 12"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",X.length,")"]})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:X.map((T,N)=>a.jsx(Qx,{result:T},`correct-${N}`))})]})]}),f&&a.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),f.autoClassifiedCount!=null&&f.autoClassifiedCount>0&&a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[f.autoClassifiedCount," of ",f.total," prompts auto-classified from skill name and tags"]}),a.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[a.jsx(ic,{label:"Precision",value:f.precision,description:"Of all activations, how many were correct?",detail:`${f.tp} true / ${f.tp+f.fp} total activations`}),a.jsx(ic,{label:"Recall",value:f.recall,description:"Of expected activations, how many fired?",detail:`${f.tp} activated / ${f.tp+f.fn} expected`}),a.jsx(ic,{label:"Reliability",value:f.reliability,description:"Overall correct classification rate",detail:`${f.tp+f.tn} correct / ${f.total} total`})]}),a.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[a.jsx(wr,{label:"True Positive",abbr:"TP",count:f.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),a.jsx(wr,{label:"False Positive",abbr:"FP",count:f.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),a.jsx(wr,{label:"False Negative",abbr:"FN",count:f.fn,bg:"rgba(248,113,113,0.06)",color:"rgba(248,113,113,0.6)",description:"Missed activation"}),a.jsx(wr,{label:"True Negative",abbr:"TN",count:f.tn,bg:"rgba(52,211,153,0.06)",color:"rgba(52,211,153,0.6)",description:"Correctly silent"})]})]})]}),a.jsx(h1,{history:Y,expanded:ae,onToggle:()=>re(!ae)})]})}function h1({history:s,expanded:o,onToggle:c}){return s===null?null:a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:o?"1px solid var(--border-subtle)":"none"},onClick:c,children:[a.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",s.length>0&&a.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",s.length," run",s.length!==1?"s":"",")"]})]}),a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),o&&a.jsx("div",{className:"px-4 py-3",children:s.length===0?a.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):a.jsx("div",{className:"space-y-2",children:s.map(u=>a.jsx(v1,{run:u},u.id))})})]})}function v1({run:s}){const o=Math.round(s.summary.reliability*100),c=o>=80?"var(--green)":o>=60?"var(--yellow)":"var(--red)",u=o>=80?"Good":o>=60?"Needs Work":"Poor",x=c;return a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:y1(s.timestamp)}),a.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:s.model||s.provider}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[s.promptCount," prompts"]})]})}),a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:c,fontVariantNumeric:"tabular-nums"},children:[o,"%"]}),a.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:x,background:`color-mix(in srgb, ${x} 10%, transparent)`},children:u})]})]})}function y1(s){const o=Date.now(),c=new Date(s).getTime(),u=Math.floor((o-c)/1e3);if(u<60)return"just now";const x=Math.floor(u/60);if(x<60)return`${x}m ago`;const v=Math.floor(x/60);if(v<24)return`${v}h ago`;const m=Math.floor(v/24);return m<7?`${m}d ago`:new Date(s).toLocaleDateString()}function Tr(){return a.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Qx({result:s}){const o=Yx[s.classification]||Yx.FN,c=s.classification==="TP"||s.classification==="TN";return a.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:o.bg,border:"1px solid transparent"},children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${o.text} 20%, transparent)`},children:c?a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:s.prompt})}),a.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[a.jsx("span",{className:"pill",style:{background:"rgba(0,0,0,0.1)",color:o.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:s.classification}),a.jsx("span",{style:{color:s.activate?"var(--green)":"var(--text-tertiary)"},children:s.activate?"Activated":"Silent"}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",s.expected==="should_activate"?"activate":"stay silent"]}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[s.confidence," confidence"]}),s.autoClassified&&a.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"})]}),s.reasoning&&a.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:s.reasoning})]})]})}function ic({label:s,value:o,description:c,detail:u}){const x=Math.round(o*100),v=x>=80?"var(--green)":x>=60?"var(--yellow)":"var(--red)";return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:v},children:[x,"%"]}),a.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:s}),a.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:c}),a.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:u})]})}function wr({abbr:s,count:o,bg:c,color:u,description:x}){return a.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:c},children:[a.jsx("div",{className:"text-[20px] font-bold",style:{color:u},children:o}),a.jsx("div",{className:"text-[11px] font-semibold",style:{color:u},children:s}),a.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:x})]})}function g1({startedAt:s}){const[o,c]=p.useState(0);return p.useEffect(()=>{const u=setInterval(()=>c(Math.floor((Date.now()-s)/1e3)),1e3);return()=>clearInterval(u)},[s]),a.jsxs("span",{className:"ml-2",children:["(",o,"s)"]})}const oc={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},$x={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},mc=600,hc=180,Nt=40,cc=mc-Nt*2,na=hc-Nt*2,b1=[25,50,75,100];function Xx(s){return new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function j1(s){return s==null?"--":`${(s/1e3).toFixed(1)}s`}function S1({entries:s,onPointClick:o}){const[c,u]=p.useState(null),x=p.useMemo(()=>[...s].reverse(),[s]);if(x.length<2)return null;const v=x.length,m=x.map((f,S)=>{const y=Nt+S/(v-1)*cc,k=f.passRate*100,R=Nt+na-k/100*na;return{x:y,y:R,pct:k,entry:f}}),b=m.map(f=>`${f.x},${f.y}`).join(" "),g=Array.from(new Set(x.map(f=>f.type)));return a.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:v>=20?"auto":void 0},children:[a.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),a.jsx("div",{className:"flex items-center gap-5 mb-3",children:g.map(f=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:oc[f]??"var(--text-tertiary)"}}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:$x[f]??f})]},f))}),a.jsxs("svg",{width:mc,height:hc,viewBox:`0 0 ${mc} ${hc}`,style:{display:"block",overflow:"visible"},children:[b1.map(f=>{const S=Nt+na-f/100*na;return a.jsxs("g",{children:[a.jsx("line",{x1:Nt,y1:S,x2:Nt+cc,y2:S,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),a.jsxs("text",{x:Nt-8,y:S+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[f,"%"]})]},f)}),a.jsx("line",{x1:Nt,y1:Nt+na,x2:Nt+cc,y2:Nt+na,stroke:"var(--border-subtle)",strokeWidth:1}),a.jsx("text",{x:Nt-8,y:Nt+na+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),a.jsx("polyline",{points:b,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),m.map((f,S)=>a.jsx("circle",{cx:f.x,cy:f.y,r:5,fill:oc[f.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:y=>{y.currentTarget.setAttribute("r","7"),u({x:f.x,y:f.y,entry:f.entry})},onMouseLeave:y=>{y.currentTarget.setAttribute("r","5"),u(null)},onClick:()=>o==null?void 0:o(f.entry)},S)),N1(v).map(f=>a.jsx("text",{x:m[f].x,y:Nt+na+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Xx(x[f].timestamp)},f))]}),c&&a.jsxs("div",{style:{position:"absolute",left:c.x,top:c.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:[a.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Xx(c.entry.timestamp)}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:c.entry.model}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:oc[c.entry.type]??"var(--text-tertiary)",color:"#fff"},children:$x[c.entry.type]??c.entry.type}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(c.entry.passRate*100),"%"]})]}),a.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:j1(c.entry.totalDurationMs)}),a.jsx("span",{children:c.entry.totalTokens!=null?`${c.entry.totalTokens} tokens`:"--"})]})]})]})}function N1(s){if(s<=3)return Array.from({length:s},(u,x)=>x);if(s<=6)return[0,Math.floor(s/2),s-1];if(s<20)return[0,Math.floor(s/3),Math.floor(2*s/3),s-1];const o=Math.ceil(s/10),c=[0];for(let u=o;u<s-1;u+=o)c.push(u);return c.push(s-1),c}const os=new Map;let Et=null,Rr=null,Ar=1e3,cs=0;function dp(){if(Et)return;Et=new EventSource("/api/events");const s=o=>c=>{let u={};try{u=c.data?JSON.parse(c.data):{}}catch{}const x=os.get(o);if(x)for(const v of x)v(u)};Et.addEventListener("benchmark:complete",s("benchmark:complete")),Et.addEventListener("history:written",s("history:written")),Et.addEventListener("leaderboard:updated",s("leaderboard:updated")),Et.onerror=()=>{Et==null||Et.close(),Et=null,cs>0&&(Rr=setTimeout(()=>{Ar=Math.min(Ar*2,3e4),dp()},Ar))},Et.onopen=()=>{Ar=1e3}}function E1(){Rr!=null&&(clearTimeout(Rr),Rr=null),Et==null||Et.close(),Et=null}function k1(s,o){return os.has(s)||os.set(s,new Set),os.get(s).add(o),cs++,dp(),()=>{var c;(c=os.get(s))==null||c.delete(o),cs--,cs<=0&&(cs=0,E1())}}function Mr(s,o){const c=p.useRef(o);c.current=o,p.useEffect(()=>k1(s,x=>c.current(x)),[s])}const _r=new Map,Ca=new Map,us=new Map;function Or(s){_r.delete(s),Ca.delete(s);const o=us.get(s);if(o)for(const c of o)c()}function gc(s,o,c={}){const{ttl:u=3e4,enabled:x=!0}=c,[,v]=p.useState(0),m=p.useRef(!0),b=p.useRef(s);b.current=s;const g=()=>Or(s);p.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]),p.useEffect(()=>{if(!x)return;const k=()=>{m.current&&v(R=>R+1)};return us.has(s)||us.set(s,new Set),us.get(s).add(k),()=>{var R;(R=us.get(s))==null||R.delete(k)}},[s,x]),p.useEffect(()=>{if(!x)return;const k=_r.get(s);if(!(!k||Date.now()-k.fetchedAt>u))return;if(Ca.has(s)){const Y=Ca.get(s),O=()=>{m.current&&b.current===s&&v(Z=>Z+1)};Y.subscribers.push(O);return}const U={promise:Promise.resolve(),subscribers:[]},L=o().then(Y=>{_r.set(s,{data:Y,fetchedAt:Date.now()}),Ca.delete(s),m.current&&b.current===s&&v(O=>O+1);for(const O of U.subscribers)O()},Y=>{Ca.delete(s),m.current&&b.current===s&&v(O=>O+1);for(const O of U.subscribers)O();throw Y});U.promise=L,Ca.set(s,U)},[s,o,u,x]);const f=_r.get(s),S=x&&!f&&Ca.has(s);return{data:f==null?void 0:f.data,loading:S||x&&!f,error:void 0,revalidate:g}}function Lr(s){return s>=.8?"var(--green)":s>=.5?"var(--yellow)":"var(--red)"}function C1(s){return s>=1e3?`${(s/1e3).toFixed(1)}s`:`${Math.round(s)}ms`}function T1({rate:s,label:o}){const c=Math.round(s*100);return a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:o}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:Lr(s)},children:[c,"%"]})]}),a.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${c}%`,background:Lr(s)}})})]})})}function w1({points:s}){if(s.length<2)return null;const o=200,c=48,u=4,x=s.length,v=s.map((g,f)=>{const S=u+f/(x-1)*(o-u*2),y=u+(c-u*2)-g.passRate*(c-u*2);return{x:S,y}}),m=`M ${v[0].x},${c-u} `+v.map(g=>`L ${g.x},${g.y}`).join(" ")+` L ${v[v.length-1].x},${c-u} Z`,b=v.map((g,f)=>`${f===0?"M":"L"} ${g.x},${g.y}`).join(" ");return a.jsxs("svg",{width:o,height:c,style:{display:"block"},children:[a.jsx("path",{d:m,fill:"var(--accent-muted)"}),a.jsx("path",{d:b,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),a.jsx("circle",{cx:v[v.length-1].x,cy:v[v.length-1].y,r:3,fill:"var(--accent)"})]})}function A1({plugin:s,skill:o}){const c=`stats/${s}/${o}`,u=p.useCallback(()=>ge.getStats(s,o),[s,o]),{data:x,loading:v}=gc(c,u),m=p.useCallback(()=>Or(c),[c]);if(Mr("benchmark:complete",m),Mr("history:written",m),v)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"skeleton h-24 rounded-xl"}),a.jsx("div",{className:"skeleton h-48 rounded-xl"}),a.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!x||x.totalRuns===0)return a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),a.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const b=x.trendPoints.length>0?x.trendPoints[x.trendPoints.length-1].passRate:0,g=x.trendPoints.length>0?x.trendPoints[0].passRate:0,f=b-g,S=x.assertionStats.slice(0,10);return a.jsxs("div",{className:"space-y-4 stagger-children",children:[a.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:x.totalRuns})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:Lr(b)},children:[Math.round(b*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:f>=0?"var(--green)":"var(--red)"},children:[f>=0?"+":"",Math.round(f*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:x.modelStats.length})]}),x.totalCost!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:$t(x.totalCost)})]}),x.costPerRun!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:$t(x.costPerRun)})]})]}),x.trendPoints.length>=2&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),a.jsx(w1,{points:x.trendPoints})]}),x.modelStats.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),a.jsx("tbody",{children:x.modelStats.map(y=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:y.model}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:y.runs}),a.jsx("td",{style:{padding:"8px",textAlign:"center"},children:a.jsxs("span",{className:"font-semibold",style:{color:Lr(y.avgPassRate)},children:[Math.round(y.avgPassRate*100),"%"]})}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:C1(y.avgDurationMs)}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:y.avgCost!=null?$t(y.avgCost):"N/A"})]},y.model))})]})]}),S.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),a.jsx("div",{className:"space-y-3",children:S.map(y=>a.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--surface-2)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},onClick:()=>{},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.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:["#",y.evalId]}),a.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:y.evalName}),a.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[y.totalRuns," runs"]})]}),a.jsx(T1,{rate:y.passRate,label:y.text})]},`${y.evalId}:${y.id}`))})]})]})}function R1({plugin:s,skill:o}){const[c,u]=p.useState(null),[x,v]=p.useState(null),[m,b]=p.useState({}),[g,f]=p.useState({});p.useEffect(()=>{ge.getEvals(s,o).then(u).catch(()=>u(null))},[s,o]);async function S(y){if(x===y){v(null);return}if(v(y),!m[y]){f(k=>({...k,[y]:!0}));try{const k=await ge.getCaseHistory(s,o,y);b(R=>({...R,[y]:k}))}catch{b(k=>({...k,[y]:[]}))}finally{f(k=>({...k,[y]:!1}))}}}return c?a.jsx("div",{className:"space-y-2 stagger-children",children:c.evals.map(y=>{const k=m[y.id]||[],R=x===y.id,U=g[y.id],L=k.length>0?k[0].pass_rate:null;return a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>S(y.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:R?"var(--surface-2)":"transparent"},onMouseEnter:Y=>{R||(Y.currentTarget.style.background="var(--surface-2)")},onMouseLeave:Y=>{R||(Y.currentTarget.style.background="transparent")},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:R?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.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:["#",y.id]}),a.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:y.name}),k.length>=2&&a.jsx(rp,{entries:k}),L!=null&&a.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:pn(L)},children:[Math.round(L*100),"%"]}),k.length>0&&a.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[k.length," runs"]})]}),R&&a.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:U?a.jsxs("div",{className:"p-4 flex items-center gap-2",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):k.length===0?a.jsx("div",{className:"p-4",children:a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):a.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:k.map((Y,O)=>a.jsxs("div",{className:"p-4",style:{background:O===0?"var(--surface-2)":"transparent"},children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:np(Y.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:Y.model}),a.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}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:pn(Y.pass_rate)},children:[Math.round(Y.pass_rate*100),"%"]})]}),a.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&&a.jsx("span",{children:sp(Y.durationMs)}),Y.tokens!=null&&a.jsxs("span",{children:[Y.tokens>=1e3?`${(Y.tokens/1e3).toFixed(1)}k`:Y.tokens," tok"]})]}),a.jsx("div",{className:"space-y-1",children:Y.assertions.map(Z=>a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:Z.pass?"var(--green)":"var(--red)"},children:a.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:Z.pass?a.jsx("polyline",{points:"20 6 9 17 4 12"}):a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:Z.text}),Z.reasoning&&a.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:Z.reasoning})]})]},Z.id))})]},O))})})]},y.id)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function _1(){const{state:s,dispatch:o}=al(),{plugin:c,skill:u}=s,[x,v]=p.useState("timeline"),[m,b]=p.useState(""),[g,f]=p.useState(""),[S,y]=p.useState(!1),[k,R]=p.useState([]),[U,L]=p.useState(null),[Y,O]=p.useState(!1),[Z,W]=p.useState(null),[F,ae]=p.useState(!1),re=`history/${c}/${u}?model=${m}&type=${g}`,q=p.useCallback(()=>ge.getHistory(c,u,{model:m||void 0,type:g||void 0}),[c,u,m,g]),{data:I,loading:G}=gc(re,q),X=I??[];p.useEffect(()=>{!I||I.length<2||ge.compareRuns(c,u,I[0].timestamp,I[1].timestamp).then(T=>{const N=T.regressions.filter(w=>w.change==="regression");o({type:"SET_REGRESSIONS",regressions:N})}).catch(()=>{})},[I,c,u,o]);const ne=p.useCallback(()=>Or(re),[re]);Mr("history:written",ne);const te=p.useCallback(async T=>{if(S){R(N=>N.includes(T)?N.filter(w=>w!==T):N.length>=2?[N[1],T]:[...N,T]);return}ae(!0);try{const N=await ge.getHistoryEntry(c,u,T);W(N)}catch{}finally{ae(!1)}},[c,u,S]),be=p.useCallback(async()=>{if(k.length===2){O(!0);try{const T=await ge.compareRuns(c,u,k[0],k[1]);L(T)}catch{}finally{O(!1)}}},[c,u,k]),he=[...new Set(X.map(T=>T.model))];return G?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"skeleton h-12 rounded-lg"}),a.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(T=>a.jsx("button",{onClick:()=>v(T),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:x===T?"var(--accent-muted)":"transparent",color:x===T?"var(--accent)":"var(--text-tertiary)"},children:T==="timeline"?"Timeline":T==="per-eval"?"Per Eval":"Statistics"},T))}),x==="timeline"&&a.jsxs("div",{children:[X.length>0&&a.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:a.jsx(S1,{entries:X,onPointClick:T=>te(T.timestamp)})}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("select",{value:m,onChange:T=>b(T.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Models"}),he.map(T=>a.jsx("option",{value:T,children:T},T))]}),a.jsxs("select",{value:g,onChange:T=>f(T.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Types"}),a.jsx("option",{value:"benchmark",children:"Benchmark"}),a.jsx("option",{value:"comparison",children:"Comparison"}),a.jsx("option",{value:"baseline",children:"Baseline"}),a.jsx("option",{value:"model-compare",children:"Model Compare"}),a.jsx("option",{value:"improve",children:"AI Improve"}),a.jsx("option",{value:"instruct",children:"AI Edit"}),a.jsx("option",{value:"ai-generate",children:"AI Generate"}),a.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{y(!S),R([]),L(null)},className:`btn text-[12px] ${S?"btn-primary":"btn-secondary"}`,children:S?"Exit Compare":"Compare Runs"}),S&&k.length===2&&a.jsx("button",{onClick:be,disabled:Y,className:"btn btn-primary text-[12px]",children:Y?"Comparing...":"Compare"})]}),a.jsx("div",{className:"space-y-2",children:X.length===0?a.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):X.map(T=>{const N=k.includes(T.timestamp);return a.jsx("button",{onClick:()=>te(T.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:N?"var(--accent-muted)":"var(--surface-1)",border:N?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:w=>{N||(w.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:w=>{N||(w.currentTarget.style.borderColor="var(--border-subtle)")},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[S&&a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:N?"var(--accent)":"var(--border-default)",background:N?"var(--accent)":"transparent"},children:N&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(T.timestamp).toLocaleString()}),a.jsx("span",{className:"pill text-[9px]",style:{background:T.type==="comparison"?"var(--purple-muted)":T.type==="baseline"?"var(--surface-3)":T.type==="model-compare"?"rgba(56,189,248,0.15)":T.type==="improve"||T.type==="instruct"?"rgba(168,85,247,0.15)":T.type==="ai-generate"?"rgba(34,197,94,0.15)":T.type==="eval-generate"?"rgba(251,146,60,0.15)":"var(--accent-muted)",color:T.type==="comparison"?"var(--purple)":T.type==="baseline"?"var(--text-tertiary)":T.type==="model-compare"?"#38bdf8":T.type==="improve"||T.type==="instruct"?"#a855f7":T.type==="ai-generate"?"#22c55e":T.type==="eval-generate"?"#fb923c":"var(--accent)"},children:T.type==="model-compare"?"model compare":T.type==="improve"?"ai improve":T.type==="instruct"?"ai edit":T.type==="ai-generate"?"ai generate":T.type==="eval-generate"?"eval generate":T.type})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:T.model}),T.totalCost!=null&&T.totalCost>0&&a.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:$t(T.totalCost)}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:T.passRate>=.8?"var(--green)":T.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(T.passRate*100),"%"]})]})]})},T.timestamp)})}),U&&a.jsx(M1,{result:U}),Z&&!S&&a.jsx(L1,{run:Z,onClose:()=>W(null)})]}),x==="per-eval"&&a.jsx(R1,{plugin:c,skill:u}),x==="statistics"&&a.jsx(A1,{plugin:c,skill:u})]})}function M1({result:s}){const o=s.regressions.filter(u=>u.change==="regression"),c=s.regressions.filter(u=>u.change==="improvement");return a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(s.runA.timestamp).toLocaleDateString()," vs ",new Date(s.runB.timestamp).toLocaleDateString()]}),(s.runA.totalCost!=null||s.runB.totalCost!=null)&&a.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[a.jsxs("span",{children:["Run A cost: ",$t(s.runA.totalCost??null)]}),a.jsxs("span",{children:["Run B cost: ",$t(s.runB.totalCost??null)]}),s.runA.totalCost!=null&&s.runB.totalCost!=null&&a.jsxs("span",{style:{color:s.runB.totalCost<=s.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",$t(s.runB.totalCost-s.runA.totalCost)]})]}),o.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",o.length,")"]}),o.map(u=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",a.jsx("span",{style:{color:"var(--red)"},children:u.assertionId})," (was passing, now failing)"]},`${u.evalId}-${u.assertionId}`))]}),c.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",c.length,")"]}),c.map(u=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",a.jsx("span",{style:{color:"var(--green)"},children:u.assertionId})," (was failing, now passing)"]},`${u.evalId}-${u.assertionId}`))]}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),a.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"var(--surface-2)"},children:[a.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),a.jsx("tbody",{children:s.caseDiffs.map(u=>a.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",u.eval_id," ",u.eval_name]}),a.jsx("td",{className:"text-right px-3 py-2",style:{color:u.passRateA!=null?u.passRateA>=.8?"var(--green)":u.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:u.passRateA!=null?`${Math.round(u.passRateA*100)}%`:u.statusA}),a.jsx("td",{className:"text-right px-3 py-2",style:{color:u.passRateB!=null?u.passRateB>=.8?"var(--green)":u.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:u.passRateB!=null?`${Math.round(u.passRateB*100)}%`:u.statusB})]},u.eval_id))})]})})]})}function L1({run:s,onClose:o}){return(s.type==="improve"||s.type==="instruct")&&s.improve?a.jsx(z1,{run:s,onClose:o}):a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(s.timestamp).toLocaleString()]}),a.jsx("button",{onClick:o,className:"btn btn-ghost text-[11px]",children:"Close"})]}),a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",s.model," | Cases: ",s.cases.length," | Pass Rate: ",s.overall_pass_rate!=null?`${Math.round(s.overall_pass_rate*100)}%`:"--",s.totalCost!=null&&s.totalCost>0&&` | Cost: ${$t(s.totalCost)}`]}),a.jsx("div",{className:"space-y-2",children:s.cases.map(c=>a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",c.eval_id," ",c.eval_name]}),a.jsxs("div",{className:"flex items-center gap-2",children:[c.cost!=null&&c.cost>0&&a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:$t(c.cost)}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.pass_rate!=null?`${Math.round(c.pass_rate*100)}%`:c.status})]})]})},c.eval_id))})]})}function z1({run:s,onClose:o}){var v;const c=p.useMemo(()=>s.improve?Dr(s.improve.original,s.improve.improved):[],[s.improve]),u=p.useMemo(()=>{const m=c.filter(g=>g.type==="added").length,b=c.filter(g=>g.type==="removed").length;return{added:m,removed:b}},[c]),x=p.useMemo(()=>{let m=0,b=0;return c.map(g=>g.type==="removed"?(m++,{...g,origNum:m,newNum:null}):g.type==="added"?(b++,{...g,origNum:null,newNum:b}):(m++,b++,{...g,origNum:m,newNum:b}))},[c]);return a.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),a.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(s.timestamp).toLocaleString()," · ",s.model]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",u.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",u.removed]})]}),a.jsx("button",{onClick:o,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:m=>{m.currentTarget.style.background="var(--surface-3)"},onMouseLeave:m=>{m.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((v=s.improve)==null?void 0:v.reasoning)&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),s.improve.reasoning]}),a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:x.map((m,b)=>a.jsxs("tr",{style:{background:m.type==="added"?"rgba(34,197,94,0.08)":m.type==="removed"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:m.type==="removed"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:m.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:m.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:m.type==="added"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:m.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:m.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:m.type==="added"?"var(--green)":m.type==="removed"?"var(--red)":"transparent",borderRight:m.type==="added"?"2px solid var(--green)":m.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:m.type==="added"?"+":m.type==="removed"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:m.type==="added"?"var(--green)":m.type==="removed"?"var(--red)":"var(--text-secondary)"},children:m.content||"​"})]},b))})})})]})}function D1({plugin:s,skill:o}){const[c,u]=p.useState([]),[x,v]=p.useState([]),[m,b]=p.useState(!0),[g,f]=p.useState(null);p.useEffect(()=>{ge.getDependencies(s,o).then(y=>{u(y.mcpDependencies),v(y.skillDependencies)}).catch(()=>{}).finally(()=>b(!1))},[s,o]);async function S(y,k){try{await navigator.clipboard.writeText(k),f(y),setTimeout(()=>f(null),2e3)}catch{}}return m?null:c.length===0&&x.length===0?a.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"}):a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.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"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:c.length+x.length})]}),a.jsxs("div",{className:"px-5 py-4",children:[c.length>0&&a.jsxs("div",{className:"space-y-3 mb-4",children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),c.map(y=>a.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:y.server}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:y.transport})]}),a.jsx("button",{onClick:()=>S(y.server,y.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:g===y.server?"var(--green)":"var(--accent)"},children:g===y.server?a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.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"]})})]}),a.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:y.url}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.matchedTools.map(k=>a.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:k},k))})]},y.server))]}),x.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),a.jsx("div",{className:"space-y-1.5",children:x.map(y=>a.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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:y.name}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:y.source==="frontmatter"?"frontmatter":"referenced"})]},y.name))})]})]})]})}function Kx({plugin:s,skill:o}){const[c,u]=p.useState([]),[x,v]=p.useState(!0),[m,b]=p.useState(null),[g,f]=p.useState(""),[S,y]=p.useState(!1),[k,R]=p.useState(null),[U,L]=p.useState(""),[Y,O]=p.useState(""),[Z,W]=p.useState(!1),[F,ae]=p.useState(new Set),re=p.useCallback(async()=>{v(!0);try{const[X,ne]=await Promise.all([ge.getCredentials(s,o).catch(()=>({credentials:[]})),ge.getParams(s,o).catch(()=>({params:[]}))]),te=new Map(ne.params.map(T=>[T.name,T])),be=new Set,he=[];for(const T of X.credentials){be.add(T.name);const N=te.get(T.name);he.push({name:T.name,status:T.status==="ready"||T.status==="resolved"?"ready":"missing",source:T.source,maskedValue:N==null?void 0:N.maskedValue})}for(const T of ne.params)be.has(T.name)||he.push({name:T.name,status:T.status,maskedValue:T.maskedValue});u(he)}finally{v(!1)}},[s,o]);p.useEffect(()=>{re()},[re]);const q=p.useCallback(async X=>{if(F.has(X)){ae(ne=>{const te=new Set(ne);return te.delete(X),te}),u(ne=>ne.map(te=>te.name===X?{...te,revealedValue:void 0}:te));return}try{const te=(await ge.getParamsRevealed(s,o,X)).params.find(be=>be.name===X);te&&(u(be=>be.map(he=>he.name===X?{...he,revealedValue:te.value}:he)),ae(be=>new Set(be).add(X)))}catch{}},[s,o,F]),I=async(X,ne)=>{if(!(!X.trim()||!ne.trim())){y(!0),R(null);try{await ge.setCredential(s,o,X,ne),b(null),f(""),ae(new Set),re()}catch(te){R(te.message)}finally{y(!1)}}},G=async()=>{if(!(!U.trim()||!Y.trim())){y(!0),R(null);try{await ge.setCredential(s,o,U.trim().toUpperCase(),Y),L(""),O(""),W(!1),re()}catch(X){R(X.message)}finally{y(!1)}}};return x?a.jsxs("div",{className:"mt-6",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("button",{onClick:()=>W(!Z),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),k&&a.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--error-muted, #3f1a1a)",color:"var(--error, #f87171)"},children:k}),c.length===0&&!Z?a.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):a.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:c.map(X=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:X.name}),X.maskedValue&&a.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:F.has(X.name)&&X.revealedValue!=null?X.revealedValue:X.maskedValue}),X.maskedValue&&a.jsx("button",{onClick:()=>q(X.name),className:"btn btn-ghost px-1",title:F.has(X.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:F.has(X.name)?a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),a.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),a.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:X.status==="ready"?"rgba(52,211,153,0.15)":"rgba(251,146,60,0.15)",color:X.status==="ready"?"var(--green)":"#fb923c"},children:X.status==="ready"?"ready":"missing"}),X.source&&a.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:X.source}),m===X.name?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{value:g,onChange:ne=>f(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&I(X.name,g)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),a.jsx("button",{onClick:()=>I(X.name,g),disabled:S||!g.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:S?"...":"Save"}),a.jsx("button",{onClick:()=>{b(null),f("")},className:"btn btn-ghost text-[10px] px-1",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):a.jsx("button",{onClick:()=>{b(X.name),f("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},X.name))}),Z&&a.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:U,onChange:X=>L(X.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),a.jsx("input",{value:Y,onChange:X=>O(X.target.value),onKeyDown:X=>{X.key==="Enter"&&G()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),a.jsxs("div",{className:"flex justify-end gap-1.5",children:[a.jsx("button",{onClick:()=>{W(!1),L(""),O("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),a.jsx("button",{onClick:G,disabled:S||!U.trim()||!Y.trim(),className:"btn btn-primary text-[10px]",children:S?"Saving...":"Save"})]})]})]})}function O1(){const{state:s}=al(),{plugin:o,skill:c}=s,[u,x]=p.useState(null),[v,m]=p.useState(!0);return p.useEffect(()=>{ge.getDependencies(o,c).then(x).catch(()=>{}).finally(()=>m(!1))},[o,c]),v?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):u?a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx(D1,{plugin:o,skill:c}),a.jsx(Kx,{plugin:o,skill:c})]}):a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),a.jsx(Kx,{plugin:o,skill:c})]})}function fp({data:s}){if(s.length<2)return a.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const o=s.slice(-10),c=80,u=24,x=2,v=c-x*2,m=u-x*2,b=o.length,g=Math.min(...o),S=Math.max(...o)-g||1,y=o.map((U,L)=>{const Y=x+L/(b-1)*v,O=x+m-(U-g)/S*m;return`${Y.toFixed(1)},${O.toFixed(1)}`}),k=o[o.length-1],R=pn(k);return a.jsxs("svg",{width:c,height:u,viewBox:`0 0 ${c} ${u}`,style:{display:"block"},children:[a.jsx("polyline",{points:y.join(" "),fill:"none",stroke:R,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[U,L]=y[y.length-1].split(",");return a.jsx("circle",{cx:U,cy:L,r:2.5,fill:R})})()]})}function B1(){return a.jsxs("span",{className:"pill",style:{background:"rgba(251,191,36,0.15)",color:"#fbbf24",fontSize:9,fontWeight:700,gap:3},children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"#fbbf24",stroke:"none",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Best Model"]})}function H1({pct:s}){const o=s>=10?"var(--green)":s>=0?"var(--yellow)":"var(--red)",c=s>=10?"var(--green-muted)":s>=0?"var(--yellow-muted)":"var(--red-muted)",u=s>=0?"+":"";return a.jsxs("span",{className:"pill",style:{background:c,color:o,fontSize:10,fontWeight:600},children:[u,s.toFixed(1),"%"]})}function U1({score:s,rating:o}){const c={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},u=c[o]??c.minimal,x=s>=0?"+":"";return a.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),a.jsxs("span",{className:"pill",style:{background:u.bg,color:u.fg,fontSize:11,fontWeight:600},children:[x,s.toFixed(1),"% (",o.toUpperCase(),")"]})]})}function q1({warning:s}){return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid rgba(251,191,36,0.3)"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:s})]})}function V1({active:s,onChange:o,hasBaseline:c}){return a.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[a.jsx("button",{onClick:()=>o("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:s==="rankings"?"var(--surface-3)":"transparent",color:s==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),a.jsx("button",{onClick:()=>o("amplification"),disabled:!c,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:s==="amplification"?"var(--surface-3)":"transparent",color:c&&s==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:c?1:.5,cursor:c?"pointer":"not-allowed"},title:c?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function G1(s){var u,x,v;if(s.length===0)return[];const o=new Map;for(const m of s)for(const b of m.models){if(b.status==="error")continue;const g=`${b.provider}/${b.model}`;o.has(g)||o.set(g,{provider:b.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const f=o.get(g);f.passRates.push(b.passRate.mean),f.lastRubric=((u=b.rubricScore)==null?void 0:u.mean)??null,f.lastDuration=b.duration.mean,f.lastCost=((x=b.cost)==null?void 0:x.total)??null,f.lastCompositeScore=b.compositeScore,b.baselinePassRate!=null&&(f.lastBaselinePassRate=b.baselinePassRate.mean,f.lastSkillDelta=(v=b.skillDelta)==null?void 0:v.mean,f.lastAmplificationPct=b.amplificationPct,f.hasBaseline=!0)}const c=[];for(const[m,b]of o){const[g,...f]=m.split("/");c.push({rank:0,model:f.join("/"),provider:g,passRate:b.passRates[b.passRates.length-1],rubricScore:b.lastRubric,duration:b.lastDuration,cost:b.lastCost,sparklineData:b.passRates,isBest:!1,baselinePassRate:b.lastBaselinePassRate,skillDelta:b.lastSkillDelta,amplificationPct:b.lastAmplificationPct,compositeScore:b.lastCompositeScore,hasBaseline:b.hasBaseline})}return c.sort((m,b)=>{const g=m.compositeScore??m.passRate;return(b.compositeScore??b.passRate)-g}),c.forEach((m,b)=>{m.rank=b+1}),c.length>0&&(c[0].isBest=!0),c}const xp=(s="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:s,whiteSpace:"nowrap"});function Y1({entries:s}){return a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(o=>a.jsx("th",{style:xp(o==="#"?"center":"left"),children:o},o))})}),a.jsx("tbody",{children:s.map(o=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface-2)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o.rank}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:o.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:o.provider}),o.isBest&&a.jsx(B1,{})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:o.passRate>=.7?"var(--green-muted)":o.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:pn(o.passRate),fontSize:11,fontWeight:600},children:[Math.round(o.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:o.rubricScore!=null?o.rubricScore.toFixed(1):"--"}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:o.duration<1e3?`${Math.round(o.duration)}ms`:`${(o.duration/1e3).toFixed(1)}s`}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:o.cost!=null?`$${o.cost.toFixed(4)}`:"N/A"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(fp,{data:o.sparklineData})})]},`${o.provider}/${o.model}`))})]})})}function Q1({entries:s}){const o=[...s].filter(c=>c.hasBaseline).sort((c,u)=>(u.amplificationPct??0)-(c.amplificationPct??0));return o.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-center",children:a.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",a.jsx("code",{children:"--baseline"})," flag."]})})}):a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(c=>a.jsx("th",{style:xp(c==="#"?"center":"left"),children:c},c))})}),a.jsx("tbody",{children:o.map((c,u)=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-2)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:u+1}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:c.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:c.provider})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:c.passRate>=.7?"var(--green-muted)":c.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:pn(c.passRate),fontSize:11,fontWeight:600},children:[Math.round(c.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px"},children:c.baselinePassRate!=null?a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(c.baselinePassRate*100),"%"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:c.skillDelta!=null?a.jsxs("span",{className:"text-[11px] font-medium",style:{color:c.skillDelta>=0?"var(--green)":"var(--red)"},children:[c.skillDelta>=0?"+":"",(c.skillDelta*100).toFixed(1),"pp"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:c.amplificationPct!=null&&isFinite(c.amplificationPct)?a.jsx(H1,{pct:c.amplificationPct}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(fp,{data:c.sparklineData})})]},`${c.provider}/${c.model}`))})]})})}function $1(){const{state:s}=al(),{plugin:o,skill:c}=s,[u,x]=p.useState("rankings"),v=`leaderboard/${o}/${c}`,m=p.useCallback(()=>ge.getLeaderboard(o,c),[o,c]),{data:b,loading:g,error:f}=gc(v,m),S=(b==null?void 0:b.entries)??[],y=(f==null?void 0:f.message)??null;p.useEffect(()=>{x("rankings")},[o,c]);const k=p.useCallback(()=>Or(v),[v]);Mr("leaderboard:updated",k);const R=p.useMemo(()=>G1(S),[S]),U=R.some(O=>O.hasBaseline),L=S[0],Y=L==null?void 0:L.judgeBiasWarning;return g?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"spinner spinner-lg"})}):y?a.jsx("div",{className:"flex items-center justify-center h-full px-8",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Failed to load leaderboard"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:y})]})}):R.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),a.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),a.jsx("div",{className:"text-[11px] font-mono px-4 py-3 rounded-lg text-left",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:'vskill eval sweep --models "anthropic/claude-sonnet-4,openrouter/meta-llama/llama-3.1-70b" --judge "anthropic/claude-sonnet-4"'}),a.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",a.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),a.jsx(V1,{active:u,onChange:x,hasBaseline:U})]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S.length," sweep",S.length!==1?"s":""," · ",R.length," model",R.length!==1?"s":""]})]}),Y&&a.jsx(q1,{warning:Y}),u==="rankings"?a.jsx(Y1,{entries:R}):a.jsx(Q1,{entries:R}),u==="amplification"&&(L==null?void 0:L.skillQualityScore)!=null&&(L==null?void 0:L.skillQualityRating)&&a.jsx(U1,{score:L.skillQualityScore,rating:L.skillQualityRating})]})}const X1=["editor","tests","run","activation","history","leaderboard","deps"];function K1(s){return s!=null&&X1.includes(s)}function Z1(){const{state:s,dispatch:o,saveContent:c,isReadOnly:u}=al(),{refreshSkills:x,clearSelection:v}=ra(),m=p.useCallback(async()=>{try{await ge.deleteSkill(s.plugin,s.skill),x(),v()}catch(f){const S=f instanceof Error?f.message:String(f);o({type:"SET_ERROR",error:`Failed to delete skill: ${S}`})}},[s.plugin,s.skill,x,v,o]);p.useEffect(()=>{const S=new URLSearchParams(window.location.search).get("panel");K1(S)&&S!==s.activePanel&&o({type:"SET_PANEL",panel:S})},[]),p.useEffect(()=>{const f=new URLSearchParams(window.location.search);f.set("panel",s.activePanel);const S=`${window.location.pathname}?${f.toString()}${window.location.hash}`;history.replaceState(null,"",S)},[s.activePanel]);const b=p.useCallback(f=>{const S=f.ctrlKey||f.metaKey;if(S&&f.key>="1"&&f.key<="7"){f.preventDefault(),o({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps"][parseInt(f.key)-1]});return}if(S&&f.key==="s"&&!f.shiftKey){f.preventDefault(),s.isDirty&&c();return}},[s.isDirty,c,o]);if(p.useEffect(()=>(window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)),[b]),s.loading)return a.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"spinner spinner-lg"}),a.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const g=Array.from(s.caseRunStates.values()).some(f=>f.status==="running"||f.status==="queued");return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsx(fv,{state:s,isReadOnly:u,onDelete:u?void 0:m}),s.error&&a.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx(ds,{error:gv(s.error),onDismiss:()=>o({type:"SET_ERROR",error:null})})}),a.jsx(vv,{activePanel:s.activePanel,onPanelChange:f=>o({type:"SET_PANEL",panel:f}),isDirty:s.isDirty,isRunning:g,hasRegressions:s.regressions.length>0,isActivationRunning:s.activationRunning}),a.jsx(yv,{children:a.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[s.activePanel==="editor"&&a.jsx(Qv,{}),s.activePanel==="tests"&&a.jsx(Fv,{}),s.activePanel==="run"&&a.jsx(d1,{}),s.activePanel==="activation"&&a.jsx(m1,{}),s.activePanel==="history"&&a.jsx(_1,{}),s.activePanel==="leaderboard"&&a.jsx($1,{}),s.activePanel==="deps"&&a.jsx(O1,{})]},s.activePanel)})},`${s.plugin}/${s.skill}`)]})}function vc(s,o=!0){let c=s.toLowerCase().replace(/[^a-z0-9]+/g,"-");return o&&(c=c.replace(/^-+|-+$/g,"")),c}function J1(s,o,c,u){const v=`.../${s.split("/").slice(-2).join("/")}`;switch(o){case 1:return`${v}/${c}/skills/${u}/SKILL.md`;case 2:return`${v}/plugins/${c}/skills/${u}/SKILL.md`;case 3:return`${v}/skills/${u}/SKILL.md`}}function W1({onCreated:s,resolveAiConfigOverride:o}){const[c,u]=p.useState("ai"),[x,v]=p.useState(null),[m,b]=p.useState(!0),{config:g}=ia(),[f,S]=p.useState(""),[y,k]=p.useState(3),[R,U]=p.useState(""),[L,Y]=p.useState(""),[O,Z]=p.useState(""),[W,F]=p.useState(""),[ae,re]=p.useState(""),[q,I]=p.useState(""),[G,X]=p.useState("write"),[ne,te]=p.useState(!1),[be,he]=p.useState(null),[T,N]=p.useState(""),[w,ee]=p.useState(!1),[B,ue]=p.useState(!1),[j,D]=p.useState(null),[P,le]=p.useState(null),[ce,de]=p.useState([]),me=p.useRef(null),Oe=p.useRef(null),Re=p.useRef(null),pt=p.useRef(null),[Dt,J]=p.useState(!1),[ie,se]=p.useState(!1);p.useEffect(()=>{ge.getProjectLayout().then(K=>{v(K),k(K.suggestedLayout);const Be=K.detectedLayouts.find(at=>at.layout===K.suggestedLayout);Be!=null&&Be.existingPlugins.length&&U(Be.existingPlugins[0])}).catch(()=>{}).finally(()=>b(!1))},[]),p.useEffect(()=>{var K;c==="ai"&&((K=me.current)==null||K.focus())},[c]),p.useEffect(()=>()=>{var K;(K=Oe.current)==null||K.abort()},[]);const xe=p.useMemo(()=>{var K;return x?((K=x.detectedLayouts.find(Be=>Be.layout===y))==null?void 0:K.existingPlugins)||[]:[]},[x,y]),ye=R==="__new__"?L:R,Ye=x?J1(x.root,y,ye||"{plugin}",f||"{skill}"):"",ut=p.useMemo(()=>x?x.detectedLayouts.filter(K=>K.layout!==4):[],[x]),$e=p.useMemo(()=>{if(!x)return null;const K=x.detectedLayouts.find(Je=>Je.layout===2&&Je.existingPlugins.length>0),Be=x.detectedLayouts.find(Je=>Je.layout===1&&Je.existingPlugins.length>0),at=K||Be;return at?{layout:at.layout,plugins:at.existingPlugins}:null},[x]),Ot=p.useCallback(()=>{if(o)return o();if(!g)return{provider:"claude-cli",model:"sonnet"};const K=g.provider||"claude-cli",Be=g.model||"sonnet";return{provider:K,model:Be}},[g,o]),mt=p.useCallback(()=>{var K;(K=Oe.current)==null||K.abort(),ee(!1)},[]),nl=p.useCallback(()=>{D(null),le(null)},[]),Xt=p.useCallback(async()=>{if(D(null),le(null),de([]),Re.current=null,!T.trim()){D("Describe what your skill should do");return}ee(!0);const K=new AbortController;Oe.current=K;const{provider:Be,model:at}=Ot();try{const Je=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:T.trim(),provider:Be,model:at}),signal:K.signal});if(!Je.ok||!Je.body){let Fe=`HTTP ${Je.status}`;try{const nt=await Je.json();nt.error&&(Fe=nt.error)}catch{}throw new Error(Fe)}const Ml=Je.body.getReader(),Bt=new TextDecoder;let oa="",Ct="";for(;;){const{done:Fe,value:nt}=await Ml.read();if(Fe)break;oa+=Bt.decode(nt,{stream:!0});const et=oa.split(`
68
- `);oa=et.pop()||"";for(const sl of et)if(sl.startsWith("event: "))Ct=sl.slice(7).trim();else if(sl.startsWith("data: ")){try{const Qe=JSON.parse(sl.slice(6));if(Ct==="progress")de(rl=>[...rl,{phase:Qe.phase,message:Qe.message,timestamp:Date.now()}]);else if(Ct==="done"||Ct==="complete"){const rl={prompt:T.trim(),provider:Ot().provider,model:Ot().model,reasoning:Qe.reasoning||""};if(S(Qe.name),Z(Qe.description),F(Qe.model||""),re(Qe.allowedTools||""),I(Qe.body),ue(!0),Re.current=rl,u("manual"),Qe.suggestedPlugin&&typeof Qe.suggestedPlugin=="object"&&Qe.suggestedPlugin.plugin){const Ve=Qe.suggestedPlugin;if(((x==null?void 0:x.detectedLayouts.flatMap(Tt=>Tt.existingPlugins))??[]).includes(Ve.plugin))if(U(Ve.plugin),Ve.layout&&(Ve.layout===1||Ve.layout===2))k(Ve.layout);else{const Tt=x==null?void 0:x.detectedLayouts.find(Ta=>Ta.existingPlugins.includes(Ve.plugin));Tt&&(Tt.layout===1||Tt.layout===2)&&k(Tt.layout)}else U("__new__"),Y(Ve.plugin)}else y===3&&$e&&se(!0);const st={name:Qe.name,plugin:ye||"",layout:y,description:Qe.description,model:Qe.model||void 0,allowedTools:Qe.allowedTools||void 0,body:Qe.body,aiMeta:rl};ge.saveDraft(st).then(Ve=>{J(!0),Ve!=null&&Ve.dir&&(pt.current=Ve.dir)}).catch(()=>{})}else Ct==="error"&&(D(Qe.message||Qe.description||"Unknown error"),Qe.category&&le(Qe))}catch{}Ct=""}}}catch(Je){Je.name!=="AbortError"&&D(Je.message)}finally{ee(!1),Oe.current=null}},[T,Ot,y,$e,ye,x]),We=p.useCallback(async()=>{if(he(null),!f.trim()){he("Skill name is required");return}if(!O.trim()){he("Description is required");return}if(y!==3&&!ye.trim()){he("Plugin name is required");return}te(!0);try{const K=await ge.createSkill({name:vc(f),plugin:ye||"",layout:y,description:O,model:W||void 0,allowedTools:ae||void 0,body:q,aiMeta:Re.current||void 0,draftDir:pt.current||void 0});pt.current=null,s(K.plugin,K.skill)}catch(K){he(K.message)}finally{te(!1)}},[f,O,y,ye,W,ae,q,s]),kt=p.useCallback(()=>{$e&&(k($e.layout),U($e.plugins[0]),se(!1))},[$e]);return{mode:c,setMode:u,layout:x,layoutLoading:m,selectedLayout:y,setSelectedLayout:k,creatableLayouts:ut,availablePlugins:xe,pathPreview:Ye,plugin:R,setPlugin:U,newPlugin:L,setNewPlugin:Y,effectivePlugin:ye,name:f,setName:S,description:O,setDescription:Z,model:W,setModel:F,allowedTools:ae,setAllowedTools:re,body:q,setBody:I,bodyViewMode:G,setBodyViewMode:X,aiPrompt:T,setAiPrompt:N,generating:w,aiGenerated:B,aiError:j,aiClassifiedError:P,aiProgress:ce,promptRef:me,handleGenerate:Xt,handleCancelGenerate:mt,clearAiError:nl,draftSaved:Dt,showPluginRecommendation:ie,setShowPluginRecommendation:se,pluginLayoutInfo:$e,applyPluginRecommendation:kt,creating:ne,error:be,handleCreate:We}}function pp(){return a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function F1(){return a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function mp({node:s,depth:o=0}){var c;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${o*16}px`,color:s.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[s.type==="dir"?a.jsx(pp,{}):a.jsx(F1,{}),a.jsxs("span",{children:[s.name,s.type==="dir"?"/":""]})]}),(c=s.children)==null?void 0:c.map(u=>a.jsx(mp,{node:u,depth:o+1},u.name))]})}function I1(s,o,c){const u=[];o&&u.push({name:"evals.json",type:"file"}),u.push({name:"history",type:"dir"});const x=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:u}];return c&&x.push({name:"draft.json",type:"file"}),{name:s||"{skill}",type:"dir",children:x}}function P1({skillName:s,hasEvals:o,isDraft:c}){const u=I1(s,o,c);return a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsx(pp,{})}),"Skill Structure"]}),a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:a.jsx(mp,{node:u})})]})}const sa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function uc({size:s=14,color:o="currentColor"}){return a.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function ey({onCreated:s,onCancel:o}){const c=W1({onCreated:s});return a.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),a.jsx("div",{className:"flex items-center justify-between mt-2",children:a.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsx("button",{onClick:()=>c.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:c.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:c.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:c.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(uc,{size:12}),"AI-Assisted"]})}),a.jsx("button",{onClick:()=>c.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:c.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:c.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:c.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),c.layoutLoading&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!c.layoutLoading&&c.layout&&c.mode==="ai"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsx(uc,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),a.jsx("textarea",{ref:c.promptRef,value:c.aiPrompt,onChange:u=>c.setAiPrompt(u.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
67
+ !Write me a poem about flowers`}),a.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:"One prompt per line"}),a.jsx(Tr,{}),a.jsx("span",{children:"No prefix = auto-classify"}),a.jsx(Tr,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),a.jsx(Tr,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),a.jsx(Tr,{}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[G," prompt",G!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:q,disabled:j||!O.trim(),className:"btn btn-primary",children:j?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"#fff",borderColor:"rgba(255,255,255,0.2)",width:14,height:14}}),"Testing..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),j&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:u,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[R||`${g.length} / ${G} prompts tested`,k&&a.jsx(gy,{startedAt:k})]})]})]})]}),a.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[a.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),a.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:te?a.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:he}}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),y&&a.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:y}),j&&g.length===0&&a.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[a.jsx("div",{className:"spinner-lg mx-auto mb-4"}),a.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),g.length>0&&a.jsxs("div",{className:"space-y-5",children:[ne.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),a.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",ne.length,")"]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:ne.map((T,N)=>a.jsx($x,{result:T},`incorrect-${N}`))})]}),X.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"16 10 11 15 8 12"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",X.length,")"]})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:X.map((T,N)=>a.jsx($x,{result:T},`correct-${N}`))})]})]}),f&&a.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),f.autoClassifiedCount!=null&&f.autoClassifiedCount>0&&a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[f.autoClassifiedCount," of ",f.total," prompts auto-classified from skill name and tags"]}),a.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[a.jsx(ic,{label:"Precision",value:f.precision,description:"Of all activations, how many were correct?",detail:`${f.tp} true / ${f.tp+f.fp} total activations`}),a.jsx(ic,{label:"Recall",value:f.recall,description:"Of expected activations, how many fired?",detail:`${f.tp} activated / ${f.tp+f.fn} expected`}),a.jsx(ic,{label:"Reliability",value:f.reliability,description:"Overall correct classification rate",detail:`${f.tp+f.tn} correct / ${f.total} total`})]}),a.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[a.jsx(wr,{label:"True Positive",abbr:"TP",count:f.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),a.jsx(wr,{label:"False Positive",abbr:"FP",count:f.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),a.jsx(wr,{label:"False Negative",abbr:"FN",count:f.fn,bg:"rgba(248,113,113,0.06)",color:"rgba(248,113,113,0.6)",description:"Missed activation"}),a.jsx(wr,{label:"True Negative",abbr:"TN",count:f.tn,bg:"rgba(52,211,153,0.06)",color:"rgba(52,211,153,0.6)",description:"Correctly silent"})]})]})]}),a.jsx(hy,{history:Y,expanded:ae,onToggle:()=>re(!ae)})]})}function hy({history:s,expanded:o,onToggle:c}){return s===null?null:a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:o?"1px solid var(--border-subtle)":"none"},onClick:c,children:[a.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",s.length>0&&a.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",s.length," run",s.length!==1?"s":"",")"]})]}),a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),o&&a.jsx("div",{className:"px-4 py-3",children:s.length===0?a.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):a.jsx("div",{className:"space-y-2",children:s.map(u=>a.jsx(vy,{run:u},u.id))})})]})}function vy({run:s}){const o=Math.round(s.summary.reliability*100),c=o>=80?"var(--green)":o>=60?"var(--yellow)":"var(--red)",u=o>=80?"Good":o>=60?"Needs Work":"Poor",x=c;return a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:yy(s.timestamp)}),a.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:s.model||s.provider}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[s.promptCount," prompts"]})]})}),a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:c,fontVariantNumeric:"tabular-nums"},children:[o,"%"]}),a.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:x,background:`color-mix(in srgb, ${x} 10%, transparent)`},children:u})]})]})}function yy(s){const o=Date.now(),c=new Date(s).getTime(),u=Math.floor((o-c)/1e3);if(u<60)return"just now";const x=Math.floor(u/60);if(x<60)return`${x}m ago`;const v=Math.floor(x/60);if(v<24)return`${v}h ago`;const p=Math.floor(v/24);return p<7?`${p}d ago`:new Date(s).toLocaleDateString()}function Tr(){return a.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function $x({result:s}){const o=Yx[s.classification]||Yx.FN,c=s.classification==="TP"||s.classification==="TN";return a.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:o.bg,border:"1px solid transparent"},children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${o.text} 20%, transparent)`},children:c?a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:o.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:s.prompt})}),a.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[a.jsx("span",{className:"pill",style:{background:"rgba(0,0,0,0.1)",color:o.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:s.classification}),a.jsx("span",{style:{color:s.activate?"var(--green)":"var(--text-tertiary)"},children:s.activate?"Activated":"Silent"}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",s.expected==="should_activate"?"activate":"stay silent"]}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[s.confidence," confidence"]}),s.autoClassified&&a.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"})]}),s.reasoning&&a.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:s.reasoning})]})]})}function ic({label:s,value:o,description:c,detail:u}){const x=Math.round(o*100),v=x>=80?"var(--green)":x>=60?"var(--yellow)":"var(--red)";return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:v},children:[x,"%"]}),a.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:s}),a.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:c}),a.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:u})]})}function wr({abbr:s,count:o,bg:c,color:u,description:x}){return a.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:c},children:[a.jsx("div",{className:"text-[20px] font-bold",style:{color:u},children:o}),a.jsx("div",{className:"text-[11px] font-semibold",style:{color:u},children:s}),a.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:x})]})}function gy({startedAt:s}){const[o,c]=m.useState(0);return m.useEffect(()=>{const u=setInterval(()=>c(Math.floor((Date.now()-s)/1e3)),1e3);return()=>clearInterval(u)},[s]),a.jsxs("span",{className:"ml-2",children:["(",o,"s)"]})}const oc={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Qx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},mc=600,hc=180,Nt=40,cc=mc-Nt*2,na=hc-Nt*2,by=[25,50,75,100];function Xx(s){return new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function jy(s){return s==null?"--":`${(s/1e3).toFixed(1)}s`}function Sy({entries:s,onPointClick:o}){const[c,u]=m.useState(null),x=m.useMemo(()=>[...s].reverse(),[s]);if(x.length<2)return null;const v=x.length,p=x.map((f,j)=>{const y=Nt+j/(v-1)*cc,k=f.passRate*100,R=Nt+na-k/100*na;return{x:y,y:R,pct:k,entry:f}}),b=p.map(f=>`${f.x},${f.y}`).join(" "),g=Array.from(new Set(x.map(f=>f.type)));return a.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:v>=20?"auto":void 0},children:[a.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),a.jsx("div",{className:"flex items-center gap-5 mb-3",children:g.map(f=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:oc[f]??"var(--text-tertiary)"}}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Qx[f]??f})]},f))}),a.jsxs("svg",{width:mc,height:hc,viewBox:`0 0 ${mc} ${hc}`,style:{display:"block",overflow:"visible"},children:[by.map(f=>{const j=Nt+na-f/100*na;return a.jsxs("g",{children:[a.jsx("line",{x1:Nt,y1:j,x2:Nt+cc,y2:j,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),a.jsxs("text",{x:Nt-8,y:j+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[f,"%"]})]},f)}),a.jsx("line",{x1:Nt,y1:Nt+na,x2:Nt+cc,y2:Nt+na,stroke:"var(--border-subtle)",strokeWidth:1}),a.jsx("text",{x:Nt-8,y:Nt+na+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),a.jsx("polyline",{points:b,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),p.map((f,j)=>a.jsx("circle",{cx:f.x,cy:f.y,r:5,fill:oc[f.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:y=>{y.currentTarget.setAttribute("r","7"),u({x:f.x,y:f.y,entry:f.entry})},onMouseLeave:y=>{y.currentTarget.setAttribute("r","5"),u(null)},onClick:()=>o==null?void 0:o(f.entry)},j)),Ny(v).map(f=>a.jsx("text",{x:p[f].x,y:Nt+na+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Xx(x[f].timestamp)},f))]}),c&&a.jsxs("div",{style:{position:"absolute",left:c.x,top:c.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:[a.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Xx(c.entry.timestamp)}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:c.entry.model}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:oc[c.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Qx[c.entry.type]??c.entry.type}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(c.entry.passRate*100),"%"]})]}),a.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:jy(c.entry.totalDurationMs)}),a.jsx("span",{children:c.entry.totalTokens!=null?`${c.entry.totalTokens} tokens`:"--"})]})]})]})}function Ny(s){if(s<=3)return Array.from({length:s},(u,x)=>x);if(s<=6)return[0,Math.floor(s/2),s-1];if(s<20)return[0,Math.floor(s/3),Math.floor(2*s/3),s-1];const o=Math.ceil(s/10),c=[0];for(let u=o;u<s-1;u+=o)c.push(u);return c.push(s-1),c}const os=new Map;let Et=null,Rr=null,Ar=1e3,cs=0;function dp(){if(Et)return;Et=new EventSource("/api/events");const s=o=>c=>{let u={};try{u=c.data?JSON.parse(c.data):{}}catch{}const x=os.get(o);if(x)for(const v of x)v(u)};Et.addEventListener("benchmark:complete",s("benchmark:complete")),Et.addEventListener("history:written",s("history:written")),Et.addEventListener("leaderboard:updated",s("leaderboard:updated")),Et.onerror=()=>{Et==null||Et.close(),Et=null,cs>0&&(Rr=setTimeout(()=>{Ar=Math.min(Ar*2,3e4),dp()},Ar))},Et.onopen=()=>{Ar=1e3}}function Ey(){Rr!=null&&(clearTimeout(Rr),Rr=null),Et==null||Et.close(),Et=null}function ky(s,o){return os.has(s)||os.set(s,new Set),os.get(s).add(o),cs++,dp(),()=>{var c;(c=os.get(s))==null||c.delete(o),cs--,cs<=0&&(cs=0,Ey())}}function Mr(s,o){const c=m.useRef(o);c.current=o,m.useEffect(()=>ky(s,x=>c.current(x)),[s])}const _r=new Map,Ca=new Map,us=new Map;function Or(s){_r.delete(s),Ca.delete(s);const o=us.get(s);if(o)for(const c of o)c()}function gc(s,o,c={}){const{ttl:u=3e4,enabled:x=!0}=c,[,v]=m.useState(0),p=m.useRef(!0),b=m.useRef(s);b.current=s;const g=()=>Or(s);m.useEffect(()=>(p.current=!0,()=>{p.current=!1}),[]),m.useEffect(()=>{if(!x)return;const k=()=>{p.current&&v(R=>R+1)};return us.has(s)||us.set(s,new Set),us.get(s).add(k),()=>{var R;(R=us.get(s))==null||R.delete(k)}},[s,x]),m.useEffect(()=>{if(!x)return;const k=_r.get(s);if(!(!k||Date.now()-k.fetchedAt>u))return;if(Ca.has(s)){const Y=Ca.get(s),O=()=>{p.current&&b.current===s&&v(Z=>Z+1)};Y.subscribers.push(O);return}const U={promise:Promise.resolve(),subscribers:[]},L=o().then(Y=>{_r.set(s,{data:Y,fetchedAt:Date.now()}),Ca.delete(s),p.current&&b.current===s&&v(O=>O+1);for(const O of U.subscribers)O()},Y=>{Ca.delete(s),p.current&&b.current===s&&v(O=>O+1);for(const O of U.subscribers)O();throw Y});U.promise=L,Ca.set(s,U)},[s,o,u,x]);const f=_r.get(s),j=x&&!f&&Ca.has(s);return{data:f==null?void 0:f.data,loading:j||x&&!f,error:void 0,revalidate:g}}function Lr(s){return s>=.8?"var(--green)":s>=.5?"var(--yellow)":"var(--red)"}function Cy(s){return s>=1e3?`${(s/1e3).toFixed(1)}s`:`${Math.round(s)}ms`}function Ty({rate:s,label:o}){const c=Math.round(s*100);return a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:o}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:Lr(s)},children:[c,"%"]})]}),a.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${c}%`,background:Lr(s)}})})]})})}function wy({points:s}){if(s.length<2)return null;const o=200,c=48,u=4,x=s.length,v=s.map((g,f)=>{const j=u+f/(x-1)*(o-u*2),y=u+(c-u*2)-g.passRate*(c-u*2);return{x:j,y}}),p=`M ${v[0].x},${c-u} `+v.map(g=>`L ${g.x},${g.y}`).join(" ")+` L ${v[v.length-1].x},${c-u} Z`,b=v.map((g,f)=>`${f===0?"M":"L"} ${g.x},${g.y}`).join(" ");return a.jsxs("svg",{width:o,height:c,style:{display:"block"},children:[a.jsx("path",{d:p,fill:"var(--accent-muted)"}),a.jsx("path",{d:b,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),a.jsx("circle",{cx:v[v.length-1].x,cy:v[v.length-1].y,r:3,fill:"var(--accent)"})]})}function Ay({plugin:s,skill:o}){const c=`stats/${s}/${o}`,u=m.useCallback(()=>ge.getStats(s,o),[s,o]),{data:x,loading:v}=gc(c,u),p=m.useCallback(()=>Or(c),[c]);if(Mr("benchmark:complete",p),Mr("history:written",p),v)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"skeleton h-24 rounded-xl"}),a.jsx("div",{className:"skeleton h-48 rounded-xl"}),a.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!x||x.totalRuns===0)return a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),a.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const b=x.trendPoints.length>0?x.trendPoints[x.trendPoints.length-1].passRate:0,g=x.trendPoints.length>0?x.trendPoints[0].passRate:0,f=b-g,j=x.assertionStats.slice(0,10);return a.jsxs("div",{className:"space-y-4 stagger-children",children:[a.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:x.totalRuns})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:Lr(b)},children:[Math.round(b*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:f>=0?"var(--green)":"var(--red)"},children:[f>=0?"+":"",Math.round(f*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:x.modelStats.length})]}),x.totalCost!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Qt(x.totalCost)})]}),x.costPerRun!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:Qt(x.costPerRun)})]})]}),x.trendPoints.length>=2&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),a.jsx(wy,{points:x.trendPoints})]}),x.modelStats.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),a.jsx("tbody",{children:x.modelStats.map(y=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:y.model}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:y.runs}),a.jsx("td",{style:{padding:"8px",textAlign:"center"},children:a.jsxs("span",{className:"font-semibold",style:{color:Lr(y.avgPassRate)},children:[Math.round(y.avgPassRate*100),"%"]})}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:Cy(y.avgDurationMs)}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:y.avgCost!=null?Qt(y.avgCost):"N/A"})]},y.model))})]})]}),j.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),a.jsx("div",{className:"space-y-3",children:j.map(y=>a.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--surface-2)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},onClick:()=>{},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.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:["#",y.evalId]}),a.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:y.evalName}),a.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[y.totalRuns," runs"]})]}),a.jsx(Ty,{rate:y.passRate,label:y.text})]},`${y.evalId}:${y.id}`))})]})]})}function Ry({plugin:s,skill:o}){const[c,u]=m.useState(null),[x,v]=m.useState(null),[p,b]=m.useState({}),[g,f]=m.useState({});m.useEffect(()=>{ge.getEvals(s,o).then(u).catch(()=>u(null))},[s,o]);async function j(y){if(x===y){v(null);return}if(v(y),!p[y]){f(k=>({...k,[y]:!0}));try{const k=await ge.getCaseHistory(s,o,y);b(R=>({...R,[y]:k}))}catch{b(k=>({...k,[y]:[]}))}finally{f(k=>({...k,[y]:!1}))}}}return c?a.jsx("div",{className:"space-y-2 stagger-children",children:c.evals.map(y=>{const k=p[y.id]||[],R=x===y.id,U=g[y.id],L=k.length>0?k[0].pass_rate:null;return a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>j(y.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:R?"var(--surface-2)":"transparent"},onMouseEnter:Y=>{R||(Y.currentTarget.style.background="var(--surface-2)")},onMouseLeave:Y=>{R||(Y.currentTarget.style.background="transparent")},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:R?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.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:["#",y.id]}),a.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:y.name}),k.length>=2&&a.jsx(rp,{entries:k}),L!=null&&a.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:pn(L)},children:[Math.round(L*100),"%"]}),k.length>0&&a.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[k.length," runs"]})]}),R&&a.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:U?a.jsxs("div",{className:"p-4 flex items-center gap-2",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):k.length===0?a.jsx("div",{className:"p-4",children:a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):a.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:k.map((Y,O)=>a.jsxs("div",{className:"p-4",style:{background:O===0?"var(--surface-2)":"transparent"},children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:np(Y.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:Y.model}),a.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}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:pn(Y.pass_rate)},children:[Math.round(Y.pass_rate*100),"%"]})]}),a.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&&a.jsx("span",{children:sp(Y.durationMs)}),Y.tokens!=null&&a.jsxs("span",{children:[Y.tokens>=1e3?`${(Y.tokens/1e3).toFixed(1)}k`:Y.tokens," tok"]})]}),a.jsx("div",{className:"space-y-1",children:Y.assertions.map(Z=>a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:Z.pass?"var(--green)":"var(--red)"},children:a.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:Z.pass?a.jsx("polyline",{points:"20 6 9 17 4 12"}):a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:Z.text}),Z.reasoning&&a.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:Z.reasoning})]})]},Z.id))})]},O))})})]},y.id)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function _y(){const{state:s,dispatch:o}=al(),{plugin:c,skill:u}=s,[x,v]=m.useState("timeline"),[p,b]=m.useState(""),[g,f]=m.useState(""),[j,y]=m.useState(!1),[k,R]=m.useState([]),[U,L]=m.useState(null),[Y,O]=m.useState(!1),[Z,W]=m.useState(null),[F,ae]=m.useState(!1),re=`history/${c}/${u}?model=${p}&type=${g}`,q=m.useCallback(()=>ge.getHistory(c,u,{model:p||void 0,type:g||void 0}),[c,u,p,g]),{data:I,loading:G}=gc(re,q),X=I??[];m.useEffect(()=>{!I||I.length<2||ge.compareRuns(c,u,I[0].timestamp,I[1].timestamp).then(T=>{const N=T.regressions.filter(w=>w.change==="regression");o({type:"SET_REGRESSIONS",regressions:N})}).catch(()=>{})},[I,c,u,o]);const ne=m.useCallback(()=>Or(re),[re]);Mr("history:written",ne);const te=m.useCallback(async T=>{if(j){R(N=>N.includes(T)?N.filter(w=>w!==T):N.length>=2?[N[1],T]:[...N,T]);return}ae(!0);try{const N=await ge.getHistoryEntry(c,u,T);W(N)}catch{}finally{ae(!1)}},[c,u,j]),be=m.useCallback(async()=>{if(k.length===2){O(!0);try{const T=await ge.compareRuns(c,u,k[0],k[1]);L(T)}catch{}finally{O(!1)}}},[c,u,k]),he=[...new Set(X.map(T=>T.model))];return G?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"skeleton h-12 rounded-lg"}),a.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(T=>a.jsx("button",{onClick:()=>v(T),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:x===T?"var(--accent-muted)":"transparent",color:x===T?"var(--accent)":"var(--text-tertiary)"},children:T==="timeline"?"Timeline":T==="per-eval"?"Per Eval":"Statistics"},T))}),x==="timeline"&&a.jsxs("div",{children:[X.length>0&&a.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:a.jsx(Sy,{entries:X,onPointClick:T=>te(T.timestamp)})}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("select",{value:p,onChange:T=>b(T.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Models"}),he.map(T=>a.jsx("option",{value:T,children:T},T))]}),a.jsxs("select",{value:g,onChange:T=>f(T.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Types"}),a.jsx("option",{value:"benchmark",children:"Benchmark"}),a.jsx("option",{value:"comparison",children:"Comparison"}),a.jsx("option",{value:"baseline",children:"Baseline"}),a.jsx("option",{value:"model-compare",children:"Model Compare"}),a.jsx("option",{value:"improve",children:"AI Improve"}),a.jsx("option",{value:"instruct",children:"AI Edit"}),a.jsx("option",{value:"ai-generate",children:"AI Generate"}),a.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{y(!j),R([]),L(null)},className:`btn text-[12px] ${j?"btn-primary":"btn-secondary"}`,children:j?"Exit Compare":"Compare Runs"}),j&&k.length===2&&a.jsx("button",{onClick:be,disabled:Y,className:"btn btn-primary text-[12px]",children:Y?"Comparing...":"Compare"})]}),a.jsx("div",{className:"space-y-2",children:X.length===0?a.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):X.map(T=>{const N=k.includes(T.timestamp);return a.jsx("button",{onClick:()=>te(T.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:N?"var(--accent-muted)":"var(--surface-1)",border:N?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:w=>{N||(w.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:w=>{N||(w.currentTarget.style.borderColor="var(--border-subtle)")},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[j&&a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:N?"var(--accent)":"var(--border-default)",background:N?"var(--accent)":"transparent"},children:N&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(T.timestamp).toLocaleString()}),a.jsx("span",{className:"pill text-[9px]",style:{background:T.type==="comparison"?"var(--purple-muted)":T.type==="baseline"?"var(--surface-3)":T.type==="model-compare"?"rgba(56,189,248,0.15)":T.type==="improve"||T.type==="instruct"?"rgba(168,85,247,0.15)":T.type==="ai-generate"?"rgba(34,197,94,0.15)":T.type==="eval-generate"?"rgba(251,146,60,0.15)":"var(--accent-muted)",color:T.type==="comparison"?"var(--purple)":T.type==="baseline"?"var(--text-tertiary)":T.type==="model-compare"?"#38bdf8":T.type==="improve"||T.type==="instruct"?"#a855f7":T.type==="ai-generate"?"#22c55e":T.type==="eval-generate"?"#fb923c":"var(--accent)"},children:T.type==="model-compare"?"model compare":T.type==="improve"?"ai improve":T.type==="instruct"?"ai edit":T.type==="ai-generate"?"ai generate":T.type==="eval-generate"?"eval generate":T.type})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:T.model}),T.totalCost!=null&&T.totalCost>0&&a.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Qt(T.totalCost)}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:T.passRate>=.8?"var(--green)":T.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(T.passRate*100),"%"]})]})]})},T.timestamp)})}),U&&a.jsx(My,{result:U}),Z&&!j&&a.jsx(Ly,{run:Z,onClose:()=>W(null)})]}),x==="per-eval"&&a.jsx(Ry,{plugin:c,skill:u}),x==="statistics"&&a.jsx(Ay,{plugin:c,skill:u})]})}function My({result:s}){const o=s.regressions.filter(u=>u.change==="regression"),c=s.regressions.filter(u=>u.change==="improvement");return a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(s.runA.timestamp).toLocaleDateString()," vs ",new Date(s.runB.timestamp).toLocaleDateString()]}),(s.runA.totalCost!=null||s.runB.totalCost!=null)&&a.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[a.jsxs("span",{children:["Run A cost: ",Qt(s.runA.totalCost??null)]}),a.jsxs("span",{children:["Run B cost: ",Qt(s.runB.totalCost??null)]}),s.runA.totalCost!=null&&s.runB.totalCost!=null&&a.jsxs("span",{style:{color:s.runB.totalCost<=s.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",Qt(s.runB.totalCost-s.runA.totalCost)]})]}),o.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",o.length,")"]}),o.map(u=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",a.jsx("span",{style:{color:"var(--red)"},children:u.assertionId})," (was passing, now failing)"]},`${u.evalId}-${u.assertionId}`))]}),c.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",c.length,")"]}),c.map(u=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",u.evalId," ",u.evalName,": ",a.jsx("span",{style:{color:"var(--green)"},children:u.assertionId})," (was failing, now passing)"]},`${u.evalId}-${u.assertionId}`))]}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),a.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"var(--surface-2)"},children:[a.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),a.jsx("tbody",{children:s.caseDiffs.map(u=>a.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",u.eval_id," ",u.eval_name]}),a.jsx("td",{className:"text-right px-3 py-2",style:{color:u.passRateA!=null?u.passRateA>=.8?"var(--green)":u.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:u.passRateA!=null?`${Math.round(u.passRateA*100)}%`:u.statusA}),a.jsx("td",{className:"text-right px-3 py-2",style:{color:u.passRateB!=null?u.passRateB>=.8?"var(--green)":u.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:u.passRateB!=null?`${Math.round(u.passRateB*100)}%`:u.statusB})]},u.eval_id))})]})})]})}function Ly({run:s,onClose:o}){return(s.type==="improve"||s.type==="instruct")&&s.improve?a.jsx(zy,{run:s,onClose:o}):a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(s.timestamp).toLocaleString()]}),a.jsx("button",{onClick:o,className:"btn btn-ghost text-[11px]",children:"Close"})]}),a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",s.model," | Cases: ",s.cases.length," | Pass Rate: ",s.overall_pass_rate!=null?`${Math.round(s.overall_pass_rate*100)}%`:"--",s.totalCost!=null&&s.totalCost>0&&` | Cost: ${Qt(s.totalCost)}`]}),a.jsx("div",{className:"space-y-2",children:s.cases.map(c=>a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",c.eval_id," ",c.eval_name]}),a.jsxs("div",{className:"flex items-center gap-2",children:[c.cost!=null&&c.cost>0&&a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:Qt(c.cost)}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:c.status==="pass"?"var(--green)":"var(--red)"},children:c.pass_rate!=null?`${Math.round(c.pass_rate*100)}%`:c.status})]})]})},c.eval_id))})]})}function zy({run:s,onClose:o}){var v;const c=m.useMemo(()=>s.improve?Dr(s.improve.original,s.improve.improved):[],[s.improve]),u=m.useMemo(()=>{const p=c.filter(g=>g.type==="added").length,b=c.filter(g=>g.type==="removed").length;return{added:p,removed:b}},[c]),x=m.useMemo(()=>{let p=0,b=0;return c.map(g=>g.type==="removed"?(p++,{...g,origNum:p,newNum:null}):g.type==="added"?(b++,{...g,origNum:null,newNum:b}):(p++,b++,{...g,origNum:p,newNum:b}))},[c]);return a.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.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:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),a.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(s.timestamp).toLocaleString()," · ",s.model]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",u.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",u.removed]})]}),a.jsx("button",{onClick:o,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:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((v=s.improve)==null?void 0:v.reasoning)&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),s.improve.reasoning]}),a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:x.map((p,b)=>a.jsxs("tr",{style:{background:p.type==="added"?"rgba(34,197,94,0.08)":p.type==="removed"?"rgba(239,68,68,0.08)":"transparent"},children:[a.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??""}),a.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??""}),a.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"?"-":" "}),a.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||"​"})]},b))})})})]})}function Dy({plugin:s,skill:o}){const[c,u]=m.useState([]),[x,v]=m.useState([]),[p,b]=m.useState(!0),[g,f]=m.useState(null);m.useEffect(()=>{ge.getDependencies(s,o).then(y=>{u(y.mcpDependencies),v(y.skillDependencies)}).catch(()=>{}).finally(()=>b(!1))},[s,o]);async function j(y,k){try{await navigator.clipboard.writeText(k),f(y),setTimeout(()=>f(null),2e3)}catch{}}return p?null:c.length===0&&x.length===0?a.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"}):a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.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:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.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"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:c.length+x.length})]}),a.jsxs("div",{className:"px-5 py-4",children:[c.length>0&&a.jsxs("div",{className:"space-y-3 mb-4",children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),c.map(y=>a.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:y.server}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:y.transport})]}),a.jsx("button",{onClick:()=>j(y.server,y.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:g===y.server?"var(--green)":"var(--accent)"},children:g===y.server?a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.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"]})})]}),a.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:y.url}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.matchedTools.map(k=>a.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:k},k))})]},y.server))]}),x.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),a.jsx("div",{className:"space-y-1.5",children:x.map(y=>a.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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:y.name}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:y.source==="frontmatter"?"frontmatter":"referenced"})]},y.name))})]})]})]})}function Kx({plugin:s,skill:o}){const[c,u]=m.useState([]),[x,v]=m.useState(!0),[p,b]=m.useState(null),[g,f]=m.useState(""),[j,y]=m.useState(!1),[k,R]=m.useState(null),[U,L]=m.useState(""),[Y,O]=m.useState(""),[Z,W]=m.useState(!1),[F,ae]=m.useState(new Set),re=m.useCallback(async()=>{v(!0);try{const[X,ne]=await Promise.all([ge.getCredentials(s,o).catch(()=>({credentials:[]})),ge.getParams(s,o).catch(()=>({params:[]}))]),te=new Map(ne.params.map(T=>[T.name,T])),be=new Set,he=[];for(const T of X.credentials){be.add(T.name);const N=te.get(T.name);he.push({name:T.name,status:T.status==="ready"||T.status==="resolved"?"ready":"missing",source:T.source,maskedValue:N==null?void 0:N.maskedValue})}for(const T of ne.params)be.has(T.name)||he.push({name:T.name,status:T.status,maskedValue:T.maskedValue});u(he)}finally{v(!1)}},[s,o]);m.useEffect(()=>{re()},[re]);const q=m.useCallback(async X=>{if(F.has(X)){ae(ne=>{const te=new Set(ne);return te.delete(X),te}),u(ne=>ne.map(te=>te.name===X?{...te,revealedValue:void 0}:te));return}try{const te=(await ge.getParamsRevealed(s,o,X)).params.find(be=>be.name===X);te&&(u(be=>be.map(he=>he.name===X?{...he,revealedValue:te.value}:he)),ae(be=>new Set(be).add(X)))}catch{}},[s,o,F]),I=async(X,ne)=>{if(!(!X.trim()||!ne.trim())){y(!0),R(null);try{await ge.setCredential(s,o,X,ne),b(null),f(""),ae(new Set),re()}catch(te){R(te.message)}finally{y(!1)}}},G=async()=>{if(!(!U.trim()||!Y.trim())){y(!0),R(null);try{await ge.setCredential(s,o,U.trim().toUpperCase(),Y),L(""),O(""),W(!1),re()}catch(X){R(X.message)}finally{y(!1)}}};return x?a.jsxs("div",{className:"mt-6",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("button",{onClick:()=>W(!Z),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),k&&a.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--error-muted, #3f1a1a)",color:"var(--error, #f87171)"},children:k}),c.length===0&&!Z?a.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):a.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:c.map(X=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:X.name}),X.maskedValue&&a.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:F.has(X.name)&&X.revealedValue!=null?X.revealedValue:X.maskedValue}),X.maskedValue&&a.jsx("button",{onClick:()=>q(X.name),className:"btn btn-ghost px-1",title:F.has(X.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:F.has(X.name)?a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),a.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),a.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:X.status==="ready"?"rgba(52,211,153,0.15)":"rgba(251,146,60,0.15)",color:X.status==="ready"?"var(--green)":"#fb923c"},children:X.status==="ready"?"ready":"missing"}),X.source&&a.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:X.source}),p===X.name?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{value:g,onChange:ne=>f(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&I(X.name,g)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),a.jsx("button",{onClick:()=>I(X.name,g),disabled:j||!g.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:j?"...":"Save"}),a.jsx("button",{onClick:()=>{b(null),f("")},className:"btn btn-ghost text-[10px] px-1",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):a.jsx("button",{onClick:()=>{b(X.name),f("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},X.name))}),Z&&a.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:U,onChange:X=>L(X.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),a.jsx("input",{value:Y,onChange:X=>O(X.target.value),onKeyDown:X=>{X.key==="Enter"&&G()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),a.jsxs("div",{className:"flex justify-end gap-1.5",children:[a.jsx("button",{onClick:()=>{W(!1),L(""),O("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),a.jsx("button",{onClick:G,disabled:j||!U.trim()||!Y.trim(),className:"btn btn-primary text-[10px]",children:j?"Saving...":"Save"})]})]})]})}function Oy(){const{state:s}=al(),{plugin:o,skill:c}=s,[u,x]=m.useState(null),[v,p]=m.useState(!0);return m.useEffect(()=>{ge.getDependencies(o,c).then(x).catch(()=>{}).finally(()=>p(!1))},[o,c]),v?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):u?a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx(Dy,{plugin:o,skill:c}),a.jsx(Kx,{plugin:o,skill:c})]}):a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),a.jsx(Kx,{plugin:o,skill:c})]})}function fp({data:s}){if(s.length<2)return a.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const o=s.slice(-10),c=80,u=24,x=2,v=c-x*2,p=u-x*2,b=o.length,g=Math.min(...o),j=Math.max(...o)-g||1,y=o.map((U,L)=>{const Y=x+L/(b-1)*v,O=x+p-(U-g)/j*p;return`${Y.toFixed(1)},${O.toFixed(1)}`}),k=o[o.length-1],R=pn(k);return a.jsxs("svg",{width:c,height:u,viewBox:`0 0 ${c} ${u}`,style:{display:"block"},children:[a.jsx("polyline",{points:y.join(" "),fill:"none",stroke:R,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[U,L]=y[y.length-1].split(",");return a.jsx("circle",{cx:U,cy:L,r:2.5,fill:R})})()]})}function By(){return a.jsxs("span",{className:"pill",style:{background:"rgba(251,191,36,0.15)",color:"#fbbf24",fontSize:9,fontWeight:700,gap:3},children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"#fbbf24",stroke:"none",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Best Model"]})}function Hy({pct:s}){const o=s>=10?"var(--green)":s>=0?"var(--yellow)":"var(--red)",c=s>=10?"var(--green-muted)":s>=0?"var(--yellow-muted)":"var(--red-muted)",u=s>=0?"+":"";return a.jsxs("span",{className:"pill",style:{background:c,color:o,fontSize:10,fontWeight:600},children:[u,s.toFixed(1),"%"]})}function Uy({score:s,rating:o}){const c={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},u=c[o]??c.minimal,x=s>=0?"+":"";return a.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),a.jsxs("span",{className:"pill",style:{background:u.bg,color:u.fg,fontSize:11,fontWeight:600},children:[x,s.toFixed(1),"% (",o.toUpperCase(),")"]})]})}function qy({warning:s}){return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid rgba(251,191,36,0.3)"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:s})]})}function Vy({active:s,onChange:o,hasBaseline:c}){return a.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[a.jsx("button",{onClick:()=>o("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:s==="rankings"?"var(--surface-3)":"transparent",color:s==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),a.jsx("button",{onClick:()=>o("amplification"),disabled:!c,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:s==="amplification"?"var(--surface-3)":"transparent",color:c&&s==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:c?1:.5,cursor:c?"pointer":"not-allowed"},title:c?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function Gy(s){var u,x,v;if(s.length===0)return[];const o=new Map;for(const p of s)for(const b of p.models){if(b.status==="error")continue;const g=`${b.provider}/${b.model}`;o.has(g)||o.set(g,{provider:b.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const f=o.get(g);f.passRates.push(b.passRate.mean),f.lastRubric=((u=b.rubricScore)==null?void 0:u.mean)??null,f.lastDuration=b.duration.mean,f.lastCost=((x=b.cost)==null?void 0:x.total)??null,f.lastCompositeScore=b.compositeScore,b.baselinePassRate!=null&&(f.lastBaselinePassRate=b.baselinePassRate.mean,f.lastSkillDelta=(v=b.skillDelta)==null?void 0:v.mean,f.lastAmplificationPct=b.amplificationPct,f.hasBaseline=!0)}const c=[];for(const[p,b]of o){const[g,...f]=p.split("/");c.push({rank:0,model:f.join("/"),provider:g,passRate:b.passRates[b.passRates.length-1],rubricScore:b.lastRubric,duration:b.lastDuration,cost:b.lastCost,sparklineData:b.passRates,isBest:!1,baselinePassRate:b.lastBaselinePassRate,skillDelta:b.lastSkillDelta,amplificationPct:b.lastAmplificationPct,compositeScore:b.lastCompositeScore,hasBaseline:b.hasBaseline})}return c.sort((p,b)=>{const g=p.compositeScore??p.passRate;return(b.compositeScore??b.passRate)-g}),c.forEach((p,b)=>{p.rank=b+1}),c.length>0&&(c[0].isBest=!0),c}const xp=(s="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:s,whiteSpace:"nowrap"});function Yy({entries:s}){return a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(o=>a.jsx("th",{style:xp(o==="#"?"center":"left"),children:o},o))})}),a.jsx("tbody",{children:s.map(o=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface-2)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o.rank}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:o.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:o.provider}),o.isBest&&a.jsx(By,{})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:o.passRate>=.7?"var(--green-muted)":o.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:pn(o.passRate),fontSize:11,fontWeight:600},children:[Math.round(o.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:o.rubricScore!=null?o.rubricScore.toFixed(1):"--"}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:o.duration<1e3?`${Math.round(o.duration)}ms`:`${(o.duration/1e3).toFixed(1)}s`}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:o.cost!=null?`$${o.cost.toFixed(4)}`:"N/A"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(fp,{data:o.sparklineData})})]},`${o.provider}/${o.model}`))})]})})}function $y({entries:s}){const o=[...s].filter(c=>c.hasBaseline).sort((c,u)=>(u.amplificationPct??0)-(c.amplificationPct??0));return o.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-center",children:a.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",a.jsx("code",{children:"--baseline"})," flag."]})})}):a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(c=>a.jsx("th",{style:xp(c==="#"?"center":"left"),children:c},c))})}),a.jsx("tbody",{children:o.map((c,u)=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-2)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:u+1}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:c.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:c.provider})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:c.passRate>=.7?"var(--green-muted)":c.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:pn(c.passRate),fontSize:11,fontWeight:600},children:[Math.round(c.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px"},children:c.baselinePassRate!=null?a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(c.baselinePassRate*100),"%"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:c.skillDelta!=null?a.jsxs("span",{className:"text-[11px] font-medium",style:{color:c.skillDelta>=0?"var(--green)":"var(--red)"},children:[c.skillDelta>=0?"+":"",(c.skillDelta*100).toFixed(1),"pp"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:c.amplificationPct!=null&&isFinite(c.amplificationPct)?a.jsx(Hy,{pct:c.amplificationPct}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(fp,{data:c.sparklineData})})]},`${c.provider}/${c.model}`))})]})})}function Qy(){const{state:s}=al(),{plugin:o,skill:c}=s,[u,x]=m.useState("rankings"),v=`leaderboard/${o}/${c}`,p=m.useCallback(()=>ge.getLeaderboard(o,c),[o,c]),{data:b,loading:g,error:f}=gc(v,p),j=(b==null?void 0:b.entries)??[],y=(f==null?void 0:f.message)??null;m.useEffect(()=>{x("rankings")},[o,c]);const k=m.useCallback(()=>Or(v),[v]);Mr("leaderboard:updated",k);const R=m.useMemo(()=>Gy(j),[j]),U=R.some(O=>O.hasBaseline),L=j[0],Y=L==null?void 0:L.judgeBiasWarning;return g?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"spinner spinner-lg"})}):y?a.jsx("div",{className:"flex items-center justify-center h-full px-8",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Failed to load leaderboard"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:y})]})}):R.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),a.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),a.jsx("div",{className:"text-[11px] font-mono px-4 py-3 rounded-lg text-left",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:'vskill eval sweep --models "anthropic/claude-sonnet-4,openrouter/meta-llama/llama-3.1-70b" --judge "anthropic/claude-sonnet-4"'}),a.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",a.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),a.jsx(Vy,{active:u,onChange:x,hasBaseline:U})]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[j.length," sweep",j.length!==1?"s":""," · ",R.length," model",R.length!==1?"s":""]})]}),Y&&a.jsx(qy,{warning:Y}),u==="rankings"?a.jsx(Yy,{entries:R}):a.jsx($y,{entries:R}),u==="amplification"&&(L==null?void 0:L.skillQualityScore)!=null&&(L==null?void 0:L.skillQualityRating)&&a.jsx(Uy,{score:L.skillQualityScore,rating:L.skillQualityRating})]})}const Xy=["editor","tests","run","activation","history","leaderboard","deps"];function Ky(s){return s!=null&&Xy.includes(s)}function Zy(){const{state:s,dispatch:o,saveContent:c,isReadOnly:u}=al(),{refreshSkills:x,clearSelection:v}=ra(),p=m.useCallback(async()=>{try{await ge.deleteSkill(s.plugin,s.skill),x(),v()}catch(f){const j=f instanceof Error?f.message:String(f);o({type:"SET_ERROR",error:`Failed to delete skill: ${j}`})}},[s.plugin,s.skill,x,v,o]);m.useEffect(()=>{const j=new URLSearchParams(window.location.search).get("panel");Ky(j)&&j!==s.activePanel&&o({type:"SET_PANEL",panel:j})},[]),m.useEffect(()=>{const f=new URLSearchParams(window.location.search);f.set("panel",s.activePanel);const j=`${window.location.pathname}?${f.toString()}${window.location.hash}`;history.replaceState(null,"",j)},[s.activePanel]);const b=m.useCallback(f=>{const j=f.ctrlKey||f.metaKey;if(j&&f.key>="1"&&f.key<="7"){f.preventDefault(),o({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps"][parseInt(f.key)-1]});return}if(j&&f.key==="s"&&!f.shiftKey){f.preventDefault(),s.isDirty&&c();return}},[s.isDirty,c,o]);if(m.useEffect(()=>(window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)),[b]),s.loading)return a.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"spinner spinner-lg"}),a.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const g=Array.from(s.caseRunStates.values()).some(f=>f.status==="running"||f.status==="queued");return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[a.jsx(fv,{state:s,isReadOnly:u,onDelete:u?void 0:p}),s.error&&a.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx(ds,{error:gv(s.error),onDismiss:()=>o({type:"SET_ERROR",error:null})})}),a.jsx(vv,{activePanel:s.activePanel,onPanelChange:f=>o({type:"SET_PANEL",panel:f}),isDirty:s.isDirty,isRunning:g,hasRegressions:s.regressions.length>0,isActivationRunning:s.activationRunning}),a.jsx(yv,{children:a.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[s.activePanel==="editor"&&a.jsx($v,{}),s.activePanel==="tests"&&a.jsx(Fv,{}),s.activePanel==="run"&&a.jsx(dy,{}),s.activePanel==="activation"&&a.jsx(my,{}),s.activePanel==="history"&&a.jsx(_y,{}),s.activePanel==="leaderboard"&&a.jsx(Qy,{}),s.activePanel==="deps"&&a.jsx(Oy,{})]},s.activePanel)})},`${s.plugin}/${s.skill}`)]})}function vc(s,o=!0){let c=s.toLowerCase().replace(/[^a-z0-9]+/g,"-");return o&&(c=c.replace(/^-+|-+$/g,"")),c}function Jy(s,o,c,u){const v=`.../${s.split("/").slice(-2).join("/")}`;switch(o){case 1:return`${v}/${c}/skills/${u}/SKILL.md`;case 2:return`${v}/plugins/${c}/skills/${u}/SKILL.md`;case 3:return`${v}/skills/${u}/SKILL.md`}}function Wy({onCreated:s,resolveAiConfigOverride:o}){const[c,u]=m.useState("ai"),[x,v]=m.useState(null),[p,b]=m.useState(!0),{config:g}=ia(),[f,j]=m.useState(""),[y,k]=m.useState(3),[R,U]=m.useState(""),[L,Y]=m.useState(""),[O,Z]=m.useState(""),[W,F]=m.useState(""),[ae,re]=m.useState(""),[q,I]=m.useState(""),[G,X]=m.useState("write"),[ne,te]=m.useState(!1),[be,he]=m.useState(null),[T,N]=m.useState(""),[w,ee]=m.useState(!1),[B,ue]=m.useState(!1),[S,D]=m.useState(null),[P,le]=m.useState(null),[ce,de]=m.useState([]),me=m.useRef(null),Oe=m.useRef(null),Re=m.useRef(null),pt=m.useRef(null),[Dt,J]=m.useState(!1),[ie,se]=m.useState(!1);m.useEffect(()=>{ge.getProjectLayout().then(K=>{v(K),k(K.suggestedLayout);const Be=K.detectedLayouts.find(at=>at.layout===K.suggestedLayout);Be!=null&&Be.existingPlugins.length&&U(Be.existingPlugins[0])}).catch(()=>{}).finally(()=>b(!1))},[]),m.useEffect(()=>{var K;c==="ai"&&((K=me.current)==null||K.focus())},[c]),m.useEffect(()=>()=>{var K;(K=Oe.current)==null||K.abort()},[]);const xe=m.useMemo(()=>{var K;return x?((K=x.detectedLayouts.find(Be=>Be.layout===y))==null?void 0:K.existingPlugins)||[]:[]},[x,y]),ye=R==="__new__"?L:R,Ye=x?Jy(x.root,y,ye||"{plugin}",f||"{skill}"):"",ut=m.useMemo(()=>x?x.detectedLayouts.filter(K=>K.layout!==4):[],[x]),Qe=m.useMemo(()=>{if(!x)return null;const K=x.detectedLayouts.find(Je=>Je.layout===2&&Je.existingPlugins.length>0),Be=x.detectedLayouts.find(Je=>Je.layout===1&&Je.existingPlugins.length>0),at=K||Be;return at?{layout:at.layout,plugins:at.existingPlugins}:null},[x]),Ot=m.useCallback(()=>{if(o)return o();if(!g)return{provider:"claude-cli",model:"sonnet"};const K=g.provider||"claude-cli",Be=g.model||"sonnet";return{provider:K,model:Be}},[g,o]),mt=m.useCallback(()=>{var K;(K=Oe.current)==null||K.abort(),ee(!1)},[]),nl=m.useCallback(()=>{D(null),le(null)},[]),Xt=m.useCallback(async()=>{if(D(null),le(null),de([]),Re.current=null,!T.trim()){D("Describe what your skill should do");return}ee(!0);const K=new AbortController;Oe.current=K;const{provider:Be,model:at}=Ot();try{const Je=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:T.trim(),provider:Be,model:at}),signal:K.signal});if(!Je.ok||!Je.body){let Fe=`HTTP ${Je.status}`;try{const nt=await Je.json();nt.error&&(Fe=nt.error)}catch{}throw new Error(Fe)}const Ml=Je.body.getReader(),Bt=new TextDecoder;let oa="",Ct="";for(;;){const{done:Fe,value:nt}=await Ml.read();if(Fe)break;oa+=Bt.decode(nt,{stream:!0});const et=oa.split(`
68
+ `);oa=et.pop()||"";for(const sl of et)if(sl.startsWith("event: "))Ct=sl.slice(7).trim();else if(sl.startsWith("data: ")){try{const $e=JSON.parse(sl.slice(6));if(Ct==="progress")de(rl=>[...rl,{phase:$e.phase,message:$e.message,timestamp:Date.now()}]);else if(Ct==="done"||Ct==="complete"){const rl={prompt:T.trim(),provider:Ot().provider,model:Ot().model,reasoning:$e.reasoning||""};if(j($e.name),Z($e.description),F($e.model||""),re($e.allowedTools||""),I($e.body),ue(!0),Re.current=rl,u("manual"),$e.suggestedPlugin&&typeof $e.suggestedPlugin=="object"&&$e.suggestedPlugin.plugin){const Ve=$e.suggestedPlugin;if(((x==null?void 0:x.detectedLayouts.flatMap(Tt=>Tt.existingPlugins))??[]).includes(Ve.plugin))if(U(Ve.plugin),Ve.layout&&(Ve.layout===1||Ve.layout===2))k(Ve.layout);else{const Tt=x==null?void 0:x.detectedLayouts.find(Ta=>Ta.existingPlugins.includes(Ve.plugin));Tt&&(Tt.layout===1||Tt.layout===2)&&k(Tt.layout)}else U("__new__"),Y(Ve.plugin)}else y===3&&Qe&&se(!0);const st={name:$e.name,plugin:ye||"",layout:y,description:$e.description,model:$e.model||void 0,allowedTools:$e.allowedTools||void 0,body:$e.body,aiMeta:rl};ge.saveDraft(st).then(Ve=>{J(!0),Ve!=null&&Ve.dir&&(pt.current=Ve.dir)}).catch(()=>{})}else Ct==="error"&&(D($e.message||$e.description||"Unknown error"),$e.category&&le($e))}catch{}Ct=""}}}catch(Je){Je.name!=="AbortError"&&D(Je.message)}finally{ee(!1),Oe.current=null}},[T,Ot,y,Qe,ye,x]),We=m.useCallback(async()=>{if(he(null),!f.trim()){he("Skill name is required");return}if(!O.trim()){he("Description is required");return}if(y!==3&&!ye.trim()){he("Plugin name is required");return}te(!0);try{const K=await ge.createSkill({name:vc(f),plugin:ye||"",layout:y,description:O,model:W||void 0,allowedTools:ae||void 0,body:q,aiMeta:Re.current||void 0,draftDir:pt.current||void 0});pt.current=null,s(K.plugin,K.skill)}catch(K){he(K.message)}finally{te(!1)}},[f,O,y,ye,W,ae,q,s]),kt=m.useCallback(()=>{Qe&&(k(Qe.layout),U(Qe.plugins[0]),se(!1))},[Qe]);return{mode:c,setMode:u,layout:x,layoutLoading:p,selectedLayout:y,setSelectedLayout:k,creatableLayouts:ut,availablePlugins:xe,pathPreview:Ye,plugin:R,setPlugin:U,newPlugin:L,setNewPlugin:Y,effectivePlugin:ye,name:f,setName:j,description:O,setDescription:Z,model:W,setModel:F,allowedTools:ae,setAllowedTools:re,body:q,setBody:I,bodyViewMode:G,setBodyViewMode:X,aiPrompt:T,setAiPrompt:N,generating:w,aiGenerated:B,aiError:S,aiClassifiedError:P,aiProgress:ce,promptRef:me,handleGenerate:Xt,handleCancelGenerate:mt,clearAiError:nl,draftSaved:Dt,showPluginRecommendation:ie,setShowPluginRecommendation:se,pluginLayoutInfo:Qe,applyPluginRecommendation:kt,creating:ne,error:be,handleCreate:We}}function pp(){return a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function Fy(){return a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function mp({node:s,depth:o=0}){var c;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${o*16}px`,color:s.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[s.type==="dir"?a.jsx(pp,{}):a.jsx(Fy,{}),a.jsxs("span",{children:[s.name,s.type==="dir"?"/":""]})]}),(c=s.children)==null?void 0:c.map(u=>a.jsx(mp,{node:u,depth:o+1},u.name))]})}function Iy(s,o,c){const u=[];o&&u.push({name:"evals.json",type:"file"}),u.push({name:"history",type:"dir"});const x=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:u}];return c&&x.push({name:"draft.json",type:"file"}),{name:s||"{skill}",type:"dir",children:x}}function Py({skillName:s,hasEvals:o,isDraft:c}){const u=Iy(s,o,c);return a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsx(pp,{})}),"Skill Structure"]}),a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:a.jsx(mp,{node:u})})]})}const sa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function uc({size:s=14,color:o="currentColor"}){return a.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function e1({onCreated:s,onCancel:o}){const c=Wy({onCreated:s});return a.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),a.jsx("div",{className:"flex items-center justify-between mt-2",children:a.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsx("button",{onClick:()=>c.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:c.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:c.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:c.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(uc,{size:12}),"AI-Assisted"]})}),a.jsx("button",{onClick:()=>c.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:c.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:c.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:c.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),c.layoutLoading&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!c.layoutLoading&&c.layout&&c.mode==="ai"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsx(uc,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),a.jsx("textarea",{ref:c.promptRef,value:c.aiPrompt,onChange:u=>c.setAiPrompt(u.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
69
69
 
70
70
  Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:c.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...sa,minHeight:"120px"},onKeyDown:u=>{u.key==="Enter"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),c.handleGenerate())}}),a.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),c.generating&&c.aiProgress.length>0&&a.jsx(fs,{entries:c.aiProgress,isRunning:!0}),c.aiError&&a.jsx("div",{children:c.aiClassifiedError?a.jsx(ds,{error:c.aiClassifiedError,onRetry:c.handleGenerate,onDismiss:c.clearAiError}):a.jsxs("div",{children:[a.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:c.aiError}),a.jsx("button",{onClick:c.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[c.generating?a.jsx("button",{onClick:c.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):a.jsxs("button",{onClick:c.handleGenerate,disabled:!c.aiPrompt.trim(),className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:c.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:c.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:c.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[a.jsx(uc,{size:14}),"Generate"]}),a.jsx("button",{onClick:o,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"}),!c.generating&&a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",a.jsx("button",{onClick:()=>c.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!c.layoutLoading&&c.layout&&c.mode==="manual"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),c.creatableLayouts.length>1&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),a.jsx("div",{className:"flex gap-2",children:c.creatableLayouts.map(u=>a.jsx("button",{onClick:()=>{c.setSelectedLayout(u.layout),c.setPlugin(u.existingPlugins[0]||""),c.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:c.selectedLayout===u.layout?"var(--accent)":"var(--surface-3)",color:c.selectedLayout===u.layout?"#fff":"var(--text-secondary)",border:`1px solid ${c.selectedLayout===u.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:u.label},u.layout))})]}),c.selectedLayout!==3&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),a.jsxs("select",{value:c.plugin,onChange:u=>{c.setPlugin(u.target.value),c.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:sa,children:[c.availablePlugins.map(u=>a.jsx("option",{value:u,children:u},u)),a.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),c.plugin==="__new__"&&a.jsx("input",{type:"text",value:c.newPlugin,onChange:u=>c.setNewPlugin(vc(u.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:sa})]}),a.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:c.pathPreview})]}),c.showPluginRecommendation&&c.pluginLayoutInfo&&c.selectedLayout===3&&a.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),a.jsxs("span",{children:["Plugins detected (",a.jsx("strong",{children:c.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:c.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),a.jsx("button",{onClick:()=>c.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("input",{type:"text",value:c.name,onChange:u=>c.setName(vc(u.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:sa})]}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("textarea",{value:c.description,onChange:u=>c.setDescription(u.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...sa,minHeight:"72px"}})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsxs("select",{value:c.model,onChange:u=>c.setModel(u.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:sa,children:[a.jsx("option",{value:"",children:"Any"}),a.jsx("option",{value:"opus",children:"Opus"}),a.jsx("option",{value:"sonnet",children:"Sonnet"}),a.jsx("option",{value:"haiku",children:"Haiku"})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),a.jsx("input",{type:"text",value:c.allowedTools,onChange:u=>c.setAllowedTools(u.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:sa})]})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"}),a.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),a.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),a.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(u=>a.jsxs("button",{onClick:()=>c.setBodyViewMode(u),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:c.bodyViewMode===u?"var(--surface-4)":"transparent",color:c.bodyViewMode===u?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:c.bodyViewMode===u?600:400,border:"none",cursor:"pointer"},children:[u==="write"?a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]}):a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),a.jsx("span",{children:u==="write"?"Write":"Preview"})]},u))})]}),c.bodyViewMode==="write"?a.jsx("textarea",{value:c.body,onChange:u=>c.setBody(u.target.value),placeholder:`# /my-skill
71
71
 
72
72
  You are an expert at...
73
- `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...sa,minHeight:"150px"}}):c.body.trim()?a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:zr(c.body)}}):a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),a.jsx(P1,{skillName:c.name||"{skill}",hasEvals:!1,isDraft:c.draftSaved}),c.error&&a.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:c.error}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:c.handleCreate,disabled:c.creating||!c.name||!c.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:c.creating||!c.name||!c.description?"var(--surface-3)":"var(--accent)",color:c.creating||!c.name||!c.description?"var(--text-tertiary)":"#fff",cursor:c.creating||!c.name||!c.description?"not-allowed":"pointer",border:"none"},children:c.creating?"Creating...":"Create Skill"}),a.jsx("button",{onClick:o,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"})]})]})]})}function ty(){return a.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:a.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:[a.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"}),a.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),a.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function dc({variant:s,message:o,onRetry:c}){const{setMode:u,setSearch:x}=ra(),[v,m]=p.useState(!1);return s==="no-selection"?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[a.jsx("div",{className:"mb-5",children:v?a.jsx(ty,{}):a.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>m(!0),style:{objectFit:"contain"}})}),a.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):s==="no-skills"?a.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:a.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:a.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"})})}),a.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),a.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",a.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"]}),a.jsxs("button",{onClick:()=>u("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:b=>{b.currentTarget.style.opacity="0.9"},onMouseLeave:b=>{b.currentTarget.style.opacity="1"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):s==="error"?a.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:a.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:[a.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:o||"Failed to load skill data"}),c&&a.jsx("button",{onClick:c,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"})]})}):a.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[a.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),a.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 Zx(){const{state:s,setMobileView:o}=ra();return s.isMobile?a.jsxs("button",{onClick:()=>o("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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function ly(){const{state:s,selectSkill:o,setMode:c,refreshSkills:u}=ra();if(s.mode==="create")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Zx,{}),a.jsx(ey,{onCreated:(b,g)=>{c("browse"),u(),o({plugin:b,skill:g,origin:"source"})},onCancel:()=>c("browse")})]});if(!s.selectedSkill)return s.skillsError?a.jsx(dc,{variant:"error",message:s.skillsError,onRetry:u}):!s.skillsLoading&&s.skills.length===0?a.jsx(dc,{variant:"no-skills"}):a.jsx(dc,{variant:"no-selection"});const{plugin:x,skill:v,origin:m}=s.selectedSkill;return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx(Zx,{}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(cv,{plugin:x,skill:v,origin:m,children:a.jsx(Z1,{})},`${x}/${v}`)})]})}function ay(){return a.jsx($h,{children:a.jsx(Gh,{children:a.jsx(Xh,{left:a.jsx(ev,{}),right:a.jsx(ly,{})})})})}Hh.createRoot(document.getElementById("root")).render(a.jsx(p.StrictMode,{children:a.jsx(ay,{})}));
73
+ `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...sa,minHeight:"150px"}}):c.body.trim()?a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:zr(c.body)}}):a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),a.jsx(Py,{skillName:c.name||"{skill}",hasEvals:!1,isDraft:c.draftSaved}),c.error&&a.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:c.error}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:c.handleCreate,disabled:c.creating||!c.name||!c.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:c.creating||!c.name||!c.description?"var(--surface-3)":"var(--accent)",color:c.creating||!c.name||!c.description?"var(--text-tertiary)":"#fff",cursor:c.creating||!c.name||!c.description?"not-allowed":"pointer",border:"none"},children:c.creating?"Creating...":"Create Skill"}),a.jsx("button",{onClick:o,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"})]})]})]})}function t1(){return a.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:a.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:[a.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"}),a.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),a.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function dc({variant:s,message:o,onRetry:c}){const{setMode:u,setSearch:x}=ra(),[v,p]=m.useState(!1);return s==="no-selection"?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[a.jsx("div",{className:"mb-5",children:v?a.jsx(t1,{}):a.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>p(!0),style:{objectFit:"contain"}})}),a.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):s==="no-skills"?a.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:a.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:a.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"})})}),a.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),a.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",a.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"]}),a.jsxs("button",{onClick:()=>u("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:b=>{b.currentTarget.style.opacity="0.9"},onMouseLeave:b=>{b.currentTarget.style.opacity="1"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):s==="error"?a.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:a.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:[a.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:o||"Failed to load skill data"}),c&&a.jsx("button",{onClick:c,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"})]})}):a.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[a.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),a.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 Zx(){const{state:s,setMobileView:o}=ra();return s.isMobile?a.jsxs("button",{onClick:()=>o("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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function l1(){const{state:s,selectSkill:o,setMode:c,refreshSkills:u}=ra();if(s.mode==="create")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Zx,{}),a.jsx(e1,{onCreated:(b,g)=>{c("browse"),u(),o({plugin:b,skill:g,origin:"source"})},onCancel:()=>c("browse")})]});if(!s.selectedSkill)return s.skillsError?a.jsx(dc,{variant:"error",message:s.skillsError,onRetry:u}):!s.skillsLoading&&s.skills.length===0?a.jsx(dc,{variant:"no-skills"}):a.jsx(dc,{variant:"no-selection"});const{plugin:x,skill:v,origin:p}=s.selectedSkill;return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx(Zx,{}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(cv,{plugin:x,skill:v,origin:p,children:a.jsx(Zy,{})},`${x}/${v}`)})]})}function a1(){return a.jsx(Qh,{children:a.jsx(Gh,{children:a.jsx(Xh,{left:a.jsx(ev,{}),right:a.jsx(l1,{})})})})}Hh.createRoot(document.getElementById("root")).render(a.jsx(m.StrictMode,{children:a.jsx(a1,{})}));